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 /crypto/secure_hash_unittest.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 'crypto/secure_hash_unittest.cc')
-rw-r--r-- | crypto/secure_hash_unittest.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/secure_hash_unittest.cc b/crypto/secure_hash_unittest.cc index 49b9da5..6ac9285 100644 --- a/crypto/secure_hash_unittest.cc +++ b/crypto/secure_hash_unittest.cc @@ -21,7 +21,7 @@ TEST(SecureHashTest, TestUpdate) { 0x04, 0x6d, 0x39, 0xcc, 0xc7, 0x11, 0x2c, 0xd0 }; - uint8 output3[crypto::SHA256_LENGTH]; + uint8 output3[crypto::kSHA256Length]; scoped_ptr<crypto::SecureHash> ctx(crypto::SecureHash::Create( crypto::SecureHash::SHA256)); @@ -29,6 +29,6 @@ TEST(SecureHashTest, TestUpdate) { ctx->Update(input3.data(), input3.size()); ctx->Finish(output3, sizeof(output3)); - for (size_t i = 0; i < crypto::SHA256_LENGTH; i++) + for (size_t i = 0; i < crypto::kSHA256Length; i++) EXPECT_EQ(expected3[i], static_cast<int>(output3[i])); } |