Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(576)

Unified Diff: net/base/hash_value.cc

Issue 1432663002: Add type-safe constructors to net::HashValue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/hash_value.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/hash_value.cc
diff --git a/net/base/hash_value.cc b/net/base/hash_value.cc
index 2a751cd21924e3525259185a3eb51f91443f3aa7..7f2e479e63c38e39638616274b974077b5b5348e 100644
--- a/net/base/hash_value.cc
+++ b/net/base/hash_value.cc
@@ -31,6 +31,15 @@ bool SHA256HashValue::Equals(const SHA256HashValue& other) const {
return memcmp(data, other.data, sizeof(data)) == 0;
}
+HashValue::HashValue(const SHA1HashValue& hash) : HashValue(HASH_VALUE_SHA1) {
+ fingerprint.sha1 = hash;
+}
+
+HashValue::HashValue(const SHA256HashValue& hash)
+ : HashValue(HASH_VALUE_SHA256) {
+ fingerprint.sha256 = hash;
+}
+
bool HashValue::Equals(const HashValue& other) const {
if (tag != other.tag)
return false;
« no previous file with comments | « net/base/hash_value.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698