Follow-up Comment #3, bug #28158 (project gnustep):
Okay, so on looking at the code again, I realized that it was simply trying
to do a straight compare of non-Unicode strings when in fact one of them was
Unicode. Here's a patch that resolves the problem (since the comparison logic
for GSMutableStrings was correct, this just eliminates the incorrect code for
GSStrings and combines the two).
I'm having trouble right now committing this in SVN myself, so I would
appreciate if someone else would...
Index: GSString.m
===================================================================
--- GSString.m (revision 29096)
+++ GSString.m (working copy)
@@ -2113,7 +2113,7 @@
return YES;
return NO;
}
- else if (c == GSMutableStringClass)
+ else if (c == GSMutableStringClass || GSObjCIsKindOf(c, GSStringClass) ==
YES)
{
GSStr other = (GSStr)anObject;
NSRange r = {0, self->_count};
@@ -2144,26 +2144,6 @@
}
return NO;
}
- else if (GSObjCIsKindOf(c, GSStringClass) == YES)
- {
- GSStr other = (GSStr)anObject;
-
- /*
- * First see if the hash is the same - if not, we can't be equal.
- */
- if (self->_flags.hash == 0)
- self->_flags.hash = (*hashImp)((id)self, hashSel);
- if (other->_flags.hash == 0)
- other->_flags.hash = (*hashImp)((id)other, hashSel);
- if (self->_flags.hash != other->_flags.hash)
- return NO;
-
- if (other->_count == self->_count
- && memcmp(other->_contents.c, self->_contents.c, self->_count) == 0)
- return YES;
-
- return NO;
- }
else if (GSObjCIsKindOf(c, NSStringClass))
{
return (*equalImp)((id)self, equalSel, anObject);
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?28158>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
_______________________________________________
Bug-gnustep mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-gnustep