diff options
author | José Fonseca <jfonseca@vmware.com> | 2011-02-01 10:41:46 +0000 |
---|---|---|
committer | José Fonseca <jfonseca@vmware.com> | 2011-02-01 10:41:46 +0000 |
commit | 3c701f1d61b33a5ffaddd4199ac277da8e287f30 (patch) | |
tree | ade3644019ab4c2ab19606ba86f9cd3501c0e19b | |
parent | a7d350790b4d0416117bc785aa77de52e9298a01 (diff) |
glsl: Fix printf_length() on MSVC.
-rw-r--r-- | src/glsl/ralloc.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/glsl/ralloc.c b/src/glsl/ralloc.c index fa2dd8b01e..3ba5d86cd9 100644 --- a/src/glsl/ralloc.c +++ b/src/glsl/ralloc.c @@ -392,7 +392,15 @@ printf_length(const char *fmt, va_list untouched_args) va_list args; va_copy(args, untouched_args); +#ifdef _MSC_VER + /* We need to use _vcsprintf to calculate the size as vsnprintf returns -1 + * if the number of characters to write is greater than count. + */ + size = _vscprintf(fmt, args); + (void)junk; +#else size = vsnprintf(&junk, 1, fmt, args); +#endif assert(size >= 0); return size; |