Fixed some problems reported by the CLANG static analyzer.
authorsnej@snej.local
Tue Mar 10 22:36:23 2009 -0700 (2009-03-10)
changeset 27b0affce7beb1
parent 26 e7a464fb6d39
child 28 06160a812d43
Fixed some problems reported by the CLANG static analyzer.
GeekGameBoard.xcodeproj/project.pbxproj
Source/GGBLayer.m
Source/GGBUtils.m
Source/GoGame.m
Source/Grid.m
Source/HexGrid.m
     1.1 --- a/GeekGameBoard.xcodeproj/project.pbxproj	Sun Jan 11 00:02:27 2009 -0800
     1.2 +++ b/GeekGameBoard.xcodeproj/project.pbxproj	Tue Mar 10 22:36:23 2009 -0700
     1.3 @@ -525,6 +525,7 @@
     1.4  				GCC_C_LANGUAGE_STANDARD = gnu99;
     1.5  				GCC_ENABLE_OBJC_GC = unsupported;
     1.6  				GCC_TREAT_WARNINGS_AS_ERRORS = YES;
     1.7 +				GCC_VERSION = 4.2;
     1.8  				GCC_WARN_ABOUT_RETURN_TYPE = YES;
     1.9  				GCC_WARN_UNUSED_VARIABLE = YES;
    1.10  				PREBINDING = NO;
    1.11 @@ -543,6 +544,7 @@
    1.12  				GCC_C_LANGUAGE_STANDARD = gnu99;
    1.13  				GCC_ENABLE_OBJC_GC = unsupported;
    1.14  				GCC_TREAT_WARNINGS_AS_ERRORS = YES;
    1.15 +				GCC_VERSION = 4.2;
    1.16  				GCC_WARN_ABOUT_RETURN_TYPE = YES;
    1.17  				GCC_WARN_UNUSED_VARIABLE = YES;
    1.18  				PREBINDING = NO;
     2.1 --- a/Source/GGBLayer.m	Sun Jan 11 00:02:27 2009 -0800
     2.2 +++ b/Source/GGBLayer.m	Tue Mar 10 22:36:23 2009 -0700
     2.3 @@ -50,7 +50,7 @@
     2.4      anim.duration= duration;
     2.5      anim.fromValue = from;
     2.6      anim.toValue = to;
     2.7 -    anim.isRemovedOnCompletion = YES;
     2.8 +    anim.removedOnCompletion = YES;
     2.9      anim.delegate = self;
    2.10      [self addAnimation:anim forKey: @"animateAndBlock:"];
    2.11      _curAnimation = (id)[self animationForKey: @"animateAndBlock:"];
     3.1 --- a/Source/GGBUtils.m	Sun Jan 11 00:02:27 2009 -0800
     3.2 +++ b/Source/GGBUtils.m	Tue Mar 10 22:36:23 2009 -0700
     3.3 @@ -34,7 +34,7 @@
     3.4  void setObjCopy( id<NSCopying> *variable, id<NSCopying> newValue )
     3.5  {
     3.6      if( *variable != newValue ) {
     3.7 -        [*variable release];
     3.8 +        [(id)*variable release];
     3.9          *variable = [(id)newValue copy];
    3.10      }
    3.11  }
     4.1 --- a/Source/GoGame.m	Sun Jan 11 00:02:27 2009 -0800
     4.2 +++ b/Source/GoGame.m	Tue Mar 10 22:36:23 2009 -0700
     4.3 @@ -38,7 +38,8 @@
     4.4  {
     4.5      static GridCoord const sSpots[10]={ { 3,3}, { 3,9}, { 3,15},
     4.6                                          { 9,3}, { 9,9}, { 9,15},
     4.7 -                                        {15,3}, {15,9}, {15,15}, {NSNotFound,NSNotFound} };
     4.8 +                                        {15,3}, {15,9}, {15,15}, 
     4.9 +                                        {(unsigned)NSNotFound,(unsigned)NSNotFound} };
    4.10      return sSpots;
    4.11  }
    4.12  
    4.13 @@ -74,7 +75,7 @@
    4.14      board.usesDiagonals = board.allowsMoves = board.allowsCaptures = NO;
    4.15      [board addAllCells];
    4.16      const GridCoord *spots = [[self class] spotCoords];
    4.17 -    for( int i=0; spots[i].row!=NSNotFound; i++ )
    4.18 +    for( int i=0; spots[i].row!=(unsigned)NSNotFound; i++ )
    4.19          ((GoSquare*)[board cellAtRow: spots[i].row column: spots[i].col]).dotted = YES;
    4.20      [_table addSublayer: board];
    4.21      [board release];
    4.22 @@ -270,7 +271,8 @@
    4.23  + (int) dimensions          {return 9;}
    4.24  + (const GridCoord*) spotCoords
    4.25  {
    4.26 -    static GridCoord const sSpots[6]= { {2,2}, {2,6}, {4,4}, {6,2}, {6,6}, {NSNotFound,NSNotFound} };
    4.27 +    static GridCoord const sSpots[6]= { {2,2}, {2,6}, {4,4}, {6,2}, {6,6}, 
    4.28 +                                        {(unsigned)NSNotFound,(unsigned)NSNotFound} };
    4.29      return sSpots;
    4.30  }
    4.31  @end
    4.32 @@ -282,7 +284,8 @@
    4.33  + (const GridCoord*) spotCoords
    4.34  {
    4.35      static GridCoord const sSpots[6] = { { 2,2}, { 2,10}, {6,6},
    4.36 -                                         {10,2}, {10,10}, {NSNotFound,NSNotFound} };
    4.37 +                                         {10,2}, {10,10},
    4.38 +                                         {(unsigned)NSNotFound,(unsigned)NSNotFound} };
    4.39      return sSpots;
    4.40  }
    4.41  @end
     5.1 --- a/Source/Grid.m	Sun Jan 11 00:02:27 2009 -0800
     5.2 +++ b/Source/Grid.m	Tue Mar 10 22:36:23 2009 -0700
     5.3 @@ -201,7 +201,7 @@
     5.4  
     5.5  - (NSArray*) cells
     5.6  {
     5.7 -    NSMutableArray *cells = [_cells mutableCopy];
     5.8 +    NSMutableArray *cells = [[_cells mutableCopy] autorelease];
     5.9      for( int i=cells.count-1; i>=0; i-- )
    5.10          if( [cells objectAtIndex: i] == [NSNull null] )
    5.11              [cells removeObjectAtIndex: i];
     6.1 --- a/Source/HexGrid.m	Sun Jan 11 00:02:27 2009 -0800
     6.2 +++ b/Source/HexGrid.m	Tue Mar 10 22:36:23 2009 -0700
     6.3 @@ -147,7 +147,7 @@
     6.4      CGPoint pos = self.position;
     6.5      CGContextTranslateCTM(ctx, pos.x, pos.y);
     6.6      CGContextBeginPath(ctx);
     6.7 -    CGContextAddPath(ctx, ((HexGrid*)_grid).cellPath);
     6.8 +    CGContextAddPath(ctx, [(HexGrid*)_grid cellPath]);
     6.9      CGContextDrawPath(ctx, (fill ?kCGPathFill :kCGPathStroke));
    6.10      
    6.11      if( !fill && self.highlighted ) {
    6.12 @@ -155,7 +155,7 @@
    6.13          CGContextSetStrokeColorWithColor(ctx, self.borderColor);
    6.14          CGContextSetLineWidth(ctx,6);
    6.15          CGContextBeginPath(ctx);
    6.16 -        CGContextAddPath(ctx, ((HexGrid*)_grid).cellPath);
    6.17 +        CGContextAddPath(ctx, [(HexGrid*)_grid cellPath]);
    6.18          CGContextDrawPath(ctx, kCGPathStroke);
    6.19      }
    6.20      CGContextRestoreGState(ctx);
    6.21 @@ -165,7 +165,7 @@
    6.22  - (BOOL)containsPoint:(CGPoint)p
    6.23  {
    6.24      return [super containsPoint: p]
    6.25 -        && CGPathContainsPoint( ((HexGrid*)_grid).cellPath, NULL, p, NO );
    6.26 +        && CGPathContainsPoint( [(HexGrid*)_grid cellPath], NULL, p, NO );
    6.27  }
    6.28  
    6.29