#Centipede Fix compile issue with `string_view` For some vendors, `std::string_view::const_iterator != const char*`. More generally, we should always use `.data()` when dealing with string operations for `string_view`. PiperOrigin-RevId: 618837412
diff --git a/centipede/environment.cc b/centipede/environment.cc index 8644a08..104bd95 100644 --- a/centipede/environment.cc +++ b/centipede/environment.cc
@@ -92,7 +92,8 @@ // Returns `value` as a size_t, CHECK-fails on parse error. static size_t GetIntFlag(std::string_view value) { size_t result{}; - CHECK(std::from_chars(value.begin(), value.end(), result).ec == std::errc()) + CHECK(std::from_chars(value.data(), value.data() + value.size(), result).ec == + std::errc()) << value; return result; }
diff --git a/centipede/util.cc b/centipede/util.cc index f5f7e37..614373d 100644 --- a/centipede/util.cc +++ b/centipede/util.cc
@@ -352,7 +352,7 @@ if (stop == start) return false; // no closing " // Replace special characters and hex values. std::string replaced = absl::StrReplaceAll( - std::string_view(line.begin() + start, stop - start), replacements); + std::string_view(line.data() + start, stop - start), replacements); dictionary_entries.emplace_back(replaced.begin(), replaced.end()); } return true;