thanks. could you please fill out the CLA as described at http://golang.org/doc/contribute.html#copyright and let me ...
16 years, 1 month ago
(2009-11-29 23:27:14 UTC)
#2
thanks.
could you please fill out the CLA as described at
http://golang.org/doc/contribute.html#copyright and
let me know once you have?
there is no need to send a separate AUTHORS/CONTRIBUTORS
CL - we'll take care of that - just let me know when you've
completed the appropriate contributor agreement.
thanks.
russ
On Thu, Nov 26, 2009 at 10:26, <skibaa@gmail.com> wrote:
> Reviewers: rsc,
>
> Message:
> Hello rsc,
>
> I'd like you to review the following change.
>
>
> Description:
> Handle \r as a whitespace when parsing JSON string.
> Fixes issue 272.
>
> Please review this at http://codereview.appspot.com/161061
>
> Affected files:
> M src/pkg/json/parse.go
> M src/pkg/json/struct_test.go
>
>
> Index: src/pkg/json/parse.go
> ===================================================================
> --- a/src/pkg/json/parse.go
> +++ b/src/pkg/json/parse.go
> @@ -198,7 +198,7 @@
> return c == '"' || c == '[' || c == ']' || c == ':' || c == '{' || c
> == '}' || c == ','
> }
>
> -func white(c byte) bool { return c == ' ' || c == '\t' || c == '\n'
> || c == '\v' }
> +func white(c byte) bool { return c == ' ' || c == '\t' || c == '\r'
> || c == '\n' || c == '\v' }
>
> func skipwhite(p string, i int) int {
> for i < len(p) && white(p[i]) {
> Index: src/pkg/json/struct_test.go
> ===================================================================
> --- a/src/pkg/json/struct_test.go
> +++ b/src/pkg/json/struct_test.go
> @@ -66,6 +66,17 @@
> }
> }
>
> +const whiteSpaceEncoded = " \t{\n\"s\"\r:\"string\"\v}"
> +
> +func TestUnmarshalWhitespace(t *testing.T) {
> + var m myStruct;
> + ok, errtok := Unmarshal(whiteSpaceEncoded, &m);
> + if !ok {
> + t.Fatalf("Unmarshal failed near %s", errtok)
> + }
> + check(t, m.S == "string", "string", m.S);
> +}
> +
> func TestUnmarshal(t *testing.T) {
> var m myStruct;
> m.F = true;
>
>
>
Issue 161061: code review 161061: Handle \r as a whitespace when parsing JSON string.
Created 16 years, 1 month ago by skibaa
Modified 2 years, 2 months ago
Reviewers:
Base URL:
Comments: 0