ObjFW  Diff

Differences From Artifact [6b96716473]:

To Artifact [753e5c551b]:


261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
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
{
	OF_INVALID_INIT_METHOD
}

#ifdef OF_HAVE_FILES
- (instancetype)initWithContentsOfFile: (OFString *)path
{
	char *buffer = NULL;
	OFStreamOffset fileSize;

	@try {
		void *pool = objc_autoreleasePoolPush();
		OFFile *file = [OFFile fileWithPath: path mode: @"r"];
		fileSize = [file seekToOffset: 0 whence: OFSeekEnd];

		if (fileSize < 0 || (unsigned long long)fileSize > SIZE_MAX)
			@throw [OFOutOfRangeException exception];

		[file seekToOffset: 0 whence: OFSeekSet];

		buffer = OFAllocMemory((size_t)fileSize, 1);
		[file readIntoBuffer: buffer exactLength: (size_t)fileSize];

		objc_autoreleasePoolPop(pool);
	} @catch (id e) {
		OFFreeMemory(buffer);
		[self release];

		@throw e;
	}

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


	return self;
}
#endif

- (instancetype)initWithContentsOfIRI: (OFIRI *)IRI
{







<
<
<
<
|
<
<
|
<
<

<
|
<
<
|
<

<

<



<
|
<
<
<
<
<
|
>







261
262
263
264
265
266
267




268


269


270

271


272

273

274

275
276
277

278





279
280
281
282
283
284
285
286
287
{
	OF_INVALID_INIT_METHOD
}

#ifdef OF_HAVE_FILES
- (instancetype)initWithContentsOfFile: (OFString *)path
{




	void *pool = objc_autoreleasePoolPush();


	OFIRI *IRI;




	@try {


		IRI = [OFIRI fileIRIWithPath: path];

	} @catch (id e) {

		[self release];

		@throw e;
	}


	self = [self initWithContentsOfIRI: IRI];






	objc_autoreleasePoolPop(pool);

	return self;
}
#endif

- (instancetype)initWithContentsOfIRI: (OFIRI *)IRI
{