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

Unified Diff: net/http/http_security_headers.cc

Issue 1492403002: Remove kuint32max. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win Created 5 years 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
Index: net/http/http_security_headers.cc
diff --git a/net/http/http_security_headers.cc b/net/http/http_security_headers.cc
index b99b206c3f3214e9e9df5307ce14460565beba7a..383d80020a95a8ceac5f804ff6ffdbd8e1e8e8dd 100644
--- a/net/http/http_security_headers.cc
+++ b/net/http/http_security_headers.cc
@@ -18,36 +18,36 @@ namespace {
enum MaxAgeParsing { REQUIRE_MAX_AGE, DO_NOT_REQUIRE_MAX_AGE };
-static_assert(kMaxHSTSAgeSecs <= kuint32max, "kMaxHSTSAgeSecs too large");
+static_assert(kMaxHSTSAgeSecs <= UINT32_MAX, "kMaxHSTSAgeSecs too large");
asanka 2015/12/04 15:12:34 Why not numeric_limits? Isn't it required to be co
Avi (use Gerrit) 2015/12/04 15:19:28 There was some rumbling about whether we can rely
// MaxAgeToInt converts a string representation of a "whole number" of
-// seconds into a uint32. The string may contain an arbitrarily large number,
+// seconds into a uint32_t. The string may contain an arbitrarily large number,
// which will be clipped to kMaxHSTSAgeSecs and which is guaranteed to fit
// within a 32-bit unsigned integer. False is returned on any parse error.
bool MaxAgeToInt(std::string::const_iterator begin,
std::string::const_iterator end,
- uint32* result) {
+ uint32_t* result) {
const base::StringPiece s(begin, end);
if (s.empty())
return false;
- int64 i = 0;
+ int64_t i = 0;
// Return false on any StringToInt64 parse errors *except* for
- // int64 overflow. StringToInt64 is used, rather than StringToUint64,
+ // int64_t overflow. StringToInt64 is used, rather than StringToUint64,
// in order to properly handle and reject negative numbers
// (StringToUint64 does not return false on negative numbers).
- // For values too large to be stored in an int64, StringToInt64 will
- // return false with i set to kint64max, so this case is detected
+ // For values too large to be stored in an int64_t, StringToInt64 will
+ // return false with i set to INT64_MAX, so this case is detected
// by the immediately following if-statement and allowed to fall
// through so that i gets clipped to kMaxHSTSAgeSecs.
- if (!base::StringToInt64(s, &i) && i != kint64max)
+ if (!base::StringToInt64(s, &i) && i != INT64_MAX)
asanka 2015/12/04 15:12:34 Why INT64_MAX instead of numeric_limits? This doe
Avi (use Gerrit) 2015/12/04 15:19:28 Consistency with above. I'll switch if you want.
asanka 2015/12/04 15:41:43 I'd prefer if we switch this instance and keep the
Avi (use Gerrit) 2015/12/04 15:48:16 Done.
return false;
if (i < 0)
return false;
if (i > kMaxHSTSAgeSecs)
i = kMaxHSTSAgeSecs;
- *result = (uint32)i;
+ *result = (uint32_t)i;
return true;
}
@@ -128,7 +128,7 @@ bool ParseHPKPHeaderImpl(const std::string& value,
GURL* report_uri) {
bool parsed_max_age = false;
bool include_subdomains_candidate = false;
- uint32 max_age_candidate = 0;
+ uint32_t max_age_candidate = 0;
GURL parsed_report_uri;
HashValueVector pins;
bool require_max_age = max_age_status == REQUIRE_MAX_AGE;
@@ -224,7 +224,7 @@ bool ParseHPKPHeaderImpl(const std::string& value,
bool ParseHSTSHeader(const std::string& value,
base::TimeDelta* max_age,
bool* include_subdomains) {
- uint32 max_age_candidate = 0;
+ uint32_t max_age_candidate = 0;
bool include_subdomains_candidate = false;
// We must see max-age exactly once.

Powered by Google App Engine
This is Rietveld 408576698