Commit 6cc758b6 authored by Victor Zverovich's avatar Victor Zverovich

Workaround MSCRT brain damage, take 2.

parent ab05af06
...@@ -40,11 +40,6 @@ ...@@ -40,11 +40,6 @@
#include <string> #include <string>
#include <sstream> #include <sstream>
#ifndef _CRT_SECURE_NO_WARNINGS
# define _CRT_SECURE_NO_WARNINGS
# define FMT_RESTORE_WARNINGS
#endif
namespace fmt { namespace fmt {
namespace internal { namespace internal {
...@@ -188,6 +183,8 @@ inline int IsInf(double x) { ...@@ -188,6 +183,8 @@ inline int IsInf(double x) {
#endif #endif
} }
#define FMT_SNPRINTF snprintf
#else #else
inline int SignBit(double value) { inline int SignBit(double value) {
...@@ -200,8 +197,7 @@ inline int SignBit(double value) { ...@@ -200,8 +197,7 @@ inline int SignBit(double value) {
inline int IsInf(double x) { return !_finite(x); } inline int IsInf(double x) { return !_finite(x); }
# undef snprintf #define FMT_SNPRINTF sprintf_s
# define snprintf _snprintf
#endif #endif
...@@ -698,12 +694,13 @@ void BasicWriter<Char>::FormatDouble( ...@@ -698,12 +694,13 @@ void BasicWriter<Char>::FormatDouble(
Char *start = &buffer_[offset]; Char *start = &buffer_[offset];
if (width_for_sprintf == 0) { if (width_for_sprintf == 0) {
n = precision < 0 ? n = precision < 0 ?
snprintf(start, size, format, value) : FMT_SNPRINTF(start, size, format, value) :
snprintf(start, size, format, precision, value); FMT_SNPRINTF(start, size, format, precision, value);
} else { } else {
n = precision < 0 ? n = precision < 0 ?
snprintf(start, size, format, width_for_sprintf, value) : FMT_SNPRINTF(start, size, format, width_for_sprintf, value) :
snprintf(start, size, format, width_for_sprintf, precision, value); FMT_SNPRINTF(start, size, format, width_for_sprintf,
precision, value);
} }
if (n >= 0 && offset + n < buffer_.capacity()) { if (n >= 0 && offset + n < buffer_.capacity()) {
if (sign) { if (sign) {
...@@ -1552,8 +1549,4 @@ void BasicFormatter<Char>::DoFormat() { ...@@ -1552,8 +1549,4 @@ void BasicFormatter<Char>::DoFormat() {
} }
} }
#ifndef FMT_RESTORE_WARNINGS
# undef _CRT_SECURE_NO_WARNINGS
#endif
#endif // FORMAT_H_ #endif // FORMAT_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment