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

Side by Side Diff: net/http/http_chunked_decoder.cc

Issue 3968001: Update code that previously constructed strings from string iterators only to... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 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 | Annotate | Revision Log
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 // Derived from: 5 // Derived from:
6 // mozilla/netwerk/protocol/http/src/nsHttpChunkedDecoder.cpp 6 // mozilla/netwerk/protocol/http/src/nsHttpChunkedDecoder.cpp
7 // The license block is: 7 // The license block is:
8 /* ***** BEGIN LICENSE BLOCK ***** 8 /* ***** BEGIN LICENSE BLOCK *****
9 * Version: MPL 1.1/GPL 2.0/LGPL 2.1 9 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
10 * 10 *
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 while (len && start[len - 1] == ' ') 185 while (len && start[len - 1] == ' ')
186 len--; 186 len--;
187 187
188 // Be more restrictive than HexStringToInt; 188 // Be more restrictive than HexStringToInt;
189 // don't allow inputs with leading "-", "+", "0x", "0X" 189 // don't allow inputs with leading "-", "+", "0x", "0X"
190 if (base::StringPiece(start, len).find_first_not_of("0123456789abcdefABCDEF") 190 if (base::StringPiece(start, len).find_first_not_of("0123456789abcdefABCDEF")
191 != base::StringPiece::npos) 191 != base::StringPiece::npos)
192 return false; 192 return false;
193 193
194 int parsed_number; 194 int parsed_number;
195 bool ok = base::HexStringToInt(std::string(start, len), &parsed_number); 195 bool ok = base::HexStringToInt(start, start + len, &parsed_number);
196 if (ok && parsed_number >= 0) { 196 if (ok && parsed_number >= 0) {
197 *out = parsed_number; 197 *out = parsed_number;
198 return true; 198 return true;
199 } 199 }
200 return false; 200 return false;
201 } 201 }
202 202
203 } // namespace net 203 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698