OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #ifndef SkBuffer_DEFINED | 10 #ifndef SkBuffer_DEFINED |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 error is set if the read operation is attempting to read past the end of the
data. | 98 error is set if the read operation is attempting to read past the end of the
data. |
99 */ | 99 */ |
100 class SkRBufferWithSizeCheck : public SkRBuffer { | 100 class SkRBufferWithSizeCheck : public SkRBuffer { |
101 public: | 101 public: |
102 SkRBufferWithSizeCheck(const void* data, size_t size) : SkRBuffer(data, size
), fError(false) {} | 102 SkRBufferWithSizeCheck(const void* data, size_t size) : SkRBuffer(data, size
), fError(false) {} |
103 | 103 |
104 /** Read the specified number of bytes from the data pointer. If buffer is n
ot | 104 /** Read the specified number of bytes from the data pointer. If buffer is n
ot |
105 null and the number of bytes to read does not overflow this object's dat
a, | 105 null and the number of bytes to read does not overflow this object's dat
a, |
106 copy those bytes into buffer. | 106 copy those bytes into buffer. |
107 */ | 107 */ |
108 virtual bool read(void* buffer, size_t size) SK_OVERRIDE; | 108 bool read(void* buffer, size_t size) SK_OVERRIDE; |
109 | 109 |
110 /** Returns whether or not a read operation attempted to read past the end o
f the data. | 110 /** Returns whether or not a read operation attempted to read past the end o
f the data. |
111 */ | 111 */ |
112 bool isValid() const { return !fError; } | 112 bool isValid() const { return !fError; } |
113 private: | 113 private: |
114 bool fError; | 114 bool fError; |
115 }; | 115 }; |
116 | 116 |
117 /** \class SkWBuffer | 117 /** \class SkWBuffer |
118 | 118 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 161 |
162 private: | 162 private: |
163 void writeNoSizeCheck(const void* buffer, size_t size); | 163 void writeNoSizeCheck(const void* buffer, size_t size); |
164 | 164 |
165 char* fData; | 165 char* fData; |
166 char* fPos; | 166 char* fPos; |
167 char* fStop; | 167 char* fStop; |
168 }; | 168 }; |
169 | 169 |
170 #endif | 170 #endif |
OLD | NEW |