X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2FString.cpp;h=f4a923963f3ecd05fabb76790fc949b51361ac7c;hb=9cb500221e2d70d8bdba2f368e4d438c97a48a9e;hp=ffc956d68206149419e32de52c54508f1d5a8931;hpb=520e20a8baebc98a5ec84d67865da4cf9819f88a;p=folly.git diff --git a/folly/String.cpp b/folly/String.cpp index ffc956d6..f4a92396 100644 --- a/folly/String.cpp +++ b/folly/String.cpp @@ -29,6 +29,12 @@ namespace folly { +static_assert(IsConvertible::value, ""); +static_assert(IsConvertible::value, ""); +static_assert(IsConvertible::value, ""); +static_assert(IsConvertible::value, ""); +static_assert(!IsConvertible>::value, ""); + static inline bool is_oddspace(char c) { return c == '\n' || c == '\t' || c == '\r'; } @@ -118,7 +124,7 @@ void stringAppendfImpl(std::string& output, const char* format, va_list args) { output.append(heap_buffer.get(), size_t(final_bytes_used)); } -} // anon namespace +} // namespace std::string stringPrintf(const char* format, ...) { va_list ap; @@ -181,7 +187,7 @@ const PrettySuffix kPrettyTimeSuffixes[] = { { "ns", 1e-9L }, { "ps", 1e-12L }, { "s ", 0 }, - { 0, 0 }, + { nullptr, 0 }, }; const PrettySuffix kPrettyBytesMetricSuffixes[] = { @@ -190,7 +196,7 @@ const PrettySuffix kPrettyBytesMetricSuffixes[] = { { "MB", 1e6L }, { "kB", 1e3L }, { "B ", 0L }, - { 0, 0 }, + { nullptr, 0 }, }; const PrettySuffix kPrettyBytesBinarySuffixes[] = { @@ -199,7 +205,7 @@ const PrettySuffix kPrettyBytesBinarySuffixes[] = { { "MB", int64_t(1) << 20 }, { "kB", int64_t(1) << 10 }, { "B ", 0L }, - { 0, 0 }, + { nullptr, 0 }, }; const PrettySuffix kPrettyBytesBinaryIECSuffixes[] = { @@ -208,7 +214,7 @@ const PrettySuffix kPrettyBytesBinaryIECSuffixes[] = { { "MiB", int64_t(1) << 20 }, { "KiB", int64_t(1) << 10 }, { "B ", 0L }, - { 0, 0 }, + { nullptr, 0 }, }; const PrettySuffix kPrettyUnitsMetricSuffixes[] = { @@ -217,7 +223,7 @@ const PrettySuffix kPrettyUnitsMetricSuffixes[] = { { "M", 1e6L }, { "k", 1e3L }, { " ", 0 }, - { 0, 0 }, + { nullptr, 0 }, }; const PrettySuffix kPrettyUnitsBinarySuffixes[] = { @@ -226,7 +232,7 @@ const PrettySuffix kPrettyUnitsBinarySuffixes[] = { { "M", int64_t(1) << 20 }, { "k", int64_t(1) << 10 }, { " ", 0 }, - { 0, 0 }, + { nullptr, 0 }, }; const PrettySuffix kPrettyUnitsBinaryIECSuffixes[] = { @@ -235,7 +241,7 @@ const PrettySuffix kPrettyUnitsBinaryIECSuffixes[] = { { "Mi", int64_t(1) << 20 }, { "Ki", int64_t(1) << 10 }, { " ", 0 }, - { 0, 0 }, + { nullptr, 0 }, }; const PrettySuffix kPrettySISuffixes[] = { @@ -260,7 +266,7 @@ const PrettySuffix kPrettySISuffixes[] = { { "z", 1e-21L }, { "y", 1e-24L }, { " ", 0 }, - { 0, 0} + { nullptr, 0} }; const PrettySuffix* const kPrettySuffixes[PRETTY_NUM_TYPES] = { @@ -274,7 +280,7 @@ const PrettySuffix* const kPrettySuffixes[PRETTY_NUM_TYPES] = { kPrettySISuffixes, }; -} // namespace +} // namespace std::string prettyPrint(double val, PrettyType type, bool addSpace) { char buf[100]; @@ -489,7 +495,7 @@ void toLowerAscii64(uint64_t& c) { c += rotated; } -} // anon namespace +} // namespace void toLowerAscii(char* str, size_t length) { static const size_t kAlignMask64 = 7; @@ -638,7 +644,7 @@ std::string stripLeftMargin(std::string s) { return join("\n", piecer); } -} // namespace folly +} // namespace folly #ifdef FOLLY_DEFINED_DMGL # undef FOLLY_DEFINED_DMGL