Overview
Comment: | OFMutableData: Add -[mutable{First,Last}Item] |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e308b28e00b86a648e151dd2b12c9cda |
User & Date: | js on 2019-08-01 22:13:50 |
Other Links: | manifest | tags |
Context
2019-08-02
| ||
02:16 | tlskey: Create OFMapTable lazily check-in: acc67b0bb6 user: js tags: trunk | |
2019-08-01
| ||
22:13 | OFMutableData: Add -[mutable{First,Last}Item] check-in: e308b28e00 user: js tags: trunk | |
21:31 | Add thread-local storage for AmigaOS check-in: abaf310373 user: js tags: trunk | |
Changes
Modified src/OFMutableData.h from [68ac1d26ec] to [5a53632ba0].
︙ | ︙ | |||
38 39 40 41 42 43 44 45 46 47 48 49 50 51 | * @warning The pointer is only valid until the OFMutableData is changed! * * Modifying the returned array directly is allowed and will change the contents * of the data. */ @property (readonly, nonatomic) void *mutableItems OF_RETURNS_INNER_POINTER; /*! * @brief Creates a new OFMutableData with an item size of 1. * * @return A new autoreleased OFMutableData */ + (instancetype)data; | > > > > > > > > > > > > | 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 | * @warning The pointer is only valid until the OFMutableData is changed! * * Modifying the returned array directly is allowed and will change the contents * of the data. */ @property (readonly, nonatomic) void *mutableItems OF_RETURNS_INNER_POINTER; /*! * @brief The first item of the OFMutableData or `NULL`. */ @property OF_NULLABLE_PROPERTY (readonly, nonatomic) void *mutableFirstItem OF_RETURNS_INNER_POINTER; /*! * @brief The last item of the OFMutableData or `NULL`. */ @property OF_NULLABLE_PROPERTY (readonly, nonatomic) void *mutableLastItem OF_RETURNS_INNER_POINTER; /*! * @brief Creates a new OFMutableData with an item size of 1. * * @return A new autoreleased OFMutableData */ + (instancetype)data; |
︙ | ︙ |
Modified src/OFMutableData.m from [4177ee034d] to [f88d322dfd].
︙ | ︙ | |||
150 151 152 153 154 155 156 157 158 159 160 161 162 163 | - (void *)mutableItemAtIndex: (size_t)idx { if (idx >= _count) @throw [OFOutOfRangeException exception]; return _items + idx * _itemSize; } - (OFData *)subdataWithRange: (of_range_t)range { if (range.length > SIZE_MAX - range.location || range.location + range.length > _count) @throw [OFOutOfRangeException exception]; | > > > > > > > > > > > > > > > > | 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 | - (void *)mutableItemAtIndex: (size_t)idx { if (idx >= _count) @throw [OFOutOfRangeException exception]; return _items + idx * _itemSize; } - (void *)mutableFirstItem { if (_items == NULL || _count == 0) return NULL; return _items; } - (void *)mutableLastItem { if (_items == NULL || _count == 0) return NULL; return _items + (_count - 1) * _itemSize; } - (OFData *)subdataWithRange: (of_range_t)range { if (range.length > SIZE_MAX - range.location || range.location + range.length > _count) @throw [OFOutOfRangeException exception]; |
︙ | ︙ |