Index: include/core/SkWriter32.h |
diff --git a/include/core/SkWriter32.h b/include/core/SkWriter32.h |
index 6bb59c5dbc703f95f29f9645332747a519b32921..3d80a7f74ccbd9ca4fc28a8c926f886562495af0 100644 |
--- a/include/core/SkWriter32.h |
+++ b/include/core/SkWriter32.h |
@@ -79,18 +79,16 @@ public: |
return p; |
} |
- // return the address of the 4byte int at the specified offset (which must |
- // be a multiple of 4. This does not allocate any new space, so the returned |
- // address is only valid for 1 int. |
- uint32_t* peek32(size_t offset) { |
+ // Return a reference to the 4 bytes at offset, which must be a multiple of 4. |
+ uint32_t& peek32(size_t offset) { |
SkASSERT(SkAlign4(offset) == offset); |
const int count = SkToInt(offset/4); |
SkASSERT(count < fCount); |
if (count < this->externalCount()) { |
- return fExternal + count; |
+ return fExternal[count]; |
} |
- return &fInternal[count - this->externalCount()]; |
+ return fInternal[count - this->externalCount()]; |
} |
bool writeBool(bool value) { |
@@ -215,8 +213,7 @@ public: |
/** |
* Move the cursor back to offset bytes from the beginning. |
- * This has the same restrictions as peek32: offset must be <= size() and |
- * offset must be a multiple of 4. |
+ * offset must be a multiple of 4 no greater than size(). |
*/ |
void rewindToOffset(size_t offset) { |
SkASSERT(SkAlign4(offset) == offset); |