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

Unified Diff: net/base/sdch_manager.cc

Issue 1829873002: Add base/parse_number.h to generalize number parsing done in //net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more tests Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/parse_number_unittest.cc ('k') | net/net.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/sdch_manager.cc
diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc
index a8272700d955fdfa4476182bac16d81b0b77e88b..435977237d83d4856008b9c442bf3946f3c36091 100644
--- a/net/base/sdch_manager.cc
+++ b/net/base/sdch_manager.cc
@@ -16,6 +16,7 @@
#include "base/time/default_clock.h"
#include "base/values.h"
#include "crypto/sha2.h"
+#include "net/base/parse_number.h"
#include "net/base/sdch_observer.h"
#include "net/url_request/url_request_http_job.h"
@@ -376,12 +377,12 @@ SdchProblemCode SdchManager::AddSdchDictionary(
return SDCH_DICTIONARY_UNSUPPORTED_VERSION;
} else if (name == "max-age") {
int64_t seconds;
+ // TODO(eroman): crbug.com/596541 -- should not accept a leading +.
base::StringToInt64(value, &seconds);
expiration = base::Time::Now() + base::TimeDelta::FromSeconds(seconds);
} else if (name == "port") {
int port;
- base::StringToInt(value, &port);
- if (port >= 0)
+ if (ParseNonNegativeDecimalInt(value, &port))
ports.insert(port);
}
}
« no previous file with comments | « net/base/parse_number_unittest.cc ('k') | net/net.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698