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

Unified Diff: src/core/SkMD5.cpp

Issue 1911363002: SkMD5: cleanup header and minor refactor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-04-22 (Friday) 10:53:13 EDT Created 4 years, 8 months 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 | « src/core/SkMD5.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMD5.cpp
diff --git a/src/core/SkMD5.cpp b/src/core/SkMD5.cpp
index 725ae55f3f095861652e2ee0f1926fe833d1e9b8..5c86522a54306116517d40c40f8b85ef2f74fb8f 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,8 @@ SkMD5::SkMD5() : byteCount(0) {
this->state[3] = 0x10325476;
}
-void SkMD5::update(const uint8_t* input, size_t inputLength) {
+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 +63,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) {
« no previous file with comments | « src/core/SkMD5.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698