summaryrefslogtreecommitdiffstats
path: root/crypto/sha2.h
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 /crypto/sha2.h
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 'crypto/sha2.h')
-rw-r--r--crypto/sha2.h4
1 files changed, 1 insertions, 3 deletions
diff --git a/crypto/sha2.h b/crypto/sha2.h
index 18acf2b..6b2f83c 100644
--- a/crypto/sha2.h
+++ b/crypto/sha2.h
@@ -16,9 +16,7 @@ namespace crypto {
//
// Functions for SHA-384 and SHA-512 can be added when the need arises.
-enum {
- SHA256_LENGTH = 32 // length in bytes of a SHA-256 hash
-};
+static const size_t kSHA256Length = 32; // length in bytes of a SHA-256 hash
// Computes the SHA-256 hash of the input string 'str' and stores the first
// 'len' bytes of the hash in the output buffer 'output'. If 'len' > 32,