From ea73fc7bcc5e674c15f07b3c5704b372274ae06f Mon Sep 17 00:00:00 2001 From: "pkasting@chromium.org" Date: Thu, 22 Sep 2011 21:24:50 +0000 Subject: 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 --- net/base/transport_security_state.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'net/base/transport_security_state.cc') 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(); } -- cgit v1.1