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

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

Issue 134163010: Refactor read and write buffers. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: original write flags were fine Created 6 years, 10 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
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"
11 #include "SkStream.h" 11 #include "SkStream.h"
12 #include "SkTypeface.h" 12 #include "SkTypeface.h"
13 13
14 SkValidatingReadBuffer::SkValidatingReadBuffer(const void* data, size_t size) : 14 SkValidatingReadBuffer::SkValidatingReadBuffer(const void* data, size_t size) :
15 fError(false) { 15 fError(false) {
16 this->setMemory(data, size); 16 this->setMemory(data, size);
17 this->setFlags(SkFlattenableReadBuffer::kValidation_Flag); 17 this->setFlags(SkReadBuffer::kValidation_Flag);
18 } 18 }
19 19
20 SkValidatingReadBuffer::~SkValidatingReadBuffer() { 20 SkValidatingReadBuffer::~SkValidatingReadBuffer() {
21 } 21 }
22 22
23 bool SkValidatingReadBuffer::validate(bool isValid) { 23 bool SkValidatingReadBuffer::validate(bool isValid) {
24 if (!fError && !isValid) { 24 if (!fError && !isValid) {
25 // When an error is found, send the read cursor to the end of the stream 25 // When an error is found, send the read cursor to the end of the stream
26 fReader.skip(fReader.available()); 26 fReader.skip(fReader.available());
27 fError = true; 27 fError = true;
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
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

Powered by Google App Engine
This is Rietveld 408576698