mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-23 00:41:02 +00:00
selector comparison fixes
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35336 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c58ccdb72c
commit
99dfb5b7da
3 changed files with 45 additions and 20 deletions
|
@ -1,3 +1,10 @@
|
|||
2012-08-02 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/GSValue.m: ([-isEqualToValue:]) add check for self equality
|
||||
and fix error checking tyep signature.
|
||||
* Source/Additions/GSObjCRuntime.m: (GSSelectorTypesMatch) fix to
|
||||
return a true BOOL value.
|
||||
|
||||
2012-07-31 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/Additions/GSMime.m: Optimisations for chunked encoding.
|
||||
|
|
|
@ -653,8 +653,13 @@ GS_EXPORT BOOL
|
|||
GSSelectorTypesMatch(const char *types1, const char *types2)
|
||||
{
|
||||
if (! types1 || ! types2)
|
||||
return NO;
|
||||
|
||||
{
|
||||
return NO; // Nul pointers never match
|
||||
}
|
||||
if (types1 == types2)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
while (*types1 && *types2)
|
||||
{
|
||||
types1 = GSSkipTypeQualifierAndLayoutInfo (types1);
|
||||
|
@ -662,21 +667,27 @@ GSSelectorTypesMatch(const char *types1, const char *types2)
|
|||
|
||||
/* Reached the end of the selector. */
|
||||
if (! *types1 && ! *types2)
|
||||
return YES;
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
/* Ignore structure name yet compare layout. */
|
||||
if (*types1 == '{' && *types2 == '{')
|
||||
{
|
||||
while (*types1 != '=' && *types1 != '}')
|
||||
types1++;
|
||||
|
||||
{
|
||||
types1++;
|
||||
}
|
||||
while (*types2 != '=' && *types2 != '}')
|
||||
types2++;
|
||||
{
|
||||
types2++;
|
||||
}
|
||||
}
|
||||
|
||||
if (*types1 != *types2)
|
||||
return NO;
|
||||
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
types1++;
|
||||
types2++;
|
||||
}
|
||||
|
@ -684,7 +695,7 @@ GSSelectorTypesMatch(const char *types1, const char *types2)
|
|||
types1 = GSSkipTypeQualifierAndLayoutInfo (types1);
|
||||
types2 = GSSkipTypeQualifierAndLayoutInfo (types2);
|
||||
|
||||
return (! *types1 && ! *types2);
|
||||
return (! *types1 && ! *types2) ? YES : NO;
|
||||
}
|
||||
|
||||
/* See header for documentation. */
|
||||
|
|
|
@ -155,20 +155,27 @@ typeSize(const char* type)
|
|||
|
||||
- (BOOL) isEqualToValue: (NSValue*)aValue
|
||||
{
|
||||
if (aValue == nil)
|
||||
return NO;
|
||||
if (object_getClass(aValue) != object_getClass(self))
|
||||
return NO;
|
||||
if (GSSelectorTypesMatch(objctype, ((GSValue*)aValue)->objctype))
|
||||
return NO;
|
||||
else
|
||||
if (aValue == self)
|
||||
{
|
||||
unsigned size = (unsigned)typeSize(objctype);
|
||||
|
||||
if (memcmp(((GSValue*)aValue)->data, data, size) != 0)
|
||||
return NO;
|
||||
return YES;
|
||||
}
|
||||
if (aValue == nil)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
if (object_getClass(aValue) != object_getClass(self))
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
if (!GSSelectorTypesMatch(objctype, ((GSValue*)aValue)->objctype))
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
if (memcmp(((GSValue*)aValue)->data, data, typeSize(objctype)) != 0)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (const char *)objCType
|
||||
|
|
Loading…
Reference in a new issue