SkMD5: .update() -> .write() Review URL: https://codereview.chromium.org/1913173003
diff --git a/bench/ChecksumBench.cpp b/bench/ChecksumBench.cpp index cba9572..4c2ac1a 100644 --- a/bench/ChecksumBench.cpp +++ b/bench/ChecksumBench.cpp
@@ -51,7 +51,7 @@ case kMD5_ChecksumType: { for (int i = 0; i < loops; i++) { SkMD5 md5; - md5.update(reinterpret_cast<uint8_t*>(fData), sizeof(fData)); + md5.write(fData, sizeof(fData)); SkMD5::Digest digest; md5.finish(digest); }
diff --git a/src/core/SkMD5.cpp b/src/core/SkMD5.cpp index 5c86522..c0c3c31 100644 --- a/src/core/SkMD5.cpp +++ b/src/core/SkMD5.cpp
@@ -80,10 +80,10 @@ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; - this->update(PADDING, paddingLength); + (void)this->write(PADDING, paddingLength); // Append length (length before padding, will cause final update). - this->update(bits, 8); + (void)this->write(bits, 8); // Write out digest. encode(digest.data, this->state);
diff --git a/src/core/SkMD5.h b/src/core/SkMD5.h index a6d9b9f..8838d47 100644 --- a/src/core/SkMD5.h +++ b/src/core/SkMD5.h
@@ -21,9 +21,6 @@ size_t bytesWritten() const final { return SkToSizeT(this->byteCount); } - /** Alias for write() */ - void update(const uint8_t* b, size_t l) { (void)this->write(b, l); } - struct Digest { uint8_t data[16]; bool operator ==(Digest const& other) const {
diff --git a/tests/CodecTest.cpp b/tests/CodecTest.cpp index bdb5e77..5ac19d9 100644 --- a/tests/CodecTest.cpp +++ b/tests/CodecTest.cpp
@@ -32,7 +32,7 @@ SkMD5 md5; size_t rowLen = bm.info().bytesPerPixel() * bm.width(); for (int y = 0; y < bm.height(); ++y) { - md5.update(static_cast<uint8_t*>(bm.getAddr(0, y)), rowLen); + md5.write(bm.getAddr(0, y), rowLen); } md5.finish(*digest); }
diff --git a/tests/MD5Test.cpp b/tests/MD5Test.cpp index efad26d..214a7a8 100644 --- a/tests/MD5Test.cpp +++ b/tests/MD5Test.cpp
@@ -23,7 +23,7 @@ // All at once { SkMD5 context; - context.update(reinterpret_cast<const uint8_t*>(string), len); + context.write(string, len); SkMD5::Digest digest; context.finish(digest); @@ -36,7 +36,7 @@ const uint8_t* data = reinterpret_cast<const uint8_t*>(string); const uint8_t* end = reinterpret_cast<const uint8_t*>(string + len); for (; data < end; ++data) { - context.update(data, 1); + context.write(data, 1); } SkMD5::Digest digest; context.finish(digest);
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp index f6ed59e..9e36d841d 100644 --- a/tests/PictureTest.cpp +++ b/tests/PictureTest.cpp
@@ -874,7 +874,7 @@ SkMD5 md5; size_t rowLen = bm.info().bytesPerPixel() * bm.width(); for (int y = 0; y < bm.height(); ++y) { - md5.update(static_cast<uint8_t*>(bm.getAddr(0, y)), rowLen); + md5.write(bm.getAddr(0, y), rowLen); } md5.finish(*digest); }