diff options
author | halcanary <halcanary@google.com> | 2016-04-25 10:29:36 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-25 10:29:36 -0700 |
commit | 1e9030472e59befbe8faaf42fd166300534d97d3 (patch) | |
tree | c51a0cde7f6a78b6f4e040f8b61c5e24415fac6d | |
parent | ac6c75056f1e8e5a5d7c3c4b64df4113368d9c31 (diff) |
SkMD5: .update() -> .write()
Review URL: https://codereview.chromium.org/1913173003
-rw-r--r-- | bench/ChecksumBench.cpp | 2 | ||||
-rw-r--r-- | src/core/SkMD5.cpp | 4 | ||||
-rw-r--r-- | src/core/SkMD5.h | 3 | ||||
-rw-r--r-- | tests/CodecTest.cpp | 2 | ||||
-rw-r--r-- | tests/MD5Test.cpp | 4 | ||||
-rw-r--r-- | tests/PictureTest.cpp | 2 |
6 files changed, 7 insertions, 10 deletions
diff --git a/bench/ChecksumBench.cpp b/bench/ChecksumBench.cpp index cba9572aa3..4c2ac1a396 100644 --- a/bench/ChecksumBench.cpp +++ b/bench/ChecksumBench.cpp @@ -51,7 +51,7 @@ protected: 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 5c86522a54..c0c3c31fb7 100644 --- a/src/core/SkMD5.cpp +++ b/src/core/SkMD5.cpp @@ -80,10 +80,10 @@ void SkMD5::finish(Digest& digest) { 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 a6d9b9f3eb..8838d47ac0 100644 --- a/src/core/SkMD5.h +++ b/src/core/SkMD5.h @@ -21,9 +21,6 @@ public: 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 bdb5e7792e..5ac19d9f70 100644 --- a/tests/CodecTest.cpp +++ b/tests/CodecTest.cpp @@ -32,7 +32,7 @@ static void md5(const SkBitmap& bm, SkMD5::Digest* digest) { 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 efad26d485..214a7a80e8 100644 --- a/tests/MD5Test.cpp +++ b/tests/MD5Test.cpp @@ -23,7 +23,7 @@ static void md5_test(const char* string, const SkMD5::Digest& expectedDigest, sk // 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 @@ static void md5_test(const char* string, const SkMD5::Digest& expectedDigest, sk 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 f6ed59e81a..9e36d841df 100644 --- a/tests/PictureTest.cpp +++ b/tests/PictureTest.cpp @@ -874,7 +874,7 @@ static void md5(const SkBitmap& bm, SkMD5::Digest* digest) { 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); } |