summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-01-24 13:22:43 +0100
committerMax Kellermann <max@musicpd.org>2018-07-06 19:04:33 +0200
commite1ee8e78123a88678b4ebee67e77669257ccb89a (patch)
tree90d24fafa8ac5b88eb77481d7de91ddd2d6ea3d3
parent63406efcd8f395368b3dc5d1d77e05077d1f5550 (diff)
util/FormatString: remove obsolete Windows fallback
Since 7d353bbe2a70cd7894b1f5954a37e4a07890478d, _GNU_SOURCE is always defined, which implies __USE_MINGW_ANSI_STDIO and thus switches to the mingw implementations of the printf() family. That's standards-compliant, unlike Microsoft's CRT implementations.
-rw-r--r--src/util/FormatString.cxx21
1 files changed, 0 insertions, 21 deletions
diff --git a/src/util/FormatString.cxx b/src/util/FormatString.cxx
index b758997aa..eb216d9b7 100644
--- a/src/util/FormatString.cxx
+++ b/src/util/FormatString.cxx
@@ -23,14 +23,9 @@
#include <stdio.h>
#include <stdlib.h>
-#ifdef _WIN32
-#include <string.h>
-#endif
-
AllocatedString<>
FormatStringV(const char *fmt, va_list args)
{
-#ifndef _WIN32
va_list tmp;
va_copy(tmp, args);
const int length = vsnprintf(NULL, 0, fmt, tmp);
@@ -43,22 +38,6 @@ FormatStringV(const char *fmt, va_list args)
char *buffer = new char[length + 1];
vsnprintf(buffer, length + 1, fmt, args);
return AllocatedString<>::Donate(buffer);
-#else
- /* On mingw32, snprintf() expects a 64 bit integer instead of
- a "long int" for "%li". This is not consistent with our
- expectation, so we're using plain sprintf() here, hoping
- the static buffer is large enough. Sorry for this hack,
- but WIN32 development is so painful, I'm not in the mood to
- do it properly now. */
-
- char buffer[16384];
- vsprintf(buffer, fmt, args);
-
- const size_t length = strlen(buffer);
- char *p = new char[length + 1];
- memcpy(p, buffer, length + 1);
- return AllocatedString<>::Donate(p);
-#endif
}
AllocatedString<>