ObjFW  Diff

Differences From Artifact [fe0918c4c9]:

To Artifact [bf7091f2d8]:


193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
		    attributesOfItemAtPath: path].fileSize;

# if ULLONG_MAX > SIZE_MAX
		if (size > SIZE_MAX)
			@throw [OFOutOfRangeException exception];
# endif

		if ((buffer = malloc((size_t)size)) == NULL)
			@throw [OFOutOfMemoryException
			    exceptionWithRequestedSize: (size_t)size];

		file = [[OFFile alloc] initWithPath: path
					       mode: @"r"];
		@try {
			[file readIntoBuffer: buffer
				 exactLength: (size_t)size];
		} @finally {
			[file release];
		}
	} @catch (id e) {
		free(buffer);
		[self release];

		@throw e;
	}

	@try {
		self = [self initWithItemsNoCopy: buffer
					   count: (size_t)size
				    freeWhenDone: true];
	} @catch (id e) {
		free(buffer);
		@throw e;
	}

	return self;
}
#endif








<
<
<
|









|










|







193
194
195
196
197
198
199



200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
		    attributesOfItemAtPath: path].fileSize;

# if ULLONG_MAX > SIZE_MAX
		if (size > SIZE_MAX)
			@throw [OFOutOfRangeException exception];
# endif




		buffer = of_malloc(1, (size_t)size);
		file = [[OFFile alloc] initWithPath: path
					       mode: @"r"];
		@try {
			[file readIntoBuffer: buffer
				 exactLength: (size_t)size];
		} @finally {
			[file release];
		}
	} @catch (id e) {
		of_free(buffer);
		[self release];

		@throw e;
	}

	@try {
		self = [self initWithItemsNoCopy: buffer
					   count: (size_t)size
				    freeWhenDone: true];
	} @catch (id e) {
		of_free(buffer);
		@throw e;
	}

	return self;
}
#endif

379
380
381
382
383
384
385
386
387
388
389
390
391
392
393

	return self;
}

- (void)dealloc
{
	if (_freeWhenDone)
		free(_items);

	[_parentData release];

	[super dealloc];
}

- (size_t)count







|







376
377
378
379
380
381
382
383
384
385
386
387
388
389
390

	return self;
}

- (void)dealloc
{
	if (_freeWhenDone)
		of_free(_items);

	[_parentData release];

	[super dealloc];
}

- (size_t)count