Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(342)

Unified Diff: net/base/mime_util.cc

Issue 1224553010: Replace base::str[n]casecmp with helper functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert CLD Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/base/mime_util.cc
diff --git a/net/base/mime_util.cc b/net/base/mime_util.cc
index 0a1774261ad45f5ba024842871cc747a2ed8e386..6bc825f5dbee7ffae79bab40e4ff5a87bf306545 100644
--- a/net/base/mime_util.cc
+++ b/net/base/mime_util.cc
@@ -116,7 +116,8 @@ const char* FindMimeType(const MimeInfo* mappings,
for (;;) {
size_t end_pos = strcspn(extensions, ",");
if (end_pos == ext.size() &&
Nico 2015/07/08 21:58:23 I was about to say that EqualsCase...() already do
brettw 2015/07/08 22:35:17 Yeah, I added a comment for clarity.
- base::strncasecmp(extensions, ext.data(), ext.size()) == 0)
+ base::EqualsCaseInsensitiveASCII(
+ base::StringPiece(extensions, ext.size()), ext))
return mappings[i].mime_type;
extensions += end_pos;
if (!*extensions)
@@ -267,13 +268,10 @@ bool MimeUtil::MatchesMimeType(const std::string& mime_type_pattern,
const std::string::size_type star = base_pattern.find('*');
if (star == std::string::npos) {
- if (base_pattern.size() == base_type.size() &&
- base::strncasecmp(base_pattern.data(), base_type.data(),
- base_pattern.size()) == 0) {
+ if (base::EqualsCaseInsensitiveASCII(base_pattern, base_type))
return MatchesMimeTypeParameters(mime_type_pattern, mime_type);
- } else {
+ else
return false;
- }
}
// Test length to prevent overlap between |left| and |right|.

Powered by Google App Engine
This is Rietveld 408576698