Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / skia / src / core / SkValidatingReadBuffer.cpp
index ab6a04a..0112f18 100644 (file)
@@ -14,7 +14,7 @@
 SkValidatingReadBuffer::SkValidatingReadBuffer(const void* data, size_t size) :
     fError(false) {
     this->setMemory(data, size);
-    this->setFlags(SkFlattenableReadBuffer::kValidation_Flag);
+    this->setFlags(SkReadBuffer::kValidation_Flag);
 }
 
 SkValidatingReadBuffer::~SkValidatingReadBuffer() {
@@ -91,7 +91,7 @@ int32_t SkValidatingReadBuffer::read32() {
 }
 
 void SkValidatingReadBuffer::readString(SkString* string) {
-    const size_t len = this->readInt();
+    const size_t len = this->readUInt();
     const void* ptr = fReader.peek();
     const char* cptr = (const char*)ptr;
 
@@ -213,10 +213,10 @@ uint32_t SkValidatingReadBuffer::getArrayCount() {
 void SkValidatingReadBuffer::readBitmap(SkBitmap* bitmap) {
     const int width = this->readInt();
     const int height = this->readInt();
+    const bool useBitmapHeap = this->readBool();
     const size_t length = this->readUInt();
     // A size of zero means the SkBitmap was simply flattened.
-    this->validate(length == 0);
-    if (fError) {
+    if (!this->validate(!useBitmapHeap && (0 == length))) {
         return;
     }
     bitmap->unflatten(*this);
@@ -256,10 +256,10 @@ SkFlattenable* SkValidatingReadBuffer::readFlattenable(SkFlattenable::Type type)
     SkFlattenable* obj = NULL;
     uint32_t sizeRecorded = this->readUInt();
     if (factory) {
-        uint32_t offset = fReader.offset();
+        size_t offset = fReader.offset();
         obj = (*factory)(*this);
         // check that we read the amount we expected
-        uint32_t sizeRead = fReader.offset() - offset;
+        size_t sizeRead = fReader.offset() - offset;
         this->validate(sizeRecorded == sizeRead);
         if (fError) {
             // we could try to fix up the offset...