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

Side by Side Diff: include/core/SkReader32.h

Issue 247753003: fix size_t/int warnings (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: revert name-change in swap32 Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/core/SkReadBuffer.h ('k') | src/core/SkReadBuffer.cpp » ('j') | 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 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkReader32_DEFINED 10 #ifndef SkReader32_DEFINED
(...skipping 15 matching lines...) Expand all
26 } 26 }
27 27
28 void setMemory(const void* data, size_t size) { 28 void setMemory(const void* data, size_t size) {
29 SkASSERT(ptr_align_4(data)); 29 SkASSERT(ptr_align_4(data));
30 SkASSERT(SkAlign4(size) == size); 30 SkASSERT(SkAlign4(size) == size);
31 31
32 fBase = fCurr = (const char*)data; 32 fBase = fCurr = (const char*)data;
33 fStop = (const char*)data + size; 33 fStop = (const char*)data + size;
34 } 34 }
35 35
36 uint32_t size() const { return SkToU32(fStop - fBase); } 36 size_t size() const { return fStop - fBase; }
37 uint32_t offset() const { return SkToU32(fCurr - fBase); } 37 size_t offset() const { return fCurr - fBase; }
38 bool eof() const { return fCurr >= fStop; } 38 bool eof() const { return fCurr >= fStop; }
39 const void* base() const { return fBase; } 39 const void* base() const { return fBase; }
40 const void* peek() const { return fCurr; } 40 const void* peek() const { return fCurr; }
41 41
42 uint32_t available() const { return SkToU32(fStop - fCurr); } 42 size_t available() const { return fStop - fCurr; }
43 bool isAvailable(uint32_t size) const { return fCurr + size <= fStop; } 43 bool isAvailable(size_t size) const { return fCurr + size <= fStop; }
44 44
45 void rewind() { fCurr = fBase; } 45 void rewind() { fCurr = fBase; }
46 46
47 void setOffset(size_t offset) { 47 void setOffset(size_t offset) {
48 SkASSERT(SkAlign4(offset) == offset); 48 SkASSERT(SkAlign4(offset) == offset);
49 SkASSERT(offset <= this->size()); 49 SkASSERT(offset <= this->size());
50 fCurr = fBase + offset; 50 fCurr = fBase + offset;
51 } 51 }
52 52
53 bool readBool() { return this->readInt() != 0; } 53 bool readBool() { return this->readInt() != 0; }
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 const char* fBase; // beginning of buffer 151 const char* fBase; // beginning of buffer
152 152
153 #ifdef SK_DEBUG 153 #ifdef SK_DEBUG
154 static bool ptr_align_4(const void* ptr) { 154 static bool ptr_align_4(const void* ptr) {
155 return (((const char*)ptr - (const char*)NULL) & 3) == 0; 155 return (((const char*)ptr - (const char*)NULL) & 3) == 0;
156 } 156 }
157 #endif 157 #endif
158 }; 158 };
159 159
160 #endif 160 #endif
OLDNEW
« no previous file with comments | « include/core/SkReadBuffer.h ('k') | src/core/SkReadBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698