From 741c3a705e4705d06eaee1e34a0cc29656c46e62 Mon Sep 17 00:00:00 2001 From: heinrich5991 Date: Mon, 29 Jun 2020 13:48:51 +0200 Subject: [PATCH] Revert "Fix str_format on mingw" This reverts commit a9f6d3716cb2a7fb02d523828ec3a544a5748b24. --- src/base/system.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/base/system.c b/src/base/system.c index e29a4dd49..dfe0dffe1 100644 --- a/src/base/system.c +++ b/src/base/system.c @@ -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)