diff options
author | brettw <brettw@chromium.org> | 2015-07-10 11:28:33 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-10 18:29:16 +0000 |
commit | 8a800901b78a29e33bc91b48621cec72964a1f14 (patch) | |
tree | 52d0f9991900203fc5867bdb3a5a755de6b80bc4 /mojo/services | |
parent | e6b7b46750d4a54a4005882a19d48334e5a9f628 (diff) | |
download | chromium_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 'mojo/services')
-rw-r--r-- | mojo/services/network/http_connection_impl.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/mojo/services/network/http_connection_impl.cc b/mojo/services/network/http_connection_impl.cc index 2df12aa..ad3347d 100644 --- a/mojo/services/network/http_connection_impl.cc +++ b/mojo/services/network/http_connection_impl.cc @@ -375,11 +375,12 @@ void HttpConnectionImpl::OnFinishedReadingResponseBody( // // TODO(yzshen): Consider adding to net::HttpServerResponseInfo a simple // setter for body which doesn't fiddle with headers. - if (base::strcasecmp(header.name.data(), - net::HttpRequestHeaders::kContentLength) == 0) { + base::StringPiece name_piece(header.name.data(), header.name.size()); + if (base::EqualsCaseInsensitiveASCII( + name_piece, net::HttpRequestHeaders::kContentLength)) { continue; - } else if (base::strcasecmp(header.name.data(), - net::HttpRequestHeaders::kContentType) == 0) { + } else if (base::EqualsCaseInsensitiveASCII( + name_piece, net::HttpRequestHeaders::kContentType)) { content_type = header.value; continue; } |