mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
tweaks to avoid clang warnings
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31293 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
d317aab108
commit
8177a34a8f
5 changed files with 52 additions and 51 deletions
|
@ -11,6 +11,11 @@
|
|||
* Source/ObjectiveC2/runtime.c: Fix class_getMethodImplementation()
|
||||
and class_getMethodImplementation_stret() so that they don't cause
|
||||
a crash when used with proxies.
|
||||
* Source/NSKeyValueCoding.m:
|
||||
* Source/cifframe.m:
|
||||
* Source/Additions/GSLock.m:
|
||||
* Source/NSDate.m:
|
||||
Tweaks to avoid clang static analyser warnings.
|
||||
|
||||
2010-09-09 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
|
@ -26,7 +31,7 @@
|
|||
|
||||
* Source/unix/GSRunLoopCtxt.m: only access array if port responds
|
||||
to selector, or it is not initialized
|
||||
* Source/NSDate.m,
|
||||
* Source/NSDate.m:
|
||||
* Source/NSScanner.m: use init return value
|
||||
|
||||
2010-09-09 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
|
|
@ -87,17 +87,14 @@
|
|||
DESTROY(self);
|
||||
self = [NSLock new];
|
||||
}
|
||||
else
|
||||
else if (self != nil)
|
||||
{
|
||||
if (self != nil)
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(_becomeThreaded:)
|
||||
name: NSWillBecomeMultiThreadedNotification
|
||||
object: nil];
|
||||
}
|
||||
locked = NO;
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver: self
|
||||
selector: @selector(_becomeThreaded:)
|
||||
name: NSWillBecomeMultiThreadedNotification
|
||||
object: nil];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
|
|
@ -469,7 +469,8 @@ otherTime(NSDate* other)
|
|||
modYear += adjective;
|
||||
hadYear = YES;
|
||||
}
|
||||
else if ([tmp caseInsensitiveCompare: mname] == NSOrderedSame)
|
||||
else if (mname != nil
|
||||
&& [tmp caseInsensitiveCompare: mname] == NSOrderedSame)
|
||||
{
|
||||
modMonth += adjective;
|
||||
hadMonth = YES;
|
||||
|
@ -1158,9 +1159,9 @@ otherTime(NSDate* other)
|
|||
NSString *s;
|
||||
NSCalendarDate *d = [calendarClass alloc];
|
||||
d = [d initWithTimeIntervalSinceReferenceDate: otherTime(self)];
|
||||
s = [d description];
|
||||
s = [[d description] retain];
|
||||
RELEASE(d);
|
||||
return s;
|
||||
return [s autorelease];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1184,9 +1185,9 @@ otherTime(NSDate* other)
|
|||
if (aTimeZone)
|
||||
[d setTimeZone: aTimeZone];
|
||||
|
||||
s = [d descriptionWithCalendarFormat: f locale: l];
|
||||
s = [[d descriptionWithCalendarFormat: f locale: l] retain];
|
||||
RELEASE(d);
|
||||
return s;
|
||||
return [s autorelease];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1199,9 +1200,9 @@ otherTime(NSDate* other)
|
|||
NSString *s;
|
||||
NSCalendarDate *d = [calendarClass alloc];
|
||||
d = [d initWithTimeIntervalSinceReferenceDate: otherTime(self)];
|
||||
s = [d descriptionWithLocale: locale];
|
||||
s = [[d descriptionWithLocale: locale] retain];
|
||||
RELEASE(d);
|
||||
return s;
|
||||
return [s autorelease];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -82,7 +82,7 @@ SetValueForKey(NSObject *self, id anObject, const char *key, unsigned size)
|
|||
{
|
||||
SEL sel = 0;
|
||||
const char *type = 0;
|
||||
int off;
|
||||
int off = 0;
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
|
@ -153,7 +153,7 @@ SetValueForKey(NSObject *self, id anObject, const char *key, unsigned size)
|
|||
static id ValueForKey(NSObject *self, const char *key, unsigned size)
|
||||
{
|
||||
SEL sel = 0;
|
||||
int off;
|
||||
int off = 0;
|
||||
const char *type = NULL;
|
||||
|
||||
if (size > 0)
|
||||
|
@ -218,11 +218,11 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
|
|||
buf[2] = 'i';
|
||||
buf[1] = '_';
|
||||
name = &buf[1]; // _isKey
|
||||
if (GSObjCFindVariable(self, name, &type, &size, &off) == NO)
|
||||
if (!GSObjCFindVariable(self, name, &type, &size, &off))
|
||||
{
|
||||
buf[4] = lo;
|
||||
name = &buf[4]; // key
|
||||
if (GSObjCFindVariable(self, name, &type, &size, &off) == NO)
|
||||
if (!GSObjCFindVariable(self, name, &type, &size, &off))
|
||||
{
|
||||
buf[4] = hi;
|
||||
buf[3] = 's';
|
||||
|
|
|
@ -190,37 +190,35 @@ cifframe_from_signature (NSMethodSignature *info)
|
|||
cframe->arg_types = buf + type_offset;
|
||||
memcpy(cframe->arg_types, arg_types, sizeof(ffi_type *) * numargs);
|
||||
cframe->values = buf + offset;
|
||||
|
||||
if (ffi_prep_cif (&cframe->cif, FFI_DEFAULT_ABI, cframe->nargs,
|
||||
rtype, cframe->arg_types) != FFI_OK)
|
||||
{
|
||||
cframe = NULL;
|
||||
result = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set values locations. This must be done after ffi_prep_cif so
|
||||
that any structure sizes get calculated first. */
|
||||
offset += numargs * sizeof(void*);
|
||||
if (offset % align != 0)
|
||||
{
|
||||
offset += align - (offset % align);
|
||||
}
|
||||
for (i = 0; i < cframe->nargs; i++)
|
||||
{
|
||||
cframe->values[i] = buf + offset;
|
||||
|
||||
offset += arg_types[i]->size;
|
||||
|
||||
if (offset % align != 0)
|
||||
{
|
||||
offset += (align - offset % align);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ffi_prep_cif (&cframe->cif, FFI_DEFAULT_ABI, cframe->nargs,
|
||||
rtype, cframe->arg_types) != FFI_OK)
|
||||
{
|
||||
cframe = NULL;
|
||||
result = NULL;
|
||||
}
|
||||
|
||||
if (cframe)
|
||||
{
|
||||
/* Set values locations. This must be done after ffi_prep_cif so
|
||||
that any structure sizes get calculated first. */
|
||||
offset += numargs * sizeof(void*);
|
||||
if (offset % align != 0)
|
||||
{
|
||||
offset += align - (offset % align);
|
||||
}
|
||||
for (i = 0; i < cframe->nargs; i++)
|
||||
{
|
||||
cframe->values[i] = buf + offset;
|
||||
|
||||
offset += arg_types[i]->size;
|
||||
|
||||
if (offset % align != 0)
|
||||
{
|
||||
offset += (align - offset % align);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue