Add casts to avoid compiler warnings bout type of method

This commit is contained in:
Richard Frith-Macdonald 2020-04-15 10:40:41 +01:00
parent 09e9354f08
commit 132729e6e0
3 changed files with 13 additions and 9 deletions

View file

@ -115,7 +115,8 @@ static SEL objSel;
{
NSUInteger count = map.nodeCount;
SEL sel = @selector(encodeObject:);
id (*imp)(id,SEL,id) = [aCoder methodForSelector: sel];
id (*imp)(id,SEL,id)
= (id (*)(id,SEL,id))[aCoder methodForSelector: sel];
GSIMapEnumerator_t enumerator = GSIMapEnumeratorForMap(&map);
GSIMapNode node = GSIMapEnumeratorNextNode(&enumerator);
@ -152,7 +153,8 @@ static SEL objSel;
id key;
id value;
SEL sel = @selector(decodeValueOfObjCType:at:);
void (*imp)(id,SEL,const char*,void*) = [aCoder methodForSelector: sel];
void (*imp)(id,SEL,const char*,void*)
= (void (*)(id,SEL,const char*,void*))[aCoder methodForSelector: sel];
const char *type = @encode(id);
[aCoder decodeValueOfObjCType: @encode(NSUInteger)
@ -220,8 +222,9 @@ static SEL objSel;
if (c > 0)
{
NSEnumerator *e = [other keyEnumerator];
id (*nxtObj)(id, SEL) = [e methodForSelector: nxtSel];
id (*otherObj)(id, SEL, id) = [other methodForSelector: objSel];
id (*nxtObj)(id, SEL) = (id (*)(id,SEL))[e methodForSelector: nxtSel];
id (*otherObj)(id, SEL, id)
= (id (*)(id,SEL,id))[other methodForSelector: objSel];
BOOL isProxy = [other isProxy];
NSUInteger i;
@ -293,7 +296,8 @@ static SEL objSel;
{
GSIMapEnumerator_t enumerator;
GSIMapNode node;
id (*otherObj)(id, SEL, id) = [other methodForSelector: objSel];
id (*otherObj)(id, SEL, id)
= (id (*)(id,SEL,id))[other methodForSelector: objSel];
enumerator = GSIMapEnumeratorForMap(&map);
while ((node = GSIMapEnumeratorNextNode(&enumerator)) != 0)

View file

@ -104,7 +104,7 @@
*/
static Class NSString_class;
static Class treeClass;
static id (*usImp)(id, SEL, const char*);
static id (*usImp)(id, SEL, const unsigned char*);
static SEL usSel;
static xmlExternalEntityLoader originalLoader = NULL;
@ -166,8 +166,8 @@ setupCache()
xmlDefaultSAXHandlerInit();
NSString_class = [NSString class];
usSel = @selector(stringWithUTF8String:);
usImp = (id (*)(id, SEL, const char*))
[NSString_class methodForSelector: usSel];
usImp = (id (*)(id, SEL, const unsigned char*))
[NSString_class methodForSelector: usSel];
treeClass = [GSTreeSAXHandler class];
}
}

View file

@ -53,7 +53,7 @@ BOOL GSDebugSet(NSString *level)
{
[[NSProcessInfo processInfo] debugSet];
}
debugImp = [_debug_set methodForSelector: debugSel];
debugImp = (id (*)(id,SEL,id))[_debug_set methodForSelector: debugSel];
if (debugImp == 0)
{
fprintf(stderr, "Unable to set up with [NSProcessInfo-debugSet]\n");