ObjFW  Check-in [14fe09e7fa]

Overview
Comment:OFMutableArray: Fix out of range check for -[removeNItems:atIndex:].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 14fe09e7fa97d76d31e50fe5cdb7178adcf45b5438913033a24c9bde648431b1
User & Date: js on 2010-01-03 17:28:10
Other Links: manifest | tags
Context
2010-01-03
17:28
Fix missing retain + autorelease on return. check-in: 0d9f732af1 user: js tags: trunk
17:28
OFMutableArray: Fix out of range check for -[removeNItems:atIndex:]. check-in: 14fe09e7fa user: js tags: trunk
17:22
Add OFFastEnumeration protocol and OFEnumerationMutationException. check-in: 9a881883be user: js tags: trunk
Changes

Modified src/OFMutableArray.m from [3bbaec8fd0] to [28d8f0b089].

154
155
156
157
158
159
160
161
162
163
164
165
166
167
168

- removeNObjects: (size_t)nobjects
	 atIndex: (size_t)index
{
	OFObject **objs = [array cArray];
	size_t i, count = [array count];

	if (nobjects > count)
		@throw [OFOutOfRangeException newWithClass: isa];

	for (i = index; i < count && i < index + nobjects; i++)
		[objs[i] release];

	[array removeNItems: nobjects
		    atIndex: index];







|







154
155
156
157
158
159
160
161
162
163
164
165
166
167
168

- removeNObjects: (size_t)nobjects
	 atIndex: (size_t)index
{
	OFObject **objs = [array cArray];
	size_t i, count = [array count];

	if (nobjects > count - index)
		@throw [OFOutOfRangeException newWithClass: isa];

	for (i = index; i < count && i < index + nobjects; i++)
		[objs[i] release];

	[array removeNItems: nobjects
		    atIndex: index];