Chromium Code Reviews| Index: src/core/SkMD5.cpp |
| diff --git a/src/core/SkMD5.cpp b/src/core/SkMD5.cpp |
| index 725ae55f3f095861652e2ee0f1926fe833d1e9b8..b2a1efd0d771ff13d15ba26274bf8d6db4076f71 100644 |
| --- a/src/core/SkMD5.cpp |
| +++ b/src/core/SkMD5.cpp |
| @@ -8,7 +8,11 @@ |
| * http://www.ietf.org/rfc/rfc1321.txt |
| */ |
| -#include "SkTypes.h" |
| +//The following macros can be defined to affect the MD5 code generated. |
| +//SK_MD5_CLEAR_DATA causes all intermediate state to be overwritten with 0's. |
| +//SK_CPU_LENDIAN allows 32 bit <=> 8 bit conversions without copies (if alligned). |
| +//SK_CPU_FAST_UNALIGNED_ACCESS allows 32 bit <=> 8 bit conversions without copies if SK_CPU_LENDIAN. |
| + |
| #include "SkMD5.h" |
| #include <string.h> |
| @@ -32,7 +36,9 @@ SkMD5::SkMD5() : byteCount(0) { |
| this->state[3] = 0x10325476; |
| } |
| -void SkMD5::update(const uint8_t* input, size_t inputLength) { |
| +// Note that this treats the buffer as a series of uint8_t values. |
|
tomhudson
2016/04/22 13:35:59
Not sure this comment is helpful - it's sitting he
hal.canary
2016/04/22 14:13:15
Done.
|
| +bool SkMD5::write(const void* buf, size_t inputLength) { |
| + const uint8_t* input = reinterpret_cast<const uint8_t*>(buf); |
| unsigned int bufferIndex = (unsigned int)(this->byteCount & 0x3F); |
| unsigned int bufferAvailable = 64 - bufferIndex; |
| @@ -58,6 +64,7 @@ void SkMD5::update(const uint8_t* input, size_t inputLength) { |
| memcpy(&this->buffer[bufferIndex], &input[inputIndex], inputLength - inputIndex); |
| this->byteCount += inputLength; |
| + return true; |
| } |
| void SkMD5::finish(Digest& digest) { |