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

Unified Diff: src/core/SkValidatingReadBuffer.h

Issue 37803002: Adding size parameter to read array functions (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fixed comments 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 side-by-side diff with in-line comments
Download patch
Index: src/core/SkValidatingReadBuffer.h
diff --git a/src/core/SkValidatingReadBuffer.h b/src/core/SkValidatingReadBuffer.h
index c854b0af2c4583ddf5dac61681236bb3fd1794b4..4d1919b62c1cfba7766948f67c6882a2ec0f22f9 100644
--- a/src/core/SkValidatingReadBuffer.h
+++ b/src/core/SkValidatingReadBuffer.h
@@ -47,24 +47,24 @@ public:
virtual void readPath(SkPath* path) SK_OVERRIDE;
// binary data and arrays
- virtual uint32_t readByteArray(void* value) SK_OVERRIDE;
- virtual uint32_t readColorArray(SkColor* colors) SK_OVERRIDE;
- virtual uint32_t readIntArray(int32_t* values) SK_OVERRIDE;
- virtual uint32_t readPointArray(SkPoint* points) SK_OVERRIDE;
- virtual uint32_t readScalarArray(SkScalar* values) SK_OVERRIDE;
+ virtual bool readByteArray(void* value, size_t size) SK_OVERRIDE;
+ virtual bool readColorArray(SkColor* colors, size_t size) SK_OVERRIDE;
+ virtual bool readIntArray(int32_t* values, size_t size) SK_OVERRIDE;
+ virtual bool readPointArray(SkPoint* points, size_t size) SK_OVERRIDE;
+ virtual bool readScalarArray(SkScalar* values, size_t size) SK_OVERRIDE;
// helpers to get info about arrays and binary data
virtual uint32_t getArrayCount() SK_OVERRIDE;
virtual void readBitmap(SkBitmap* bitmap) SK_OVERRIDE;
// TODO: Implement this (securely) when needed
- virtual SkTypeface* readTypeface() SK_OVERRIDE { return NULL; }
+ virtual SkTypeface* readTypeface() SK_OVERRIDE;
- virtual void validate(bool isValid) SK_OVERRIDE {
- fError = fError || !isValid;
- }
+ virtual void validate(bool isValid) SK_OVERRIDE;
private:
+ bool readArray(void* value, size_t size, size_t elementSize);
+
void setMemory(const void* data, size_t size);
static bool IsPtrAlign4(const void* ptr) {

Powered by Google App Engine
This is Rietveld 408576698