rlp: fix handling of single byte zero when decoding into a pointer

A single zero byte carries information and should not set the pointer
to nil. This is arguably a corner case. While here, fix the comment
to explain pointer reuse.
This commit is contained in:
Felix Lange
2015-04-14 12:28:19 +02:00
parent 509d0a8d78
commit 6788f955c2
2 changed files with 6 additions and 6 deletions

View File

@ -378,7 +378,7 @@ var decodeTests = []decodeTest{
},
// pointers
{input: "00", ptr: new(*uint), value: (*uint)(nil)},
{input: "00", ptr: new(*uint), value: uintp(0)},
{input: "80", ptr: new(*uint), value: (*uint)(nil)},
{input: "C0", ptr: new(*uint), value: (*uint)(nil)},
{input: "07", ptr: new(*uint), value: uintp(7)},