Index: src/OFString.m ================================================================== --- src/OFString.m +++ src/OFString.m @@ -1099,14 +1099,13 @@ OF_HASH_INIT(hash); for (i = 0; i < length; i++) { const of_unichar_t c = unicodeString[i]; - OF_HASH_ADD(hash, (c & 0xFF000000) >> 24); - OF_HASH_ADD(hash, (c & 0x00FF0000) >> 16); - OF_HASH_ADD(hash, (c & 0x00FF0000) >> 8); - OF_HASH_ADD(hash, c & 0xFF); + OF_HASH_ADD(hash, (c & 0xFF0000) >> 16); + OF_HASH_ADD(hash, (c & 0x00FF00) >> 8); + OF_HASH_ADD(hash, c & 0x0000FF); } OF_HASH_FINALIZE(hash); return hash; Index: tests/OFDictionaryTests.m ================================================================== --- tests/OFDictionaryTests.m +++ tests/OFDictionaryTests.m @@ -96,12 +96,15 @@ #ifdef OF_HAVE_FAST_ENUMERATION size_t i = 0; BOOL ok = YES; for (OFString *key in dict) { - if (![key isEqual: keys[i]]) + if (i > 1 || ![key isEqual: keys[1 - i]]) { ok = NO; + break; + } + [dict setObject: [dict objectForKey: key] forKey: key]; i++; } @@ -126,12 +129,16 @@ __block size_t i = 0; __block BOOL ok = YES; [dict enumerateKeysAndObjectsUsingBlock: ^ (id key, id obj, BOOL *stop) { - if (![key isEqual: keys[i]]) + if (i > 1 || ![key isEqual: keys[1 - i]]) { ok = NO; + *stop = YES; + return; + } + [dict setObject: [dict objectForKey: key] forKey: key]; i++; }]; @@ -172,11 +179,11 @@ return @"val1"; if ([key isEqual: keys[1]]) return @"val2"; return nil; - }] description] isEqual: @"{\n\tkey1 = val1;\n\tkey2 = val2;\n}"]) + }] description] isEqual: @"{\n\tkey2 = val2;\n\tkey1 = val1;\n}"]) TEST(@"-[filteredDictionaryUsingBlock:]", [[[dict filteredDictionaryUsingBlock: ^ BOOL (id key, id obj) { return ([key isEqual: keys[0]] ? YES : NO); }] description] isEqual: @"{\n\tkey1 = value_1;\n}"]) Index: tests/OFSet.m ================================================================== --- tests/OFSet.m +++ tests/OFSet.m @@ -49,11 +49,11 @@ TEST(@"-[hash]", [set1 hash] == [set2 hash]) TEST(@"-[description]", [[set1 description] - isEqual: @"{(\n\tbaz,\n\tbar,\n\tx,\n\tfoo\n)}"] && + isEqual: @"{(\n\tfoo,\n\tbaz,\n\tx,\n\tbar\n)}"] && [[set1 description] isEqual: [set2 description]]) TEST(@"-[copy]", [set1 isEqual: [[set1 copy] autorelease]]) TEST(@"-[mutableCopy]", @@ -96,23 +96,23 @@ i = 0; for (OFString *s in set1) { switch (i) { case 0: - if (![s isEqual: @"baz"]) + if (![s isEqual: @"foo"]) ok = NO; break; case 1: - if (![s isEqual: @"bar"]) + if (![s isEqual: @"baz"]) ok = NO; break; case 2: if (![s isEqual: @"x"]) ok = NO; break; case 3: - if (![s isEqual: @"foo"]) + if (![s isEqual: @"bar"]) ok = NO; break; } i++; Index: tests/OFStringTests.m ================================================================== --- tests/OFStringTests.m +++ tests/OFStringTests.m @@ -115,11 +115,11 @@ R([s[1] appendUTF8String: "1๐„ž"]) && R([s[1] appendString: @"3"]) && R([s[0] appendString: s[1]]) && [s[0] isEqual: @"tรคsโ‚ฌ1๐„ž3"]) TEST(@"-[length]", [s[0] length] == 7) TEST(@"-[UTF8StringLength]", [s[0] UTF8StringLength] == 13) - TEST(@"-[hash]", [s[0] hash] == 0x324B6743) + TEST(@"-[hash]", [s[0] hash] == 0x2E623BD1) TEST(@"-[characterAtIndex:]", [s[0] characterAtIndex: 0] == 't' && [s[0] characterAtIndex: 1] == 0xE4 && [s[0] characterAtIndex: 3] == 0x20AC && [s[0] characterAtIndex: 5] == 0x1D11E) Index: tests/serialization.xml ================================================================== --- tests/serialization.xml +++ tests/serialization.xml @@ -1,8 +1,33 @@ + + + Qu"xbar +test + 1234 + 0x1.34a456d5cfaadp+10 + asd + 0x1.34a456d5cfaadp+10 + + + + Hello + + + Blub + + + B"la + + + MDEyMzQ1Njc4OTo7PEFCQ0RFRkdISklLTE1OT1BRUlNUVVZXWFla + + + data + Hello Wo ld! How are you? @@ -47,48 +72,23 @@ - bar foo + bar + + foo + bar - - foo - list - - - Qu"xbar -test - 1234 - 0x1.34a456d5cfaadp+10 - asd - 0x1.34a456d5cfaadp+10 - - - - Hello - - - MDEyMzQ1Njc4OTo7PEFCQ0RFRkdISklLTE1OT1BRUlNUVVZXWFla - - - data - - - Blub - - - B"la -