src/string.cpp
changeset 8181 9c6a2d52e136
parent 8131 160939e24ed3
child 8214 971f861d5543
equal deleted inserted replaced
8180:df1ff9450ec9 8181:9c6a2d52e136
   151 
   151 
   152 	return false;
   152 	return false;
   153 }
   153 }
   154 
   154 
   155 #ifdef WIN32
   155 #ifdef WIN32
       
   156 /* Since version 3.14, MinGW Runtime has snprintf() and vsnprintf() conform to C99 but it's not the case for older versions */
       
   157 #if (__MINGW32_MAJOR_VERSION < 3) || ((__MINGW32_MAJOR_VERSION == 3) && (__MINGW32_MINOR_VERSION < 14))
   156 int CDECL snprintf(char *str, size_t size, const char *format, ...)
   158 int CDECL snprintf(char *str, size_t size, const char *format, ...)
   157 {
   159 {
   158 	va_list ap;
   160 	va_list ap;
   159 	int ret;
   161 	int ret;
   160 
   162 
   161 	va_start(ap, format);
   163 	va_start(ap, format);
   162 	ret = vsnprintf(str, size, format, ap);
   164 	ret = vsnprintf(str, size, format, ap);
   163 	va_end(ap);
   165 	va_end(ap);
   164 	return ret;
   166 	return ret;
   165 }
   167 }
       
   168 #endif /* MinGW Runtime < 3.14 */
   166 
   169 
   167 #ifdef _MSC_VER
   170 #ifdef _MSC_VER
   168 /* *nprintf broken, not POSIX compliant, MSDN description
   171 /* *nprintf broken, not POSIX compliant, MSDN description
   169  * - If len < count, then len characters are stored in buffer, a null-terminator is appended, and len is returned.
   172  * - If len < count, then len characters are stored in buffer, a null-terminator is appended, and len is returned.
   170  * - If len = count, then len characters are stored in buffer, no null-terminator is appended, and len is returned.
   173  * - If len = count, then len characters are stored in buffer, no null-terminator is appended, and len is returned.