aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkValidatingReadBuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkValidatingReadBuffer.cpp')
-rw-r--r--src/core/SkValidatingReadBuffer.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/core/SkValidatingReadBuffer.cpp b/src/core/SkValidatingReadBuffer.cpp
index 384dd10b30..9f094f9617 100644
--- a/src/core/SkValidatingReadBuffer.cpp
+++ b/src/core/SkValidatingReadBuffer.cpp
@@ -118,8 +118,8 @@ void SkValidatingReadBuffer::readPoint(SkPoint* point) {
}
void SkValidatingReadBuffer::readMatrix(SkMatrix* matrix) {
- const size_t size = matrix->readFromMemory(fReader.peek(), fReader.available());
- this->validate((SkAlign4(size) != size) || (0 == size));
+ const size_t size = matrix->readFromMemory(fReader.peek());
+ this->validate(SkAlign4(size) == size);
if (!fError) {
(void)this->skip(size);
}
@@ -140,16 +140,16 @@ void SkValidatingReadBuffer::readRect(SkRect* rect) {
}
void SkValidatingReadBuffer::readRegion(SkRegion* region) {
- const size_t size = region->readFromMemory(fReader.peek(), fReader.available());
- this->validate((SkAlign4(size) != size) || (0 == size));
+ const size_t size = region->readFromMemory(fReader.peek());
+ this->validate(SkAlign4(size) == size);
if (!fError) {
(void)this->skip(size);
}
}
void SkValidatingReadBuffer::readPath(SkPath* path) {
- const size_t size = path->readFromMemory(fReader.peek(), fReader.available());
- this->validate((SkAlign4(size) != size) || (0 == size));
+ const size_t size = path->readFromMemory(fReader.peek());
+ this->validate(SkAlign4(size) == size);
if (!fError) {
(void)this->skip(size);
}
@@ -189,8 +189,6 @@ bool SkValidatingReadBuffer::readScalarArray(SkScalar* values, size_t size) {
}
uint32_t SkValidatingReadBuffer::getArrayCount() {
- const size_t inc = sizeof(uint32_t);
- fError = fError || !IsPtrAlign4(fReader.peek()) || !fReader.isAvailable(inc);
return *(uint32_t*)fReader.peek();
}