From: Christopher Dykes Date: Thu, 25 Aug 2016 17:18:25 +0000 (-0700) Subject: Don't pass the single quote format parameter when formatting things X-Git-Tag: v2016.08.29.00~11 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e4e0bbe1072ab82e52a9dde6619c8eb2f0e19376;p=folly.git Don't pass the single quote format parameter when formatting things Summary: We are formatting an integer value, so it is doing absolutely nothing at all, as confirmed by the version I implemented for MSVC, which does output the value with digit separators, which fails the unit tests because the unit test expects the digit separators to not be present. What's more, whe specifically assert that the user has not requested digit separators in the format string. This also kills the MSVC special case entirely because it's not needed. Reviewed By: yfeldblum Differential Revision: D3768405 fbshipit-source-id: 388cd0ca9699e257c71798b9bf355aa651748e60 --- diff --git a/folly/Format-inl.h b/folly/Format-inl.h index d2a38c0e..c27b7662 100644 --- a/folly/Format-inl.h +++ b/folly/Format-inl.h @@ -492,23 +492,12 @@ class FormatValue< "' specifier"); valBufBegin = valBuf + 3; // room for sign and base prefix -#ifdef _MSC_VER - char valBuf2[valBufSize]; - snprintf(valBuf2, valBufSize, "%ju", static_cast(uval)); - int len = GetNumberFormat( - LOCALE_USER_DEFAULT, - 0, - valBuf2, - nullptr, - valBufBegin, - (int)((valBuf + valBufSize) - valBufBegin) - ); -#elif defined(__ANDROID__) +#if defined(__ANDROID__) int len = snprintf(valBufBegin, (valBuf + valBufSize) - valBufBegin, "%" PRIuMAX, static_cast(uval)); #else int len = snprintf(valBufBegin, (valBuf + valBufSize) - valBufBegin, - "%'ju", static_cast(uval)); + "%ju", static_cast(uval)); #endif // valBufSize should always be big enough, so this should never // happen.