Don’t assume `QuicheStringPiece::const_iterator` is a `const char*` Explicitly convert a `QuicheStringPiece::const_iterator` to `const char*` before trying to initialize a `QuicheStringPiece` with it. This is technically required by the standard – `std::string_view` (to which `QuicheStringPiece` decays in C++17 mode) only has std::string_view::string_view(const char*, size_t); std::string_view::string_view(const char*); and not std::string_view::string_view(std::string_view::const_iterator); In practice, this isn’t generally an issue, because most STL implementations use `const char*` as the `string_view` iterator type. MSVC, however, uses a struct for the iterator and therefore requires the explicit conversion. Thanks go to Yifan Yang <needyyang@google.com>, who identified this issue. PiperOrigin-RevId: 320031927 Change-Id: If81aff793fac2db7202b5df0d02f86147fc3a658
diff --git a/spdy/core/spdy_alt_svc_wire_format.cc b/spdy/core/spdy_alt_svc_wire_format.cc index 90dbab8..7f7ca29 100644 --- a/spdy/core/spdy_alt_svc_wire_format.cc +++ b/spdy/core/spdy_alt_svc_wire_format.cc
@@ -197,7 +197,7 @@ // ... will be stored in |versions| as 0x51303338. uint32_t quic_version; if (!SpdyHexDecodeToUInt32( - quiche::QuicheStringPiece(parameter_value_begin, + quiche::QuicheStringPiece(&*parameter_value_begin, c - parameter_value_begin), &quic_version) || quic_version == 0) {