Fix fibers gdb utils script
[folly.git] / folly / Format-inl.h
index 77df9e20640102f4734e45f31815fd5c60e9d6c4..c27b7662ae1f71c52fe31512945ccd50f074d69c 100644 (file)
@@ -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 <folly/Exception.h>
 #include <folly/FormatTraits.h>
 #include <folly/Traits.h>
+#include <folly/portability/Windows.h>
 
 // Ignore -Wformat-nonliteral warnings within this file
 #pragma GCC diagnostic push
@@ -443,7 +444,7 @@ class FormatValue<
     char sign;
     if (std::is_signed<T>::value) {
       if (folly::is_negative(val_)) {
-        uval = static_cast<UT>(-val_);
+        uval = -static_cast<UT>(val_);
         sign = '-';
       } else {
         uval = static_cast<UT>(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<uintmax_t>(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<uintmax_t>(uval));
 #else
       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
       // happen.