if (st->Index >= 0) {
const GLfloat *val = prog->Parameters->ParameterValues[st->Index];
if (st->Swizzle == SWIZZLE_NOOP)
- sprintf(s, "{%g, %g, %g, %g}", val[0], val[1], val[2], val[3]);
+ _mesa_snprintf(s, sizeof(s), "{%g, %g, %g, %g}", val[0], val[1], val[2], val[3]);
else {
- sprintf(s, "%g", val[GET_SWZ(st->Swizzle, 0)]);
+ _mesa_snprintf(s, sizeof(s), "%g", val[GET_SWZ(st->Swizzle, 0)]);
}
}
break;
case PROGRAM_TEMPORARY:
if (n->Var)
- sprintf(s, "%s", (char *) n->Var->a_name);
+ _mesa_snprintf(s, sizeof(s), "%s", (char *) n->Var->a_name);
else
- sprintf(s, "t[%d]", st->Index);
+ _mesa_snprintf(s, sizeof(s), "t[%d]", st->Index);
break;
case PROGRAM_STATE_VAR:
case PROGRAM_UNIFORM:
- sprintf(s, "%s", prog->Parameters->Parameters[st->Index].Name);
+ _mesa_snprintf(s, sizeof(s), "%s", prog->Parameters->Parameters[st->Index].Name);
break;
case PROGRAM_VARYING:
- sprintf(s, "%s", prog->Varying->Parameters[st->Index].Name);
+ _mesa_snprintf(s, sizeof(s), "%s", prog->Varying->Parameters[st->Index].Name);
break;
case PROGRAM_INPUT:
- sprintf(s, "input[%d]", st->Index);
+ _mesa_snprintf(s, sizeof(s), "input[%d]", st->Index);
break;
case PROGRAM_OUTPUT:
- sprintf(s, "output[%d]", st->Index);
+ _mesa_snprintf(s, sizeof(s), "output[%d]", st->Index);
break;
default:
s[0] = 0;
}
s = (char *) malloc(len);
- sprintf(s, "%s = %s %s %s %s", dstAnnot,
- srcAnnot0, operator, srcAnnot1, srcAnnot2);
- assert(strlen(s) < len);
+ _mesa_snprintf(s, len, "%s = %s %s %s %s", dstAnnot,
+ srcAnnot0, operator, srcAnnot1, srcAnnot2);
free(dstAnnot);
free(srcAnnot0);
if (emitInfo->EmitComments) {
/* emit NOP with comment describing the variable's storage location */
char s[1000];
- sprintf(s, "TEMP[%d]%s = variable %s (size %d)",
- n->Store->Index,
- _mesa_swizzle_string(n->Store->Swizzle, 0, GL_FALSE),
- (n->Var ? (char *) n->Var->a_name : "anonymous"),
- n->Store->Size);
+ _mesa_snprintf(s, sizeof(s), "TEMP[%d]%s = variable %s (size %d)",
+ n->Store->Index,
+ _mesa_swizzle_string(n->Store->Swizzle, 0, GL_FALSE),
+ (n->Var ? (char *) n->Var->a_name : "anonymous"),
+ n->Store->Size);
emit_comment(emitInfo, s);
}
return NULL;
assert(Elements(files) == PROGRAM_FILE_MAX);
#if 0
if (st->Size == 1)
- sprintf(s, "%s[%d]", files[st->File], st->Index);
+ _mesa_snprintf(s, "%s[%d]", files[st->File], st->Index);
else
- sprintf(s, "%s[%d..%d]", files[st->File], st->Index,
- st->Index + st->Size - 1);
+ _mesa_snprintf(s, "%s[%d..%d]", files[st->File], st->Index,
+ st->Index + st->Size - 1);
#endif
assert(st->File < (GLint) (sizeof(files) / sizeof(files[0])));
- sprintf(s, "%s[%d]", files[st->File], st->Index);
+ _mesa_snprintf(s, sizeof(s), "%s[%d]", files[st->File], st->Index);
return s;
}
slang_fq_type_string(const slang_fully_specified_type *t)
{
static char str[1000];
- sprintf(str, "%s %s", slang_type_qual_string(t->qualifier),
+ _mesa_snprintf(str, sizeof(str), "%s %s", slang_type_qual_string(t->qualifier),
slang_type_string(t->specifier.type));
return str;
}
slang_var_string(const slang_variable *v)
{
static char str[1000];
- sprintf(str, "%s : %s",
- (char *) v->a_name,
- slang_fq_type_string(&v->type));
+ _mesa_snprintf(str, sizeof(str), "%s : %s",
+ (char *) v->a_name,
+ slang_fq_type_string(&v->type));
return str;
}
#endif