X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2FFormat-inl.h;h=c27b7662ae1f71c52fe31512945ccd50f074d69c;hb=5b8add09a804f52169f96db1ee73e33acf8a56ae;hp=ea9ce8752f06b7d8938ddd156a9e5310571fa386;hpb=29169ddf26a342fd9a77c1f548e442c59b7a2569;p=folly.git diff --git a/folly/Format-inl.h b/folly/Format-inl.h index ea9ce875..c27b7662 100644 --- a/folly/Format-inl.h +++ b/folly/Format-inl.h @@ -1,5 +1,5 @@ /* - * Copyright 2015 Facebook, Inc. + * Copyright 2016 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -28,6 +28,7 @@ #include #include #include +#include // Ignore -Wformat-nonliteral warnings within this file #pragma GCC diagnostic push @@ -443,7 +444,7 @@ class FormatValue< char sign; if (std::is_signed::value) { if (folly::is_negative(val_)) { - uval = static_cast(-val_); + uval = -static_cast(val_); sign = '-'; } else { uval = static_cast(val_); @@ -491,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. @@ -771,7 +761,9 @@ template class TryFormatValue { public: template - static void formatOrFail(T& value, FormatArg& arg, FormatCallback& cb) { + static void formatOrFail(T& /* value */, + FormatArg& arg, + FormatCallback& /* cb */) { arg.error("No formatter available for this type"); } }; @@ -1047,8 +1039,8 @@ class FormatValue> { static constexpr size_t valueCount = std::tuple_size::value; template - typename std::enable_if::type - doFormatFrom(size_t i, FormatArg& arg, Callback& cb) const { + typename std::enable_if::type doFormatFrom( + size_t i, FormatArg& arg, Callback& /* cb */) const { arg.enforce("tuple index out of range, max=", i); }