Overview
Comment: | Better out of range checking in OFMutableDictionary. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
12689ed614b3d7e3b6fc06db11af38be |
User & Date: | js on 2010-03-19 00:53:27 |
Other Links: | manifest | tags |
Context
2010-03-19
| ||
22:05 | Better values for OFMutableDictionary resizing. check-in: 6c93ca551a user: js tags: trunk | |
00:53 | Better out of range checking in OFMutableDictionary. check-in: 12689ed614 user: js tags: trunk | |
2010-03-18
| ||
19:28 | Remove useless import. check-in: 7ad078d4e6 user: js tags: trunk | |
Changes
Modified src/OFMutableDictionary.m from [5a9553cf23] to [6f0115135e].
︙ | ︙ | |||
25 26 27 28 29 30 31 | size_t *size) { size_t fill = count * 4 / *size; size_t newsize; struct of_dictionary_bucket *newdata; uint32_t i; | < | | > | > > > | 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | size_t *size) { size_t fill = count * 4 / *size; size_t newsize; struct of_dictionary_bucket *newdata; uint32_t i; if (count > SIZE_MAX / 4) @throw [OFOutOfRangeException newWithClass: isa]; if (fill > 3) newsize = *size << 1; else if (fill < 1) newsize = *size >> 1; else return; if (newsize == 0) @throw [OFOutOfRangeException newWithClass: isa]; newdata = [self allocMemoryForNItems: newsize withSize: BUCKET_SIZE]; memset(newdata, 0, newsize * BUCKET_SIZE); for (i = 0; i < *size; i++) { if ((*data)[i].key != nil && (*data)[i].key != DELETED) { uint32_t j, last; |
︙ | ︙ |