change NewWithCString to allocate room for the terminating NULL, so the data
can be treated as a cstring (duh).



git-svn-id: http://skia.googlecode.com/svn/trunk@4430 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/core/SkData.h b/include/core/SkData.h
index f24cf9c..61b52c5 100644
--- a/include/core/SkData.h
+++ b/include/core/SkData.h
@@ -69,7 +69,9 @@
     
     /**
      *  Create a new dataref by copying the specified c-string
-     *  (a null-terminated array of bytes).
+     *  (a null-terminated array of bytes). The returned SkData will have size()
+     *  equal to strlen(cstr) + 1. If cstr is NULL, it will be treated the same
+     *  as "".
      */
     static SkData* NewWithCString(const char cstr[]);
     
diff --git a/src/core/SkData.cpp b/src/core/SkData.cpp
index 2653f32..496d599 100644
--- a/src/core/SkData.cpp
+++ b/src/core/SkData.cpp
@@ -112,10 +112,13 @@
 }
 
 SkData* SkData::NewWithCString(const char cstr[]) {
-    if (NULL == cstr || 0 == cstr[0]) {
-        return NewEmpty();
+    size_t size;
+    if (NULL == cstr) {
+        cstr = "";
+        size = 1;
     } else {
-        return NewWithCopy(cstr, strlen(cstr));
+        size = strlen(cstr) + 1;
     }
+    return NewWithCopy(cstr, size);
 }