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

Side by Side Diff: base/string_util.cc

Issue 1604011: Use HttpRequestHeaders for extra_headers. (Closed)
Patch Set: Address eroman comments. Created 10 years, 8 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 | net/http/http_auth_handler.h » ('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 #include "base/string_util.h" 5 #include "base/string_util.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #include <ctype.h> 9 #include <ctype.h>
10 #include <errno.h> 10 #include <errno.h>
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 std::vector<string16>* r) { 1351 std::vector<string16>* r) {
1352 SplitStringUsingSubstrT(str, s, r); 1352 SplitStringUsingSubstrT(str, s, r);
1353 } 1353 }
1354 1354
1355 void SplitStringUsingSubstr(const std::string& str, 1355 void SplitStringUsingSubstr(const std::string& str,
1356 const std::string& s, 1356 const std::string& s,
1357 std::vector<std::string>* r) { 1357 std::vector<std::string>* r) {
1358 SplitStringUsingSubstrT(str, s, r); 1358 SplitStringUsingSubstrT(str, s, r);
1359 } 1359 }
1360 1360
1361 std::vector<string16> SplitStringUsingSubstr(const string16& str,
1362 const string16& s) {
1363 std::vector<string16> result;
1364 SplitStringUsingSubstr(str, s, &result);
1365 return result;
1366 }
1367
1368 std::vector<std::string> SplitStringUsingSubstr(const std::string& str,
1369 const std::string& s) {
1370 std::vector<std::string> result;
1371 SplitStringUsingSubstr(str, s, &result);
1372 return result;
1373 }
1374
1375 template<typename STR> 1361 template<typename STR>
1376 static size_t TokenizeT(const STR& str, 1362 static size_t TokenizeT(const STR& str,
1377 const STR& delimiters, 1363 const STR& delimiters,
1378 std::vector<STR>* tokens) { 1364 std::vector<STR>* tokens) {
1379 tokens->clear(); 1365 tokens->clear();
1380 1366
1381 typename STR::size_type start = str.find_first_not_of(delimiters); 1367 typename STR::size_type start = str.find_first_not_of(delimiters);
1382 while (start != STR::npos) { 1368 while (start != STR::npos) {
1383 typename STR::size_type end = str.find_first_of(delimiters, start + 1); 1369 typename STR::size_type end = str.find_first_of(delimiters, start + 1);
1384 if (end == STR::npos) { 1370 if (end == STR::npos) {
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1888 // Each input byte creates two output hex characters. 1874 // Each input byte creates two output hex characters.
1889 std::string ret(size * 2, '\0'); 1875 std::string ret(size * 2, '\0');
1890 1876
1891 for (size_t i = 0; i < size; ++i) { 1877 for (size_t i = 0; i < size; ++i) {
1892 char b = reinterpret_cast<const char*>(bytes)[i]; 1878 char b = reinterpret_cast<const char*>(bytes)[i];
1893 ret[(i * 2)] = kHexChars[(b >> 4) & 0xf]; 1879 ret[(i * 2)] = kHexChars[(b >> 4) & 0xf];
1894 ret[(i * 2) + 1] = kHexChars[b & 0xf]; 1880 ret[(i * 2) + 1] = kHexChars[b & 0xf];
1895 } 1881 }
1896 return ret; 1882 return ret;
1897 } 1883 }
OLDNEW
« no previous file with comments | « no previous file | net/http/http_auth_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698