avoid a few warnings

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34665 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2012-01-30 11:31:40 +00:00
parent 92ae73861f
commit ad0ba98491
6 changed files with 67 additions and 44 deletions

View file

@ -1,3 +1,12 @@
2012-01-30 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSKeyValueCoding.m:
* Source/NSAffineTransform.m:
* Source/NSNotificationCenter.m:
* Source/NSConnection.m:
* Source/GSString.m:
Avoid a few static analyser warnings.
2012-01-29 Richard Frith-Macdonald <rfm@gnu.org> 2012-01-29 Richard Frith-Macdonald <rfm@gnu.org>
* configure.ac: * configure.ac:

View file

@ -4615,6 +4615,8 @@ NSAssert(_flags.owned == 1 && _zone != 0, NSInternalInconsistencyException);
} }
if (encoding == internalEncoding) if (encoding == internalEncoding)
{
if (0 != chars)
{ {
if (shouldFree == YES) if (shouldFree == YES)
{ {
@ -4626,6 +4628,7 @@ NSAssert(_flags.owned == 1 && _zone != 0, NSInternalInconsistencyException);
_contents.c = NSZoneMalloc(_zone, length); _contents.c = NSZoneMalloc(_zone, length);
memcpy(_contents.c, chars, length); memcpy(_contents.c, chars, length);
} }
}
_count = length; _count = length;
_flags.wide = 0; _flags.wide = 0;
return self; return self;
@ -5595,9 +5598,6 @@ literalIsEqual(NXConstantString *self, id anObject)
NSUInteger start; NSUInteger start;
NSUInteger stop; NSUInteger stop;
NSRange range; NSRange range;
BOOL (*mImp)(id, SEL, unichar);
unichar n = 0;
unsigned i = 0;
BOOL ascii; BOOL ascii;
index = lengthUTF8((const uint8_t*)nxcsptr, nxcslen, &ascii, 0); index = lengthUTF8((const uint8_t*)nxcsptr, nxcslen, &ascii, 0);
@ -5609,6 +5609,12 @@ literalIsEqual(NXConstantString *self, id anObject)
range.location = NSNotFound; range.location = NSNotFound;
range.length = 0; range.length = 0;
if (stop > start)
{
BOOL (*mImp)(id, SEL, unichar);
unichar n = 0;
unsigned i = 0;
mImp = (BOOL(*)(id,SEL,unichar)) mImp = (BOOL(*)(id,SEL,unichar))
[aSet methodForSelector: @selector(characterIsMember:)]; [aSet methodForSelector: @selector(characterIsMember:)];
@ -5639,8 +5645,9 @@ literalIsEqual(NXConstantString *self, id anObject)
{ {
while (index < stop) while (index < stop)
{ {
unichar letter = nextUTF8((const uint8_t *)nxcsptr, nxcslen, &i, &n); unichar letter;
letter = nextUTF8((const uint8_t *)nxcsptr, nxcslen, &i, &n);
if ((*mImp)(aSet, @selector(characterIsMember:), letter)) if ((*mImp)(aSet, @selector(characterIsMember:), letter))
{ {
range = NSMakeRange(index, 1); range = NSMakeRange(index, 1);
@ -5649,6 +5656,7 @@ literalIsEqual(NXConstantString *self, id anObject)
index++; index++;
} }
} }
}
return range; return range;
} }

View file

@ -594,6 +594,7 @@ static NSAffineTransformStruct identityTransform = {
if ([aCoder allowsKeyedCoding]) if ([aCoder allowsKeyedCoding])
{ {
// FIXME // FIXME
return [self notImplemented: _cmd];
/* /*
NSData *data = [aCoder decodeObjectForKey: @"NSTransformStruct"]; NSData *data = [aCoder decodeObjectForKey: @"NSTransformStruct"];
unsigned int cursor = 0; unsigned int cursor = 0;

View file

@ -2141,6 +2141,10 @@ static NSLock *cached_proxies_gate = nil;
break; break;
} }
} }
else
{
datum = 0;
}
[inv setReturnValue: datum]; [inv setReturnValue: datum];
/* Decode the values returned by reference. Note: this logic /* Decode the values returned by reference. Note: this logic

View file

@ -604,7 +604,7 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
{ {
SEL sel = 0; SEL sel = 0;
const char *type = NULL; const char *type = NULL;
int off; int off = 0;
const char *name; const char *name;
char key[size + 1]; char key[size + 1];
char buf[size + 5]; char buf[size + 5];
@ -711,6 +711,7 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
name = buf; // _setKey: name = buf; // _setKey:
type = NULL; type = NULL;
off = 0;
sel = sel_getUid(name); sel = sel_getUid(name);
if (sel == 0 || [self respondsToSelector: sel] == NO) if (sel == 0 || [self respondsToSelector: sel] == NO)
{ {
@ -802,7 +803,7 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
{ {
SEL sel = 0; SEL sel = 0;
const char *type = 0; const char *type = 0;
int off; int off = 0;
unsigned size = [aKey length] * 8; unsigned size = [aKey length] * 8;
char key[size + 1]; char key[size + 1];

View file

@ -1276,9 +1276,9 @@ static NSNotificationCenter *default_center = nil;
GSNotification *notification; GSNotification *notification;
notification = (id)NSAllocateObject(concrete, 0, NSDefaultMallocZone()); notification = (id)NSAllocateObject(concrete, 0, NSDefaultMallocZone());
name = notification->_name = [name copyWithZone: [self zone]]; notification->_name = [name copyWithZone: [self zone]];
object = notification->_object = TEST_RETAIN(object); notification->_object = [object retain];
notification->_info = TEST_RETAIN(info); notification->_info = [info retain];
[self _postAndRelease: notification]; [self _postAndRelease: notification];
} }