Fixed a bunch of Clang static analyzer issues.
As part of this, -[ShipEntity newMissile] was renamed to -selectMissile, because the "new" prefix conventionally indicates a method that returns a new object which is not autoreleased (as in -[Universe newShipWithRole:]). Also introduced a bunch of annoying but technically correct "potential leak" issues. (These all refer to cases where an object is weakRetained and passed to JS_SetPrivate(). They aren't actual leaks, but they don't follow normal OpenStep retain/release behaviour.)" git-svn-id: http://svn.berlios.de/svnroot/repos/oolite-linux/trunk@2996 127b21dd-08f5-0310-b4b7-95ae10353056
This commit is contained in:
parent
c89ffe7eca
commit
68c919aab4
@ -54,7 +54,7 @@ MA 02110-1301, USA.
|
||||
double cor8k, lim8k;
|
||||
double cor16k, lim16k;
|
||||
|
||||
Vector rotationAxis;
|
||||
// Vector rotationAxis;
|
||||
|
||||
double corona_speed_factor; // multiply delta_t by this before adding it to corona_stage
|
||||
double corona_stage; // 0.0 -> 1.0
|
||||
|
@ -431,7 +431,7 @@ MA 02110-1301, USA.
|
||||
- (unsigned) equipmentCount;
|
||||
- (void) removeEquipmentItem:(NSString *)equipmentKey;
|
||||
- (void) removeAllEquipment;
|
||||
- (OOEquipmentType *) newMissile;
|
||||
- (OOEquipmentType *) selectMissile;
|
||||
- (int) removeMissiles;
|
||||
|
||||
// Internal, subject to change. Use the methods above instead.
|
||||
|
@ -474,8 +474,8 @@ static GLfloat calcFuelChargeRate (GLfloat my_mass, GLfloat base_mass)
|
||||
BOOL missilesProblem = NO;
|
||||
for (i = 0, j = 0; i < missiles; i++)
|
||||
{
|
||||
missile_list[i] = [self newMissile];
|
||||
// could loop forever (if missile_role is badly defined, newMissile might return nil in some cases) . Try 3 times, and if no luck, skip
|
||||
missile_list[i] = [self selectMissile];
|
||||
// could loop forever (if missile_role is badly defined, selectMissile might return nil in some cases) . Try 3 times, and if no luck, skip
|
||||
if (missile_list[i] == nil && j < 3)
|
||||
{
|
||||
j++;
|
||||
@ -2396,7 +2396,7 @@ ShipEntity* doOctreesCollide(ShipEntity* prime, ShipEntity* other)
|
||||
}
|
||||
|
||||
|
||||
- (OOEquipmentType *) newMissile
|
||||
- (OOEquipmentType *) selectMissile
|
||||
{
|
||||
ShipEntity *missile = nil;
|
||||
OOEquipmentType *missileType = nil;
|
||||
|
@ -91,13 +91,14 @@ This code is hereby placed in the public domain.
|
||||
*/
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "OOFunctionAttributes.h"
|
||||
|
||||
@class OOWeakReference;
|
||||
|
||||
|
||||
@protocol OOWeakReferenceSupport <NSObject>
|
||||
|
||||
- (id)weakRetain; // Returns a retained OOWeakReference, which should be released when finished with.
|
||||
- (id)weakRetain OO_RETURNS_RETAINED; // Returns a retained OOWeakReference, which should be released when finished with.
|
||||
- (void)weakRefDied:(OOWeakReference *)weakRef;
|
||||
|
||||
@end
|
||||
|
@ -1645,8 +1645,8 @@ static JSBool ShipSelectNewMissile(JSContext *context, JSObject *this, uintN arg
|
||||
|
||||
if (JSShipGetShipEntity(context, this, &thisEnt)) // valid ship.
|
||||
{
|
||||
result = [[thisEnt newMissile] identifier];
|
||||
// if there's a badly defined missile, newMissile may be nil
|
||||
result = [[thisEnt selectMissile] identifier];
|
||||
// if there's a badly defined missile, selectMissile may return nil
|
||||
if (result == nil) result = @"EQ_MISSILE";
|
||||
}
|
||||
|
||||
|
@ -1259,9 +1259,6 @@ GLfloat docked_light_specular[4] = { DOCKED_ILLUM_LEVEL, DOCKED_ILLUM_LEVEL, DOC
|
||||
NSAutoreleasePool *pool = nil;
|
||||
NSDictionary *systeminfo = nil;
|
||||
BOOL sunGoneNova;
|
||||
OOTechLevelID techlevel;
|
||||
OOGovernmentID government;
|
||||
OOEconomyID economy;
|
||||
unsigned thargoidChance;
|
||||
Vector lastPiratePosition = kZeroVector;
|
||||
unsigned wolfPackCounter = 0;
|
||||
@ -1269,9 +1266,9 @@ GLfloat docked_light_specular[4] = { DOCKED_ILLUM_LEVEL, DOCKED_ILLUM_LEVEL, DOC
|
||||
systeminfo = [self generateSystemData:system_seed];
|
||||
sunGoneNova = [systeminfo oo_boolForKey:@"sun_gone_nova"];
|
||||
|
||||
techlevel = [systeminfo oo_unsignedCharForKey:KEY_TECHLEVEL]; // 0 .. 13
|
||||
government = [systeminfo oo_unsignedCharForKey:KEY_GOVERNMENT]; // 0 .. 7 (0 anarchic .. 7 most stable)
|
||||
economy = [systeminfo oo_unsignedCharForKey:KEY_ECONOMY]; // 0 .. 7 (0 richest .. 7 poorest)
|
||||
// OOTechLevelID techlevel = [systeminfo oo_unsignedCharForKey:KEY_TECHLEVEL]; // 0 .. 13
|
||||
OOGovernmentID government = [systeminfo oo_unsignedCharForKey:KEY_GOVERNMENT]; // 0 .. 7 (0 anarchic .. 7 most stable)
|
||||
OOEconomyID economy = [systeminfo oo_unsignedCharForKey:KEY_ECONOMY]; // 0 .. 7 (0 richest .. 7 poorest)
|
||||
|
||||
thargoidChance = (system_seed.e < 127) ? 10 : 3; // if Human Colonials live here, there's a greater % chance the Thargoids will attack!
|
||||
|
||||
@ -2567,12 +2564,10 @@ GLfloat docked_light_specular[4] = { DOCKED_ILLUM_LEVEL, DOCKED_ILLUM_LEVEL, DOC
|
||||
NSMutableArray *ships = [NSMutableArray arrayWithCapacity:count]; //return [[(NSArray *)theShips copy] autorelease];
|
||||
ShipEntity *ship = nil;
|
||||
Entity<OOStellarBody> *entity = nil;
|
||||
Vector pos, direction, point0, point1;
|
||||
Vector pos = kZeroVector, direction = kZeroVector, point0 = kZeroVector, point1 = kZeroVector;
|
||||
double radius = 0;
|
||||
|
||||
pos = direction = point0 = point1 = kZeroVector;
|
||||
|
||||
if (routeFraction != NSNotFound && ([route isEqualTo:@"pw"] || [route isEqualTo:@"sw"] || [route isEqualTo:@"ps"]))
|
||||
if (routeFraction != NSNotFound && ([route isEqualToString:@"pw"] || [route isEqualToString:@"sw"] || [route isEqualToString:@"ps"]))
|
||||
{
|
||||
routeFraction = 1.0f - routeFraction;
|
||||
}
|
||||
@ -8522,6 +8517,13 @@ static OOComparisonResult comparePrice(id dict1, id dict2, void * context)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
- (void *) suppressClangStuff
|
||||
{
|
||||
return _preloadingPlanetMaterials;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user