Export of internal Abseil changes.

--
ed4be0cb9a708158187a0628c1c2167ae6783274 by Greg Falcon <gfalcon@google.com>:

Refactor a string unit test into a template function for internal purposes.

PiperOrigin-RevId: 210798880

--
e4c734be903ac7b3a88caf4b17909343c283a21a by Abseil Team <absl-team@google.com>:

Add a note that the RFC3339_* format specifiers use %Y, and so
do not produce 4-digit years on output nor require 4-digit years
on input, as a strict reading of RFC3339 might require.

PiperOrigin-RevId: 210785544

--
cfb5e32f9397e49ddb731445a191b36652fe2f6d by Greg Falcon <gfalcon@google.com>:

Refactor a string unit test into a template function for internal purposes.

PiperOrigin-RevId: 210776525

--
105ee700e62869cfda2a37e6f7c2ea483f8fc75e by Xiaoyi Zhang <zhangxy@google.com>:

Correctly define ABSL_HAVE_STD_STRING_VIEW for MSVC 2017. Currently the macro
is not defined even though MSVC 2017 provides `std::string_view`, and this
means both `absl::string_view` and `std::string_view` exist as distinct types.
A bunch of places relying on the false assumption that
`string_view::const_iterator` is `const char*` have to be fixed to build
successfully.

See related github issue https://github.com/abseil/abseil-cpp/issues/161.

PiperOrigin-RevId: 210764947
GitOrigin-RevId: ed4be0cb9a708158187a0628c1c2167ae6783274
Change-Id: I7a9658b3201aa669db9d3d90474feb08072718c7
This commit is contained in:
Abseil Team 2018-08-29 15:09:00 -07:00 committed by jueminyang
parent 6c7e5ffc43
commit 0f4bc96675
13 changed files with 36 additions and 29 deletions

View file

@ -90,7 +90,7 @@ bool ParseFormatString(string_view src, Consumer consumer) {
int next_arg = 0;
while (!src.empty()) {
const char* percent =
static_cast<const char*>(memchr(src.begin(), '%', src.size()));
static_cast<const char*>(memchr(src.data(), '%', src.size()));
if (!percent) {
// We found the last substring.
return consumer.Append(src);
@ -98,7 +98,7 @@ bool ParseFormatString(string_view src, Consumer consumer) {
// We found a percent, so push the text run then process the percent.
size_t percent_loc = percent - src.data();
if (!consumer.Append(string_view(src.data(), percent_loc))) return false;
if (percent + 1 >= src.end()) return false;
if (percent + 1 >= src.data() + src.size()) return false;
UnboundConversion conv;
@ -178,7 +178,8 @@ class ParsedFormatBase {
const char* const base = data_.get();
string_view text(base, 0);
for (const auto& item : items_) {
text = string_view(text.end(), (base + item.text_end) - text.end());
const char* const end = text.data() + text.size();
text = string_view(end, (base + item.text_end) - end);
if (item.is_conversion) {
if (!consumer.ConvertOne(item.conv, text)) return false;
} else {