/*
- * Copyright 2016 Facebook, Inc.
+ * Copyright 2017 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <folly/Format.h>
-#include <folly/portability/Constexpr.h>
+#include <folly/ConstexprMath.h>
+#include <folly/CppAttributes.h>
#include <double-conversion/double-conversion.h>
extern const FormatArg::Align formatAlignTable[];
extern const FormatArg::Sign formatSignTable[];
-} // namespace detail
+} // namespace detail
using namespace folly::detail;
}
// 2+: for null terminator and optional sign shenanigans.
- constexpr size_t bufLen =
+ constexpr int bufLen =
2 + constexpr_max(
2 + DoubleToStringConverter::kMaxFixedDigitsBeforePoint +
DoubleToStringConverter::kMaxFixedDigitsAfterPoint,
constexpr_max(8 + DoubleToStringConverter::kMaxExponentialDigits,
7 + DoubleToStringConverter::kMaxPrecisionDigits));
char buf[bufLen];
- StringBuilder builder(buf + 1, static_cast<int> (sizeof(buf) - 1));
+ StringBuilder builder(buf + 1, bufLen - 1);
char plusSign;
switch (arg.sign) {
switch (arg.presentation) {
case '%':
val *= 100;
+ FOLLY_FALLTHROUGH;
case 'f':
case 'F':
{
prefixLen = 1;
}
- piece = fbstring(p, len);
+ piece = fbstring(p, size_t(len));
}
auto end = fullArgString.end();
// Parse key
- auto p = static_cast<const char*>(memchr(b, ':', end - b));
+ auto p = static_cast<const char*>(memchr(b, ':', size_t(end - b)));
if (!p) {
key_ = StringPiece(b, end);
return;
remaining_digits -= current_group_size;
}
}
-} // detail
+} // namespace detail
-} // namespace folly
+} // namespace folly