Ykkrosh
3705caae7a
Noted that the code won't compile unless SDL was compiled with X11 support (which my copy wasn't). This was SVN commit r4645.
27 lines
689 B
C++
27 lines
689 B
C++
#include "precompiled.h"
|
|
|
|
#include <cstdio>
|
|
#include <cstdarg>
|
|
|
|
// See declaration in sysdep.h for explanation of need
|
|
|
|
int vsnprintf2(char* buffer, size_t count, const char* format, va_list argptr)
|
|
{
|
|
int ret = vsnprintf(buffer, count, format, argptr);
|
|
|
|
/*
|
|
"The glibc implementation of the functions snprintf() and vsnprintf() conforms
|
|
to the C99 standard ... since glibc version 2.1. Until glibc 2.0.6 they would
|
|
return -1 when the output was truncated."
|
|
- man printf
|
|
|
|
MSVC's _vsnprintf still returns -1, so we want this one to do the same (for
|
|
compatibility), if the output (including the terminating null) is truncated.
|
|
*/
|
|
|
|
if (ret >= (int)count)
|
|
return -1;
|
|
|
|
return ret;
|
|
}
|