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

Side by Side Diff: src/core/SkDescriptor.h

Issue 242643008: fix warnings around size_t/int (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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 | « no previous file | src/core/SkDistanceFieldGen.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 2006 The Android Open Source Project 3 * Copyright 2006 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 SkDescriptor_DEFINED 10 #ifndef SkDescriptor_DEFINED
(...skipping 19 matching lines...) Expand all
30 sk_free(desc); 30 sk_free(desc);
31 } 31 }
32 32
33 void init() { 33 void init() {
34 fLength = sizeof(SkDescriptor); 34 fLength = sizeof(SkDescriptor);
35 fCount = 0; 35 fCount = 0;
36 } 36 }
37 37
38 uint32_t getLength() const { return fLength; } 38 uint32_t getLength() const { return fLength; }
39 39
40 void* addEntry(uint32_t tag, uint32_t length, const void* data = NULL) { 40 void* addEntry(uint32_t tag, size_t length, const void* data = NULL) {
41 SkASSERT(tag); 41 SkASSERT(tag);
42 SkASSERT(SkAlign4(length) == length); 42 SkASSERT(SkAlign4(length) == length);
43 SkASSERT(this->findEntry(tag, NULL) == NULL); 43 SkASSERT(this->findEntry(tag, NULL) == NULL);
44 44
45 Entry* entry = (Entry*)((char*)this + fLength); 45 Entry* entry = (Entry*)((char*)this + fLength);
46 entry->fTag = tag; 46 entry->fTag = tag;
47 entry->fLen = length; 47 entry->fLen = SkToU32(length);
48 if (data) { 48 if (data) {
49 memcpy(entry + 1, data, length); 49 memcpy(entry + 1, data, length);
50 } 50 }
51 51
52 fCount += 1; 52 fCount += 1;
53 fLength += sizeof(Entry) + length; 53 fLength += sizeof(Entry) + length;
54 return (entry + 1); // return its data 54 return (entry + 1); // return its data
55 } 55 }
56 56
57 void computeChecksum() { 57 void computeChecksum() {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 + sizeof(SkDescriptor::Entry) + sizeof(void*) // for typeface 156 + sizeof(SkDescriptor::Entry) + sizeof(void*) // for typeface
157 + 32 // slop for occational small extras 157 + 32 // slop for occational small extras
158 }; 158 };
159 SkDescriptor* fDesc; 159 SkDescriptor* fDesc;
160 uint32_t fStorage[(kStorageSize + 3) >> 2]; 160 uint32_t fStorage[(kStorageSize + 3) >> 2];
161 }; 161 };
162 #define SkAutoDescriptor(...) SK_REQUIRE_LOCAL_VAR(SkAutoDescriptor) 162 #define SkAutoDescriptor(...) SK_REQUIRE_LOCAL_VAR(SkAutoDescriptor)
163 163
164 164
165 #endif 165 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkDistanceFieldGen.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698