Commits

Ivan Vučica  committed fcd83e6

Fixed clang warnings by replacing nil with NULL in some places (e.g. where error argument is a pointer to a pointer). Fixed handling non-textfield cells.

  • Participants
  • Parent commits 323212b

Comments (0)

Files changed (2)

File OPML/OPMLOutline+ViewRelated.m

     if(!item)
     {
         // own child count
-        return [[[self bodyNode] nodesForXPath:@"./outline" error:nil] count];
+        return [[[self bodyNode] nodesForXPath:@"./outline" error:NULL] count];
     }
     
     if([item isKindOfClass:[OPMLOutlineXMLElement class]])
             {
                 // no url? it's not an inclusion.
                 // just return the number of locally-stored children.
-                return [[xmlItem nodesForXPath:@"./outline" error:nil] count];
+                return [[xmlItem nodesForXPath:@"./outline" error:NULL] count];
             }
             // otherwise load the outline, assign it to the
             // node, and return the number of children in included outline.
             else
             {
                 // we have not loaded the outline ok, so return local children
-                return [[xmlItem nodesForXPath:@"./outline" error:nil] count];
+                return [[xmlItem nodesForXPath:@"./outline" error:NULL] count];
             }
         }
         else
         #if !GNUSTEP
             return [xmlItem childCount];
         #else
-            return [[xmlItem nodesForXPath:@"./outline" error:nil] count];
+            return [[xmlItem nodesForXPath:@"./outline" error:NULL] count];
         #endif
         }
     }
     if(!item)
     {
         // root body node
-        return [[[self bodyNode] nodesForXPath:@"./outline" error:nil] objectAtIndex:index];
+        return [[[self bodyNode] nodesForXPath:@"./outline" error:NULL] objectAtIndex:index];
     }
     
     if([item isKindOfClass:[OPMLOutlineXMLElement class]])
         if(includedOutline) // ask outline about its root node's child
             return [includedOutline outlineView:outlineView child:index ofItem:nil];
         
-        return [[xmlItem nodesForXPath:@"./outline" error:nil] objectAtIndex:index];
+        return [[xmlItem nodesForXPath:@"./outline" error:NULL] objectAtIndex:index];
     }
     
     return nil;
     
     NSInteger rowId = [outlineView rowForItem:item];
     NSTableColumn * column = [[outlineView tableColumns] objectAtIndex:0];
-    NSTextFieldCell * cell = [column dataCellForRow:rowId];
-    
+    NSTextFieldCell * cell = (NSTextFieldCell*)[column dataCellForRow:rowId];
+    if(![cell isKindOfClass:[NSTextFieldCell class]])
+    {
+        return 17;
+    }
+
     CGFloat extraPixels = 10;
     
     CGFloat availableWidth = [[outlineView superview] frame].size.width - indentation - cell.image.size.width - extraPixels;
     NSDictionary * attributes = nil;
     if([[cell attributedStringValue] length] > 0)
     {
-        attributes = [[cell attributedStringValue] attributesAtIndex:0 effectiveRange:nil];
+        attributes = [[cell attributedStringValue] attributesAtIndex:0 effectiveRange:NULL];
     }
     
     /////////////////////

File OPML/OPMLOutline.m

                                  
                                  nil];
     
-    self = [super initWithXMLString:defaultContent options:0 error:nil];
+    self = [super initWithXMLString:defaultContent options:0 error:NULL];
     if(!self)
         return nil;
 
-    NSArray *opmlNodes = [self nodesForXPath:@"./opml" error:nil];
+    NSArray *opmlNodes = [self nodesForXPath:@"./opml" error:NULL];
 
     _xmlDocument = self;
     [self setOpmlRoot:[opmlNodes objectAtIndex:0]];
     if(!self)
         return nil;
     
