bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug #28158] NSMutableDictionary is broken for lookup using GSUnicodeInl


From: Doug Simons
Subject: [bug #28158] NSMutableDictionary is broken for lookup using GSUnicodeInlineString key
Date: Fri, 04 Dec 2009 22:55:27 +0000
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_2; en-us) AppleWebKit/531.21.8 (KHTML, like Gecko) Version/4.0.4 Safari/531.21.10

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/





reply via email to

[Prev in Thread] Current Thread [Next in Thread]