From 9195bfa97811d899cf36722c2b111ca908865fd2 Mon Sep 17 00:00:00 2001 From: Jean-Charles BERTIN Date: Thu, 19 May 2016 12:35:52 +0200 Subject: [PATCH 1/3] Fixed warnings about implicit conversion from nullable pointer to non-nullable pointer. --- KissXML/Private/DDXMLPrivate.h | 38 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/KissXML/Private/DDXMLPrivate.h b/KissXML/Private/DDXMLPrivate.h index c374d723..252ec40c 100644 --- a/KissXML/Private/DDXMLPrivate.h +++ b/KissXML/Private/DDXMLPrivate.h @@ -3,30 +3,30 @@ // We can't rely solely on NSAssert, because many developers disable them for release builds. // Our API contract requires us to keep these assertions intact. -#define DDXMLAssert(condition, desc, ...) \ - do{ \ - if(!(condition)) { \ - [[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd \ - object:self \ - file:[NSString stringWithUTF8String:__FILE__] \ - lineNumber:__LINE__ \ - description:(desc), ##__VA_ARGS__]; \ - } \ +#define DDXMLAssert(condition, desc, ...) \ + do{ \ + if(!(condition)) { \ + [[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd \ + object:self \ + file:@__FILE__ \ + lineNumber:__LINE__ \ + description:(desc), ##__VA_ARGS__]; \ + } \ }while(NO) // Create assertion to ensure xml node is not a zombie. #if DDXML_DEBUG_MEMORY_ISSUES -#define DDXMLNotZombieAssert() \ - do{ \ - if(DDXMLIsZombie(genericPtr, self)) { \ - NSString *desc = @"XML node is a zombie - It's parent structure has been freed!"; \ - [[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd \ - object:self \ - file:[NSString stringWithUTF8String:__FILE__] \ - lineNumber:__LINE__ \ - description:desc]; \ - } \ +#define DDXMLNotZombieAssert() \ + do{ \ + if(DDXMLIsZombie(genericPtr, self)) { \ + NSString *desc = @"XML node is a zombie - It's parent structure has been freed!"; \ + [[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd \ + object:self \ + file:@__FILE__ \ + lineNumber:__LINE__ \ + description:desc]; \ + } \ }while(NO) #endif From 969f5282ef78657c1aeed5147f6504593a945259 Mon Sep 17 00:00:00 2001 From: Jean-Charles BERTIN Date: Thu, 19 May 2016 12:38:58 +0200 Subject: [PATCH 2/3] Fixed warnings about no explicit ownership when compiling with -Wexplicit-ownership-type. --- KissXML/DDXMLDocument.h | 6 +++--- KissXML/DDXMLDocument.m | 4 ++-- KissXML/DDXMLElement.h | 2 +- KissXML/DDXMLElement.m | 2 +- KissXML/DDXMLNode.h | 6 +++--- KissXML/DDXMLNode.m | 12 ++++++------ KissXML/Private/DDXMLPrivate.h | 4 ++-- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/KissXML/DDXMLDocument.h b/KissXML/DDXMLDocument.h index 20573786..be4d3a3c 100644 --- a/KissXML/DDXMLDocument.h +++ b/KissXML/DDXMLDocument.h @@ -32,9 +32,9 @@ typedef NSUInteger DDXMLDocumentContentKind; { } -- (id)initWithXMLString:(NSString *)string options:(NSUInteger)mask error:(NSError **)error; -//- (id)initWithContentsOfURL:(NSURL *)url options:(NSUInteger)mask error:(NSError **)error; -- (id)initWithData:(NSData *)data options:(NSUInteger)mask error:(NSError **)error; +- (id)initWithXMLString:(NSString *)string options:(NSUInteger)mask error:(NSError * __autoreleasing*)error; +//- (id)initWithContentsOfURL:(NSURL *)url options:(NSUInteger)mask error:(NSError * __autoreleasing*)error; +- (id)initWithData:(NSData *)data options:(NSUInteger)mask error:(NSError * __autoreleasing*)error; //- (id)initWithRootElement:(DDXMLElement *)element; //+ (Class)replacementClassForClass:(Class)cls; diff --git a/KissXML/DDXMLDocument.m b/KissXML/DDXMLDocument.m index 83cf02ae..070e5f0e 100644 --- a/KissXML/DDXMLDocument.m +++ b/KissXML/DDXMLDocument.m @@ -62,7 +62,7 @@ - (id)initWithPrimitive:(xmlKindPtr)kindPtr owner:(DDXMLNode *)inOwner * Returns an initialized DDXMLDocument object, or nil if initialization fails * because of parsing errors or other reasons. **/ -- (id)initWithXMLString:(NSString *)string options:(NSUInteger)mask error:(NSError **)error +- (id)initWithXMLString:(NSString *)string options:(NSUInteger)mask error:(NSError * __autoreleasing*)error { return [self initWithData:[string dataUsingEncoding:NSUTF8StringEncoding] options:mask @@ -75,7 +75,7 @@ - (id)initWithXMLString:(NSString *)string options:(NSUInteger)mask error:(NSErr * Returns an initialized DDXMLDocument object, or nil if initialization fails * because of parsing errors or other reasons. **/ -- (id)initWithData:(NSData *)data options:(NSUInteger)mask error:(NSError **)error +- (id)initWithData:(NSData *)data options:(NSUInteger)mask error:(NSError * __autoreleasing*)error { if (data == nil || [data length] == 0) { diff --git a/KissXML/DDXMLElement.h b/KissXML/DDXMLElement.h index 379ab107..414b992b 100644 --- a/KissXML/DDXMLElement.h +++ b/KissXML/DDXMLElement.h @@ -26,7 +26,7 @@ - (id)initWithName:(NSString *)name; - (id)initWithName:(NSString *)name URI:(NSString *)URI; - (id)initWithName:(NSString *)name stringValue:(NSString *)string; -- (id)initWithXMLString:(NSString *)string error:(NSError **)error; +- (id)initWithXMLString:(NSString *)string error:(NSError * __autoreleasing*)error; #pragma mark --- Elements by name --- diff --git a/KissXML/DDXMLElement.m b/KissXML/DDXMLElement.m index 012299fe..14f5cc42 100644 --- a/KissXML/DDXMLElement.m +++ b/KissXML/DDXMLElement.m @@ -101,7 +101,7 @@ - (id)initWithName:(NSString *)name stringValue:(NSString *)string return result; } -- (id)initWithXMLString:(NSString *)string error:(NSError **)error +- (id)initWithXMLString:(NSString *)string error:(NSError * __autoreleasing*)error { DDXMLDocument *doc = [[DDXMLDocument alloc] initWithXMLString:string options:0 error:error]; if (doc == nil) diff --git a/KissXML/DDXMLNode.h b/KissXML/DDXMLNode.h index 4a5b35b9..49cda6a1 100644 --- a/KissXML/DDXMLNode.h +++ b/KissXML/DDXMLNode.h @@ -160,8 +160,8 @@ enum { #pragma mark --- XPath/XQuery --- -- (NSArray *)nodesForXPath:(NSString *)xpath error:(NSError **)error; -//- (NSArray *)objectsForXQuery:(NSString *)xquery constants:(NSDictionary *)constants error:(NSError **)error; -//- (NSArray *)objectsForXQuery:(NSString *)xquery error:(NSError **)error; +- (NSArray *)nodesForXPath:(NSString *)xpath error:(NSError * __autoreleasing*)error; +//- (NSArray *)objectsForXQuery:(NSString *)xquery constants:(NSDictionary *)constants error:(NSError * __autoreleasing*)error; +//- (NSArray *)objectsForXQuery:(NSString *)xquery error:(NSError * __autoreleasing*)error; @end diff --git a/KissXML/DDXMLNode.m b/KissXML/DDXMLNode.m index a2cbabcd..df7028a2 100644 --- a/KissXML/DDXMLNode.m +++ b/KissXML/DDXMLNode.m @@ -1025,7 +1025,7 @@ - (NSString *)URI return nil; } -+ (void)getHasPrefix:(BOOL *)hasPrefixPtr localName:(NSString **)localNamePtr forName:(NSString *)name ++ (void)getHasPrefix:(BOOL *)hasPrefixPtr localName:(NSString * __autoreleasing*)localNamePtr forName:(NSString *)name { // This is a private/internal method @@ -1051,7 +1051,7 @@ + (void)getHasPrefix:(BOOL *)hasPrefixPtr localName:(NSString **)localNamePtr fo } } -+ (void)getPrefix:(NSString **)prefixPtr localName:(NSString **)localNamePtr forName:(NSString *)name ++ (void)getPrefix:(NSString * __autoreleasing*)prefixPtr localName:(NSString * __autoreleasing*)localNamePtr forName:(NSString *)name { // This is a private/internal method @@ -1194,7 +1194,7 @@ - (NSString *)XMLStringWithOptions:(NSUInteger)options #pragma mark XPath/XQuery //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -- (NSArray *)nodesForXPath:(NSString *)xpath error:(NSError **)error +- (NSArray *)nodesForXPath:(NSString *)xpath error:(NSError * __autoreleasing*)error { #if DDXML_DEBUG_MEMORY_ISSUES DDXMLNotZombieAssert(); @@ -2890,14 +2890,14 @@ - (NSString *)canonicalXMLStringPreservingComments:(BOOL)comments { // #pragma mark XPath/XQuery -- (NSArray *)nodesForXPath:(NSString *)xpath error:(NSError **)error { +- (NSArray *)nodesForXPath:(NSString *)xpath error:(NSError * __autoreleasing*)error { return [NSArray array]; } -- (NSArray *)objectsForXQuery:(NSString *)xquery constants:(NSDictionary *)constants error:(NSError **)error { +- (NSArray *)objectsForXQuery:(NSString *)xquery constants:(NSDictionary *)constants error:(NSError * __autoreleasing*)error { return [NSArray array]; } -- (NSArray *)objectsForXQuery:(NSString *)xquery error:(NSError **)error { +- (NSArray *)objectsForXQuery:(NSString *)xquery error:(NSError * __autoreleasing*)error { return [NSArray array]; } diff --git a/KissXML/Private/DDXMLPrivate.h b/KissXML/Private/DDXMLPrivate.h index 252ec40c..aa8551a7 100644 --- a/KissXML/Private/DDXMLPrivate.h +++ b/KissXML/Private/DDXMLPrivate.h @@ -178,8 +178,8 @@ NS_INLINE BOOL IsXmlNsPtr(void *kindPtr) - (BOOL)_hasParent; -+ (void)getHasPrefix:(BOOL *)hasPrefixPtr localName:(NSString **)localNamePtr forName:(NSString *)name; -+ (void)getPrefix:(NSString **)prefixPtr localName:(NSString **)localNamePtr forName:(NSString *)name; ++ (void)getHasPrefix:(BOOL *)hasPrefixPtr localName:(NSString * __autoreleasing*)localNamePtr forName:(NSString *)name; ++ (void)getPrefix:(NSString * __autoreleasing*)prefixPtr localName:(NSString * __autoreleasing*)localNamePtr forName:(NSString *)name; + (void)recursiveStripDocPointersFromNode:(xmlNodePtr)node; From 0dc599767999cfa307adfc1ccf8ab24b9dc2057c Mon Sep 17 00:00:00 2001 From: Jean-Charles BERTIN Date: Thu, 19 May 2016 12:39:56 +0200 Subject: [PATCH 3/3] Fixed warning about declaration shadowing a local variable when compiling with -Wshadow. --- KissXML/DDXMLElement.m | 1 - 1 file changed, 1 deletion(-) diff --git a/KissXML/DDXMLElement.m b/KissXML/DDXMLElement.m index 14f5cc42..35409ee6 100644 --- a/KissXML/DDXMLElement.m +++ b/KissXML/DDXMLElement.m @@ -247,7 +247,6 @@ - (NSArray *)elementsForLocalName:(NSString *)localName URI:(NSString *)uri } else { - NSString *prefix; NSString *realLocalName; [DDXMLNode getPrefix:&prefix localName:&realLocalName forName:localName];