[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] NSJSONSerialization: Move on after parsing a JSON Value
From: |
Lubomir Rintel |
Subject: |
[PATCH] NSJSONSerialization: Move on after parsing a JSON Value |
Date: |
Tue, 14 Feb 2012 13:42:11 +0100 |
* Source/NSJSONSerialization.m: (parseValue): swallow the last character
of null/true/false as well.
---
Source/NSJSONSerialization.m | 3 +++
Tests/base/NSJSONSerialization/json.m | 1 +
2 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/Source/NSJSONSerialization.m b/Source/NSJSONSerialization.m
index a40e3b2..c5eba68 100644
--- a/Source/NSJSONSerialization.m
+++ b/Source/NSJSONSerialization.m
@@ -601,6 +601,7 @@ parseValue(ParserState *state)
(consumeChar(state) == 'l') &&
(consumeChar(state) == 'l'))
{
+ consumeChar(state);
return [[NSNull null] retain];
}
break;
@@ -612,6 +613,7 @@ parseValue(ParserState *state)
(consumeChar(state) == 'u') &&
(consumeChar(state) == 'e'))
{
+ consumeChar(state);
return [[NSNumber alloc] initWithBool: YES];
}
break;
@@ -623,6 +625,7 @@ parseValue(ParserState *state)
(consumeChar(state) == 's') &&
(consumeChar(state) == 'e'))
{
+ consumeChar(state);
return [[NSNumber alloc] initWithBool: NO];
}
break;
diff --git a/Tests/base/NSJSONSerialization/json.m
b/Tests/base/NSJSONSerialization/json.m
index 275eeca..5a07788 100644
--- a/Tests/base/NSJSONSerialization/json.m
+++ b/Tests/base/NSJSONSerialization/json.m
@@ -19,6 +19,7 @@ int main(void)
},\
},\
\"emptyString\":\"\",\"emptyArray\":[],\"emptyObject\":{},\
+ \"valueTest\":[true,false,null],\
\"IDs\": [116, 943, 234, 38793],\
\"escapeTest\": \"\\\"\\u0001\"\
}";
--
1.7.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] NSJSONSerialization: Move on after parsing a JSON Value,
Lubomir Rintel <=