summaryrefslogtreecommitdiffstats
path: root/net/http
diff options
context:
space:
mode:
authorerikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-22 16:05:47 +0000
committererikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-22 16:05:47 +0000
commitc2750c67ca3a672018bac2dfb07628d079aafc8d (patch)
tree8bbff1c4c3aeb363e06734e91e172653e34737cc /net/http
parent213b99ad9d66e3c039bbb90c19d78603975c1be9 (diff)
downloadchromium_src-c2750c67ca3a672018bac2dfb07628d079aafc8d.zip
chromium_src-c2750c67ca3a672018bac2dfb07628d079aafc8d.tar.gz
chromium_src-c2750c67ca3a672018bac2dfb07628d079aafc8d.tar.bz2
Update code that previously constructed strings from string iterators only to use StringToInt. These usages now pass the iterators directly to the new StringToInt overloads.
BUG=None TEST=All Review URL: http://codereview.chromium.org/3968001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63515 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r--net/http/http_chunked_decoder.cc2
-rw-r--r--net/http/http_response_headers.cc24
2 files changed, 14 insertions, 12 deletions
diff --git a/net/http/http_chunked_decoder.cc b/net/http/http_chunked_decoder.cc
index 455c9ed..d5b16dd 100644
--- a/net/http/http_chunked_decoder.cc
+++ b/net/http/http_chunked_decoder.cc
@@ -192,7 +192,7 @@ bool HttpChunkedDecoder::ParseChunkSize(const char* start, int len, int* out) {
return false;
int parsed_number;
- bool ok = base::HexStringToInt(std::string(start, len), &parsed_number);
+ bool ok = base::HexStringToInt(start, start + len, &parsed_number);
if (ok && parsed_number >= 0) {
*out = parsed_number;
return true;
diff --git a/net/http/http_response_headers.cc b/net/http/http_response_headers.cc
index 99c5404..7376fa0 100644
--- a/net/http/http_response_headers.cc
+++ b/net/http/http_response_headers.cc
@@ -598,7 +598,7 @@ void HttpResponseHeaders::ParseStatusLine(
raw_headers_.push_back(' ');
raw_headers_.append(code, p);
raw_headers_.push_back(' ');
- base::StringToInt(std::string(code, p), &response_code_);
+ base::StringToInt(code, p, &response_code_);
// Skip whitespace.
while (*p == ' ')
@@ -973,7 +973,9 @@ bool HttpResponseHeaders::GetMaxAgeValue(TimeDelta* result) const {
value.begin() + kMaxAgePrefixLen,
kMaxAgePrefix)) {
int64 seconds;
- base::StringToInt64(value.substr(kMaxAgePrefixLen), &seconds);
+ base::StringToInt64(value.begin() + kMaxAgePrefixLen,
+ value.end(),
+ &seconds);
*result = TimeDelta::FromSeconds(seconds);
return true;
}
@@ -1148,9 +1150,9 @@ bool HttpResponseHeaders::GetContentRange(int64* first_byte_position,
byte_range_resp_spec.begin() + minus_position;
HttpUtil::TrimLWS(&first_byte_pos_begin, &first_byte_pos_end);
- bool ok = base::StringToInt64(
- std::string(first_byte_pos_begin, first_byte_pos_end),
- first_byte_position);
+ bool ok = base::StringToInt64(first_byte_pos_begin,
+ first_byte_pos_end,
+ first_byte_position);
// Obtain last-byte-pos.
std::string::const_iterator last_byte_pos_begin =
@@ -1159,9 +1161,9 @@ bool HttpResponseHeaders::GetContentRange(int64* first_byte_position,
byte_range_resp_spec.end();
HttpUtil::TrimLWS(&last_byte_pos_begin, &last_byte_pos_end);
- ok &= base::StringToInt64(
- std::string(last_byte_pos_begin, last_byte_pos_end),
- last_byte_position);
+ ok &= base::StringToInt64(last_byte_pos_begin,
+ last_byte_pos_end,
+ last_byte_position);
if (!ok) {
*first_byte_position = *last_byte_position = -1;
return false;
@@ -1184,9 +1186,9 @@ bool HttpResponseHeaders::GetContentRange(int64* first_byte_position,
if (LowerCaseEqualsASCII(instance_length_begin, instance_length_end, "*")) {
return false;
- } else if (!base::StringToInt64(
- std::string(instance_length_begin, instance_length_end),
- instance_length)) {
+ } else if (!base::StringToInt64(instance_length_begin,
+ instance_length_end,
+ instance_length)) {
*instance_length = -1;
return false;
}