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 --- crypto/sha2.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'crypto/sha2.h') 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, -- cgit v1.1