diff options
Diffstat (limited to 'src/mesa/main')
-rw-r--r-- | src/mesa/main/imports.c | 19 | ||||
-rw-r--r-- | src/mesa/main/imports.h | 3 | ||||
-rw-r--r-- | src/mesa/main/version.c | 2 |
3 files changed, 20 insertions, 4 deletions
diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c index 112490915f7..56e8195810e 100644 --- a/src/mesa/main/imports.c +++ b/src/mesa/main/imports.c @@ -827,6 +827,19 @@ _mesa_str_checksum(const char *str) /*@}*/ +/** 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 */ /*@{*/ @@ -866,7 +879,7 @@ output_if_debug(const char *prefixString, const char *outputString, * 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 @@ -915,7 +928,7 @@ flush_delayed_errors( GLcontext *ctx ) 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)); @@ -1022,7 +1035,7 @@ _mesa_error( GLcontext *ctx, GLenum error, const char *fmtString, ... ) 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; diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h index 269d985f1e1..ac3a7b5d61a 100644 --- a/src/mesa/main/imports.h +++ b/src/mesa/main/imports.h @@ -583,6 +583,9 @@ _mesa_strtod( const char *s, char **end ); 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, ... ); diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 0d01f160593..a39b6806501 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -124,7 +124,7 @@ _mesa_compute_version(GLcontext *ctx) 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); } } |