-    NSArray *opmlNodes = [doc nodesForXPath:@"./opml" error:nil];
+    NSArray *opmlNodes = [doc nodesForXPath:@"./opml" error:NULL];
     if([opmlNodes count] == 0)
     {
         NSDictionary * desc;
 -(void)_debug_printOutlineElementClasses
 {
     NSLog(@"debug");
-    //for(NSXMLElement * element in [[self bodyNode] nodesForXPath:@"./outline" error:nil])
-    NSEnumerator *e = [[[self bodyNode] nodesForXPath:@"./outline" error:nil] objectEnumerator];
+    //for(NSXMLElement * element in [[self bodyNode] nodesForXPath:@"./outline" error:NULL])
+    NSEnumerator *e = [[[self bodyNode] nodesForXPath:@"./outline" error:NULL] objectEnumerator];
     for(NSXMLElement * element = [e nextObject]; element; element = [e nextObject])
     {
         NSLog(@"element class: %@", [element class]);
         NSData * data = [NSData dataWithContentsOfURL:url];
         [[NSNotificationCenter defaultCenter] postNotificationName:kOPMLOutlineInclusionLoadingEndedNotification object:self userInfo:nil];
         
-        OPMLOutline * o = [[[OPMLOutline alloc] initWithOPMLData:data error:nil] autorelease];
+        OPMLOutline * o = [[[OPMLOutline alloc] initWithOPMLData:data error:NULL] autorelease];
         if(o)
         {
             [_includedOutlines setValue:o forKey:[url absoluteString]];
 {
     NSArray * headNodes;
     
-    headNodes = [_opmlRoot nodesForXPath:@"./head" error:nil];
+    headNodes = [_opmlRoot nodesForXPath:@"./head" error:NULL];
     if([headNodes count] == 0)
     {
         return nil;
 {
     NSArray * bodyNodes;
     
-    bodyNodes = [_opmlRoot nodesForXPath:@"./body" error:nil];
+    bodyNodes = [_opmlRoot nodesForXPath:@"./body" error:NULL];
     if([bodyNodes count] == 0)
     {
         return nil;
     NSInteger top, bottom, left, right;
     NSArray *windowTopNodes, *windowBottomNodes, *windowLeftNodes, *windowRightNodes;
     
-    windowTopNodes = [[self headNode] nodesForXPath:@"./windowTop" error:nil];
-    windowBottomNodes = [[self headNode] nodesForXPath:@"./windowBottom" error:nil];
-    windowLeftNodes = [[self headNode] nodesForXPath:@"./windowLeft" error:nil];
-    windowRightNodes = [[self headNode] nodesForXPath:@"./windowRight" error:nil];
+    windowTopNodes = [[self headNode] nodesForXPath:@"./windowTop" error:NULL];
+    windowBottomNodes = [[self headNode] nodesForXPath:@"./windowBottom" error:NULL];
+    windowLeftNodes = [[self headNode] nodesForXPath:@"./windowLeft" error:NULL];
+    windowRightNodes = [[self headNode] nodesForXPath:@"./windowRight" error:NULL];
     
     top = [windowTopNodes count] ? [[[windowTopNodes objectAtIndex:0] stringValue] intValue] : 0;
     bottom = [windowBottomNodes count] ? [[[windowBottomNodes objectAtIndex:0] stringValue] intValue] : 0;
     right = [NSString stringWithFormat:@"%d", (int)windowContentFrame.origin.x + (int)windowContentFrame.size.width];    
     bottom = [NSString stringWithFormat:@"%d", (int)windowContentFrame.origin.y + (int)windowContentFrame.size.height];
     
-    windowTopNodes = [[self headNode] nodesForXPath:@"./windowTop" error:nil];
-    windowBottomNodes = [[self headNode] nodesForXPath:@"./windowBottom" error:nil];
-    windowLeftNodes = [[self headNode] nodesForXPath:@"./windowLeft" error:nil];
-    windowRightNodes = [[self headNode] nodesForXPath:@"./windowRight" error:nil];
+    windowTopNodes = [[self headNode] nodesForXPath:@"./windowTop" error:NULL];
+    windowBottomNodes = [[self headNode] nodesForXPath:@"./windowBottom" error:NULL];
+    windowLeftNodes = [[self headNode] nodesForXPath:@"./windowLeft" error:NULL];
+    windowRightNodes = [[self headNode] nodesForXPath:@"./windowRight" error:NULL];
 
     
     
 
 - (NSString*) documentAttributeValueForKey:(NSString*)nodeName
 {
-    NSArray * attributeNodes = [[self headNode] nodesForXPath:[NSString stringWithFormat:@"./%@", nodeName] error:nil];
+    NSArray * attributeNodes = [[self headNode] nodesForXPath:[NSString stringWithFormat:@"./%@", nodeName] error:NULL];
     NSString * attribute = [attributeNodes count] ? [[attributeNodes objectAtIndex:0] stringValue] : @"";
     return attribute ? attribute : @"";
 }
 - (void) setDocumentAttributeValue:(NSString*)aString forKey:(NSString*)nodeName
 {
-    NSArray * attributeNodes = [[self headNode] nodesForXPath:[NSString stringWithFormat:@"./%@", nodeName] error:nil];
+    NSArray * attributeNodes = [[self headNode] nodesForXPath:[NSString stringWithFormat:@"./%@", nodeName] error:NULL];
     if([attributeNodes count] == 0)
     {
         [[self headNode] addChild:[NSXMLElement elementWithName:nodeName stringValue:aString]];