From 55836caa8d98703ba47b566bf32fa596463b7aa7 Mon Sep 17 00:00:00 2001 From: cstamford Date: Tue, 10 Mar 2015 07:04:31 +0000 Subject: [PATCH] Added the define FMT_SWPRINTF to allow compilation under TDM-gcc (and possibly other MinGW distributions). --- format.cc | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/format.cc b/format.cc index 13474980..865b78cf 100644 --- a/format.cc +++ b/format.cc @@ -100,6 +100,12 @@ inline int fmt_snprintf(char *buffer, size_t size, const char *format, ...) { # define FMT_SNPRINTF fmt_snprintf #endif // _MSC_VER +#if defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT) +# define FMT_SWPRINTF snwprintf +#else +# define FMT_SWPRINTF swprintf +#endif // defined(_WIN32) && defined(__MINGW32__) && !defined(__NO_ISOCEXT) + // Checks if a value fits in int - used to avoid warnings about comparing // signed and unsigned integers. template @@ -388,12 +394,12 @@ int fmt::internal::CharTraits::format_float( unsigned width, int precision, T value) { if (width == 0) { return precision < 0 ? - swprintf(buffer, size, format, value) : - swprintf(buffer, size, format, precision, value); + FMT_SWPRINTF(buffer, size, format, value) : + FMT_SWPRINTF(buffer, size, format, precision, value); } return precision < 0 ? - swprintf(buffer, size, format, width, value) : - swprintf(buffer, size, format, width, precision, value); + FMT_SWPRINTF(buffer, size, format, width, value) : + FMT_SWPRINTF(buffer, size, format, width, precision, value); } template