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

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

Issue 26702002: force readbuffer clients to use specialized readFoo for flattenables (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "SkData.h" 8 #include "SkData.h"
9 #include "SkFlattenableBuffers.h" 9 #include "SkFlattenableBuffers.h"
10 #include "SkOSFile.h" 10 #include "SkOSFile.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 if (fCount > 0) { 313 if (fCount > 0) {
314 fKeySize = buffer.getArrayCount(); 314 fKeySize = buffer.getArrayCount();
315 fPairs = allocatePairStorage(fCount, fKeySize); 315 fPairs = allocatePairStorage(fCount, fKeySize);
316 char* keyStorage = (char*)(fPairs + fCount); 316 char* keyStorage = (char*)(fPairs + fCount);
317 317
318 buffer.readByteArray(keyStorage); 318 buffer.readByteArray(keyStorage);
319 319
320 for (int i = 0; i < fCount; ++i) { 320 for (int i = 0; i < fCount; ++i) {
321 fPairs[i].fKey = keyStorage; 321 fPairs[i].fKey = keyStorage;
322 keyStorage += strlen(keyStorage) + 1; 322 keyStorage += strlen(keyStorage) + 1;
323 fPairs[i].fValue = buffer.readFlattenableT<SkData>(); 323 fPairs[i].fValue = buffer.readData();
324 } 324 }
325 } else { 325 } else {
326 fKeySize = 0; 326 fKeySize = 0;
327 fPairs = NULL; 327 fPairs = NULL;
328 } 328 }
329 } 329 }
330 330
331 SkDataSet* SkDataSet::NewEmpty() { 331 SkDataSet* SkDataSet::NewEmpty() {
332 static SkDataSet* gEmptySet; 332 static SkDataSet* gEmptySet;
333 if (NULL == gEmptySet) { 333 if (NULL == gEmptySet) {
334 gEmptySet = SkNEW_ARGS(SkDataSet, (NULL, 0)); 334 gEmptySet = SkNEW_ARGS(SkDataSet, (NULL, 0));
335 } 335 }
336 gEmptySet->ref(); 336 gEmptySet->ref();
337 return gEmptySet; 337 return gEmptySet;
338 } 338 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698