mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-28 11:10:51 +00:00
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:
parent
92ae73861f
commit
ad0ba98491
6 changed files with 67 additions and 44 deletions
|
@ -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:
|
||||||
|
|
|
@ -4616,15 +4616,18 @@ NSAssert(_flags.owned == 1 && _zone != 0, NSInternalInconsistencyException);
|
||||||
|
|
||||||
if (encoding == internalEncoding)
|
if (encoding == internalEncoding)
|
||||||
{
|
{
|
||||||
if (shouldFree == YES)
|
if (0 != chars)
|
||||||
{
|
|
||||||
_zone = NSZoneFromPointer(chars);
|
|
||||||
_contents.c = chars;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
_contents.c = NSZoneMalloc(_zone, length);
|
if (shouldFree == YES)
|
||||||
memcpy(_contents.c, chars, length);
|
{
|
||||||
|
_zone = NSZoneFromPointer(chars);
|
||||||
|
_contents.c = chars;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_contents.c = NSZoneMalloc(_zone, length);
|
||||||
|
memcpy(_contents.c, chars, length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_count = length;
|
_count = length;
|
||||||
_flags.wide = 0;
|
_flags.wide = 0;
|
||||||
|
@ -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,44 +5609,52 @@ literalIsEqual(NXConstantString *self, id anObject)
|
||||||
range.location = NSNotFound;
|
range.location = NSNotFound;
|
||||||
range.length = 0;
|
range.length = 0;
|
||||||
|
|
||||||
mImp = (BOOL(*)(id,SEL,unichar))
|
if (stop > start)
|
||||||
[aSet methodForSelector: @selector(characterIsMember:)];
|
|
||||||
|
|
||||||
for (index = 0; index < start; index++)
|
|
||||||
{
|
{
|
||||||
nextUTF8((const uint8_t *)nxcsptr, nxcslen, &i, &n);
|
BOOL (*mImp)(id, SEL, unichar);
|
||||||
}
|
unichar n = 0;
|
||||||
if ((mask & NSBackwardsSearch) == NSBackwardsSearch)
|
unsigned i = 0;
|
||||||
{
|
|
||||||
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;
|
if ((mask & NSBackwardsSearch) == NSBackwardsSearch)
|
||||||
while (index-- > 0)
|
|
||||||
{
|
{
|
||||||
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);
|
buf[pos] = nextUTF8((const uint8_t *)nxcsptr, nxcslen, &i, &n);
|
||||||
break;
|
}
|
||||||
|
index = stop;
|
||||||
|
while (index-- > 0)
|
||||||
|
{
|
||||||
|
if ((*mImp)(aSet, @selector(characterIsMember:), buf[--pos]))
|
||||||
|
{
|
||||||
|
range = NSMakeRange(index, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
|
||||||
{
|
|
||||||
while (index < stop)
|
|
||||||
{
|
{
|
||||||
unichar letter = nextUTF8((const uint8_t *)nxcsptr, nxcslen, &i, &n);
|
while (index < stop)
|
||||||
|
|
||||||
if ((*mImp)(aSet, @selector(characterIsMember:), letter))
|
|
||||||
{
|
{
|
||||||
range = NSMakeRange(index, 1);
|
unichar letter;
|
||||||
break;
|
|
||||||
|
letter = nextUTF8((const uint8_t *)nxcsptr, nxcslen, &i, &n);
|
||||||
|
if ((*mImp)(aSet, @selector(characterIsMember:), letter))
|
||||||
|
{
|
||||||
|
range = NSMakeRange(index, 1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
index++;
|
||||||
}
|
}
|
||||||
index++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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];
|
||||||
|
|
||||||
|
|
|
@ -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];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue