summaryrefslogtreecommitdiffstats
path: root/chrome/service
diff options
context:
space:
mode:
authorbrettw <brettw@chromium.org>2015-07-10 11:28:33 -0700
committerCommit bot <commit-bot@chromium.org>2015-07-10 18:29:16 +0000
commit8a800901b78a29e33bc91b48621cec72964a1f14 (patch)
tree52d0f9991900203fc5867bdb3a5a755de6b80bc4 /chrome/service
parente6b7b46750d4a54a4005882a19d48334e5a9f628 (diff)
downloadchromium_src-8a800901b78a29e33bc91b48621cec72964a1f14.zip
chromium_src-8a800901b78a29e33bc91b48621cec72964a1f14.tar.gz
chromium_src-8a800901b78a29e33bc91b48621cec72964a1f14.tar.bz2
Replace base::str[n]casecmp with helper functions.
Adds CompareCaseInsensitiveASCII and EqualsCaseInsensitiveASCII helper functions and removes base::strcasecmp and base::strncasecmp. This avoids the dangerous locale-sensitive behavior. ClientIsAdvertisingSdchEncoding in sdch_browsertest had the condition inverted, but because it returned true any time the given line wasn't found, the test didn't notice. cups_helper changed most significantly. I redid the loop to use StringPieces which saves a lot of copies. On line 82 cups_helper used to do a prefix match which I'm pretty sure it wanted a regular compare. I changed this. render_text_harfbuzz set "<" operator was also doing a prefix comparison only, when it looks like it really just wanted to compare the strings. file_path passed string pieces into strcasecmp which could then read off the end if they're not null terminated. This patch fixes the bug and calls the native strcasecmp which is probably the best we can do for Posix file names. Removed additional version of the same function in net. Adds a backwards-compat hack for crashpad which improperly uses base from a DEPS-ed in repo. Review URL: https://codereview.chromium.org/1224553010 Cr-Commit-Position: refs/heads/master@{#338324}
Diffstat (limited to 'chrome/service')
-rw-r--r--chrome/service/cloud_print/cloud_print_connector.cc2
-rw-r--r--chrome/service/cloud_print/cloud_print_proxy_backend.cc4
2 files changed, 3 insertions, 3 deletions
diff --git a/chrome/service/cloud_print/cloud_print_connector.cc b/chrome/service/cloud_print/cloud_print_connector.cc
index a1f6be7..f53c865 100644
--- a/chrome/service/cloud_print/cloud_print_connector.cc
+++ b/chrome/service/cloud_print/cloud_print_connector.cc
@@ -653,7 +653,7 @@ void CloudPrintConnector::OnReceivePrinterCaps(
bool CloudPrintConnector::IsSamePrinter(const std::string& name1,
const std::string& name2) const {
- return (0 == base::strcasecmp(name1.c_str(), name2.c_str()));
+ return base::EqualsCaseInsensitiveASCII(name1, name2);
}
} // namespace cloud_print
diff --git a/chrome/service/cloud_print/cloud_print_proxy_backend.cc b/chrome/service/cloud_print/cloud_print_proxy_backend.cc
index f93215d..53485cc 100644
--- a/chrome/service/cloud_print/cloud_print_proxy_backend.cc
+++ b/chrome/service/cloud_print/cloud_print_proxy_backend.cc
@@ -550,8 +550,8 @@ void CloudPrintProxyBackend::Core::OnIncomingNotification(
DCHECK(base::MessageLoop::current() == backend_->core_thread_.message_loop());
VLOG(1) << "CP_CONNECTOR: Incoming notification.";
- if (0 == base::strcasecmp(kCloudPrintPushNotificationsSource,
- notification.channel.c_str()))
+ if (base::EqualsCaseInsensitiveASCII(kCloudPrintPushNotificationsSource,
+ notification.channel))
HandlePrinterNotification(notification.data);
}