# HG changeset patch # User PeterN # Date 2023-05-26 18:17:54 # Node ID a8ea984125b312bc30bd2e96f6eb4092e8d023b0 # Parent 04e49b112b0de5fde220dfb5e66a03558237cacc Fix d9a04ba446: Ensure MD5Hash is initialized. (#10876) Not all instances need to be initialized as often they are copied or written to, but doing all ensures no surprises. Move the ^= operator to MD5Hash while we're at it. diff --git a/src/3rdparty/md5/md5.h b/src/3rdparty/md5/md5.h --- a/src/3rdparty/md5/md5.h +++ b/src/3rdparty/md5/md5.h @@ -57,20 +57,20 @@ static const size_t MD5_HASH_BYTES = 16; /** Container for storing a MD5 hash/checksum/digest. */ -using MD5Hash = std::array; +struct MD5Hash : std::array { + MD5Hash() : std::array{} {} -/** - * Exclusively-or one hash into another hash. - * @param lhs The hash to exclusively-or into. - * @param rhs The hash to exclusively-or with. - * @return Reference to \c lhs hash. - */ -inline MD5Hash &operator^=(MD5Hash &lhs, const MD5Hash &rhs) -{ - for (size_t i = 0; i < lhs.size(); i++) lhs[i] ^= rhs[i]; - return lhs; -} - + /** + * Exclusively-or the given hash into this hash. + * @param other The other hash. + * @return Reference to this hash. + */ + MD5Hash &operator^=(const MD5Hash &other) + { + for (size_t i = 0; i < size(); i++) this->operator[](i) ^= other[i]; + return *this; + } +}; struct Md5 { private: