Avoid some gcc-4.1 compiler warnings.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22932 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2006-05-15 12:07:35 +00:00
parent 93f406d7fd
commit 546aa0c854
11 changed files with 49 additions and 39 deletions

View file

@ -4,6 +4,17 @@
content. content.
* Source/NSPredicate.m: Revert to previous version as last change * Source/NSPredicate.m: Revert to previous version as last change
contained broken code and wouldn't compile. contained broken code and wouldn't compile.
* Source/NSKeyValueCoding.m:
* Source/GSArray.m:
* Source/GSFFCallInvocation.m:
* Source/NSInvocation.m:
* Source/NSCoder.m:
* Source/NSObject.m:
* Source/Additions/GSCategories.m:
* Headers/Foundation/NSLock.h:
* Tools/AGSHtml.m:
* Tools/autogsdoc.m:
Use casts to avoid spurious warnings from gcc-4.1
2006-05-15 Fred Kiefer <FredKiefer@gmx.de> 2006-05-15 Fred Kiefer <FredKiefer@gmx.de>

View file

@ -222,7 +222,7 @@
* </example> * </example>
*/ */
#define GS_INITIALIZED_LOCK(IDENT,CLASSNAME) \ #define GS_INITIALIZED_LOCK(IDENT,CLASSNAME) \
(IDENT != nil ? IDENT : [CLASSNAME newLockAt: &IDENT]) (IDENT != nil ? (id)IDENT : (id)[CLASSNAME newLockAt: &IDENT])
/** /**
* Defines the <code>newLockAt:</code> method. * Defines the <code>newLockAt:</code> method.

View file

@ -992,7 +992,7 @@ static void MD5Transform (uint32_t buf[4], uint32_t const in[16])
* Ordering objects by their address is pretty useless, * Ordering objects by their address is pretty useless,
* so subclasses should override this is some useful way. * so subclasses should override this is some useful way.
*/ */
if (self > anObject) if ((id)self > anObject)
{ {
return NSOrderedDescending; return NSOrderedDescending;
} }

View file

@ -19,7 +19,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
$Date$ $Revision$ $Date$ $Revision$
*/ */
@ -121,9 +122,9 @@ static Class GSInlineArrayClass;
+ (id) allocWithZone: (NSZone*)zone + (id) allocWithZone: (NSZone*)zone
{ {
GSArray *array = NSAllocateObject(self, 0, zone); GSArray *array = (GSArray*)NSAllocateObject(self, 0, zone);
return array; return (id)array;
} }
- (id) copyWithZone: (NSZone*)zone - (id) copyWithZone: (NSZone*)zone

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
*/ */
#include "Foundation/NSException.h" #include "Foundation/NSException.h"
#include "Foundation/NSCoder.h" #include "Foundation/NSCoder.h"
@ -684,8 +685,8 @@ GSFFCallInvokeWithTargetAndImp(NSInvocation *_inv, id anObject, IMP imp)
{ {
GSMethod method; GSMethod method;
method = GSGetMethod((GSObjCIsInstance(_target) method = GSGetMethod((GSObjCIsInstance(_target)
? GSObjCClass(_target) ? (id)GSObjCClass(_target)
: _target), : (id)_target),
_selector, _selector,
GSObjCIsInstance(_target), GSObjCIsInstance(_target),
YES); YES);

View file

@ -123,8 +123,9 @@
- (void) encodePropertyList: (id)plist - (void) encodePropertyList: (id)plist
{ {
id anObject = plist ? [NSSerializer serializePropertyList: plist] : nil; id anObject;
anObject = plist ? (id)[NSSerializer serializePropertyList: plist] : nil;
[self encodeValueOfObjCType: @encode(id) at: &anObject]; [self encodeValueOfObjCType: @encode(id) at: &anObject];
} }

View file

@ -19,7 +19,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSInvocation class reference</title> <title>NSInvocation class reference</title>
$Date$ $Revision$ $Date$ $Revision$
@ -602,8 +603,8 @@ _arg_addr(NSInvocation *inv, int index)
{ {
GSMethod method; GSMethod method;
method = GSGetMethod((GSObjCIsInstance(_target) method = GSGetMethod((GSObjCIsInstance(_target)
? GSObjCClass(_target) ? (id)GSObjCClass(_target)
: _target), : (id)_target),
_selector, _selector,
GSObjCIsInstance(_target), GSObjCIsInstance(_target),
YES); YES);

View file

@ -217,11 +217,9 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
- (id) handleQueryWithUnboundKey: (NSString*)aKey - (id) handleQueryWithUnboundKey: (NSString*)aKey
{ {
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
self, self, @"NSTargetObjectUserInfoKey",
@"NSTargetObjectUserInfoKey", (aKey ? (id)aKey : (id)@"(nil)"), @"NSUnknownUserInfoKey",
(aKey ? aKey : @"(nil)"), nil];
@"NSUnknownUserInfoKey",
nil];
NSException *exp = [NSException exceptionWithName: NSUndefinedKeyException NSException *exp = [NSException exceptionWithName: NSUndefinedKeyException
reason: @"Unable to find value for key" reason: @"Unable to find value for key"
userInfo: dict]; userInfo: dict];
@ -235,11 +233,9 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
- (void) handleTakeValue: (id)anObject forUnboundKey: (NSString*)aKey - (void) handleTakeValue: (id)anObject forUnboundKey: (NSString*)aKey
{ {
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys: NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
(anObject ? anObject : @"(nil)"), (anObject ? (id)anObject : (id)@"(nil)"), @"NSTargetObjectUserInfoKey",
@"NSTargetObjectUserInfoKey", (aKey ? (id)aKey : (id)@"(nil)"), @"NSUnknownUserInfoKey",
(aKey ? aKey : @"(nil)"), nil];
@"NSUnknownUserInfoKey",
nil];
NSException *exp = [NSException exceptionWithName: NSUndefinedKeyException NSException *exp = [NSException exceptionWithName: NSUndefinedKeyException
reason: @"Unable to set value for key" reason: @"Unable to set value for key"
userInfo: dict]; userInfo: dict];
@ -345,11 +341,9 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
} }
dict = [NSDictionary dictionaryWithObjectsAndKeys: dict = [NSDictionary dictionaryWithObjectsAndKeys:
(anObject ? anObject : @"(nil)"), (anObject ? (id)anObject : (id)@"(nil)"), @"NSTargetObjectUserInfoKey",
@"NSTargetObjectUserInfoKey", (aKey ? (id)aKey : (id)@"(nil)"), @"NSUnknownUserInfoKey",
(aKey ? aKey : @"(nil)"), nil];
@"NSUnknownUserInfoKey",
nil];
exp = [NSException exceptionWithName: NSInvalidArgumentException exp = [NSException exceptionWithName: NSInvalidArgumentException
reason: @"Unable to set nil value for key" reason: @"Unable to set nil value for key"
userInfo: dict]; userInfo: dict];
@ -801,11 +795,9 @@ static id ValueForKey(NSObject *self, const char *key, unsigned size)
return [self handleQueryWithUnboundKey: aKey]; return [self handleQueryWithUnboundKey: aKey];
} }
dict = [NSDictionary dictionaryWithObjectsAndKeys: dict = [NSDictionary dictionaryWithObjectsAndKeys:
self, self, @"NSTargetObjectUserInfoKey",
@"NSTargetObjectUserInfoKey", (aKey ? (id)aKey : (id)@"(nil)"), @"NSUnknownUserInfoKey",
(aKey ? aKey : @"(nil)"), nil];
@"NSUnknownUserInfoKey",
nil];
exp = [NSException exceptionWithName: NSUndefinedKeyException exp = [NSException exceptionWithName: NSUndefinedKeyException
reason: @"Unable to find value for key" reason: @"Unable to find value for key"
userInfo: dict]; userInfo: dict];

View file

@ -18,7 +18,8 @@
You should have received a copy of the GNU Library General Public You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free License along with this library; if not, write to the Free
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02111 USA.
<title>NSObject class reference</title> <title>NSObject class reference</title>
$Date$ $Revision$ $Date$ $Revision$
@ -1388,8 +1389,9 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
format: @"%@ null selector given", NSStringFromSelector(_cmd)]; format: @"%@ null selector given", NSStringFromSelector(_cmd)];
mth = GSGetMethod(self, aSelector, YES, YES); mth = GSGetMethod(self, aSelector, YES, YES);
return mth ? [NSMethodSignature signatureWithObjCTypes:mth->method_types] if (mth == 0)
: nil; return nil;
return [NSMethodSignature signatureWithObjCTypes:mth->method_types];
} }
/** /**
@ -2075,8 +2077,9 @@ GSDescriptionForClassMethod(pcl self, SEL aSel)
format: @"%@ null selector given", NSStringFromSelector(_cmd)]; format: @"%@ null selector given", NSStringFromSelector(_cmd)];
mth = GSGetMethod(self, aSelector, YES, YES); mth = GSGetMethod(self, aSelector, YES, YES);
return mth ? [NSMethodSignature signatureWithObjCTypes:mth->method_types] if (mth == 0)
: nil; return nil;
return [NSMethodSignature signatureWithObjCTypes:mth->method_types];
} }
- (IMP) methodFor: (SEL)aSel - (IMP) methodFor: (SEL)aSel

View file

@ -2290,7 +2290,7 @@ static NSString *mainFont = nil;
{ {
NSArray *a; NSArray *a;
NSMutableString *ivarBuf = ivarsAtEnd ? NSMutableString *ivarBuf = ivarsAtEnd ?
[NSMutableString stringWithCapacity: 1024] : nil; (id)[NSMutableString stringWithCapacity: 1024] : nil;
NSDictionary *prop = [node attributes]; NSDictionary *prop = [node attributes];
node = [node firstChildElement]; node = [node firstChildElement];

View file

@ -2203,7 +2203,7 @@ main(int argc, char **argv, char **env)
{ {
NSLog(@"Replace %@ with %@", NSLog(@"Replace %@ with %@",
[s substringWithRange: replace], [s substringWithRange: replace],
repstr ? repstr : @"self"); repstr ? (id)repstr : (id)@"self");
} }
if (repstr != nil) if (repstr != nil)
{ {