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

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

Issue 2177863003: net/url_util: fix std::string::assign invocation: pass string instead of char*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/base/url_util.h" 5 #include "net/base/url_util.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_POSIX) 9 #if defined(OS_POSIX)
10 #include <netinet/in.h> 10 #include <netinet/in.h>
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 while (url::ExtractQueryKeyValue(input.data(), &cursor, &key_range, 67 while (url::ExtractQueryKeyValue(input.data(), &cursor, &key_range,
68 &value_range)) { 68 &value_range)) {
69 const base::StringPiece key( 69 const base::StringPiece key(
70 input.data() + key_range.begin, key_range.len); 70 input.data() + key_range.begin, key_range.len);
71 std::string key_value_pair; 71 std::string key_value_pair;
72 // Check |replaced| as only the first pair should be replaced. 72 // Check |replaced| as only the first pair should be replaced.
73 if (!replaced && key == param_name) { 73 if (!replaced && key == param_name) {
74 replaced = true; 74 replaced = true;
75 key_value_pair = (param_name + "=" + param_value); 75 key_value_pair = (param_name + "=" + param_value);
76 } else { 76 } else {
77 key_value_pair.assign(input.data(), 77 key_value_pair.assign(input, key_range.begin,
78 key_range.begin,
79 value_range.end() - key_range.begin); 78 value_range.end() - key_range.begin);
80 } 79 }
81 if (!output.empty()) 80 if (!output.empty())
82 output += "&"; 81 output += "&";
83 82
84 output += key_value_pair; 83 output += key_value_pair;
85 } 84 }
86 if (!replaced) { 85 if (!replaced) {
87 if (!output.empty()) 86 if (!output.empty())
88 output += "&"; 87 output += "&";
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 } 431 }
433 432
434 if (is_local6) 433 if (is_local6)
435 *is_local6 = false; 434 *is_local6 = false;
436 return normalized_host == "localhost" || 435 return normalized_host == "localhost" ||
437 normalized_host == "localhost.localdomain" || 436 normalized_host == "localhost.localdomain" ||
438 IsNormalizedLocalhostTLD(normalized_host); 437 IsNormalizedLocalhostTLD(normalized_host);
439 } 438 }
440 439
441 } // namespace net 440 } // namespace net
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