texTarget = "RECT";
else
texTarget = "2D";
- snprintf(program2, sizeof(program2), program, texTarget);
+ _mesa_snprintf(program2, sizeof(program2), program, texTarget);
_mesa_GenPrograms(1, &blit->DepthFP);
_mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, blit->DepthFP);
texTarget = "RECT";
else
texTarget = "2D";
- snprintf(program2, sizeof(program2), program, texTarget);
+ _mesa_snprintf(program2, sizeof(program2), program, texTarget);
_mesa_GenPrograms(1, &drawpix->StencilFP);
_mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, drawpix->StencilFP);
texTarget = "RECT";
else
texTarget = "2D";
- snprintf(program2, sizeof(program2), program, texTarget);
+ _mesa_snprintf(program2, sizeof(program2), program, texTarget);
_mesa_GenPrograms(1, &drawpix->DepthFP);
_mesa_BindProgram(GL_FRAGMENT_PROGRAM_ARB, drawpix->DepthFP);
/*@}*/
+/** Wrapper around vsnprintf() */
+int
+_mesa_snprintf( char *str, size_t size, const char *fmt, ... )
+{
+ int r;
+ va_list args;
+ va_start( args, fmt );
+ r = vsnprintf( str, size, fmt, args );
+ va_end( args );
+ return r;
+}
+
+
/**********************************************************************/
/** \name Diagnostics */
/*@{*/
* visible, so communicate with the debugger instead */
{
char buf[4096];
- snprintf(buf, sizeof(buf), "%s: %s%s", prefixString, outputString, newline ? "\n" : "");
+ _mesa_snprintf(buf, sizeof(buf), "%s: %s%s", prefixString, outputString, newline ? "\n" : "");
OutputDebugStringA(buf);
}
#endif
char s[MAXSTRING];
if (ctx->ErrorDebugCount) {
- snprintf(s, MAXSTRING, "%d similar %s errors",
+ _mesa_snprintf(s, MAXSTRING, "%d similar %s errors",
ctx->ErrorDebugCount,
error_string(ctx->ErrorValue));
vsnprintf(s, MAXSTRING, fmtString, args);
va_end(args);
- snprintf(s2, MAXSTRING, "%s in %s", error_string(error), s);
+ _mesa_snprintf(s2, MAXSTRING, "%s in %s", error_string(error), s);
output_if_debug("Mesa: User error", s2, GL_TRUE);
ctx->ErrorDebugFmtString = fmtString;
extern unsigned int
_mesa_str_checksum(const char *str);
+extern int
+_mesa_snprintf( char *str, size_t size, const char *fmt, ... );
+
extern void
_mesa_warning( __GLcontext *gc, const char *fmtString, ... );
ctx->VersionString = (char *) malloc(max);
if (ctx->VersionString) {
- snprintf(ctx->VersionString, max, "%u.%u Mesa " MESA_VERSION_STRING,
+ _mesa_snprintf(ctx->VersionString, max, "%u.%u Mesa " MESA_VERSION_STRING,
ctx->VersionMajor, ctx->VersionMinor);
}
}
return InstInfo[opcode].Name;
else {
static char s[20];
- snprintf(s, sizeof(s), "OP%u", opcode);
+ _mesa_snprintf(s, sizeof(s), "OP%u", opcode);
return s;
}
}
default:
{
static char s[20];
- snprintf(s, sizeof(s), "FILE%u", f);
+ _mesa_snprintf(s, sizeof(s), "FILE%u", f);
return s;
}
}
else
type = "vert";
- snprintf(filename, sizeof(filename), "shader_%u.%s", shader->Name, type);
+ _mesa_snprintf(filename, sizeof(filename), "shader_%u.%s", shader->Name, type);
f = fopen(filename, "w");
if (!f) {
fprintf(stderr, "Unable to open %s for writing\n", filename);
else
type = "vert";
- snprintf(filename, sizeof(filename), "shader_%u.%s", shader->Name, type);
+ _mesa_snprintf(filename, sizeof(filename), "shader_%u.%s", shader->Name, type);
f = fopen(filename, "a"); /* append */
if (!f) {
fprintf(stderr, "Unable to open %s for appending\n", filename);
{
if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 63)) {
char s[100];
- snprintf(s, sizeof(s),
+ _mesa_snprintf(s, sizeof(s),
"relative address offset too large (%d)", (yyvsp[(1) - (1)].integer));
yyerror(& (yylsp[(1) - (1)]), state, s);
YYERROR;
{
if (((yyvsp[(1) - (1)].integer) < 0) || ((yyvsp[(1) - (1)].integer) > 64)) {
char s[100];
- snprintf(s, sizeof(s),
+ _mesa_snprintf(s, sizeof(s),
"relative address offset too large (%d)", (yyvsp[(1) - (1)].integer));
yyerror(& (yylsp[(1) - (1)]), state, s);
YYERROR;
if (exist != NULL) {
char m[1000];
- snprintf(m, sizeof(m), "redeclared identifier: %s", (yyvsp[(2) - (4)].string));
+ _mesa_snprintf(m, sizeof(m), "redeclared identifier: %s", (yyvsp[(2) - (4)].string));
free((yyvsp[(2) - (4)].string));
yyerror(& (yylsp[(2) - (4)]), state, m);
YYERROR;
va_start(args, fmt);
- /* Call vsnprintf once to determine how large the final string is. Call it
- * again to do the actual formatting. from the vsnprintf manual page:
+ /* Call v_mesa_snprintf once to determine how large the final string is. Call it
+ * again to do the actual formatting. from the v_mesa_snprintf manual page:
*
* Upon successful return, these functions return the number of
* characters printed (not including the trailing '\0' used to end
* output to strings).
*/
- length = 1 + vsnprintf(NULL, 0, fmt, args);
+ length = 1 + v_mesa_snprintf(NULL, 0, fmt, args);
str = malloc(length);
if (str) {
- vsnprintf(str, length, fmt, args);
+ v_mesa_snprintf(str, length, fmt, args);
}
va_end(args);
{
if (($1 < 0) || ($1 > 63)) {
char s[100];
- snprintf(s, sizeof(s),
+ _mesa_snprintf(s, sizeof(s),
"relative address offset too large (%d)", $1);
yyerror(& @1, state, s);
YYERROR;
{
if (($1 < 0) || ($1 > 64)) {
char s[100];
- snprintf(s, sizeof(s),
+ _mesa_snprintf(s, sizeof(s),
"relative address offset too large (%d)", $1);
yyerror(& @1, state, s);
YYERROR;
if (exist != NULL) {
char m[1000];
- snprintf(m, sizeof(m), "redeclared identifier: %s", $2);
+ _mesa_snprintf(m, sizeof(m), "redeclared identifier: %s", $2);
free($2);
yyerror(& @2, state, m);
YYERROR;
va_start(args, fmt);
/* Call vsnprintf once to determine how large the final string is. Call it
- * again to do the actual formatting. from the vsnprintf manual page:
+ * again to do the actual formatting. from the v_mesa_snprintf manual page:
*
* Upon successful return, these functions return the number of
* characters printed (not including the trailing '\0' used to end
str = malloc(length);
if (str) {
- vsnprintf(str, length, fmt, args);
+ v_mesa_snprintf(str, length, fmt, args);
}
va_end(args);
unit = prog->SamplerUnits[sampler];
target = prog->SamplerTargets[sampler];
if (targetUsed[unit] != -1 && targetUsed[unit] != target) {
- snprintf(errMsg, 100,
+ _mesa_snprintf(errMsg, 100,
"Texture unit %d is accessed both as %s and %s",
unit, targetName[targetUsed[unit]], targetName[target]);
return GL_FALSE;
if (A->pragmas->Debug) {
char s[1000];
- snprintf(s, sizeof(s), "Call/inline %s()", (char *) fun->header.a_name);
+ _mesa_snprintf(s, sizeof(s), "Call/inline %s()", (char *) fun->header.a_name);
n->Comment = _slang_strdup(s);
}
*/
slang_variable *p = slang_variable_scope_grow(fun->parameters);
char name[10];
- snprintf(name, sizeof(name), "p%d", i);
+ _mesa_snprintf(name, sizeof(name), "p%d", i);
p->a_name = slang_atom_pool_atom(A->atoms, name);
p->type.qualifier = SLANG_QUAL_CONST;
p->type.specifier.type = baseType;
/* error */
char s[100];
/* XXX isn't this really an out of memory/resources error? */
- snprintf(s, sizeof(s), "Undefined variable '%s'",
+ _mesa_snprintf(s, sizeof(s), "Undefined variable '%s'",
(char *) n->Var->a_name);
slang_info_log_error(emitInfo->log, s);
return NULL;
}
if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_CENTROID)) {
char msg[100];
- snprintf(msg, sizeof(msg),
+ _mesa_snprintf(msg, sizeof(msg),
"centroid modifier mismatch for '%s'", var->Name);
link_error(shProg, msg);
free(map);
}
if (!bits_agree(var->Flags, v->Flags, PROG_PARAM_BIT_INVARIANT)) {
char msg[100];
- snprintf(msg, sizeof(msg),
+ _mesa_snprintf(msg, sizeof(msg),
"invariant modifier mismatch for '%s'", var->Name);
link_error(shProg, msg);
free(map);