OLD | NEW |
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 #ifndef SkValidatingReadBuffer_DEFINED | 8 #ifndef SkValidatingReadBuffer_DEFINED |
9 #define SkValidatingReadBuffer_DEFINED | 9 #define SkValidatingReadBuffer_DEFINED |
10 | 10 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // binary data and arrays | 55 // binary data and arrays |
56 bool readByteArray(void* value, size_t size) override; | 56 bool readByteArray(void* value, size_t size) override; |
57 bool readColorArray(SkColor* colors, size_t size) override; | 57 bool readColorArray(SkColor* colors, size_t size) override; |
58 bool readIntArray(int32_t* values, size_t size) override; | 58 bool readIntArray(int32_t* values, size_t size) override; |
59 bool readPointArray(SkPoint* points, size_t size) override; | 59 bool readPointArray(SkPoint* points, size_t size) override; |
60 bool readScalarArray(SkScalar* values, size_t size) override; | 60 bool readScalarArray(SkScalar* values, size_t size) override; |
61 | 61 |
62 // helpers to get info about arrays and binary data | 62 // helpers to get info about arrays and binary data |
63 uint32_t getArrayCount() override; | 63 uint32_t getArrayCount() override; |
64 | 64 |
65 // TODO: Implement this (securely) when needed | |
66 SkTypeface* readTypeface() override; | |
67 | |
68 bool validate(bool isValid) override; | 65 bool validate(bool isValid) override; |
69 bool isValid() const override; | 66 bool isValid() const override; |
70 | 67 |
71 bool validateAvailable(size_t size) override; | 68 bool validateAvailable(size_t size) override; |
72 | 69 |
73 private: | 70 private: |
74 bool readArray(void* value, size_t size, size_t elementSize); | 71 bool readArray(void* value, size_t size, size_t elementSize); |
75 | 72 |
76 void setMemory(const void* data, size_t size); | 73 void setMemory(const void* data, size_t size); |
77 | 74 |
78 static bool IsPtrAlign4(const void* ptr) { | 75 static bool IsPtrAlign4(const void* ptr) { |
79 return SkIsAlign4((uintptr_t)ptr); | 76 return SkIsAlign4((uintptr_t)ptr); |
80 } | 77 } |
81 | 78 |
82 bool fError; | 79 bool fError; |
83 | 80 |
84 typedef SkReadBuffer INHERITED; | 81 typedef SkReadBuffer INHERITED; |
85 }; | 82 }; |
86 | 83 |
87 #endif // SkValidatingReadBuffer_DEFINED | 84 #endif // SkValidatingReadBuffer_DEFINED |
OLD | NEW |