diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-22 21:24:50 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-22 21:24:50 +0000 |
commit | ea73fc7bcc5e674c15f07b3c5704b372274ae06f (patch) | |
tree | 6523b42c6a923c0c7def207d2d0fceb6ac45917c /net/base/transport_security_state.cc | |
parent | 54d37a339429f6106c7a4e7deb8a67e3970a6a2b (diff) | |
download | chromium_src-ea73fc7bcc5e674c15f07b3c5704b372274ae06f.zip chromium_src-ea73fc7bcc5e674c15f07b3c5704b372274ae06f.tar.gz chromium_src-ea73fc7bcc5e674c15f07b3c5704b372274ae06f.tar.bz2 |
Convert SHA256_LENGTH from a constant-in-anonymous-enum to a static const. This defines the constant where it's declared to preserve the existing readability.
Normally this makes things like DCHECK_EQ() unhappy, but when I'd originally tested this I didn't seem to need to make any changes due to that. Will be watching the trybots...
The original motiviation for this change was to find a way to eliminate some cases of passing anonymous-typed values as template arguments (which happens when you use a value from the enum in e.g. EXPECT_EQ()), which is technically illegal in C++03, though we don't warn about it. Simply naming the enum would have done this, but in general naming enums used to declare constants like this is bizarre ("enum Constants { ... }"?).
BUG=92247
TEST=Compiles
Review URL: http://codereview.chromium.org/7823004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102369 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/base/transport_security_state.cc')
-rw-r--r-- | net/base/transport_security_state.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/base/transport_security_state.cc b/net/base/transport_security_state.cc index 601ab35..b43a356 100644 --- a/net/base/transport_security_state.cc +++ b/net/base/transport_security_state.cc @@ -47,7 +47,7 @@ TransportSecurityState::TransportSecurityState(const std::string& hsts_hosts) } static std::string HashHost(const std::string& canonicalized_host) { - char hashed[crypto::SHA256_LENGTH]; + char hashed[crypto::kSHA256Length]; crypto::SHA256HashString(canonicalized_host, hashed, sizeof(hashed)); return std::string(hashed, sizeof(hashed)); } @@ -522,7 +522,7 @@ static std::string HashedDomainToExternalString(const std::string& hashed) { static std::string ExternalStringToHashedDomain(const std::string& external) { std::string out; if (!base::Base64Decode(external, &out) || - out.size() != crypto::SHA256_LENGTH) { + out.size() != crypto::kSHA256Length) { return std::string(); } |