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

Issue 22359003: allow NULL in writeString/readString (Closed)

Created:
7 years, 4 months ago by mtklein
Modified:
7 years, 4 months ago
Reviewers:
scroggo, reed1
CC:
skia-review_googlegroups.com
Visibility:
Public.

Description

allow NULL in writeString/readString BUG=skia:1469 , code.google.com/p/android/issues/detail?id=58257 Committed: http://code.google.com/p/skia/source/detail?r=10662

Patch Set 1 #

Total comments: 3

Patch Set 2 : style nit #

Unified diffs Side-by-side diffs Delta from patch set Stats (+40 lines, -1 line) Patch
M src/core/SkWriter32.cpp View 1 2 chunks +11 lines, -1 line 0 comments Download
M tests/Writer32Test.cpp View 2 chunks +29 lines, -0 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
mtklein
Seemed the easiest way to fix things is just to allow reading and writing NULL ...
7 years, 4 months ago (2013-08-09 15:07:13 UTC) #1
scroggo
> Seemed the easiest way to fix things is just to allow > reading and ...
7 years, 4 months ago (2013-08-09 15:18:28 UTC) #2
mtklein
https://codereview.chromium.org/22359003/diff/1/src/core/SkWriter32.cpp File src/core/SkWriter32.cpp (right): https://codereview.chromium.org/22359003/diff/1/src/core/SkWriter32.cpp#newcode249 src/core/SkWriter32.cpp:249: if (len == 0xFFFF) { On 2013/08/09 15:18:28, scroggo ...
7 years, 4 months ago (2013-08-09 15:22:49 UTC) #3
scroggo
https://codereview.chromium.org/22359003/diff/1/src/core/SkWriter32.cpp File src/core/SkWriter32.cpp (right): https://codereview.chromium.org/22359003/diff/1/src/core/SkWriter32.cpp#newcode249 src/core/SkWriter32.cpp:249: if (len == 0xFFFF) { On 2013/08/09 15:22:49, mtklein ...
7 years, 4 months ago (2013-08-09 15:23:53 UTC) #4
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/mtklein@google.com/22359003/8001
7 years, 4 months ago (2013-08-09 15:30:22 UTC) #5
commit-bot: I haz the power
Change committed as 10662
7 years, 4 months ago (2013-08-09 16:03:08 UTC) #6
reed1
What is the 0xFFFF for?
7 years, 4 months ago (2013-08-12 13:00:05 UTC) #7
mtklein
On 2013/08/12 13:00:05, reed1 wrote: > What is the 0xFFFF for? SkWriter32::writeString() normally writes [ ...
7 years, 4 months ago (2013-08-12 13:47:36 UTC) #8
reed1
7 years, 4 months ago (2013-08-12 14:31:22 UTC) #9
Message was sent while issue was closed.
On 2013/08/12 13:47:36, mtklein wrote:
> On 2013/08/12 13:00:05, reed1 wrote:
> > What is the 0xFFFF for?
> 
> SkWriter32::writeString() normally writes [ 4 byte length ] [ length + 1 bytes
> of data and \0 ].  E.g. { 1, 97, 0 } encodes "a", { 0, 0 } encodes "", etc. 
(We
> like this because it lets us return a valid const char* pointing into the
stream
> without copying.)
> 
> writeString() requires len < 0xFFFF, so we could never normally write it as
> those first 4 bytes.  This leaves { 0xFFFF } as a convenient way to encode
NULL
> and to allow NULL to be distinguished from "".

Hmmm, but "why" does it require len < 0xFFFF, and do we actually need to encode
NULL strings? I don't see that mentioned in the dox...

Powered by Google App Engine
This is Rietveld 408576698