Index: Source/CFRuntime.c =================================================================== --- Source/CFRuntime.c (revision 36708) +++ Source/CFRuntime.c (working copy) @@ -329,8 +329,6 @@ { CFRuntimeClass *cls; - CF_OBJC_FUNCDISPATCH0(CFGetTypeID(cf), CFHashCode, cf, "hash"); - cls = __CFRuntimeClassTable[CFGetTypeID(cf)]; if (cls->hash) return cls->hash (cf); Index: Source/CFString.c =================================================================== --- Source/CFString.c (revision 36700) +++ Source/CFString.c (working copy) @@ -189,14 +189,40 @@ CFStringHash (CFTypeRef cf) { CFStringRef str = (CFStringRef) cf; - if (str->_hash == 0) + UniChar *buf; + CFIndex len; + Boolean isObjc; + CFHashCode hash; + + isObjc = CF_IS_OBJC (_kCFStringTypeID, str); + + if (!isObjc) { - CFIndex len = CFStringGetLength (str) * - (CFStringIsUnicode (str) ? sizeof (UniChar) : sizeof (char)); - ((struct __CFString *) str)->_hash = GSHashBytes (str->_contents, len); + if (str->_hash == 0) + { + if (CFStringIsUnicode (str)) + { + len = CFStringGetLength (str) * sizeof (UniChar); + ((struct __CFString *) str)->_hash = GSHashBytes (str->_contents, len); + return str->_hash; + } + } + else + return str->_hash; } - return str->_hash; + len = CFStringGetLength (str) * sizeof (UniChar); + + buf = CFAllocatorAllocate(kCFAllocatorSystemDefault, len+2, 0); + CFStringGetCharacters (str, CFRangeMake(0, len/2), buf); + buf[len] = 0; + + hash = GSHashBytes (buf, len); + if (!isObjc) + ((struct __CFString *) str)->_hash = hash; + + CFAllocatorDeallocate(kCFAllocatorSystemDefault, buf); + return hash; } static CFStringRef