Fix some accidental uses of argument-dependent lookup

StringToInt(string_piece) works because base::StringPiece is in
namespace base, but when it is switched to std::string_view, this won't
work anymore. Use the idiomatic spelling.

Bug: chromium:691162
Change-Id: Ic45e0d2729fa5fc7c3e7a56fe159957b1bdcdf94
Reviewed-on: https://chromium-review.googlesource.com/c/crashpad/crashpad/+/4298113
Commit-Queue: David Benjamin <davidben@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
This commit is contained in:
David Benjamin 2023-02-28 16:34:24 -05:00 committed by Crashpad LUCI CQ
parent 9830fbf3b4
commit 90bba04e22
2 changed files with 8 additions and 8 deletions

View File

@ -315,7 +315,7 @@ class RingBufferAnnotationSnapshot final {
int next_value; int next_value;
base::StringPiece str(reinterpret_cast<const char*>(&bytes[0]), base::StringPiece str(reinterpret_cast<const char*>(&bytes[0]),
bytes.size()); bytes.size());
if (!HexStringToInt(str, &next_value)) { if (!base::HexStringToInt(str, &next_value)) {
fprintf(stderr, fprintf(stderr,
"Couldn't parse value: [%.*s]\n", "Couldn't parse value: [%.*s]\n",
base::checked_cast<int>(bytes.size()), base::checked_cast<int>(bytes.size()),

View File

@ -62,8 +62,8 @@ bool ReadCPUsOnline(uint32_t* first_cpu, uint8_t* cpu_count) {
std::string left, right; std::string left, right;
if (SplitStringFirst(range, '-', &left, &right)) { if (SplitStringFirst(range, '-', &left, &right)) {
unsigned int start, end; unsigned int start, end;
if (!StringToUint(base::StringPiece(left), &start) || if (!base::StringToUint(base::StringPiece(left), &start) ||
!StringToUint(base::StringPiece(right), &end) || end <= start) { !base::StringToUint(base::StringPiece(right), &end) || end <= start) {
LOG(ERROR) << "format error: " << range; LOG(ERROR) << "format error: " << range;
return false; return false;
} }
@ -78,7 +78,7 @@ bool ReadCPUsOnline(uint32_t* first_cpu, uint8_t* cpu_count) {
} }
} else { } else {
unsigned int cpuno; unsigned int cpuno;
if (!StringToUint(base::StringPiece(range), &cpuno)) { if (!base::StringToUint(base::StringPiece(range), &cpuno)) {
LOG(ERROR) << "format error"; LOG(ERROR) << "format error";
return false; return false;
} }
@ -399,13 +399,13 @@ void SystemSnapshotLinux::ReadKernelVersion(const std::string& version_string) {
return; return;
} }
if (!StringToInt(base::StringPiece(versions[0]), &os_version_major_)) { if (!base::StringToInt(base::StringPiece(versions[0]), &os_version_major_)) {
LOG(WARNING) << "no kernel version"; LOG(WARNING) << "no kernel version";
return; return;
} }
DCHECK_GE(os_version_major_, 3); DCHECK_GE(os_version_major_, 3);
if (!StringToInt(base::StringPiece(versions[1]), &os_version_minor_)) { if (!base::StringToInt(base::StringPiece(versions[1]), &os_version_minor_)) {
LOG(WARNING) << "no major revision"; LOG(WARNING) << "no major revision";
return; return;
} }
@ -415,7 +415,7 @@ void SystemSnapshotLinux::ReadKernelVersion(const std::string& version_string) {
if (minor_rev_end == std::string::npos) { if (minor_rev_end == std::string::npos) {
minor_rev_end = versions[2].size(); minor_rev_end = versions[2].size();
} }
if (!StringToInt(base::StringPiece(versions[2].c_str(), minor_rev_end), if (!base::StringToInt(base::StringPiece(versions[2].c_str(), minor_rev_end),
&os_version_bugfix_)) { &os_version_bugfix_)) {
LOG(WARNING) << "no minor revision"; LOG(WARNING) << "no minor revision";
return; return;