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

Side by Side Diff: net/base/cookie_monster.cc

Issue 2865003: Working towards -Wextra... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « gpu/command_buffer/common/id_allocator.cc ('k') | net/http/http_response_headers.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 // Returns true if |c| occurs in |chars| 1177 // Returns true if |c| occurs in |chars|
1178 // TODO maybe make this take an iterator, could check for end also? 1178 // TODO maybe make this take an iterator, could check for end also?
1179 static inline bool CharIsA(const char c, const char* chars) { 1179 static inline bool CharIsA(const char c, const char* chars) {
1180 return strchr(chars, c) != NULL; 1180 return strchr(chars, c) != NULL;
1181 } 1181 }
1182 // Seek the iterator to the first occurrence of a character in |chars|. 1182 // Seek the iterator to the first occurrence of a character in |chars|.
1183 // Returns true if it hit the end, false otherwise. 1183 // Returns true if it hit the end, false otherwise.
1184 static inline bool SeekTo(std::string::const_iterator* it, 1184 static inline bool SeekTo(std::string::const_iterator* it,
1185 const std::string::const_iterator& end, 1185 const std::string::const_iterator& end,
1186 const char* chars) { 1186 const char* chars) {
1187 for (; *it != end && !CharIsA(**it, chars); ++(*it)); 1187 for (; *it != end && !CharIsA(**it, chars); ++(*it)) {}
1188 return *it == end; 1188 return *it == end;
1189 } 1189 }
1190 // Seek the iterator to the first occurrence of a character not in |chars|. 1190 // Seek the iterator to the first occurrence of a character not in |chars|.
1191 // Returns true if it hit the end, false otherwise. 1191 // Returns true if it hit the end, false otherwise.
1192 static inline bool SeekPast(std::string::const_iterator* it, 1192 static inline bool SeekPast(std::string::const_iterator* it,
1193 const std::string::const_iterator& end, 1193 const std::string::const_iterator& end,
1194 const char* chars) { 1194 const char* chars) {
1195 for (; *it != end && CharIsA(**it, chars); ++(*it)); 1195 for (; *it != end && CharIsA(**it, chars); ++(*it)) {}
1196 return *it == end; 1196 return *it == end;
1197 } 1197 }
1198 static inline bool SeekBackPast(std::string::const_iterator* it, 1198 static inline bool SeekBackPast(std::string::const_iterator* it,
1199 const std::string::const_iterator& end, 1199 const std::string::const_iterator& end,
1200 const char* chars) { 1200 const char* chars) {
1201 for (; *it != end && CharIsA(**it, chars); --(*it)); 1201 for (; *it != end && CharIsA(**it, chars); --(*it)) {}
1202 return *it == end; 1202 return *it == end;
1203 } 1203 }
1204 1204
1205 const char CookieMonster::ParsedCookie::kTerminator[] = "\n\r\0"; 1205 const char CookieMonster::ParsedCookie::kTerminator[] = "\n\r\0";
1206 const int CookieMonster::ParsedCookie::kTerminatorLen = 1206 const int CookieMonster::ParsedCookie::kTerminatorLen =
1207 sizeof(kTerminator) - 1; 1207 sizeof(kTerminator) - 1;
1208 const char CookieMonster::ParsedCookie::kWhitespace[] = " \t"; 1208 const char CookieMonster::ParsedCookie::kWhitespace[] = " \t";
1209 const char CookieMonster::ParsedCookie::kValueSeparator[] = ";"; 1209 const char CookieMonster::ParsedCookie::kValueSeparator[] = ";";
1210 const char CookieMonster::ParsedCookie::kTokenSeparator[] = ";="; 1210 const char CookieMonster::ParsedCookie::kTokenSeparator[] = ";=";
1211 1211
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 return true; 1512 return true;
1513 } 1513 }
1514 1514
1515 std::string CookieMonster::CanonicalCookie::DebugString() const { 1515 std::string CookieMonster::CanonicalCookie::DebugString() const {
1516 return StringPrintf("name: %s value: %s path: %s creation: %" PRId64, 1516 return StringPrintf("name: %s value: %s path: %s creation: %" PRId64,
1517 name_.c_str(), value_.c_str(), path_.c_str(), 1517 name_.c_str(), value_.c_str(), path_.c_str(),
1518 static_cast<int64>(creation_date_.ToTimeT())); 1518 static_cast<int64>(creation_date_.ToTimeT()));
1519 } 1519 }
1520 1520
1521 } // namespace 1521 } // namespace
OLDNEW
« no previous file with comments | « gpu/command_buffer/common/id_allocator.cc ('k') | net/http/http_response_headers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698