aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-02-19 12:56:49 -0700
committerBrian Paul <[email protected]>2010-02-19 12:56:49 -0700
commit78a0c353d0f87c85feaa6dcb3042fc25d424f21b (patch)
treeea638e071a08127708883560bdb96b8c0547d854 /src/mesa/main
parent8de5a292f70dba854a4bf06a2210bc38381e6bcf (diff)
mesa: restore _mesa_snprintf() - it's needed for Windows
This reverts part of commit 298be2b028263b2c343a707662c6fbfa18293cb2
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/imports.c19
-rw-r--r--src/mesa/main/imports.h3
-rw-r--r--src/mesa/main/version.c2
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);
}
}