Overview
Comment: | Add -[OFMutableData increaseCountBy:] |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e3c4bf8e3b533b7de57bf42736e08026 |
User & Date: | js on 2017-08-13 11:51:48 |
Other Links: | manifest | tags |
Context
2017-08-13
| ||
13:48 | Add functions to read & write BE/LE value pointers check-in: 6202189a07 user: js tags: trunk | |
11:51 | Add -[OFMutableData increaseCountBy:] check-in: e3c4bf8e3b user: js tags: trunk | |
2017-08-12
| ||
21:03 | Add -[OFMutableArray sortUsingSelector:options:] check-in: daa11c19cb user: js tags: trunk | |
Changes
Modified src/OFMutableData.h from [effb9d03d4] to [0dca48a207].
︙ | ︙ | |||
153 154 155 156 157 158 159 160 161 162 163 164 165 166 | * @param index The index where the items should be added * @param count The number of items to add */ - (void)insertItems: (const void *)items atIndex: (size_t)index count: (size_t)count; /*! * @brief Removes the item at the specified index. * * @param index The index of the item to remove */ - (void)removeItemAtIndex: (size_t)index; | > > > > > > > > | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | * @param index The index where the items should be added * @param count The number of items to add */ - (void)insertItems: (const void *)items atIndex: (size_t)index count: (size_t)count; /*! * @brief Increases the count by the specified number. The new items are all * filled with null bytes. * * @param count The count by which to increase the count */ - (void)increaseCountBy: (size_t)count; /*! * @brief Removes the item at the specified index. * * @param index The index of the item to remove */ - (void)removeItemAtIndex: (size_t)index; |
︙ | ︙ |
Modified src/OFMutableData.m from [fd7ae0376c] to [511512b3be].
︙ | ︙ | |||
215 216 217 218 219 220 221 222 223 224 225 226 227 228 | memmove(_items + (index + count) * _itemSize, _items + index * _itemSize, (_count - index) * _itemSize); memcpy(_items + index * _itemSize, items, count * _itemSize); _count += count; } - (void)removeItemAtIndex: (size_t)index { [self removeItemsInRange: of_range(index, 1)]; } - (void)removeItemsInRange: (of_range_t)range | > > > > > > > > > > > > > > > > | 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 | memmove(_items + (index + count) * _itemSize, _items + index * _itemSize, (_count - index) * _itemSize); memcpy(_items + index * _itemSize, items, count * _itemSize); _count += count; } - (void)increaseCountBy: (size_t)count { if (count > SIZE_MAX - _count) @throw [OFOutOfRangeException exception]; if (_count + count > _capacity) { _items = [self resizeMemory: _items size: _itemSize count: _count + count]; _capacity = _count + count; } memset(_items + _count * _itemSize, '\0', count * _itemSize); _count += count; } - (void)removeItemAtIndex: (size_t)index { [self removeItemsInRange: of_range(index, 1)]; } - (void)removeItemsInRange: (of_range_t)range |
︙ | ︙ |