# HG changeset patch # User snej@snej.local # Date 1236749783 25200 # Node ID b0affce7beb1f15fa9d626bee78be95789bc1bd3 # Parent e7a464fb6d39c224a08bbda8286b49d29beff56c Fixed some problems reported by the CLANG static analyzer. diff -r e7a464fb6d39 -r b0affce7beb1 GeekGameBoard.xcodeproj/project.pbxproj --- a/GeekGameBoard.xcodeproj/project.pbxproj Sun Jan 11 00:02:27 2009 -0800 +++ b/GeekGameBoard.xcodeproj/project.pbxproj Tue Mar 10 22:36:23 2009 -0700 @@ -525,6 +525,7 @@ GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = unsupported; GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = 4.2; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; @@ -543,6 +544,7 @@ GCC_C_LANGUAGE_STANDARD = gnu99; GCC_ENABLE_OBJC_GC = unsupported; GCC_TREAT_WARNINGS_AS_ERRORS = YES; + GCC_VERSION = 4.2; GCC_WARN_ABOUT_RETURN_TYPE = YES; GCC_WARN_UNUSED_VARIABLE = YES; PREBINDING = NO; diff -r e7a464fb6d39 -r b0affce7beb1 Source/GGBLayer.m --- a/Source/GGBLayer.m Sun Jan 11 00:02:27 2009 -0800 +++ b/Source/GGBLayer.m Tue Mar 10 22:36:23 2009 -0700 @@ -50,7 +50,7 @@ anim.duration= duration; anim.fromValue = from; anim.toValue = to; - anim.isRemovedOnCompletion = YES; + anim.removedOnCompletion = YES; anim.delegate = self; [self addAnimation:anim forKey: @"animateAndBlock:"]; _curAnimation = (id)[self animationForKey: @"animateAndBlock:"]; diff -r e7a464fb6d39 -r b0affce7beb1 Source/GGBUtils.m --- a/Source/GGBUtils.m Sun Jan 11 00:02:27 2009 -0800 +++ b/Source/GGBUtils.m Tue Mar 10 22:36:23 2009 -0700 @@ -34,7 +34,7 @@ void setObjCopy( id *variable, id newValue ) { if( *variable != newValue ) { - [*variable release]; + [(id)*variable release]; *variable = [(id)newValue copy]; } } diff -r e7a464fb6d39 -r b0affce7beb1 Source/GoGame.m --- a/Source/GoGame.m Sun Jan 11 00:02:27 2009 -0800 +++ b/Source/GoGame.m Tue Mar 10 22:36:23 2009 -0700 @@ -38,7 +38,8 @@ { static GridCoord const sSpots[10]={ { 3,3}, { 3,9}, { 3,15}, { 9,3}, { 9,9}, { 9,15}, - {15,3}, {15,9}, {15,15}, {NSNotFound,NSNotFound} }; + {15,3}, {15,9}, {15,15}, + {(unsigned)NSNotFound,(unsigned)NSNotFound} }; return sSpots; } @@ -74,7 +75,7 @@ board.usesDiagonals = board.allowsMoves = board.allowsCaptures = NO; [board addAllCells]; const GridCoord *spots = [[self class] spotCoords]; - for( int i=0; spots[i].row!=NSNotFound; i++ ) + for( int i=0; spots[i].row!=(unsigned)NSNotFound; i++ ) ((GoSquare*)[board cellAtRow: spots[i].row column: spots[i].col]).dotted = YES; [_table addSublayer: board]; [board release]; @@ -270,7 +271,8 @@ + (int) dimensions {return 9;} + (const GridCoord*) spotCoords { - static GridCoord const sSpots[6]= { {2,2}, {2,6}, {4,4}, {6,2}, {6,6}, {NSNotFound,NSNotFound} }; + static GridCoord const sSpots[6]= { {2,2}, {2,6}, {4,4}, {6,2}, {6,6}, + {(unsigned)NSNotFound,(unsigned)NSNotFound} }; return sSpots; } @end @@ -282,7 +284,8 @@ + (const GridCoord*) spotCoords { static GridCoord const sSpots[6] = { { 2,2}, { 2,10}, {6,6}, - {10,2}, {10,10}, {NSNotFound,NSNotFound} }; + {10,2}, {10,10}, + {(unsigned)NSNotFound,(unsigned)NSNotFound} }; return sSpots; } @end diff -r e7a464fb6d39 -r b0affce7beb1 Source/Grid.m --- a/Source/Grid.m Sun Jan 11 00:02:27 2009 -0800 +++ b/Source/Grid.m Tue Mar 10 22:36:23 2009 -0700 @@ -201,7 +201,7 @@ - (NSArray*) cells { - NSMutableArray *cells = [_cells mutableCopy]; + NSMutableArray *cells = [[_cells mutableCopy] autorelease]; for( int i=cells.count-1; i>=0; i-- ) if( [cells objectAtIndex: i] == [NSNull null] ) [cells removeObjectAtIndex: i]; diff -r e7a464fb6d39 -r b0affce7beb1 Source/HexGrid.m --- a/Source/HexGrid.m Sun Jan 11 00:02:27 2009 -0800 +++ b/Source/HexGrid.m Tue Mar 10 22:36:23 2009 -0700 @@ -147,7 +147,7 @@ CGPoint pos = self.position; CGContextTranslateCTM(ctx, pos.x, pos.y); CGContextBeginPath(ctx); - CGContextAddPath(ctx, ((HexGrid*)_grid).cellPath); + CGContextAddPath(ctx, [(HexGrid*)_grid cellPath]); CGContextDrawPath(ctx, (fill ?kCGPathFill :kCGPathStroke)); if( !fill && self.highlighted ) { @@ -155,7 +155,7 @@ CGContextSetStrokeColorWithColor(ctx, self.borderColor); CGContextSetLineWidth(ctx,6); CGContextBeginPath(ctx); - CGContextAddPath(ctx, ((HexGrid*)_grid).cellPath); + CGContextAddPath(ctx, [(HexGrid*)_grid cellPath]); CGContextDrawPath(ctx, kCGPathStroke); } CGContextRestoreGState(ctx); @@ -165,7 +165,7 @@ - (BOOL)containsPoint:(CGPoint)p { return [super containsPoint: p] - && CGPathContainsPoint( ((HexGrid*)_grid).cellPath, NULL, p, NO ); + && CGPathContainsPoint( [(HexGrid*)_grid cellPath], NULL, p, NO ); }