ObjFW  Diff

Differences From Artifact [f5681d0dfa]:

To Artifact [019e3d878c]:


113
114
115
116
117
118
119
120






121















122
123
124
125




126
127
128
129
130
131
132
133
134
135
136
137
			 withSize: itemsize];

	memcpy(data + count * itemsize, carray, nitems * itemsize);
	count += nitems;

	return self;
}







- removeNItems: (size_t)nitems















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





	data = [self resizeMemory: data
			 toNItems: count - nitems
			 withSize: itemsize];

	count -= nitems;

	return self;
}

- (id)copy
{
	OFDataArray *new = [[OFDataArray alloc] initWithItemSize: itemsize];








>
>
>
>
>
>

>
>
>
>
>
>
>
>
>
>
>
>
>
>
>




>
>
>
>

|

<
<







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153


154
155
156
157
158
159
160
			 withSize: itemsize];

	memcpy(data + count * itemsize, carray, nitems * itemsize);
	count += nitems;

	return self;
}

- removeItemAtIndex: (size_t)index
{
	return [self removeNItems: 1
			  atIndex: index];
}

- removeNItems: (size_t)nitems
{
	if (nitems > count)
		@throw [OFOutOfRangeException newWithClass: isa];


	count -= nitems;
	data = [self resizeMemory: data
			 toNItems: count
			 withSize: itemsize];

	return self;
}

- removeNItems: (size_t)nitems
       atIndex: (size_t)index
{
	if (nitems > count)
		@throw [OFOutOfRangeException newWithClass: isa];

	memmove(data + index * itemsize, data + (index + nitems) * itemsize,
	    nitems * itemsize);

	count -= nitems;
	data = [self resizeMemory: data
			 toNItems: count
			 withSize: itemsize];



	return self;
}

- (id)copy
{
	OFDataArray *new = [[OFDataArray alloc] initWithItemSize: itemsize];
259
260
261
262
263
264
265

266
267
268
269
270

271














272





273
274
275
276
277
278
279
- removeNItems: (size_t)nitems
{
	size_t nsize;

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


	nsize = ((count - nitems) * itemsize + lastpagebyte) & ~lastpagebyte;

	if (size != nsize)
		data = [self resizeMemory: data
				   toSize: nsize];
















	count -= nitems;





	size = nsize;

	return self;
}

- (id)copy
{







>
|




>

>
>
>
>
>
>
>
>
>
>
>
>
>
>

>
>
>
>
>







282
283
284
285
286
287
288
289
290
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
- removeNItems: (size_t)nitems
{
	size_t nsize;

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

	count -= nitems;
	nsize = (count * itemsize + lastpagebyte) & ~lastpagebyte;

	if (size != nsize)
		data = [self resizeMemory: data
				   toSize: nsize];
	size = nsize;

	return self;
}

- removeNItems: (size_t)nitems
       atIndex: (size_t)index
{
	size_t nsize;

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

	memmove(data + index * itemsize, data + (index + nitems) * itemsize,
	    nitems * itemsize);

	count -= nitems;
	nsize = (count * itemsize + lastpagebyte) & ~lastpagebyte;

	if (size != nsize)
		data = [self resizeMemory: data
				   toSize: nsize];
	size = nsize;

	return self;
}

- (id)copy
{