mirror of
https://gitlab.alpinelinux.org/alpine/aports.git
synced 2026-02-11 02:42:21 +01:00
37 lines
1.3 KiB
Diff
37 lines
1.3 KiB
Diff
--- a/google/cloud/spanner/interval.cc
|
|
+++ b/google/cloud/spanner/interval.cc
|
|
@@ -345,22 +345,22 @@ StatusOr<Interval> Interval::ParseISO8601Interval(absl::string_view str) {
|
|
Interval intvl;
|
|
absl::string_view s = str;
|
|
|
|
+ bool negated = !absl::ConsumePrefix(&s, "+") && absl::ConsumePrefix(&s, "-");
|
|
+ if (!absl::ConsumePrefix(&s, "P")) {
|
|
+ return SyntaxError(str, s, GCP_ERROR_INFO());
|
|
+ }
|
|
+
|
|
auto const* units = std::begin(kISO8601DateUnitFactories);
|
|
auto const* units_end = std::end(kISO8601DateUnitFactories);
|
|
enum { kValue, kUnit, kNothing } expecting = kValue;
|
|
- bool negated = false;
|
|
+ bool seen_T = false;
|
|
|
|
for (;;) {
|
|
- if (units == std::begin(kISO8601DateUnitFactories)) {
|
|
- negated = !absl::ConsumePrefix(&s, "+") && absl::ConsumePrefix(&s, "-");
|
|
- if (!absl::ConsumePrefix(&s, "P")) break;
|
|
- }
|
|
- if (units_end == std::end(kISO8601DateUnitFactories)) {
|
|
- if (absl::ConsumePrefix(&s, "T")) {
|
|
- units = std::begin(kISO8601TimeUnitFactories);
|
|
- units_end = std::end(kISO8601TimeUnitFactories);
|
|
- expecting = kValue;
|
|
- }
|
|
+ if (!seen_T && absl::ConsumePrefix(&s, "T")) {
|
|
+ units = std::begin(kISO8601TimeUnitFactories);
|
|
+ units_end = std::end(kISO8601TimeUnitFactories);
|
|
+ expecting = kValue;
|
|
+ seen_T = true;
|
|
}
|
|
if (units == units_end) break;
|
|
double vf;
|