diff options
author | Brian Paul <[email protected]> | 2010-02-19 12:56:49 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-02-19 12:56:49 -0700 |
commit | 78a0c353d0f87c85feaa6dcb3042fc25d424f21b (patch) | |
tree | ea638e071a08127708883560bdb96b8c0547d854 /src/mesa/shader | |
parent | 8de5a292f70dba854a4bf06a2210bc38381e6bcf (diff) |
mesa: restore _mesa_snprintf() - it's needed for Windows
This reverts part of commit 298be2b028263b2c343a707662c6fbfa18293cb2
Diffstat (limited to 'src/mesa/shader')
-rw-r--r-- | src/mesa/shader/prog_instruction.c | 2 | ||||
-rw-r--r-- | src/mesa/shader/prog_print.c | 6 | ||||
-rw-r--r-- | src/mesa/shader/program_parse.tab.c | 14 | ||||
-rw-r--r-- | src/mesa/shader/program_parse.y | 10 | ||||
-rw-r--r-- | src/mesa/shader/shader_api.c | 2 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_codegen.c | 4 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_emit.c | 2 | ||||
-rw-r--r-- | src/mesa/shader/slang/slang_link.c | 4 |
8 files changed, 22 insertions, 22 deletions
diff --git a/src/mesa/shader/prog_instruction.c b/src/mesa/shader/prog_instruction.c index e5534b20e34..81099cb99c5 100644 --- a/src/mesa/shader/prog_instruction.c +++ b/src/mesa/shader/prog_instruction.c @@ -345,7 +345,7 @@ _mesa_opcode_string(gl_inst_opcode opcode) 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; } } diff --git a/src/mesa/shader/prog_print.c b/src/mesa/shader/prog_print.c index b4905abf4c8..0af70af9ad9 100644 --- a/src/mesa/shader/prog_print.c +++ b/src/mesa/shader/prog_print.c @@ -77,7 +77,7 @@ file_string(gl_register_file f, gl_prog_print_mode mode) default: { static char s[20]; - snprintf(s, sizeof(s), "FILE%u", f); + _mesa_snprintf(s, sizeof(s), "FILE%u", f); return s; } } @@ -997,7 +997,7 @@ _mesa_write_shader_to_file(const struct gl_shader *shader) 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); @@ -1047,7 +1047,7 @@ _mesa_append_uniforms_to_file(const struct gl_shader *shader, 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); diff --git a/src/mesa/shader/program_parse.tab.c b/src/mesa/shader/program_parse.tab.c index 3f26f9f84a7..52f60843584 100644 --- a/src/mesa/shader/program_parse.tab.c +++ b/src/mesa/shader/program_parse.tab.c @@ -2984,7 +2984,7 @@ yyreduce: { 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; @@ -3001,7 +3001,7 @@ yyreduce: { 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; @@ -4915,7 +4915,7 @@ yyreduce: 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; @@ -5559,18 +5559,18 @@ make_error_string(const char *fmt, ...) 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); diff --git a/src/mesa/shader/program_parse.y b/src/mesa/shader/program_parse.y index 1c856d859d6..75cb4cf4799 100644 --- a/src/mesa/shader/program_parse.y +++ b/src/mesa/shader/program_parse.y @@ -936,7 +936,7 @@ addrRegPosOffset: INTEGER { 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; @@ -950,7 +950,7 @@ addrRegNegOffset: INTEGER { 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; @@ -2173,7 +2173,7 @@ ALIAS_statement: ALIAS IDENTIFIER '=' USED_IDENTIFIER 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; @@ -2599,7 +2599,7 @@ make_error_string(const char *fmt, ...) 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 @@ -2609,7 +2609,7 @@ make_error_string(const char *fmt, ...) str = malloc(length); if (str) { - vsnprintf(str, length, fmt, args); + v_mesa_snprintf(str, length, fmt, args); } va_end(args); diff --git a/src/mesa/shader/shader_api.c b/src/mesa/shader/shader_api.c index 8bd780b0b0f..129a973cf1a 100644 --- a/src/mesa/shader/shader_api.c +++ b/src/mesa/shader/shader_api.c @@ -2076,7 +2076,7 @@ validate_samplers(GLcontext *ctx, const struct gl_program *prog, char *errMsg) 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; diff --git a/src/mesa/shader/slang/slang_codegen.c b/src/mesa/shader/slang/slang_codegen.c index b17256bb1e1..6901b93d5de 100644 --- a/src/mesa/shader/slang/slang_codegen.c +++ b/src/mesa/shader/slang/slang_codegen.c @@ -1643,7 +1643,7 @@ _slang_gen_function_call(slang_assemble_ctx *A, slang_function *fun, 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); } @@ -2190,7 +2190,7 @@ _slang_make_array_constructor(slang_assemble_ctx *A, slang_operation *oper) */ 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; diff --git a/src/mesa/shader/slang/slang_emit.c b/src/mesa/shader/slang/slang_emit.c index 52fe7868906..7c0ea0c1148 100644 --- a/src/mesa/shader/slang/slang_emit.c +++ b/src/mesa/shader/slang/slang_emit.c @@ -2303,7 +2303,7 @@ emit_var_ref(slang_emit_info *emitInfo, slang_ir_node *n) /* 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; diff --git a/src/mesa/shader/slang/slang_link.c b/src/mesa/shader/slang/slang_link.c index b59fc0a43a9..7c7bfbdbc5e 100644 --- a/src/mesa/shader/slang/slang_link.c +++ b/src/mesa/shader/slang/slang_link.c @@ -139,7 +139,7 @@ link_varying_vars(GLcontext *ctx, } 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); @@ -147,7 +147,7 @@ link_varying_vars(GLcontext *ctx, } 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); |