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>
* configure.ac:

View file

@ -4616,15 +4616,18 @@ NSAssert(_flags.owned == 1 && _zone != 0, NSInternalInconsistencyException);
if (encoding == internalEncoding)
{
if (shouldFree == YES)
{
_zone = NSZoneFromPointer(chars);
_contents.c = chars;
}
else
if (0 != chars)
{
_contents.c = NSZoneMalloc(_zone, length);
memcpy(_contents.c, chars, length);
if (shouldFree == YES)
{
_zone = NSZoneFromPointer(chars);
_contents.c = chars;
}
else
{
_contents.c = NSZoneMalloc(_zone, length);
memcpy(_contents.c, chars, length);
}
}
_count = length;
_flags.wide = 0;
@ -5595,9 +5598,6 @@ literalIsEqual(NXConstantString *self, id anObject)
NSUInteger start;
NSUInteger stop;
NSRange range;
BOOL (*mImp)(id, SEL, unichar);
unichar n = 0;
unsigned i = 0;
BOOL ascii;
index = lengthUTF8((const uint8_t*)nxcsptr, nxcslen, &ascii, 0);
@ -5609,44 +5609,52 @@ literalIsEqual(NXConstantString *self, id anObject)
range.location = NSNotFound;
range.length = 0;
mImp = (BOOL(*)(id,SEL,unichar))
[aSet methodForSelector: @selector(characterIsMember:)];
if (stop > start)
{
BOOL (*mImp)(id, SEL, unichar);
unichar n = 0;
unsigned i = 0;
for (index = 0; index < start; index++)
{
nextUTF8((const uint8_t *)nxcsptr, nxcslen, &i, &n);
}
if ((mask & NSBackwardsSearch) == NSBackwardsSearch)
{
unichar buf[stop - start];
NSUInteger pos = 0;
for (pos = 0; pos + start < stop; pos++)
mImp = (BOOL(*)(id,SEL,unichar))
[aSet methodForSelector: @selector(characterIsMember:)];
for (index = 0; index < start; index++)
{
buf[pos] = nextUTF8((const uint8_t *)nxcsptr, nxcslen, &i, &n);
nextUTF8((const uint8_t *)nxcsptr, nxcslen, &i, &n);
}
index = stop;
while (index-- > 0)
if ((mask & NSBackwardsSearch) == NSBackwardsSearch)
{
if ((*mImp)(aSet, @selector(characterIsMember:), buf[--pos]))
unichar buf[stop - start];
NSUInteger pos = 0;
for (pos = 0; pos + start < stop; pos++)
{
range = NSMakeRange(index, 1);
break;
buf[pos] = nextUTF8((const uint8_t *)nxcsptr, nxcslen, &i, &n);
}
index = stop;
while (index-- > 0)
{
if ((*mImp)(aSet, @selector(characterIsMember:), buf[--pos]))
{
range = NSMakeRange(index, 1);
break;
}
}
}
}
else
{
while (index < stop)
else
{
unichar letter = nextUTF8((const uint8_t *)nxcsptr, nxcslen, &i, &n);
if ((*mImp)(aSet, @selector(characterIsMember:), letter))
while (index < stop)
{
range = NSMakeRange(index, 1);
break;
unichar letter;
letter = nextUTF8((const uint8_t *)nxcsptr, nxcslen, &i, &n);
if ((*mImp)(aSet, @selector(characterIsMember:), letter))
{
range = NSMakeRange(index, 1);
break;
}
index++;
}
index++;
}
}

View file

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

View file

@ -2141,6 +2141,10 @@ static NSLock *cached_proxies_gate = nil;
break;
}
}
else
{
datum = 0;
}
[inv setReturnValue: datum];
/* 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;
const char *type = NULL;
int off;
int off = 0;
const char *name;
char key[size + 1];
char buf[size + 5];
@ -711,6 +711,7 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
name = buf; // _setKey:
type = NULL;
off = 0;
sel = sel_getUid(name);
if (sel == 0 || [self respondsToSelector: sel] == NO)
{
@ -802,7 +803,7 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
{
SEL sel = 0;
const char *type = 0;
int off;
int off = 0;
unsigned size = [aKey length] * 8;
char key[size + 1];

View file

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