Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Unified Diff: src/core/SkWriter32.cpp

Issue 22862002: Write NULL as "" so readString() always returns a non-NULL string. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: len 0 Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkWriter32.h ('k') | tests/Writer32Test.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkWriter32.cpp
diff --git a/src/core/SkWriter32.cpp b/src/core/SkWriter32.cpp
index e41e2df0c470423c34d017bc51e324165d9ed19a..ca21c5ad6db8efe43cd671d5e3cb453c3df07e53 100644
--- a/src/core/SkWriter32.cpp
+++ b/src/core/SkWriter32.cpp
@@ -246,12 +246,6 @@ void SkWriter32::validate() const {
const char* SkReader32::readString(size_t* outLen) {
size_t len = this->readInt();
- if (0xFFFF == len) {
- if (outLen) {
- *outLen = 0;
- }
- return NULL;
- }
const void* ptr = this->peek();
// skip over teh string + '\0' and then pad to a multiple of 4
@@ -275,9 +269,8 @@ 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;
+ str = "";
+ len = 0;
}
if ((long)len < 0) {
len = strlen(str);
« no previous file with comments | « include/core/SkWriter32.h ('k') | tests/Writer32Test.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698