Index: src/core/SkWriter32.cpp |
diff --git a/src/core/SkWriter32.cpp b/src/core/SkWriter32.cpp |
index 56edd19698031ace0308c7a09bf1ad93585c600e..7978fae9fa15818b1337a7c65e399157e3e344dc 100644 |
--- a/src/core/SkWriter32.cpp |
+++ b/src/core/SkWriter32.cpp |
@@ -246,6 +246,12 @@ void SkWriter32::validate() const { |
const char* SkReader32::readString(size_t* outLen) { |
size_t len = this->readInt(); |
+ if (len == 0xFFFF) { |
scroggo
2013/08/09 15:18:28
What do you think about setting a constant for thi
mtklein
2013/08/09 15:22:49
You know, I think it helps to see 0xFFFF itself as
scroggo
2013/08/09 15:23:53
Okay with me.
|
+ if (outLen) { |
+ *outLen = 0; |
+ } |
+ return NULL; |
+ } |
const void* ptr = this->peek(); |
// skip over teh string + '\0' and then pad to a multiple of 4 |
@@ -268,8 +274,12 @@ size_t SkReader32::readIntoString(SkString* copy) { |
} |
void SkWriter32::writeString(const char str[], size_t len) { |
+ if (NULL == str) { |
+ // We're already requiring len < 0xFFFF, so we can use that to mark NULL. |
+ this->write32(0xFFFF); |
+ return; |
+ } |
if ((long)len < 0) { |
- SkASSERT(str); |
len = strlen(str); |
} |
this->write32(len); |