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

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

Issue 1936103002: Remove unused encodedString API on SkWriteBuffer/SkReadBuffer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « src/core/SkValidatingReadBuffer.h ('k') | src/core/SkWriteBuffer.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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 const size_t alignedSize = SkAlign4(len + 1); 103 const size_t alignedSize = SkAlign4(len + 1);
104 this->skip(alignedSize); 104 this->skip(alignedSize);
105 if (!fError) { 105 if (!fError) {
106 this->validate(cptr[len] == '\0'); 106 this->validate(cptr[len] == '\0');
107 } 107 }
108 if (!fError) { 108 if (!fError) {
109 string->set(cptr, len); 109 string->set(cptr, len);
110 } 110 }
111 } 111 }
112 112
113 void* SkValidatingReadBuffer::readEncodedString(size_t* length, SkPaint::TextEnc oding encoding) {
114 const int32_t encodingType = this->readInt();
115 this->validate(encodingType == encoding);
116 *length = this->readInt();
117 const void* ptr = this->skip(SkAlign4(*length));
118 void* data = nullptr;
119 if (!fError) {
120 data = sk_malloc_throw(*length);
121 memcpy(data, ptr, *length);
122 }
123 return data;
124 }
125
126 void SkValidatingReadBuffer::readPoint(SkPoint* point) { 113 void SkValidatingReadBuffer::readPoint(SkPoint* point) {
127 point->fX = this->readScalar(); 114 point->fX = this->readScalar();
128 point->fY = this->readScalar(); 115 point->fY = this->readScalar();
129 } 116 }
130 117
131 void SkValidatingReadBuffer::readMatrix(SkMatrix* matrix) { 118 void SkValidatingReadBuffer::readMatrix(SkMatrix* matrix) {
132 size_t size = 0; 119 size_t size = 0;
133 if (!fError) { 120 if (!fError) {
134 size = matrix->readFromMemory(fReader.peek(), fReader.available()); 121 size = matrix->readFromMemory(fReader.peek(), fReader.available());
135 this->validate((SkAlign4(size) == size) && (0 != size)); 122 this->validate((SkAlign4(size) == size) && (0 != size));
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 284
298 void SkValidatingReadBuffer::skipFlattenable() { 285 void SkValidatingReadBuffer::skipFlattenable() {
299 SkString name; 286 SkString name;
300 this->readString(&name); 287 this->readString(&name);
301 if (fError) { 288 if (fError) {
302 return; 289 return;
303 } 290 }
304 uint32_t sizeRecorded = this->readUInt(); 291 uint32_t sizeRecorded = this->readUInt();
305 this->skip(sizeRecorded); 292 this->skip(sizeRecorded);
306 } 293 }
OLDNEW
« no previous file with comments | « src/core/SkValidatingReadBuffer.h ('k') | src/core/SkWriteBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698