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

Side by Side Diff: src/utils/SkSHA1.h

Issue 187653003: Add size_t bytesWritten() const to SkWStream. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add and use SkToSizeT Created 6 years, 9 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 unified diff | Download patch
« src/core/SkStream.cpp ('K') | « src/utils/SkMD5.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkSHA1_DEFINED 8 #ifndef SkSHA1_DEFINED
9 #define SkSHA1_DEFINED 9 #define SkSHA1_DEFINED
10 10
(...skipping 11 matching lines...) Expand all
22 SkSHA1(); 22 SkSHA1();
23 23
24 /** Processes input, adding it to the digest. 24 /** Processes input, adding it to the digest.
25 * Note that this treats the buffer as a series of uint8_t values. 25 * Note that this treats the buffer as a series of uint8_t values.
26 */ 26 */
27 virtual bool write(const void* buffer, size_t size) SK_OVERRIDE { 27 virtual bool write(const void* buffer, size_t size) SK_OVERRIDE {
28 update(reinterpret_cast<const uint8_t*>(buffer), size); 28 update(reinterpret_cast<const uint8_t*>(buffer), size);
29 return true; 29 return true;
30 } 30 }
31 31
32 virtual size_t bytesWritten() const SK_OVERRIDE { return SkToSizeT(this->byt eCount); }
33
32 /** Processes input, adding it to the digest. Calling this after finish is u ndefined. */ 34 /** Processes input, adding it to the digest. Calling this after finish is u ndefined. */
33 void update(const uint8_t* input, size_t length); 35 void update(const uint8_t* input, size_t length);
34 36
35 struct Digest { 37 struct Digest {
36 uint8_t data[20]; 38 uint8_t data[20];
37 }; 39 };
38 40
39 /** Computes and returns the digest. */ 41 /** Computes and returns the digest. */
40 void finish(Digest& digest); 42 void finish(Digest& digest);
41 43
42 private: 44 private:
43 // number of bytes, modulo 2^64 45 // number of bytes, modulo 2^64
44 uint64_t byteCount; 46 uint64_t byteCount;
45 47
46 // state (ABCDE) 48 // state (ABCDE)
47 uint32_t state[5]; 49 uint32_t state[5];
48 50
49 // input buffer 51 // input buffer
50 uint8_t buffer[64]; 52 uint8_t buffer[64];
51 }; 53 };
52 54
53 #endif 55 #endif
OLDNEW
« src/core/SkStream.cpp ('K') | « src/utils/SkMD5.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698