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

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

Issue 945713002: win vs2015: fix variable shadowing warnings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/upload_file_element_reader.cc ('k') | 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 <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
(...skipping 25 matching lines...) Expand all
36 std::string param_value = EscapeQueryParamValue(value, true); 36 std::string param_value = EscapeQueryParamValue(value, true);
37 37
38 const std::string input = url.query(); 38 const std::string input = url.query();
39 url::Component cursor(0, input.size()); 39 url::Component cursor(0, input.size());
40 std::string output; 40 std::string output;
41 url::Component key_range, value_range; 41 url::Component key_range, value_range;
42 while (url::ExtractQueryKeyValue(input.data(), &cursor, &key_range, 42 while (url::ExtractQueryKeyValue(input.data(), &cursor, &key_range,
43 &value_range)) { 43 &value_range)) {
44 const base::StringPiece key( 44 const base::StringPiece key(
45 input.data() + key_range.begin, key_range.len); 45 input.data() + key_range.begin, key_range.len);
46 const base::StringPiece value(
47 input.data() + value_range.begin, value_range.len);
scottmg 2015/02/20 05:02:06 this one seems a little tricky because it's shadow
48 std::string key_value_pair; 46 std::string key_value_pair;
49 // Check |replaced| as only the first pair should be replaced. 47 // Check |replaced| as only the first pair should be replaced.
50 if (!replaced && key == param_name) { 48 if (!replaced && key == param_name) {
51 replaced = true; 49 replaced = true;
52 key_value_pair = (param_name + "=" + param_value); 50 key_value_pair = (param_name + "=" + param_value);
53 } else { 51 } else {
54 key_value_pair.assign(input.data(), 52 key_value_pair.assign(input.data(),
55 key_range.begin, 53 key_range.begin,
56 value_range.end() - key_range.begin); 54 value_range.end() - key_range.begin);
57 } 55 }
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 for (QueryIterator it(url); !it.IsAtEnd(); it.Advance()) { 126 for (QueryIterator it(url); !it.IsAtEnd(); it.Advance()) {
129 if (it.GetKey() == search_key) { 127 if (it.GetKey() == search_key) {
130 *out_value = it.GetUnescapedValue(); 128 *out_value = it.GetUnescapedValue();
131 return true; 129 return true;
132 } 130 }
133 } 131 }
134 return false; 132 return false;
135 } 133 }
136 134
137 } // namespace net 135 } // namespace net
OLDNEW
« no previous file with comments | « net/base/upload_file_element_reader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698