Revert/fix handling of -isEqualToString: for proxies and subclasses.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31018 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2010-07-22 06:06:39 +00:00
parent 6f7bc142f2
commit 37ae0eb8f1
2 changed files with 17 additions and 14 deletions

View file

@ -1,3 +1,17 @@
2010-07-22 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSString.m: Change to use ([-isKindOfClass:]) in a couple
of places. Revert David's last change entirely ... in the svn log
he said: 'Do the same stupid thing Apple does (return NO), rather
than the stupid thing we were doing (segfault), when passing a proxy
as the argument to [NSString isEqualToString:]', but this comment
seems to be almost entirely wrong as:
1. we don't segfault (on my machines ... perhaps we do on other
systems but if so we should find the underlying bug and fix it)
2. Apple (OSX Snow Leopard) doesn't behave that way ... the testsuite
(NSProxy test00.m) shows it behaving the saem way as GNUstep.
3. The change also broke string subclasses (bug #30511)
2010-07-19 Niels Grewe <niels.grewe@halbordnung.de>
* Source/ObjectiveC2/runtime.c:

View file

@ -653,7 +653,7 @@ handle_printf_atsign (FILE *stream,
return obj;
}
}
else if (GSObjCIsKindOf(self, GSStringClass) == YES)
else if ([self isKindOfClass: GSStringClass] == YES)
{
[NSException raise: NSInternalInconsistencyException
format: @"Called +allocWithZone: on private string class"];
@ -2158,14 +2158,9 @@ handle_printf_atsign (FILE *stream,
}
if (anObject != nil && GSObjCIsInstance(anObject) == YES)
{
Class c = object_getClass(anObject);
if (c != nil)
if ([anObject isKindOfClass: NSStringClass])
{
if (GSObjCIsKindOf(c, NSStringClass))
{
return [self isEqualToString: anObject];
}
return [self isEqualToString: anObject];
}
}
return NO;
@ -2180,12 +2175,6 @@ handle_printf_atsign (FILE *stream,
if ([self hash] != [aString hash])
return NO;
// Note: This is entirely wrong, stupid, and breaks the spirit of
// Objective-C. Unfortunately, it's What Apple Does, so we are stuck with
// it.
if ([aString isProxy] || ![aString isKindOfClass: [self class]])
return NO;
if (strCompNsNs(self, aString, 0, (NSRange){0, [self length]})
== NSOrderedSame)
return YES;