diff options
-rw-r--r-- | absl/container/inlined_vector.h | 4 | ||||
-rw-r--r-- | absl/strings/internal/str_format/parser.cc | 3 | ||||
-rw-r--r-- | absl/strings/internal/str_format/parser_test.cc | 2 |
3 files changed, 8 insertions, 1 deletions
diff --git a/absl/container/inlined_vector.h b/absl/container/inlined_vector.h index 7c574aec43bd..4849f7eaddaf 100644 --- a/absl/container/inlined_vector.h +++ b/absl/container/inlined_vector.h @@ -1354,6 +1354,10 @@ bool operator>=(const InlinedVector<T, N, A>& a, return !(a < b); } +// AbslHashValue() +// +// Provides `absl::Hash` support for inlined vectors. You do not normally call +// this function directly. template <typename Hash, typename TheT, size_t TheN, typename TheA> Hash AbslHashValue(Hash hash, const InlinedVector<TheT, TheN, TheA>& vec) { auto p = vec.data(); diff --git a/absl/strings/internal/str_format/parser.cc b/absl/strings/internal/str_format/parser.cc index 5e3d0d0547d1..10487f23c855 100644 --- a/absl/strings/internal/str_format/parser.cc +++ b/absl/strings/internal/str_format/parser.cc @@ -99,10 +99,11 @@ bool ConsumeConversion(string_view *src, UnboundConversion *conv, // digit doesn't match the expected characters. int num_digits = std::numeric_limits<int>::digits10; for (;;) { - if (ABSL_PREDICT_FALSE(pos == end || !num_digits)) break; + if (ABSL_PREDICT_FALSE(pos == end)) break; c = *pos++; if (!std::isdigit(c)) break; --num_digits; + if (ABSL_PREDICT_FALSE(!num_digits)) break; digits = 10 * digits + c - '0'; } return digits; diff --git a/absl/strings/internal/str_format/parser_test.cc b/absl/strings/internal/str_format/parser_test.cc index ae40203191b9..ff7057534f43 100644 --- a/absl/strings/internal/str_format/parser_test.cc +++ b/absl/strings/internal/str_format/parser_test.cc @@ -246,6 +246,8 @@ TEST_F(ConsumeUnboundConversionTest, WidthAndPrecision) { EXPECT_FALSE(Run("1000000000.999999999d")); EXPECT_FALSE(Run("999999999.1000000000d")); + EXPECT_FALSE(Run("9999999999d")); + EXPECT_FALSE(Run(".9999999999d")); } TEST_F(ConsumeUnboundConversionTest, Flags) { |