Skip to content

Commit

Permalink
ppd_provider: pacify presubmit
Browse files Browse the repository at this point in the history
This change modifies the PpdProvider class to follow the conventions
required by the presubmit checks. The changes are trivial and will cause
no behavioral changes. They pave the way to moving the implementation of
this class into a "deprecated" source file.

Bug: 1025995
Change-Id: I6bb71439e519a7a71c7e8f87639b6f4719b3be96
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1935046
Reviewed-by: Sean Kau <skau@chromium.org>
Commit-Queue: Kalvin Lee <kdlee@chromium.org>
Cr-Commit-Position: refs/heads/master@{#720581}
  • Loading branch information
Kalvin Lee authored and Commit Bot committed Dec 2, 2019
1 parent 9c5f9cd commit d11ee50
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions chromeos/printing/ppd_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,10 @@ class PpdProviderImpl : public PpdProvider {

// Strip shard number from 2 digits following 'index'
int idx_pos = url_str.find_first_of("0123456789", url_str.find("index-"));
return std::stoi(url_str.substr(idx_pos, 2));
int shard_number;
return base::StringToInt(url_str.substr(idx_pos, 2), &shard_number)
? shard_number
: -1;
}

// Return the URL to get a localized manufacturers map.
Expand Down Expand Up @@ -1387,7 +1390,7 @@ class PpdProviderImpl : public PpdProvider {
// |contents|, clears |contents| otherwise.
PpdProvider::CallbackResultCode ValidateAndParseManufacturersJSON(
std::vector<ManufacturersJSON>* contents) {
DCHECK(contents != NULL);
DCHECK(contents != nullptr);
contents->clear();

base::Value::ListStorage top_list;
Expand Down Expand Up @@ -1421,7 +1424,7 @@ class PpdProviderImpl : public PpdProvider {
// |contents|, clears |contents| otherwise.
PpdProvider::CallbackResultCode ValidateAndParsePrintersJSON(
std::vector<PrintersJSON>* contents) {
DCHECK(contents != NULL);
DCHECK(contents != nullptr);
contents->clear();

base::Value::ListStorage top_list;
Expand Down

0 comments on commit d11ee50

Please sign in to comment.