summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-22 21:24:50 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-22 21:24:50 +0000
commitea73fc7bcc5e674c15f07b3c5704b372274ae06f (patch)
tree6523b42c6a923c0c7def207d2d0fceb6ac45917c /net
parent54d37a339429f6106c7a4e7deb8a67e3970a6a2b (diff)
downloadchromium_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')
-rw-r--r--net/base/crl_set.cc6
-rw-r--r--net/base/dnssec_chain_verifier.cc2
-rw-r--r--net/base/transport_security_state.cc4
3 files changed, 6 insertions, 6 deletions
diff --git a/net/base/crl_set.cc b/net/base/crl_set.cc
index c0543bf..eb22e8b 100644
--- a/net/base/crl_set.cc
+++ b/net/base/crl_set.cc
@@ -152,10 +152,10 @@ static const int kCurrentFileVersion = 0;
static bool ReadCRL(base::StringPiece* data, std::string* out_parent_spki_hash,
std::vector<std::string>* out_serials) {
- if (data->size() < crypto::SHA256_LENGTH)
+ if (data->size() < crypto::kSHA256Length)
return false;
- *out_parent_spki_hash = std::string(data->data(), crypto::SHA256_LENGTH);
- data->remove_prefix(crypto::SHA256_LENGTH);
+ *out_parent_spki_hash = std::string(data->data(), crypto::kSHA256Length);
+ data->remove_prefix(crypto::kSHA256Length);
if (data->size() < sizeof(uint32))
return false;
diff --git a/net/base/dnssec_chain_verifier.cc b/net/base/dnssec_chain_verifier.cc
index a5f8b36..7be383d 100644
--- a/net/base/dnssec_chain_verifier.cc
+++ b/net/base/dnssec_chain_verifier.cc
@@ -428,7 +428,7 @@ bool DNSSECChainVerifier::DigestKey(base::StringPiece* out,
uint16 keyid,
uint8 algorithm) {
std::string temp;
- uint8 temp2[crypto::SHA256_LENGTH];
+ uint8 temp2[crypto::kSHA256Length];
const uint8* digest;
unsigned digest_len;
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();
}