Various minor issues exposed by Clang static analyzer, and associated cleanup.
git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@4733 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
11619ea6fa
commit
fe5ac693dd
@ -51,14 +51,6 @@ MA 02110-1301, USA.
|
|||||||
// Callback method
|
// Callback method
|
||||||
- (void) updateFunction: (NSDictionary *)hwDict;
|
- (void) updateFunction: (NSDictionary *)hwDict;
|
||||||
|
|
||||||
// internal methods
|
|
||||||
- (void) removeFunction: (int)selFunctionIdx;
|
|
||||||
- (NSArray *)getStickFunctionList;
|
|
||||||
- (void)displayFunctionList: (GuiDisplayGen *)gui
|
|
||||||
skip: (unsigned) skip;
|
|
||||||
- (NSString *)describeStickDict: (NSDictionary *)stickDict;
|
|
||||||
- (NSString *)hwToString: (int)hwFlags;
|
|
||||||
|
|
||||||
// Future: populate via plist
|
// Future: populate via plist
|
||||||
- (NSDictionary *)makeStickGuiDict: (NSString *)what
|
- (NSDictionary *)makeStickGuiDict: (NSString *)what
|
||||||
allowable: (int)allowable
|
allowable: (int)allowable
|
||||||
|
@ -29,6 +29,18 @@ MA 02110-1301, USA.
|
|||||||
#import "OOCollectionExtractors.h"
|
#import "OOCollectionExtractors.h"
|
||||||
|
|
||||||
|
|
||||||
|
@interface PlayerEntity (StickMapperInternal)
|
||||||
|
|
||||||
|
- (void) removeFunction: (int)selFunctionIdx;
|
||||||
|
- (NSArray *)stickFunctionList;
|
||||||
|
- (void)displayFunctionList: (GuiDisplayGen *)gui
|
||||||
|
skip: (unsigned) skip;
|
||||||
|
- (NSString *)describeStickDict: (NSDictionary *)stickDict;
|
||||||
|
- (NSString *)hwToString: (int)hwFlags;
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
@implementation PlayerEntity (StickMapper)
|
@implementation PlayerEntity (StickMapper)
|
||||||
|
|
||||||
- (void) setGuiToStickMapperScreen:(unsigned)skip
|
- (void) setGuiToStickMapperScreen:(unsigned)skip
|
||||||
@ -256,7 +268,7 @@ MA 02110-1301, USA.
|
|||||||
|
|
||||||
if(!stickFunctions)
|
if(!stickFunctions)
|
||||||
{
|
{
|
||||||
stickFunctions = [self getStickFunctionList];
|
stickFunctions = [[self stickFunctionList] retain];
|
||||||
}
|
}
|
||||||
NSDictionary *assignedAxes = [stickHandler axisFunctions];
|
NSDictionary *assignedAxes = [stickHandler axisFunctions];
|
||||||
NSDictionary *assignedButs = [stickHandler buttonFunctions];
|
NSDictionary *assignedButs = [stickHandler buttonFunctions];
|
||||||
@ -405,9 +417,9 @@ MA 02110-1301, USA.
|
|||||||
|
|
||||||
// TODO: This data could be put into a plist (i18n or just modifiable by
|
// TODO: This data could be put into a plist (i18n or just modifiable by
|
||||||
// the user). It is otherwise an ugly method, but it'll do for testing.
|
// the user). It is otherwise an ugly method, but it'll do for testing.
|
||||||
- (NSArray *)getStickFunctionList
|
- (NSArray *)stickFunctionList
|
||||||
{
|
{
|
||||||
NSMutableArray *funcList=[[NSMutableArray alloc] init];
|
NSMutableArray *funcList = [NSMutableArray array];
|
||||||
|
|
||||||
[funcList addObject:
|
[funcList addObject:
|
||||||
[self makeStickGuiDict:DESC(@"stickmapper-roll")
|
[self makeStickGuiDict:DESC(@"stickmapper-roll")
|
||||||
@ -548,7 +560,8 @@ MA 02110-1301, USA.
|
|||||||
axisfn:(int)axisfn
|
axisfn:(int)axisfn
|
||||||
butfn:(int)butfn
|
butfn:(int)butfn
|
||||||
{
|
{
|
||||||
NSMutableDictionary *guiDict=[[NSMutableDictionary alloc] init];
|
NSMutableDictionary *guiDict = [NSMutableDictionary dictionary];
|
||||||
|
|
||||||
if ([what length] > 30) what = [[what substringToIndex:28] stringByAppendingString:@"..."];
|
if ([what length] > 30) what = [[what substringToIndex:28] stringByAppendingString:@"..."];
|
||||||
[guiDict setObject: what forKey: KEY_GUIDESC];
|
[guiDict setObject: what forKey: KEY_GUIDESC];
|
||||||
[guiDict setObject: [NSNumber numberWithInt: allowable]
|
[guiDict setObject: [NSNumber numberWithInt: allowable]
|
||||||
|
@ -4998,21 +4998,8 @@ NSComparisonResult ComparePlanetsBySurfaceDistance(id i1, id i2, void* context)
|
|||||||
OOPlanetEntity* e1 = i1;
|
OOPlanetEntity* e1 = i1;
|
||||||
OOPlanetEntity* e2 = i2;
|
OOPlanetEntity* e2 = i2;
|
||||||
|
|
||||||
#if OBSOLETE
|
|
||||||
//fx: empirical value used to help determine proximity when non-nested planets are close to each other
|
|
||||||
float fx=1.35;
|
|
||||||
float r;
|
|
||||||
|
|
||||||
float p1 = magnitude2(vector_subtract([e1 position], p));
|
|
||||||
float p2 = magnitude2(vector_subtract([e2 position], p));
|
|
||||||
r = [e1 radius];
|
|
||||||
p1 -= fx*r*r;
|
|
||||||
r = [e2 radius];
|
|
||||||
p2 -= fx*r*r;
|
|
||||||
#else
|
|
||||||
float p1 = SurfaceDistanceSqaredV(p, e1);
|
float p1 = SurfaceDistanceSqaredV(p, e1);
|
||||||
float p2 = SurfaceDistanceSqaredV(p, e2);
|
float p2 = SurfaceDistanceSqaredV(p, e2);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (p1 < p2) return NSOrderedAscending;
|
if (p1 < p2) return NSOrderedAscending;
|
||||||
if (p1 > p2) return NSOrderedDescending;
|
if (p1 > p2) return NSOrderedDescending;
|
||||||
|
@ -85,15 +85,6 @@ enum
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) dealloc
|
|
||||||
{
|
|
||||||
/* This class can never be dealloced, but this is here to placate the
|
|
||||||
Clang Static Analyzer.
|
|
||||||
*/
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void) playMusicNamed:(NSString *)name loop:(BOOL)loop
|
- (void) playMusicNamed:(NSString *)name loop:(BOOL)loop
|
||||||
{
|
{
|
||||||
if ([self isPlaying] && [name isEqual:[self playingMusic]]) return;
|
if ([self isPlaying] && [name isEqual:[self playingMusic]]) return;
|
||||||
|
@ -273,7 +273,8 @@ SOFTWARE.
|
|||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([super init] == nil) return nil;
|
self = [super init];
|
||||||
|
if (self == nil) return nil;
|
||||||
|
|
||||||
// Note: _roles and _roleString are derived on the fly as needed.
|
// Note: _roles and _roleString are derived on the fly as needed.
|
||||||
// MKW 20090815 - if we are re-initialising this OORoleSet object, we need
|
// MKW 20090815 - if we are re-initialising this OORoleSet object, we need
|
||||||
|
@ -58,16 +58,6 @@ static NSString * const kStageName = @"Checking shipdata.plist";
|
|||||||
|
|
||||||
@implementation OOCheckShipDataPListVerifierStage
|
@implementation OOCheckShipDataPListVerifierStage
|
||||||
|
|
||||||
- (void) dealloc
|
|
||||||
{
|
|
||||||
/* This class never retains any instance variables (we can get away with
|
|
||||||
that because they're never used after returning to the caller of -run),
|
|
||||||
but this is here to placate the Clang Static Analyzer.
|
|
||||||
*/
|
|
||||||
[super dealloc];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (NSString *)name
|
- (NSString *)name
|
||||||
{
|
{
|
||||||
return kStageName;
|
return kStageName;
|
||||||
|
@ -59,7 +59,7 @@ MA 02110-1301, USA.
|
|||||||
_jsSelf = JS_NewObject(context, class, prototype, NULL);
|
_jsSelf = JS_NewObject(context, class, prototype, NULL);
|
||||||
if (_jsSelf != NULL)
|
if (_jsSelf != NULL)
|
||||||
{
|
{
|
||||||
if (!JS_SetPrivate(context, _jsSelf, [self weakRetain])) _jsSelf = NULL;
|
if (!JS_SetPrivate(context, _jsSelf, OOConsumeReference([self weakRetain]))) _jsSelf = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_jsSelf != NULL)
|
if (_jsSelf != NULL)
|
||||||
|
@ -391,9 +391,9 @@ typedef uint8_t OOEconomyID; // 0..7
|
|||||||
- (BOOL) breakPatternHide;
|
- (BOOL) breakPatternHide;
|
||||||
|
|
||||||
- (NSString *) randomShipKeyForRoleRespectingConditions:(NSString *)role;
|
- (NSString *) randomShipKeyForRoleRespectingConditions:(NSString *)role;
|
||||||
- (ShipEntity *) newShipWithRole:(NSString *)role; // Selects ship using role weights, applies auto_ai, respects conditions
|
- (ShipEntity *) newShipWithRole:(NSString *)role OO_RETURNS_RETAINED; // Selects ship using role weights, applies auto_ai, respects conditions
|
||||||
- (ShipEntity *) newShipWithName:(NSString *)shipKey; // Does not apply auto_ai or respect conditions
|
- (ShipEntity *) newShipWithName:(NSString *)shipKey OO_RETURNS_RETAINED; // Does not apply auto_ai or respect conditions
|
||||||
- (ShipEntity *) newShipWithName:(NSString *)shipKey usePlayerProxy:(BOOL)usePlayerProxy; // If usePlayerProxy, non-carriers are instantiated as ProxyPlayerEntity.
|
- (ShipEntity *) newShipWithName:(NSString *)shipKey usePlayerProxy:(BOOL)usePlayerProxy OO_RETURNS_RETAINED; // If usePlayerProxy, non-carriers are instantiated as ProxyPlayerEntity.
|
||||||
|
|
||||||
- (Class) shipClassForShipDictionary:(NSDictionary *)dict;
|
- (Class) shipClassForShipDictionary:(NSDictionary *)dict;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user