1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-28 00:49:11 +00:00

(svn r8176) -Backport from trunk (r8042, r8089, r8090, r8112):

- OS/2 compilation with GCC (thanks to Paul Smedley and TrueBrain for help) (r8042)
 - [win32] *nprintf functions are broken, 'len = count' wasn't handled (r8089, r8090)
 - MSVC solution files will make openttd THE startup project (r8112)
This commit is contained in:
Darkvater
2007-01-17 00:38:27 +00:00
parent a4bab5f17f
commit 1778566ab8
6 changed files with 126 additions and 71 deletions

View File

@@ -160,11 +160,16 @@ int CDECL snprintf(char *str, size_t size, const char *format, ...)
}
#ifdef _MSC_VER
/* *nprintf broken, not POSIX compliant, MSDN description
* - If len < count, then len characters are stored in buffer, a null-terminator is appended, and len is returned.
* - If len = count, then len characters are stored in buffer, no null-terminator is appended, and len is returned.
* - If len > count, then count characters are stored in buffer, no null-terminator is appended, and a negative value is returned
*/
int CDECL vsnprintf(char *str, size_t size, const char *format, va_list ap)
{
int ret;
ret = _vsnprintf(str, size, format, ap);
if (ret < 0) str[size - 1] = '\0';
if (ret < 0 || ret == size) str[size - 1] = '\0';
return ret;
}
#endif /* _MSC_VER */