From 02f624292a555b8313297bd10d3c2aa73344d8cd Mon Sep 17 00:00:00 2001 From: Alan Harper Date: Wed, 4 May 2011 11:16:55 +1000 Subject: [PATCH 1/3] Remove analyser warnings --- JSONKit.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/JSONKit.m b/JSONKit.m index e7bef74..3911126 100644 --- a/JSONKit.m +++ b/JSONKit.m @@ -736,7 +736,7 @@ - (void)insertObject:(id)anObject atIndex:(NSUInteger)objectIndex if(mutations == 0UL) { [NSException raise:NSInternalInconsistencyException format:@"*** -[%@ %@]: mutating method sent to immutable object", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } if(anObject == NULL) { [NSException raise:NSInvalidArgumentException format:@"*** -[%@ %@]: attempt to insert nil", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } if(objectIndex > count) { [NSException raise:NSRangeException format:@"*** -[%@ %@]: index (%lu) beyond bounds (%lu)", NSStringFromClass([self class]), NSStringFromSelector(_cmd), objectIndex, count + 1UL]; } - anObject = [anObject retain]; + [anObject retain]; _JKArrayInsertObjectAtIndex(self, anObject, objectIndex); mutations = (mutations == NSUIntegerMax) ? 1UL : mutations + 1UL; } @@ -754,7 +754,7 @@ - (void)replaceObjectAtIndex:(NSUInteger)objectIndex withObject:(id)anObject if(mutations == 0UL) { [NSException raise:NSInternalInconsistencyException format:@"*** -[%@ %@]: mutating method sent to immutable object", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } if(anObject == NULL) { [NSException raise:NSInvalidArgumentException format:@"*** -[%@ %@]: attempt to insert nil", NSStringFromClass([self class]), NSStringFromSelector(_cmd)]; } if(objectIndex >= count) { [NSException raise:NSRangeException format:@"*** -[%@ %@]: index (%lu) beyond bounds (%lu)", NSStringFromClass([self class]), NSStringFromSelector(_cmd), objectIndex, count]; } - anObject = [anObject retain]; + [anObject retain]; _JKArrayReplaceObjectAtIndexWithObject(self, objectIndex, anObject); mutations = (mutations == NSUIntegerMax) ? 1UL : mutations + 1UL; } From e133ca913efb1f3f0d0b3a1e7ad873514db235e9 Mon Sep 17 00:00:00 2001 From: Stewart Gleadow Date: Wed, 25 May 2011 16:23:13 +1000 Subject: [PATCH 2/3] Fixing compile warning on undefined parameter --- JSONKit.m | 2 ++ 1 file changed, 2 insertions(+) diff --git a/JSONKit.m b/JSONKit.m index 555ab76..b63d499 100644 --- a/JSONKit.m +++ b/JSONKit.m @@ -887,7 +887,9 @@ static void _JKDictionaryResizeIfNeccessary(JKDictionary *dictionary) { NSUInteger idx = 0UL; for(idx = 0UL; idx < oldCapacity; idx++) { if(oldEntry[idx].key != NULL) { _JKDictionaryAddObject(dictionary, oldEntry[idx].keyHash, oldEntry[idx].key, oldEntry[idx].object); oldEntry[idx].keyHash = 0UL; oldEntry[idx].key = NULL; oldEntry[idx].object = NULL; } } +#ifndef NS_BLOCK_ASSERTIONS NSCParameterAssert((oldCount == dictionary->count)); +#endif free(oldEntry); oldEntry = NULL; } } From e5125e0b66c0db49f73e9a345b018ffad7ecdeaf Mon Sep 17 00:00:00 2001 From: Sadat Rahman Date: Thu, 9 Jun 2011 11:05:57 +1000 Subject: [PATCH 3/3] * Fixed error reported by Xcode 4.2. --- JSONKit.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/JSONKit.m b/JSONKit.m index b63d499..d66ce39 100644 --- a/JSONKit.m +++ b/JSONKit.m @@ -1553,7 +1553,7 @@ static int jk_parse_string(JKParseState *parseState) { break; case JSONStringStateEscapedNeedEscapeForSurrogate: - if((currentChar == '\\')) { stringState = JSONStringStateEscapedNeedEscapedUForSurrogate; } + if (currentChar == '\\') { stringState = JSONStringStateEscapedNeedEscapedUForSurrogate; } else { if((parseState->parseOptionFlags & JKParseOptionLooseUnicode) == 0) { jk_error(parseState, @"Required a second \\u Unicode escape sequence following a surrogate \\u Unicode escape sequence."); stringState = JSONStringStateError; goto finishedParsing; } else { stringState = JSONStringStateParsing; atStringCharacter--; if(jk_string_add_unicodeCodePoint(parseState, UNI_REPLACEMENT_CHAR, &tokenBufferIdx, &stringHash)) { jk_error(parseState, @"Internal error: Unable to add UTF8 sequence to internal string buffer. %@ line #%ld", [NSString stringWithUTF8String:__FILE__], (long)__LINE__); stringState = JSONStringStateError; goto finishedParsing; } }