Commit bae18697 authored by Orvid King's avatar Orvid King Committed by facebook-github-bot-9

Adjust Format-inl.h to work with MSVC

Summary: Originally #247, which was closed before being merged, this doesn't change the behavior of the formatting function now.
Closes #297

Reviewed By: @yfeldblum

Differential Revision: D2340712

Pulled By: @sgolemon
parent 1b08746e
...@@ -490,8 +490,21 @@ class FormatValue< ...@@ -490,8 +490,21 @@ class FormatValue<
"' specifier"); "' specifier");
valBufBegin = valBuf + 3; // room for sign and base prefix valBufBegin = valBuf + 3; // room for sign and base prefix
#ifdef _MSC_VER
char valBuf2[valBufSize];
snprintf(valBuf2, valBufSize, "%ju", static_cast<uintmax_t>(uval));
int len = GetNumberFormat(
LOCALE_USER_DEFAULT,
0,
valBuf2,
nullptr,
valBufBegin,
(int)((valBuf + valBufSize) - valBufBegin)
);
#else
int len = snprintf(valBufBegin, (valBuf + valBufSize) - valBufBegin, int len = snprintf(valBufBegin, (valBuf + valBufSize) - valBufBegin,
"%'ju", static_cast<uintmax_t>(uval)); "%'ju", static_cast<uintmax_t>(uval));
#endif
// valBufSize should always be big enough, so this should never // valBufSize should always be big enough, so this should never
// happen. // happen.
assert(len < valBuf + valBufSize - valBufBegin); assert(len < valBuf + valBufSize - valBufBegin);
......
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