mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 09:04:13 +00:00
more static analyser fixups
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@36532 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
119c9a28c2
commit
f371df09b6
8 changed files with 50 additions and 46 deletions
|
@ -30,11 +30,13 @@
|
|||
#if defined(GNUSTEP_BASE_INTERNAL)
|
||||
#import "Foundation/NSObject.h"
|
||||
#import "Foundation/NSEnumerator.h"
|
||||
#import "Foundation/NSException.h"
|
||||
#import "Foundation/NSGarbageCollector.h"
|
||||
#import "Foundation/NSZone.h"
|
||||
#else
|
||||
#import <Foundation/NSObject.h>
|
||||
#import <Foundation/NSEnumerator.h>
|
||||
#import <Foundation/NSException.h>
|
||||
#import <Foundation/NSGarbageCollector.h>
|
||||
#import <Foundation/NSZone.h>
|
||||
#endif
|
||||
|
@ -619,6 +621,10 @@ GSIMapMoreNodes(GSIMapTable map, unsigned required)
|
|||
map->freeNodes = newNodes;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[NSException raise: NSMallocException format: @"No memory for nodes"];
|
||||
}
|
||||
}
|
||||
|
||||
static INLINE GSIMapNode
|
||||
|
@ -1056,10 +1062,6 @@ GSIMapAddPairNoRetain(GSIMapTable map, GSIMapKey key, GSIMapVal value)
|
|||
{
|
||||
GSIMapMoreNodes(map, map->nodeCount < map->increment ? 0: map->increment);
|
||||
node = map->freeNodes;
|
||||
if (node == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
map->freeNodes = node->nextInBucket;
|
||||
GSI_MAP_WRITE_KEY(map, &node->key, key);
|
||||
|
@ -1079,10 +1081,6 @@ GSIMapAddPair(GSIMapTable map, GSIMapKey key, GSIMapVal value)
|
|||
{
|
||||
GSIMapMoreNodes(map, map->nodeCount < map->increment ? 0: map->increment);
|
||||
node = map->freeNodes;
|
||||
if (node == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
map->freeNodes = node->nextInBucket;
|
||||
GSI_MAP_WRITE_KEY(map, &node->key, key);
|
||||
|
@ -1104,10 +1102,6 @@ GSIMapAddKeyNoRetain(GSIMapTable map, GSIMapKey key)
|
|||
{
|
||||
GSIMapMoreNodes(map, map->nodeCount < map->increment ? 0: map->increment);
|
||||
node = map->freeNodes;
|
||||
if (node == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
map->freeNodes = node->nextInBucket;
|
||||
GSI_MAP_WRITE_KEY(map, &node->key, key);
|
||||
|
@ -1126,10 +1120,6 @@ GSIMapAddKey(GSIMapTable map, GSIMapKey key)
|
|||
{
|
||||
GSIMapMoreNodes(map, map->nodeCount < map->increment ? 0: map->increment);
|
||||
node = map->freeNodes;
|
||||
if (node == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
map->freeNodes = node->nextInBucket;
|
||||
GSI_MAP_WRITE_KEY(map, &node->key, key);
|
||||
|
|
|
@ -1317,7 +1317,6 @@ static NSMutableDictionary *credentialsCache = nil;
|
|||
}
|
||||
}
|
||||
setup = YES;
|
||||
trust = NO;
|
||||
|
||||
ca = [opts objectForKey: GSTLSCAFile];
|
||||
dca = caFile;
|
||||
|
@ -1694,13 +1693,15 @@ static NSMutableDictionary *credentialsCache = nil;
|
|||
break;
|
||||
} /* switch */
|
||||
|
||||
#if 0
|
||||
if (ecdh != 0)
|
||||
{
|
||||
[str appendFormat: _(@"- Ephemeral ECDH using curve %s\n"),
|
||||
#if 1
|
||||
"curve not available"];
|
||||
#else
|
||||
gnutls_ecc_curve_get_name(gnutls_ecc_curve_get(session))];
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if (dhe != 0)
|
||||
{
|
||||
[str appendFormat: _(@"- Ephemeral DH using prime of %d bits\n"),
|
||||
|
|
|
@ -777,9 +777,17 @@ NSDecimalPower(NSDecimal *result, const NSDecimal *n, NSUInteger power, NSRoundi
|
|||
if (e & 1)
|
||||
{
|
||||
error = NSDecimalMultiply(result, result, &n1, mode);
|
||||
if (NSCalculationNoError != error)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
// keep on squaring the number
|
||||
error = NSDecimalMultiply(&n1, &n1, &n1, mode);
|
||||
if (NSCalculationNoError != error)
|
||||
{
|
||||
break;
|
||||
}
|
||||
e >>= 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -2044,8 +2044,6 @@ static NSStringEncoding defaultEncoding;
|
|||
{
|
||||
NSDirectoryEnumerator *direnum;
|
||||
NSMutableArray *content;
|
||||
IMP nxtImp;
|
||||
IMP addImp;
|
||||
BOOL is_dir;
|
||||
|
||||
/*
|
||||
|
@ -2055,6 +2053,7 @@ static NSStringEncoding defaultEncoding;
|
|||
{
|
||||
return nil;
|
||||
}
|
||||
content = [NSMutableArray arrayWithCapacity: 128];
|
||||
/* We initialize the directory enumerator with justContents == YES,
|
||||
which tells the NSDirectoryEnumerator code that we only enumerate
|
||||
the contents non-recursively once, and exit. NSDirectoryEnumerator
|
||||
|
@ -2064,17 +2063,20 @@ static NSStringEncoding defaultEncoding;
|
|||
followSymlinks: NO
|
||||
justContents: YES
|
||||
for: self];
|
||||
content = [NSMutableArray arrayWithCapacity: 128];
|
||||
|
||||
nxtImp = [direnum methodForSelector: @selector(nextObject)];
|
||||
addImp = [content methodForSelector: @selector(addObject:)];
|
||||
|
||||
while ((path = (*nxtImp)(direnum, @selector(nextObject))) != nil)
|
||||
if (nil != direnum)
|
||||
{
|
||||
(*addImp)(content, @selector(addObject:), path);
|
||||
}
|
||||
RELEASE(direnum);
|
||||
IMP nxtImp;
|
||||
IMP addImp;
|
||||
|
||||
nxtImp = [direnum methodForSelector: @selector(nextObject)];
|
||||
addImp = [content methodForSelector: @selector(addObject:)];
|
||||
|
||||
while ((path = (*nxtImp)(direnum, @selector(nextObject))) != nil)
|
||||
{
|
||||
(*addImp)(content, @selector(addObject:), path);
|
||||
}
|
||||
RELEASE(direnum);
|
||||
}
|
||||
return [content makeImmutableCopyOnFail: NO];
|
||||
}
|
||||
|
||||
|
@ -2113,30 +2115,31 @@ static NSStringEncoding defaultEncoding;
|
|||
NSDirectoryEnumerator *direnum;
|
||||
NSMutableArray *content;
|
||||
BOOL isDir;
|
||||
IMP nxtImp;
|
||||
IMP addImp;
|
||||
|
||||
if (![self fileExistsAtPath: path isDirectory: &isDir] || !isDir)
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
content = [NSMutableArray arrayWithCapacity: 128];
|
||||
direnum = [[NSDirectoryEnumerator alloc] initWithDirectoryPath: path
|
||||
recurseIntoSubdirectories: YES
|
||||
followSymlinks: NO
|
||||
justContents: NO
|
||||
for: self];
|
||||
content = [NSMutableArray arrayWithCapacity: 128];
|
||||
|
||||
nxtImp = [direnum methodForSelector: @selector(nextObject)];
|
||||
addImp = [content methodForSelector: @selector(addObject:)];
|
||||
|
||||
while ((path = (*nxtImp)(direnum, @selector(nextObject))) != nil)
|
||||
if (nil != direnum)
|
||||
{
|
||||
(*addImp)(content, @selector(addObject:), path);
|
||||
IMP nxtImp;
|
||||
IMP addImp;
|
||||
|
||||
nxtImp = [direnum methodForSelector: @selector(nextObject)];
|
||||
addImp = [content methodForSelector: @selector(addObject:)];
|
||||
|
||||
while ((path = (*nxtImp)(direnum, @selector(nextObject))) != nil)
|
||||
{
|
||||
(*addImp)(content, @selector(addObject:), path);
|
||||
}
|
||||
RELEASE(direnum);
|
||||
}
|
||||
|
||||
RELEASE(direnum);
|
||||
|
||||
return [content makeImmutableCopyOnFail: NO];
|
||||
}
|
||||
|
||||
|
|
|
@ -443,7 +443,6 @@ static NSIndexPath *dummy = nil;
|
|||
if (NSDecrementExtraRefCountWasZero(self))
|
||||
{
|
||||
[self dealloc];
|
||||
self = nil;
|
||||
}
|
||||
[lock unlock];
|
||||
}
|
||||
|
|
|
@ -734,13 +734,12 @@ static NSRecursiveLock *classLock = nil;
|
|||
NSLocale *newLocale;
|
||||
NSString *localeId;
|
||||
#if GS_USE_ICU == 1
|
||||
int32_t length;
|
||||
char cLocaleId[ULOC_FULLNAME_CAPACITY];
|
||||
UErrorCode error = U_ZERO_ERROR;
|
||||
|
||||
localeId = [NSLocale canonicalLocaleIdentifierFromString: string];
|
||||
// Normalize locale ID
|
||||
length = uloc_canonicalize ([localeId UTF8String], cLocaleId,
|
||||
uloc_canonicalize ([localeId UTF8String], cLocaleId,
|
||||
ULOC_FULLNAME_CAPACITY, &error);
|
||||
if (U_FAILURE(error))
|
||||
{
|
||||
|
|
|
@ -844,6 +844,7 @@ static char **_gnu_noobjc_env = NULL;
|
|||
#else /* !HAVE_FUNCTION_STRERROR */
|
||||
fprintf(stderr, "Couldn't open file %s when starting gnustep-base.\n",
|
||||
proc_file_name);
|
||||
free(proc_file_name);
|
||||
#endif /* HAVE_FUNCTION_STRERROR */
|
||||
fprintf(stderr, "Your gnustep-base library is compiled for a kernel supporting the /proc filesystem, but it can't access it.\n");
|
||||
fprintf(stderr, "You should recompile or change your kernel.\n");
|
||||
|
|
|
@ -917,7 +917,6 @@ static NSURLProtocol *placeholder = nil;
|
|||
if (YES == wasInHeaders && NO == isInHeaders)
|
||||
{
|
||||
GSMimeHeader *info;
|
||||
NSString *enc;
|
||||
int len = -1;
|
||||
NSString *ct;
|
||||
NSString *st;
|
||||
|
@ -950,11 +949,15 @@ static NSURLProtocol *placeholder = nil;
|
|||
}
|
||||
|
||||
s = [info objectForKey: NSHTTPPropertyStatusReasonKey];
|
||||
|
||||
/* Should use this?
|
||||
NSString *enc;
|
||||
enc = [[document headerNamed: @"content-transfer-encoding"] value];
|
||||
if (enc == nil)
|
||||
{
|
||||
enc = [[document headerNamed: @"transfer-encoding"] value];
|
||||
}
|
||||
*/
|
||||
|
||||
info = [document headerNamed: @"content-type"];
|
||||
ct = [document contentType];
|
||||
|
|
Loading…
Reference in a new issue