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

Side by Side Diff: net/cookies/cookie_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: 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 unified diff | Download patch
« no previous file with comments | « net/base/mime_util.cc ('k') | net/dns/dns_response.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/cookies/cookie_util.h" 5 #include "net/cookies/cookie_util.h"
6 6
7 #include <cstdio> 7 #include <cstdio>
8 #include <cstdlib> 8 #include <cstdlib>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 while (tokenizer.GetNext()) { 118 while (tokenizer.GetNext()) {
119 const std::string token = tokenizer.token(); 119 const std::string token = tokenizer.token();
120 DCHECK(!token.empty()); 120 DCHECK(!token.empty());
121 bool numerical = base::IsAsciiDigit(token[0]); 121 bool numerical = base::IsAsciiDigit(token[0]);
122 122
123 // String field 123 // String field
124 if (!numerical) { 124 if (!numerical) {
125 if (!found_month) { 125 if (!found_month) {
126 for (int i = 0; i < kMonthsLen; ++i) { 126 for (int i = 0; i < kMonthsLen; ++i) {
127 // Match prefix, so we could match January, etc 127 // Match prefix, so we could match January, etc
128 if (base::strncasecmp(token.c_str(), kMonths[i], 3) == 0) { 128 if (base::StartsWith(token, base::StringPiece(kMonths[i], 3),
129 base::CompareCase::INSENSITIVE_ASCII)) {
129 exploded.month = i + 1; 130 exploded.month = i + 1;
130 found_month = true; 131 found_month = true;
131 break; 132 break;
132 } 133 }
133 } 134 }
134 } else { 135 } else {
135 // If we've gotten here, it means we've already found and parsed our 136 // If we've gotten here, it means we've already found and parsed our
136 // month, and we have another string, which we would expect to be the 137 // month, and we have another string, which we would expect to be the
137 // the time zone name. According to the RFC and my experiments with 138 // the time zone name. According to the RFC and my experiments with
138 // how sites format their expirations, we don't have much of a reason 139 // how sites format their expirations, we don't have much of a reason
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 buffer.append("; "); 262 buffer.append("; ");
262 buffer.append(i->first.begin(), i->first.end()); 263 buffer.append(i->first.begin(), i->first.end());
263 buffer.push_back('='); 264 buffer.push_back('=');
264 buffer.append(i->second.begin(), i->second.end()); 265 buffer.append(i->second.begin(), i->second.end());
265 } 266 }
266 return buffer; 267 return buffer;
267 } 268 }
268 269
269 } // namespace cookie_util 270 } // namespace cookie_util
270 } // namespace net 271 } // namespace net
OLDNEW
« no previous file with comments | « net/base/mime_util.cc ('k') | net/dns/dns_response.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698