mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
parent
186f917cc9
commit
741c3a705e
|
@ -2333,13 +2333,11 @@ int str_length(const char *str)
|
|||
int str_format(char *buffer, int buffer_size, const char *format, ...)
|
||||
{
|
||||
int ret;
|
||||
|
||||
#if defined(CONF_FAMILY_WINDOWS)
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
#if defined(__MINGW32__)
|
||||
ret = __mingw_vsnprintf(buffer, buffer_size, format, ap);
|
||||
#elif defined(CONF_FAMILY_WINDOWS)
|
||||
ret = _vsnprintf(buffer, buffer_size, format, ap);
|
||||
va_end(ap);
|
||||
|
||||
buffer[buffer_size-1] = 0; /* assure null termination */
|
||||
|
||||
|
@ -2348,11 +2346,13 @@ int str_format(char *buffer, int buffer_size, const char *format, ...)
|
|||
if(ret < 0)
|
||||
ret = buffer_size - 1;
|
||||
#else
|
||||
va_list ap;
|
||||
va_start(ap, format);
|
||||
ret = vsnprintf(buffer, buffer_size, format, ap);
|
||||
#endif
|
||||
va_end(ap);
|
||||
|
||||
/* null termination is assured by definition of vsnprintf */
|
||||
#endif
|
||||
|
||||
/* a return value of buffer_size or more indicates truncated output */
|
||||
if(ret >= buffer_size)
|
||||
|
|
Loading…
Reference in a new issue