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

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

Issue 826973002: replace COMPILE_ASSERT with static_assert in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: apply fixups Created 5 years, 11 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/http/http_response_body_drainer_unittest.cc ('k') | net/http/http_server_properties.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/base64.h" 5 #include "base/base64.h"
6 #include "base/basictypes.h" 6 #include "base/basictypes.h"
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_tokenizer.h" 8 #include "base/strings/string_tokenizer.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "net/http/http_security_headers.h" 10 #include "net/http/http_security_headers.h"
11 #include "net/http/http_util.h" 11 #include "net/http/http_util.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 namespace { 15 namespace {
16 16
17 COMPILE_ASSERT(kMaxHSTSAgeSecs <= kuint32max, kMaxHSTSAgeSecsTooLarge); 17 static_assert(kMaxHSTSAgeSecs <= kuint32max, "kMaxHSTSAgeSecs too large");
18 18
19 // MaxAgeToInt converts a string representation of a "whole number" of 19 // MaxAgeToInt converts a string representation of a "whole number" of
20 // seconds into a uint32. The string may contain an arbitrarily large number, 20 // seconds into a uint32. The string may contain an arbitrarily large number,
21 // which will be clipped to kMaxHSTSAgeSecs and which is guaranteed to fit 21 // which will be clipped to kMaxHSTSAgeSecs and which is guaranteed to fit
22 // within a 32-bit unsigned integer. False is returned on any parse error. 22 // within a 32-bit unsigned integer. False is returned on any parse error.
23 bool MaxAgeToInt(std::string::const_iterator begin, 23 bool MaxAgeToInt(std::string::const_iterator begin,
24 std::string::const_iterator end, 24 std::string::const_iterator end,
25 uint32* result) { 25 uint32* result) {
26 const std::string s(begin, end); 26 const std::string s(begin, end);
27 int64 i = 0; 27 int64 i = 0;
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 } 336 }
337 337
338 if (!found) 338 if (!found)
339 hashes->push_back(*i); 339 hashes->push_back(*i);
340 } 340 }
341 341
342 return true; 342 return true;
343 } 343 }
344 344
345 } // namespace net 345 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_response_body_drainer_unittest.cc ('k') | net/http/http_server_properties.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698