Browse Source

Fix compatibility with RE2 2023-07-01.

First discovered in https://github.com/microsoft/vcpkg/pull/32595 , Google RE2 no longer provides their own custom StringPiece type, and instead use abseil::string_view (which may end up being std::string_view).

2d39b703d0 made StringPiece convertible to std::string and RE2 internally appears to have been changed over to use such conversions.

However, if we made the same change RE2 did internally, that would break compatibility with older versions of RE2.

There appear to be 2 ways  to fix this:
1. Both the old StringPiece and the new string_view have data() and size() members with which we can construct a new std::string without care for which one we got.
2. We can just copy the string_ member we already have.

This change does 2 but 1 would be reasonable if the authors wish for that resolution.
pull/3134/head
Billy Robert O'Neal III 2 years ago
parent
commit
013ce38dc0
1 changed files with 1 additions and 1 deletions
  1. +1
    -1
      cpp/src/phonenumbers/regexp_adapter_re2.cc

+ 1
- 1
cpp/src/phonenumbers/regexp_adapter_re2.cc View File

@ -39,7 +39,7 @@ class RE2RegExpInput : public RegExpInput {
utf8_input_(string_) {}
virtual string ToString() const {
return utf8_input_.ToString();
return string_;
}
StringPiece* Data() {


Loading…
Cancel
Save