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

Side by Side Diff: net/cookies/parsed_cookie.cc

Issue 640303008: Remove trivially-true check in parsed_cookie.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/simpler_bug422036
Patch Set: Created 6 years, 2 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 | « no previous file | no next file » | 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 // Portions of this code based on Mozilla: 5 // Portions of this code based on Mozilla:
6 // (netwerk/cookie/src/nsCookieService.cpp) 6 // (netwerk/cookie/src/nsCookieService.cpp)
7 /* ***** BEGIN LICENSE BLOCK ***** 7 /* ***** BEGIN LICENSE BLOCK *****
8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 8 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
9 * 9 *
10 * The contents of this file are subject to the Mozilla Public License Version 10 * The contents of this file are subject to the Mozilla Public License Version
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 (*i >= 0x2D && *i <= 0x3A) || 130 (*i >= 0x2D && *i <= 0x3A) ||
131 (*i >= 0x3C && *i <= 0x5B) || 131 (*i >= 0x3C && *i <= 0x5B) ||
132 (*i >= 0x5D && *i <= 0x7E)); 132 (*i >= 0x5D && *i <= 0x7E));
133 if (!valid_octet) 133 if (!valid_octet)
134 return false; 134 return false;
135 } 135 }
136 return true; 136 return true;
137 } 137 }
138 138
139 bool IsControlCharacter(unsigned char c) { 139 bool IsControlCharacter(unsigned char c) {
140 return (c >= 0) && (c <= 31); 140 return c <= 31; // unsigned char is always >= 0.
Ryan Sleevi 2014/10/17 19:17:10 just nuke this comment
141 } 141 }
142 142
143 bool IsValidCookieAttributeValue(const std::string& value) { 143 bool IsValidCookieAttributeValue(const std::string& value) {
144 // The greatest common denominator of cookie attribute values is 144 // The greatest common denominator of cookie attribute values is
145 // <any CHAR except CTLs or ";"> according to RFC 6265. 145 // <any CHAR except CTLs or ";"> according to RFC 6265.
146 for (std::string::const_iterator i = value.begin(); i != value.end(); ++i) { 146 for (std::string::const_iterator i = value.begin(); i != value.end(); ++i) {
147 if (IsControlCharacter(*i) || *i == ';') 147 if (IsControlCharacter(*i) || *i == ';')
148 return false; 148 return false;
149 } 149 }
150 return true; 150 return true;
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 for (size_t i = 0; i < arraysize(indexes); ++i) { 489 for (size_t i = 0; i < arraysize(indexes); ++i) {
490 if (*indexes[i] == index) 490 if (*indexes[i] == index)
491 *indexes[i] = 0; 491 *indexes[i] = 0;
492 else if (*indexes[i] > index) 492 else if (*indexes[i] > index)
493 --*indexes[i]; 493 --*indexes[i];
494 } 494 }
495 pairs_.erase(pairs_.begin() + index); 495 pairs_.erase(pairs_.begin() + index);
496 } 496 }
497 497
498 } // namespace 498 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698