Comment: | OFObject: Change type of -[hash] to unsigned long
The internal hash is still 32 bit in most places, but this way, it is at |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
aeb403a1ed86aa0e6461f35b1c3d2128 |
User & Date: | js on 2020-10-10 14:27:37 |
Other Links: | manifest | tags |
2020-10-10
| ||
14:43 | Fix accidental type change check-in: c14f0fc208 user: js tags: trunk | |
14:27 | OFObject: Change type of -[hash] to unsigned long check-in: aeb403a1ed user: js tags: trunk | |
11:09 | ofhttp: Add --ignore-status option check-in: 3162555b75 user: js tags: trunk | |
Modified src/OFASN1BitString.m from [2a56c21bf5] to [58adebf4a8].
︙ | ︙ | |||
168 169 170 171 172 173 174 | return false; if (bitString->_bitStringLength != _bitStringLength) return false; return true; } | | | | 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 | return false; if (bitString->_bitStringLength != _bitStringLength) return false; return true; } - (unsigned long)hash { return _bitStringValue.hash + (unsigned long)_bitStringLength; } - (OFString *)description { return [OFString stringWithFormat: @"<OFASN1BitString: %@ (%zu bits)>", _bitStringValue, _bitStringLength]; } @end |
Modified src/OFASN1Boolean.m from [435f978afe] to [ab43e337d1].
︙ | ︙ | |||
100 101 102 103 104 105 106 | if (boolean->_booleanValue != _booleanValue) return false; return true; } | | | | 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | if (boolean->_booleanValue != _booleanValue) return false; return true; } - (unsigned long)hash { return _booleanValue; } - (OFString *)description { return (_booleanValue ? @"<OFASN1Boolean: true>" : @"<OFASN1Boolean: false>"); } @end |
Modified src/OFASN1Enumerated.m from [78253ff0bd] to [ba2cabe5ff].
︙ | ︙ | |||
87 88 89 90 91 92 93 | if (enumerated->_longLongValue != _longLongValue) return false; return true; } | | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | if (enumerated->_longLongValue != _longLongValue) return false; return true; } - (unsigned long)hash { return (unsigned long)_longLongValue; } - (OFString *)description { return [OFString stringWithFormat: @"<OFASN1Enumerated: %lld>", _longLongValue]; } @end |
Modified src/OFASN1IA5String.m from [c986963291] to [6816147795].
︙ | ︙ | |||
108 109 110 111 112 113 114 | if (![IA5String->_IA5StringValue isEqual: _IA5StringValue]) return false; return true; } | | | 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | if (![IA5String->_IA5StringValue isEqual: _IA5StringValue]) return false; return true; } - (unsigned long)hash { return _IA5StringValue.hash; } - (OFString *)description { return [OFString stringWithFormat: @"<OFASN1IA5String: %@>", _IA5StringValue]; } @end |
Modified src/OFASN1Integer.m from [39a371a7d5] to [e6486b0fce].
︙ | ︙ | |||
109 110 111 112 113 114 115 | if (integer->_longLongValue != _longLongValue) return false; return true; } | | | | 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | if (integer->_longLongValue != _longLongValue) return false; return true; } - (unsigned long)hash { return (unsigned long)_longLongValue; } - (OFString *)description { return [OFString stringWithFormat: @"<OFASN1Integer: %lld>", _longLongValue]; } @end |
Modified src/OFASN1NumericString.m from [bebd01e80f] to [1f3277f085].
︙ | ︙ | |||
120 121 122 123 124 125 126 | if (![numericString->_numericStringValue isEqual: _numericStringValue]) return false; return true; } | | | 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 | if (![numericString->_numericStringValue isEqual: _numericStringValue]) return false; return true; } - (unsigned long)hash { return _numericStringValue.hash; } - (OFString *)description { return [OFString stringWithFormat: @"<OFASN1NumericString: %@>", _numericStringValue]; } @end |
Modified src/OFASN1ObjectIdentifier.m from [13ae15fdce] to [0496bf5735].
︙ | ︙ | |||
165 166 167 168 169 170 171 | if (![objectIdentifier->_subidentifiers isEqual: _subidentifiers]) return false; return true; } | | | 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | if (![objectIdentifier->_subidentifiers isEqual: _subidentifiers]) return false; return true; } - (unsigned long)hash { return _subidentifiers.hash; } - (OFString *)description { return [OFString stringWithFormat: @"<OFASN1ObjectIdentifier: %@>", [_subidentifiers componentsJoinedByString: @"."]]; } @end |
Modified src/OFASN1OctetString.m from [72ec0acbc8] to [3d5ad35b08].
︙ | ︙ | |||
93 94 95 96 97 98 99 | if (![octetString->_octetStringValue isEqual: _octetStringValue]) return false; return true; } | | | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | if (![octetString->_octetStringValue isEqual: _octetStringValue]) return false; return true; } - (unsigned long)hash { return _octetStringValue.hash; } - (OFString *)description { return [OFString stringWithFormat: @"<OFASN1OctetString: %@>", _octetStringValue]; } @end |
Modified src/OFASN1PrintableString.m from [fb2d5a3a36] to [d326d7d84e].
︙ | ︙ | |||
140 141 142 143 144 145 146 | if (![printableString->_printableStringValue isEqual: _printableStringValue]) return false; return true; } | | | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 | if (![printableString->_printableStringValue isEqual: _printableStringValue]) return false; return true; } - (unsigned long)hash { return _printableStringValue.hash; } - (OFString *)description { return [OFString stringWithFormat: @"<OFASN1PrintableString: %@>", _printableStringValue]; } @end |
Modified src/OFASN1UTF8String.m from [7ebbe5d5f6] to [fe525c2cd3].
︙ | ︙ | |||
107 108 109 110 111 112 113 | if (![UTF8String->_UTF8StringValue isEqual: _UTF8StringValue]) return false; return true; } | | | 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | if (![UTF8String->_UTF8StringValue isEqual: _UTF8StringValue]) return false; return true; } - (unsigned long)hash { return _UTF8StringValue.hash; } - (OFString *)description { return [OFString stringWithFormat: @"<OFASN1UTF8String: %@>", _UTF8StringValue]; } @end |
Modified src/OFASN1Value.m from [2cb0a2171f] to [e6d6355cac].
︙ | ︙ | |||
95 96 97 98 99 100 101 | return false; if (![value->_DEREncodedContents isEqual: _DEREncodedContents]) return false; return true; } | | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | return false; if (![value->_DEREncodedContents isEqual: _DEREncodedContents]) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD(hash, _tagClass & 0xFF); OF_HASH_ADD(hash, _tagNumber & 0xFF); |
︙ | ︙ |
Modified src/OFAdjacentArray.m from [8ce426fd6f] to [b6ccf04769].
︙ | ︙ | |||
304 305 306 307 308 309 310 | for (size_t i = 0; i < count; i++) if (![objects[i] isEqual: otherObjects[i]]) return false; return true; } | | | 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 | for (size_t i = 0; i < count; i++) if (![objects[i] isEqual: otherObjects[i]]) return false; return true; } - (unsigned long)hash { id const *objects = _array.items; size_t count = _array.count; uint32_t hash; OF_HASH_INIT(hash); |
︙ | ︙ |
Modified src/OFArray.m from [76b22a5fc0] to [3a99f337b3].
︙ | ︙ | |||
511 512 513 514 515 516 517 | if (![[self objectAtIndex: i] isEqual: [otherArray objectAtIndex: i]]) return false; return true; } | | | 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 | if (![[self objectAtIndex: i] isEqual: [otherArray objectAtIndex: i]]) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); for (id object in self) OF_HASH_ADD_HASH(hash, [object hash]); |
︙ | ︙ |
Modified src/OFColor.m from [cc4d687d8e] to [442896ccaa].
︙ | ︙ | |||
118 119 120 121 122 123 124 | return false; if (other->_alpha != _alpha) return false; return true; } | | | 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | return false; if (other->_alpha != _alpha) return false; return true; } - (unsigned long)hash { uint32_t hash; float tmp; OF_HASH_INIT(hash); tmp = OF_BSWAP_FLOAT_IF_LE(_red); |
︙ | ︙ |
Modified src/OFConstantString.m from [0761b10d3a] to [0adc85a65a].
︙ | ︙ | |||
256 257 258 259 260 261 262 | - (bool)isEqual: (id)object { [self finishInitialization]; return [self isEqual: object]; } | | | 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 | - (bool)isEqual: (id)object { [self finishInitialization]; return [self isEqual: object]; } - (unsigned long)hash { [self finishInitialization]; return self.hash; } - (OFString *)description |
︙ | ︙ |
Modified src/OFDNSQuery.m from [fef90630f2] to [7b9ce87bc6].
︙ | ︙ | |||
89 90 91 92 93 94 95 | return false; if (query->_recordType != _recordType) return false; return true; } | | | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | return false; if (query->_recordType != _recordType) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, _domainName.hash); OF_HASH_ADD(hash, _DNSClass); OF_HASH_ADD(hash, _recordType); |
︙ | ︙ |
Modified src/OFDNSResourceRecord.m from [08b68e10ee] to [2126cc3910].
︙ | ︙ | |||
239 240 241 242 243 244 245 | if (!of_socket_address_equal(&record->_address, &_address)) return false; return true; } | | | 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | if (!of_socket_address_equal(&record->_address, &_address)) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, _name.hash); OF_HASH_ADD(hash, _DNSClass >> 8); |
︙ | ︙ | |||
325 326 327 328 329 330 331 | if (!of_socket_address_equal(&record->_address, &_address)) return false; return true; } | | | 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 | if (!of_socket_address_equal(&record->_address, &_address)) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, _name.hash); OF_HASH_ADD(hash, _DNSClass >> 8); |
︙ | ︙ | |||
421 422 423 424 425 426 427 | if (record->_alias != _alias && ![record->_alias isEqual: _alias]) return false; return true; } | | | 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 | if (record->_alias != _alias && ![record->_alias isEqual: _alias]) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, _name.hash); OF_HASH_ADD(hash, _DNSClass >> 8); |
︙ | ︙ | |||
524 525 526 527 528 529 530 | if (record->_OS != _OS && ![record->_OS isEqual: _OS]) return false; return true; } | | | 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 | if (record->_OS != _OS && ![record->_OS isEqual: _OS]) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, _name.hash); OF_HASH_ADD(hash, _DNSClass >> 8); |
︙ | ︙ | |||
629 630 631 632 633 634 635 | if (record->_mailExchange != _mailExchange && ![record->_mailExchange isEqual: _mailExchange]) return false; return true; } | | | 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 | if (record->_mailExchange != _mailExchange && ![record->_mailExchange isEqual: _mailExchange]) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, _name.hash); OF_HASH_ADD(hash, _DNSClass >> 8); |
︙ | ︙ | |||
730 731 732 733 734 735 736 | if (record->_authoritativeHost != _authoritativeHost && ![record->_authoritativeHost isEqual: _authoritativeHost]) return false; return true; } | | | 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 | if (record->_authoritativeHost != _authoritativeHost && ![record->_authoritativeHost isEqual: _authoritativeHost]) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, _name.hash); OF_HASH_ADD(hash, _DNSClass >> 8); |
︙ | ︙ | |||
828 829 830 831 832 833 834 | if (record->_domainName != _domainName && ![record->_domainName isEqual: _domainName]) return false; return true; } | | | 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 | if (record->_domainName != _domainName && ![record->_domainName isEqual: _domainName]) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, _name.hash); OF_HASH_ADD(hash, _DNSClass >> 8); |
︙ | ︙ | |||
933 934 935 936 937 938 939 | if (record->_TXTDomainName != _TXTDomainName && ![record->_TXTDomainName isEqual: _TXTDomainName]) return false; return true; } | | | 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 | if (record->_TXTDomainName != _TXTDomainName && ![record->_TXTDomainName isEqual: _TXTDomainName]) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, _name.hash); OF_HASH_ADD(hash, _DNSClass >> 8); |
︙ | ︙ | |||
1069 1070 1071 1072 1073 1074 1075 | if (record->_minTTL != _minTTL) return false; return true; } | | | 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 | if (record->_minTTL != _minTTL) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, _name.hash); OF_HASH_ADD(hash, _DNSClass >> 8); |
︙ | ︙ | |||
1210 1211 1212 1213 1214 1215 1216 | if (record->_port != _port) return false; return true; } | | | 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 | if (record->_port != _port) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, _name.hash); OF_HASH_ADD(hash, _DNSClass >> 8); |
︙ | ︙ | |||
1315 1316 1317 1318 1319 1320 1321 | if (record->_textStrings != _textStrings && ![record->_textStrings isEqual: _textStrings]) return false; return true; } | | | 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 | if (record->_textStrings != _textStrings && ![record->_textStrings isEqual: _textStrings]) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, _name.hash); OF_HASH_ADD(hash, _DNSClass >> 8); |
︙ | ︙ |
Modified src/OFDNSResponse.m from [2d2248bdf2] to [f58f953bdc].
︙ | ︙ | |||
98 99 100 101 102 103 104 | if (response->_additionalRecords != _additionalRecords && ![response->_additionalRecords isEqual: _additionalRecords]) return false; return true; } | | | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 | if (response->_additionalRecords != _additionalRecords && ![response->_additionalRecords isEqual: _additionalRecords]) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, _domainName.hash); OF_HASH_ADD_HASH(hash, [_answerRecords hash]); OF_HASH_ADD_HASH(hash, [_authorityRecords hash]); |
︙ | ︙ |
Modified src/OFData.m from [63de509839] to [fe0918c4c9].
︙ | ︙ | |||
485 486 487 488 489 490 491 | if (comparison > 0) return OF_ORDERED_DESCENDING; else return OF_ORDERED_ASCENDING; } | | | 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 | if (comparison > 0) return OF_ORDERED_DESCENDING; else return OF_ORDERED_ASCENDING; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); for (size_t i = 0; i < _count * _itemSize; i++) OF_HASH_ADD(hash, ((uint8_t *)_items)[i]); |
︙ | ︙ |
Modified src/OFDate.m from [996b4908b2] to [f5afc23b94].
︙ | ︙ | |||
534 535 536 537 538 539 540 | if (otherDate.timeIntervalSince1970 != self.timeIntervalSince1970) return false; return true; } | | | 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 | if (otherDate.timeIntervalSince1970 != self.timeIntervalSince1970) return false; return true; } - (unsigned long)hash { uint32_t hash; double tmp; OF_HASH_INIT(hash); tmp = OF_BSWAP_DOUBLE_IF_BE(self.timeIntervalSince1970); |
︙ | ︙ |
Modified src/OFDictionary.m from [9428854186] to [505aa3e10f].
︙ | ︙ | |||
593 594 595 596 597 598 599 | [new makeImmutable]; return new; } #endif | | | | | | 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 | [new makeImmutable]; return new; } #endif - (unsigned long)hash { void *pool = objc_autoreleasePoolPush(); OFEnumerator *keyEnumerator = [self keyEnumerator]; OFEnumerator *objectEnumerator = [self objectEnumerator]; id key, object; unsigned long hash = 0; while ((key = [keyEnumerator nextObject]) != nil && (object = [objectEnumerator nextObject]) != nil) { hash ^= [key hash]; hash ^= [object hash]; } objc_autoreleasePoolPop(pool); return hash; } |
︙ | ︙ |
Modified src/OFHTTPCookie.m from [1fa52c5268] to [a6b5d4bf43].
︙ | ︙ | |||
359 360 361 362 363 364 365 | if (cookie->_extensions != _extensions && ![cookie->_extensions isEqual: _extensions]) return false; return true; } | | | 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 | if (cookie->_extensions != _extensions && ![cookie->_extensions isEqual: _extensions]) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, _name.hash); OF_HASH_ADD_HASH(hash, _value.hash); OF_HASH_ADD_HASH(hash, _domain.hash); |
︙ | ︙ |
Modified src/OFHTTPRequest.m from [2b2b69fc08] to [5fbba85cad].
︙ | ︙ | |||
181 182 183 184 185 186 187 | if (request.remoteAddress != self.remoteAddress && !of_socket_address_equal(request.remoteAddress, self.remoteAddress)) return false; return true; } | | | 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | if (request.remoteAddress != self.remoteAddress && !of_socket_address_equal(request.remoteAddress, self.remoteAddress)) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD(hash, _method); OF_HASH_ADD(hash, _protocolVersion.major); |
︙ | ︙ |
Modified src/OFList.m from [58e8774a64] to [2cea85f754].
︙ | ︙ | |||
318 319 320 321 322 323 324 | } copy->_lastListObject = listObject; return copy; } | | | 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | } copy->_lastListObject = listObject; return copy; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); for (of_list_object_t *iter = _firstListObject; iter != NULL; iter = iter->next) |
︙ | ︙ |
Modified src/OFMapTable.h from [c882862b86] to [7fe069efae].
︙ | ︙ | |||
29 30 31 32 33 34 35 | */ struct of_map_table_functions_t { /** The function to retain keys / objects */ void *_Nullable (*_Nullable retain)(void *_Nullable object); /** The function to release keys / objects */ void (*_Nullable release)(void *_Nullable object); /** The function to hash keys */ | | | 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | */ struct of_map_table_functions_t { /** The function to retain keys / objects */ void *_Nullable (*_Nullable retain)(void *_Nullable object); /** The function to release keys / objects */ void (*_Nullable release)(void *_Nullable object); /** The function to hash keys */ unsigned long (*_Nullable hash)(void *_Nullable object); /** The function to compare keys / objects */ bool (*_Nullable equal)(void *_Nullable object1, void *_Nullable object2); }; typedef struct of_map_table_functions_t of_map_table_functions_t; #ifdef OF_HAVE_BLOCKS |
︙ | ︙ | |||
72 73 74 75 76 77 78 | * and objects should be retained, released, compared and hashed. */ OF_SUBCLASSING_RESTRICTED @interface OFMapTable: OFObject <OFCopying, OFFastEnumeration> { of_map_table_functions_t _keyFunctions, _objectFunctions; struct of_map_table_bucket *_Nonnull *_Nullable _buckets; | | | 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | * and objects should be retained, released, compared and hashed. */ OF_SUBCLASSING_RESTRICTED @interface OFMapTable: OFObject <OFCopying, OFFastEnumeration> { of_map_table_functions_t _keyFunctions, _objectFunctions; struct of_map_table_bucket *_Nonnull *_Nullable _buckets; unsigned long _count, _capacity; uint8_t _rotate; unsigned long _mutations; } /** * @brief The key functions used by the map table. */ |
︙ | ︙ | |||
238 239 240 241 242 243 244 | * @brief A class which provides methods to enumerate through an OFMapTable's * keys or objects. */ @interface OFMapTableEnumerator: OFObject { OFMapTable *_mapTable; struct of_map_table_bucket *_Nonnull *_Nullable _buckets; | < | | < | 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | * @brief A class which provides methods to enumerate through an OFMapTable's * keys or objects. */ @interface OFMapTableEnumerator: OFObject { OFMapTable *_mapTable; struct of_map_table_bucket *_Nonnull *_Nullable _buckets; unsigned long _capacity, _mutations, *_Nullable _mutationsPtr; unsigned long _position; } - (instancetype)init OF_UNAVAILABLE; /** * @brief Returns a pointer to the next object, or NULL if the enumeration * finished. |
︙ | ︙ |
Modified src/OFMapTable.m from [ec26b7463a] to [8775708778].
︙ | ︙ | |||
30 31 32 33 34 35 36 | #import "OFInvalidArgumentException.h" #import "OFOutOfRangeException.h" #define MIN_CAPACITY 16 struct of_map_table_bucket { void *key, *object; | | | | | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | #import "OFInvalidArgumentException.h" #import "OFOutOfRangeException.h" #define MIN_CAPACITY 16 struct of_map_table_bucket { void *key, *object; unsigned long hash; }; static struct of_map_table_bucket deleted = { 0 }; static void * defaultRetain(void *object) { return object; } static void defaultRelease(void *object) { } static unsigned long defaultHash(void *object) { return (unsigned long)(uintptr_t)object; } static bool defaultEqual(void *object1, void *object2) { return (object1 == object2); } OF_DIRECT_MEMBERS @interface OFMapTable () - (void)of_setObject: (void *)object forKey: (void *)key hash: (unsigned long)hash; @end OF_DIRECT_MEMBERS @interface OFMapTableEnumerator () - (instancetype)of_initWithMapTable: (OFMapTable *)mapTable buckets: (struct of_map_table_bucket **)buckets capacity: (unsigned long)capacity mutationsPointer: (unsigned long *)mutationsPtr OF_METHOD_FAMILY(init); @end @interface OFMapTableKeyEnumerator: OFMapTableEnumerator @end |
︙ | ︙ | |||
141 142 143 144 145 146 147 | SET_DEFAULT(_objectFunctions.retain, defaultRetain); SET_DEFAULT(_objectFunctions.release, defaultRelease); SET_DEFAULT(_objectFunctions.hash, defaultHash); SET_DEFAULT(_objectFunctions.equal, defaultEqual); #undef SET_DEFAULT | | | | | | | 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | SET_DEFAULT(_objectFunctions.retain, defaultRetain); SET_DEFAULT(_objectFunctions.release, defaultRelease); SET_DEFAULT(_objectFunctions.hash, defaultHash); SET_DEFAULT(_objectFunctions.equal, defaultEqual); #undef SET_DEFAULT if (capacity > ULONG_MAX / sizeof(*_buckets) || capacity > ULONG_MAX / 8) @throw [OFOutOfRangeException exception]; for (_capacity = 1; _capacity < capacity;) { if (_capacity > ULONG_MAX / 2) @throw [OFOutOfRangeException exception]; _capacity *= 2; } if (capacity * 8 / _capacity >= 6) if (_capacity <= ULONG_MAX / 2) _capacity *= 2; if (_capacity < MIN_CAPACITY) _capacity = MIN_CAPACITY; _buckets = [self allocZeroedMemoryWithSize: sizeof(*_buckets) count: _capacity]; if (of_hash_seed != 0) _rotate = of_random16() & 31; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { for (unsigned long i = 0; i < _capacity; i++) { if (_buckets[i] != NULL && _buckets[i] != &deleted) { _keyFunctions.release(_buckets[i]->key); _objectFunctions.release(_buckets[i]->object); } } [super dealloc]; |
︙ | ︙ | |||
201 202 203 204 205 206 207 | mapTable = object; if (mapTable->_count != _count || mapTable->_keyFunctions.equal != _keyFunctions.equal || mapTable->_objectFunctions.equal != _objectFunctions.equal) return false; | | | | | | | | | | 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | mapTable = object; if (mapTable->_count != _count || mapTable->_keyFunctions.equal != _keyFunctions.equal || mapTable->_objectFunctions.equal != _objectFunctions.equal) return false; for (unsigned long i = 0; i < _capacity; i++) { if (_buckets[i] != NULL && _buckets[i] != &deleted) { void *objectIter = [mapTable objectForKey: _buckets[i]->key]; if (!_objectFunctions.equal(objectIter, _buckets[i]->object)) return false; } } return true; } - (unsigned long)hash { unsigned long hash = 0; for (unsigned long i = 0; i < _capacity; i++) { if (_buckets[i] != NULL && _buckets[i] != &deleted) { hash ^= OF_ROR(_buckets[i]->hash, _rotate); hash ^= _objectFunctions.hash(_buckets[i]->object); } } return hash; } - (id)copy { OFMapTable *copy = [[OFMapTable alloc] initWithKeyFunctions: _keyFunctions objectFunctions: _objectFunctions capacity: _capacity]; @try { for (unsigned long i = 0; i < _capacity; i++) if (_buckets[i] != NULL && _buckets[i] != &deleted) [copy of_setObject: _buckets[i]->object forKey: _buckets[i]->key hash: OF_ROR(_buckets[i]->hash, _rotate)]; } @catch (id e) { [copy release]; @throw e; } return copy; } - (size_t)count { return _count; } - (void *)objectForKey: (void *)key { unsigned long i, hash, last; if (key == NULL) @throw [OFInvalidArgumentException exception]; hash = OF_ROL(_keyFunctions.hash(key), _rotate); last = _capacity; |
︙ | ︙ | |||
291 292 293 294 295 296 297 | if (_keyFunctions.equal(_buckets[i]->key, key)) return _buckets[i]->object; } return NULL; } | | | | | | | | 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 | if (_keyFunctions.equal(_buckets[i]->key, key)) return _buckets[i]->object; } return NULL; } - (void)of_resizeForCount: (unsigned long)count OF_DIRECT { unsigned long fullness, capacity; struct of_map_table_bucket **buckets; if (count > ULONG_MAX / sizeof(*_buckets) || count > ULONG_MAX / 8) @throw [OFOutOfRangeException exception]; fullness = count * 8 / _capacity; if (fullness >= 6) { if (_capacity > ULONG_MAX / 2) return; capacity = _capacity * 2; } else if (fullness <= 1) capacity = _capacity / 2; else return; /* * Don't downsize if we have an initial capacity or if we would fall * below the minimum capacity. */ if ((capacity < _capacity && count > _count) || capacity < MIN_CAPACITY) return; buckets = [self allocZeroedMemoryWithSize: sizeof(*buckets) count: capacity]; for (unsigned long i = 0; i < _capacity; i++) { if (_buckets[i] != NULL && _buckets[i] != &deleted) { unsigned long j, last; last = capacity; for (j = _buckets[i]->hash & (capacity - 1); j < last && buckets[j] != NULL; j++); /* In case the last bucket is already used */ |
︙ | ︙ | |||
352 353 354 355 356 357 358 | [self freeMemory: _buckets]; _buckets = buckets; _capacity = capacity; } - (void)of_setObject: (void *)object forKey: (void *)key | | | | 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | [self freeMemory: _buckets]; _buckets = buckets; _capacity = capacity; } - (void)of_setObject: (void *)object forKey: (void *)key hash: (unsigned long)hash { unsigned long i, last; void *old; if (key == NULL || object == NULL) @throw [OFInvalidArgumentException exception]; hash = OF_ROL(hash, _rotate); last = _capacity; |
︙ | ︙ | |||
448 449 450 451 452 453 454 | [self of_setObject: object forKey: key hash: _keyFunctions.hash(key)]; } - (void)removeObjectForKey: (void *)key { | | | 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 | [self of_setObject: object forKey: key hash: _keyFunctions.hash(key)]; } - (void)removeObjectForKey: (void *)key { unsigned long i, hash, last; if (key == NULL) @throw [OFInvalidArgumentException exception]; hash = OF_ROL(_keyFunctions.hash(key), _rotate); last = _capacity; |
︙ | ︙ | |||
504 505 506 507 508 509 510 | return; } } } - (void)removeAllObjects { | | | 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 | return; } } } - (void)removeAllObjects { for (unsigned long i = 0; i < _capacity; i++) { if (_buckets[i] != NULL) { if (_buckets[i] == &deleted) { _buckets[i] = NULL; continue; } _keyFunctions.release(_buckets[i]->key); |
︙ | ︙ | |||
538 539 540 541 542 543 544 | } - (bool)containsObject: (void *)object { if (object == NULL || _count == 0) return false; | | | | 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 | } - (bool)containsObject: (void *)object { if (object == NULL || _count == 0) return false; for (unsigned long i = 0; i < _capacity; i++) if (_buckets[i] != NULL && _buckets[i] != &deleted) if (_objectFunctions.equal(_buckets[i]->object, object)) return true; return false; } - (bool)containsObjectIdenticalTo: (void *)object { if (object == NULL || _count == 0) return false; for (unsigned long i = 0; i < _capacity; i++) if (_buckets[i] != NULL && _buckets[i] != &deleted) if (_buckets[i]->object == object) return true; return false; } |
︙ | ︙ | |||
581 582 583 584 585 586 587 | mutationsPointer: &_mutations] autorelease]; } - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state objects: (id *)objects count: (int)count { | | | 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 | mutationsPointer: &_mutations] autorelease]; } - (int)countByEnumeratingWithState: (of_fast_enumeration_state_t *)state objects: (id *)objects count: (int)count { unsigned long j = state->state; int i; for (i = 0; i < count; i++) { for (; j < _capacity && (_buckets[j] == NULL || _buckets[j] == &deleted); j++); if (j < _capacity) { |
︙ | ︙ | |||
654 655 656 657 658 659 660 | - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)of_initWithMapTable: (OFMapTable *)mapTable buckets: (struct of_map_table_bucket **)buckets | | | 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 | - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)of_initWithMapTable: (OFMapTable *)mapTable buckets: (struct of_map_table_bucket **)buckets capacity: (unsigned long)capacity mutationsPointer: (unsigned long *)mutationsPtr { self = [super init]; _mapTable = [mapTable retain]; _buckets = buckets; _capacity = capacity; |
︙ | ︙ |
Modified src/OFMapTableDictionary.m from [7eeaf3a50d] to [d2c4c5ea8c].
︙ | ︙ | |||
45 46 47 48 49 50 51 | static void release(void *object) { [(id)object release]; } | | | 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | static void release(void *object) { [(id)object release]; } static unsigned long hash(void *object) { return [(id)object hash]; } static bool equal(void *object1, void *object2) |
︙ | ︙ | |||
442 443 444 445 446 447 448 | } @catch (OFEnumerationMutationException *e) { @throw [OFEnumerationMutationException exceptionWithObject: self]; } } #endif | | | 442 443 444 445 446 447 448 449 450 451 452 453 | } @catch (OFEnumerationMutationException *e) { @throw [OFEnumerationMutationException exceptionWithObject: self]; } } #endif - (unsigned long)hash { return _mapTable.hash; } @end |
Modified src/OFMapTableSet.m from [9e9f04ba7b] to [6da1f132a2].
︙ | ︙ | |||
37 38 39 40 41 42 43 | static void release(void *object) { [(id)object release]; } | | | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | static void release(void *object) { [(id)object release]; } static unsigned long hash(void *object) { return [(id)object hash]; } static bool equal(void *object1, void *object2) |
︙ | ︙ |
Modified src/OFMessagePackExtension.m from [c468d48f16] to [0041614de1].
︙ | ︙ | |||
173 174 175 176 177 178 179 | if (extension->_type != _type || ![extension->_data isEqual: _data]) return false; return true; } | | | 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | if (extension->_type != _type || ![extension->_data isEqual: _data]) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD(hash, (uint8_t)_type); OF_HASH_ADD_HASH(hash, _data.hash); |
︙ | ︙ |
Modified src/OFNumber.m from [eeab93bc59] to [80a9f3f337].
︙ | ︙ | |||
983 984 985 986 987 988 989 | if (uint1 < uint2) return OF_ORDERED_ASCENDING; return OF_ORDERED_SAME; } } | | | 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 | if (uint1 < uint2) return OF_ORDERED_ASCENDING; return OF_ORDERED_SAME; } } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); if (isFloat(self)) { double d; |
︙ | ︙ |
Modified src/OFObject.h from [de7a4dbfdc] to [2f5277b92c].
︙ | ︙ | |||
318 319 320 321 322 323 324 | * * @warning If you reimplement this, you also need to reimplement @ref isEqual: * to behave in a way compatible to your reimplementation of this * method! * * @return A 32 bit hash for the object */ | | | 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | * * @warning If you reimplement this, you also need to reimplement @ref isEqual: * to behave in a way compatible to your reimplementation of this * method! * * @return A 32 bit hash for the object */ - (unsigned long)hash; /** * @brief Returns the retain count. * * @return The retain count */ - (unsigned int)retainCount; |
︙ | ︙ | |||
541 542 543 544 545 546 547 | # ifdef __cplusplus @property (readonly, nonatomic) Class class; # else @property (readonly, nonatomic, getter=class) Class class_; #endif @property OF_NULLABLE_PROPERTY (readonly, nonatomic) Class superclass; | | | 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 | # ifdef __cplusplus @property (readonly, nonatomic) Class class; # else @property (readonly, nonatomic, getter=class) Class class_; #endif @property OF_NULLABLE_PROPERTY (readonly, nonatomic) Class superclass; @property (readonly, nonatomic) unsigned long hash; @property (readonly, nonatomic) unsigned int retainCount; @property (readonly, nonatomic) bool isProxy; @property (readonly, nonatomic) bool allowsWeakReference; /** * @brief The name of the object's class. */ |
︙ | ︙ |
Modified src/OFObject.m from [73163cea94] to [c2480d6470].
︙ | ︙ | |||
1021 1022 1023 1024 1025 1026 1027 | } - (bool)isEqual: (id)object { return (object == self); } | | | 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 | } - (bool)isEqual: (id)object { return (object == self); } - (unsigned long)hash { uintptr_t ptr = (uintptr_t)self; uint32_t hash; OF_HASH_INIT(hash); for (size_t i = 0; i < sizeof(ptr); i++) { |
︙ | ︙ |
Modified src/OFOptionsParser.m from [91dcfe7c0f] to [a777f53d6b].
︙ | ︙ | |||
20 21 22 23 24 25 26 | #import "OFOptionsParser.h" #import "OFApplication.h" #import "OFArray.h" #import "OFMapTable.h" #import "OFInvalidArgumentException.h" | | | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #import "OFOptionsParser.h" #import "OFApplication.h" #import "OFArray.h" #import "OFMapTable.h" #import "OFInvalidArgumentException.h" static unsigned long stringHash(void *object) { return ((OFString *)object).hash; } static bool stringEqual(void *object1, void *object2) |
︙ | ︙ |
Modified src/OFPair.m from [a27e0f483b] to [6855a79df9].
︙ | ︙ | |||
81 82 83 84 85 86 87 | if (pair->_secondObject != _secondObject && ![pair->_secondObject isEqual: _secondObject]) return false; return true; } | | | 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | if (pair->_secondObject != _secondObject && ![pair->_secondObject isEqual: _secondObject]) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, [_firstObject hash]); OF_HASH_ADD_HASH(hash, [_secondObject hash]); |
︙ | ︙ |
Modified src/OFSandbox.m from [66d9366bf3] to [103c5612bc].
︙ | ︙ | |||
465 466 467 468 469 470 471 | return false; if (sandbox->_returnsErrors != _returnsErrors) return false; return true; } | | | 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 | return false; if (sandbox->_returnsErrors != _returnsErrors) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD(hash, _allowsStdIO); OF_HASH_ADD(hash, _allowsReadingFiles); |
︙ | ︙ |
Modified src/OFSet.m from [e3c9e370a2] to [fd18f62182].
︙ | ︙ | |||
294 295 296 297 298 299 300 | if (set.count != self.count) return false; return [set isSubsetOfSet: self]; } | | | | | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 | if (set.count != self.count) return false; return [set isSubsetOfSet: self]; } - (unsigned long)hash { void *pool = objc_autoreleasePoolPush(); unsigned long hash = 0; for (id object in self) hash ^= [object hash]; objc_autoreleasePoolPop(pool); return hash; } - (OFString *)description |
︙ | ︙ |
Modified src/OFString.m from [a28b46c55c] to [91d4470735].
︙ | ︙ | |||
1658 1659 1660 1661 1662 1663 1664 | return OF_ORDERED_DESCENDING; if (length < otherLength) return OF_ORDERED_ASCENDING; return OF_ORDERED_SAME; } | | | 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 | return OF_ORDERED_DESCENDING; if (length < otherLength) return OF_ORDERED_ASCENDING; return OF_ORDERED_SAME; } - (unsigned long)hash { const of_unichar_t *characters = self.characters; size_t length = self.length; uint32_t hash; OF_HASH_INIT(hash); |
︙ | ︙ |
Modified src/OFTriple.m from [132f7da5da] to [9a522e8d33].
︙ | ︙ | |||
95 96 97 98 99 100 101 | if (triple->_thirdObject != _thirdObject && ![triple->_thirdObject isEqual: _thirdObject]) return false; return true; } | | | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | if (triple->_thirdObject != _thirdObject && ![triple->_thirdObject isEqual: _thirdObject]) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, [_firstObject hash]); OF_HASH_ADD_HASH(hash, [_secondObject hash]); |
︙ | ︙ |
Modified src/OFURL.m from [00f085f9ce] to [0558fd50c5].
︙ | ︙ | |||
846 847 848 849 850 851 852 | if (URL->_URLEncodedFragment != _URLEncodedFragment && ![URL->_URLEncodedFragment isEqual: _URLEncodedFragment]) return false; return true; } | | | 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 | if (URL->_URLEncodedFragment != _URLEncodedFragment && ![URL->_URLEncodedFragment isEqual: _URLEncodedFragment]) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, _URLEncodedScheme.hash); OF_HASH_ADD_HASH(hash, _URLEncodedHost.hash); |
︙ | ︙ |
Modified src/OFUTF8String.h from [3d372b3717] to [e49ea36f6c].
︙ | ︙ | |||
25 26 27 28 29 30 31 | * A pointer to the actual data. * * Since constant strings don't have `_storage`, they have to allocate * it on the first access. Strings created at runtime just set the * pointer to `&_storage`. */ struct of_string_utf8_ivars { | | | | | | | | | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | * A pointer to the actual data. * * Since constant strings don't have `_storage`, they have to allocate * it on the first access. Strings created at runtime just set the * pointer to `&_storage`. */ struct of_string_utf8_ivars { char *cString; size_t cStringLength; bool isUTF8; size_t length; bool hashed; unsigned long hash; char *_Nullable freeWhenDone; } *restrict _s; struct of_string_utf8_ivars _storage; } @end #ifdef __cplusplus extern "C" { |
︙ | ︙ |
Modified src/OFUTF8String.m from [03dadccc61] to [d8b3a6972a].
︙ | ︙ | |||
925 926 927 928 929 930 931 | else if (_s->cStringLength - i < otherCStringLength - j) return OF_ORDERED_ASCENDING; #endif return OF_ORDERED_SAME; } | | | 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 | else if (_s->cStringLength - i < otherCStringLength - j) return OF_ORDERED_ASCENDING; #endif return OF_ORDERED_SAME; } - (unsigned long)hash { uint32_t hash; if (_s->hashed) return _s->hash; OF_HASH_INIT(hash); |
︙ | ︙ |
Modified src/OFValue.m from [a224fd5a05] to [c1cd16a470].
︙ | ︙ | |||
204 205 206 207 208 209 210 | free(value); free(otherValue); } return ret; } | | | 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | free(value); free(otherValue); } return ret; } - (unsigned long)hash { size_t size = of_sizeof_type_encoding(self.objCType); unsigned char *value; uint32_t hash; if ((value = malloc(size)) == NULL) @throw [OFOutOfMemoryException |
︙ | ︙ |
Modified src/OFXMLAttribute.m from [e9a34efaab] to [182fa6d94f].
︙ | ︙ | |||
136 137 138 139 140 141 142 | return false; if (![attribute->_stringValue isEqual: _stringValue]) return false; return true; } | | | 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | return false; if (![attribute->_stringValue isEqual: _stringValue]) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, _name.hash); OF_HASH_ADD_HASH(hash, _namespace.hash); |
︙ | ︙ |
Modified src/OFXMLCDATA.m from [f85cf9a41b] to [bc1aa40b4f].
︙ | ︙ | |||
84 85 86 87 88 89 90 | return false; CDATA = object; return ([CDATA->_CDATA isEqual: _CDATA]); } | | | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | return false; CDATA = object; return ([CDATA->_CDATA isEqual: _CDATA]); } - (unsigned long)hash { return _CDATA.hash; } - (OFString *)stringValue { return [[_CDATA copy] autorelease]; |
︙ | ︙ |
Modified src/OFXMLCharacters.m from [d05a22ddc3] to [a2bb78c19c].
︙ | ︙ | |||
84 85 86 87 88 89 90 | return false; characters = object; return ([characters->_characters isEqual: _characters]); } | | | 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | return false; characters = object; return ([characters->_characters isEqual: _characters]); } - (unsigned long)hash { return _characters.hash; } - (OFString *)stringValue { return [[_characters copy] autorelease]; |
︙ | ︙ |
Modified src/OFXMLComment.m from [69c4d2c798] to [cfed32bae5].
︙ | ︙ | |||
86 87 88 89 90 91 92 | return false; comment = object; return ([comment->_comment isEqual: _comment]); } | | | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | return false; comment = object; return ([comment->_comment isEqual: _comment]); } - (unsigned long)hash { return _comment.hash; } - (OFString *)stringValue { return @""; |
︙ | ︙ |
Modified src/OFXMLElement.m from [a8d9602939] to [804319c0a1].
︙ | ︙ | |||
1062 1063 1064 1065 1066 1067 1068 | if (element->_children != _children && ![element->_children isEqual: _children]) return false; return true; } | | | 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 | if (element->_children != _children && ![element->_children isEqual: _children]) return false; return true; } - (unsigned long)hash { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD_HASH(hash, _name.hash); OF_HASH_ADD_HASH(hash, _namespace.hash); |
︙ | ︙ |
Modified src/OFXMLProcessingInstructions.m from [c927bb8870] to [7c38ca2413].
︙ | ︙ | |||
87 88 89 90 91 92 93 | processingInstructions = object; return [processingInstructions->_processingInstructions isEqual: _processingInstructions]; } | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | processingInstructions = object; return [processingInstructions->_processingInstructions isEqual: _processingInstructions]; } - (unsigned long)hash { return _processingInstructions.hash; } - (OFString *)stringValue { return @""; |
︙ | ︙ |
Modified src/macros.h from [76df5e8f5b] to [43e7dc4d8f].
︙ | ︙ | |||
810 811 812 813 814 815 816 | { \ hash += (hash << 3); \ hash ^= (hash >> 11); \ hash += (hash << 15); \ } #define OF_HASH_ADD_HASH(hash, other) \ { \ | | | 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 | { \ hash += (hash << 3); \ hash ^= (hash >> 11); \ hash += (hash << 15); \ } #define OF_HASH_ADD_HASH(hash, other) \ { \ uint32_t otherCopy = (uint32_t)other; \ OF_HASH_ADD(hash, (otherCopy >> 24) & 0xFF); \ OF_HASH_ADD(hash, (otherCopy >> 16) & 0xFF); \ OF_HASH_ADD(hash, (otherCopy >> 8) & 0xFF); \ OF_HASH_ADD(hash, otherCopy & 0xFF); \ } static OF_INLINE bool |
︙ | ︙ |
Modified src/runtime/arc.m from [7f174d7d34] to [d8155e4574].
︙ | ︙ | |||
30 31 32 33 34 35 36 | }; static struct objc_hashtable *hashtable; #ifdef OF_HAVE_THREADS static of_spinlock_t spinlock; #endif | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | }; static struct objc_hashtable *hashtable; #ifdef OF_HAVE_THREADS static of_spinlock_t spinlock; #endif static unsigned long hash(const void *object) { return (uint32_t)(uintptr_t)object; } static bool equal(const void *object1, const void *object2) |
︙ | ︙ |
Modified src/socket.h from [5c636947ff] to [750c66c5d1].
︙ | ︙ | |||
215 216 217 218 219 220 221 | /** * @brief Returns the hash for the specified of_socket_address_t. * * @param address The address to hash * @return The hash for the specified of_socket_address_t */ | | | 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | /** * @brief Returns the hash for the specified of_socket_address_t. * * @param address The address to hash * @return The hash for the specified of_socket_address_t */ extern unsigned long of_socket_address_hash( const of_socket_address_t *_Nonnull address); /** * @brief Converts the specified of_socket_address_t to an IP string and port. * * @param address The address to convert to a string * @param port A pointer to an uint16_t which should be set to the port of the |
︙ | ︙ |
Modified src/socket.m from [e490baa3be] to [4343bc563f].
︙ | ︙ | |||
604 605 606 607 608 609 610 | default: @throw [OFInvalidArgumentException exception]; } return true; } | | | 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 | default: @throw [OFInvalidArgumentException exception]; } return true; } unsigned long of_socket_address_hash(const of_socket_address_t *address) { uint32_t hash; OF_HASH_INIT(hash); OF_HASH_ADD(hash, address->family); |
︙ | ︙ |