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

Side by Side Diff: src/core/SkValidatingReadBuffer.cpp

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 | « src/core/SkStream.cpp ('k') | src/core/SkWriter32.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 * 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 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 SkFlattenable::Factory factory = SkFlattenable::NameToFactory(cname); 249 SkFlattenable::Factory factory = SkFlattenable::NameToFactory(cname);
250 if (NULL == factory) { 250 if (NULL == factory) {
251 return NULL; // writer failed to give us the flattenable 251 return NULL; // writer failed to give us the flattenable
252 } 252 }
253 253
254 // if we get here, factory may still be null, but if that is the case, the 254 // if we get here, factory may still be null, but if that is the case, the
255 // failure was ours, not the writer. 255 // failure was ours, not the writer.
256 SkFlattenable* obj = NULL; 256 SkFlattenable* obj = NULL;
257 uint32_t sizeRecorded = this->readUInt(); 257 uint32_t sizeRecorded = this->readUInt();
258 if (factory) { 258 if (factory) {
259 uint32_t offset = fReader.offset(); 259 size_t offset = fReader.offset();
260 obj = (*factory)(*this); 260 obj = (*factory)(*this);
261 // check that we read the amount we expected 261 // check that we read the amount we expected
262 uint32_t sizeRead = fReader.offset() - offset; 262 size_t sizeRead = fReader.offset() - offset;
263 this->validate(sizeRecorded == sizeRead); 263 this->validate(sizeRecorded == sizeRead);
264 if (fError) { 264 if (fError) {
265 // we could try to fix up the offset... 265 // we could try to fix up the offset...
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 }
OLDNEW
« no previous file with comments | « src/core/SkStream.cpp ('k') | src/core/SkWriter32.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698