diff options
Diffstat (limited to 'absl/strings')
-rw-r--r-- | absl/strings/internal/numbers_test_common.h | 23 | ||||
-rw-r--r-- | absl/strings/internal/str_format/arg.h | 8 | ||||
-rw-r--r-- | absl/strings/string_view.h | 2 |
3 files changed, 17 insertions, 16 deletions
diff --git a/absl/strings/internal/numbers_test_common.h b/absl/strings/internal/numbers_test_common.h index 20e3af51141e..f6241ff3d8ee 100644 --- a/absl/strings/internal/numbers_test_common.h +++ b/absl/strings/internal/numbers_test_common.h @@ -64,11 +64,11 @@ struct uint32_test_case { inline const std::array<uint32_test_case, 27>& strtouint32_test_cases() { static const std::array<uint32_test_case, 27> test_cases{{ - {"0xffffffff", true, 16, std::numeric_limits<uint32_t>::max()}, + {"0xffffffff", true, 16, (std::numeric_limits<uint32_t>::max)()}, {"0x34234324", true, 16, 0x34234324}, {"34234324", true, 16, 0x34234324}, {"0", true, 16, 0}, - {" \t\n 0xffffffff", true, 16, std::numeric_limits<uint32_t>::max()}, + {" \t\n 0xffffffff", true, 16, (std::numeric_limits<uint32_t>::max)()}, {" \f\v 46", true, 10, 46}, // must accept weird whitespace {" \t\n 72717222", true, 8, 072717222}, {" \t\n 072717222", true, 8, 072717222}, @@ -77,7 +77,7 @@ inline const std::array<uint32_test_case, 27>& strtouint32_test_cases() { // Base-10 version. {"34234324", true, 0, 34234324}, - {"4294967295", true, 0, std::numeric_limits<uint32_t>::max()}, + {"4294967295", true, 0, (std::numeric_limits<uint32_t>::max)()}, {"34234324 \n\t", true, 10, 34234324}, // Unusual base @@ -96,8 +96,8 @@ inline const std::array<uint32_test_case, 27>& strtouint32_test_cases() { {" \t\n -123", false, 0, 0}, // Out of bounds. - {"4294967296", false, 0, std::numeric_limits<uint32_t>::max()}, - {"0x100000000", false, 0, std::numeric_limits<uint32_t>::max()}, + {"4294967296", false, 0, (std::numeric_limits<uint32_t>::max)()}, + {"0x100000000", false, 0, (std::numeric_limits<uint32_t>::max)()}, {nullptr, false, 0, 0}, }}; return test_cases; @@ -119,7 +119,7 @@ inline const std::array<uint64_test_case, 34>& strtouint64_test_cases() { {"000", true, 0, 0}, {"0", true, 0, 0}, {" \t\n 0xffffffffffffffff", true, 16, - std::numeric_limits<uint64_t>::max()}, + (std::numeric_limits<uint64_t>::max)()}, {"012345670123456701234", true, 8, int64_t{012345670123456701234}}, {"12345670123456701234", true, 8, int64_t{012345670123456701234}}, @@ -130,7 +130,7 @@ inline const std::array<uint64_test_case, 34>& strtouint64_test_cases() { {"34234324487834466", true, 0, int64_t{34234324487834466}}, {" \t\n 18446744073709551615", true, 0, - std::numeric_limits<uint64_t>::max()}, + (std::numeric_limits<uint64_t>::max)()}, {"34234324487834466 \n\t ", true, 0, int64_t{34234324487834466}}, @@ -156,12 +156,13 @@ inline const std::array<uint64_test_case, 34>& strtouint64_test_cases() { // Out of bounds. {"18446744073709551616", false, 10, 0}, {"18446744073709551616", false, 0, 0}, - {"0x10000000000000000", false, 16, std::numeric_limits<uint64_t>::max()}, + {"0x10000000000000000", false, 16, + (std::numeric_limits<uint64_t>::max)()}, {"0X10000000000000000", false, 16, - std::numeric_limits<uint64_t>::max()}, // 0X versus 0x. - {"0x10000000000000000", false, 0, std::numeric_limits<uint64_t>::max()}, + (std::numeric_limits<uint64_t>::max)()}, // 0X versus 0x. + {"0x10000000000000000", false, 0, (std::numeric_limits<uint64_t>::max)()}, {"0X10000000000000000", false, 0, - std::numeric_limits<uint64_t>::max()}, // 0X versus 0x. + (std::numeric_limits<uint64_t>::max)()}, // 0X versus 0x. {"0x1234", true, 16, 0x1234}, diff --git a/absl/strings/internal/str_format/arg.h b/absl/strings/internal/str_format/arg.h index 3376d48afda2..ec9e6f0063b1 100644 --- a/absl/strings/internal/str_format/arg.h +++ b/absl/strings/internal/str_format/arg.h @@ -335,12 +335,12 @@ class FormatArgImpl { using CommonType = typename std::conditional<std::is_signed<T>::value, int64_t, uint64_t>::type; if (static_cast<CommonType>(val) > - static_cast<CommonType>(std::numeric_limits<int>::max())) { - return std::numeric_limits<int>::max(); + static_cast<CommonType>((std::numeric_limits<int>::max)())) { + return (std::numeric_limits<int>::max)(); } else if (std::is_signed<T>::value && static_cast<CommonType>(val) < - static_cast<CommonType>(std::numeric_limits<int>::min())) { - return std::numeric_limits<int>::min(); + static_cast<CommonType>((std::numeric_limits<int>::min)())) { + return (std::numeric_limits<int>::min)(); } return static_cast<int>(val); } diff --git a/absl/strings/string_view.h b/absl/strings/string_view.h index 6bcd3c4e341f..2cc10f522e13 100644 --- a/absl/strings/string_view.h +++ b/absl/strings/string_view.h @@ -490,7 +490,7 @@ class string_view { private: static constexpr size_type kMaxSize = - std::numeric_limits<difference_type>::max(); + (std::numeric_limits<difference_type>::max)(); static constexpr size_type CheckLengthInternal(size_type len) { return ABSL_ASSERT(len <= kMaxSize), len; |