OLD | NEW |
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 #include "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkErrorInternals.h" | 9 #include "SkErrorInternals.h" |
10 #include "SkValidatingReadBuffer.h" | 10 #include "SkValidatingReadBuffer.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 uint32_t SkValidatingReadBuffer::readUInt() { | 85 uint32_t SkValidatingReadBuffer::readUInt() { |
86 return this->readInt(); | 86 return this->readInt(); |
87 } | 87 } |
88 | 88 |
89 int32_t SkValidatingReadBuffer::read32() { | 89 int32_t SkValidatingReadBuffer::read32() { |
90 return this->readInt(); | 90 return this->readInt(); |
91 } | 91 } |
92 | 92 |
93 void SkValidatingReadBuffer::readString(SkString* string) { | 93 void SkValidatingReadBuffer::readString(SkString* string) { |
94 const size_t len = this->readInt(); | 94 const size_t len = this->readUInt(); |
95 const void* ptr = fReader.peek(); | 95 const void* ptr = fReader.peek(); |
96 const char* cptr = (const char*)ptr; | 96 const char* cptr = (const char*)ptr; |
97 | 97 |
98 // skip over the string + '\0' and then pad to a multiple of 4 | 98 // skip over the string + '\0' and then pad to a multiple of 4 |
99 const size_t alignedSize = SkAlign4(len + 1); | 99 const size_t alignedSize = SkAlign4(len + 1); |
100 this->skip(alignedSize); | 100 this->skip(alignedSize); |
101 if (!fError) { | 101 if (!fError) { |
102 this->validate(cptr[len] == '\0'); | 102 this->validate(cptr[len] == '\0'); |
103 } | 103 } |
104 if (!fError) { | 104 if (!fError) { |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 delete obj; | 266 delete obj; |
267 obj = NULL; | 267 obj = NULL; |
268 } | 268 } |
269 } else { | 269 } else { |
270 // we must skip the remaining data | 270 // we must skip the remaining data |
271 this->skip(sizeRecorded); | 271 this->skip(sizeRecorded); |
272 SkASSERT(false); | 272 SkASSERT(false); |
273 } | 273 } |
274 return obj; | 274 return obj; |
275 } | 275 } |
OLD | NEW |