ObjFW  Diff

Differences From Artifact [deb3b00a60]:

To Artifact [72c8a07e42]:


295
296
297
298
299
300
301

302
303

304
305
306
307
308
309
310

	if (_stream == nil)
		@throw [OFNotOpenException exceptionWithObject: self];

	if (_atEndOfStream)
		return 0;


	if (sizeof(length) >= sizeof(uint64_t) && length > UINT64_MAX)
		@throw [OFOutOfRangeException exception];


	if ((uint64_t)length > _toRead)
		length = (size_t)_toRead;

	ret = [_stream readIntoBuffer: buffer
			       length: length];








>
|

>







295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312

	if (_stream == nil)
		@throw [OFNotOpenException exceptionWithObject: self];

	if (_atEndOfStream)
		return 0;

#if SIZE_MAX >= UINT64_MAX
	if (length > UINT64_MAX)
		@throw [OFOutOfRangeException exception];
#endif

	if ((uint64_t)length > _toRead)
		length = (size_t)_toRead;

	ret = [_stream readIntoBuffer: buffer
			       length: length];

374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
			_toRead = 0;
		}

		size = [_entry size];

		if (size % 512 != 0)
			[_stream readIntoBuffer: buffer
				    exactLength: 512 - (size % 512)];
	}
}
@end

@implementation OFTarArchive_FileWriteStream
- (instancetype)initWithStream: (OFStream *)stream
			 entry: (OFTarArchiveEntry *)entry







|







376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
			_toRead = 0;
		}

		size = [_entry size];

		if (size % 512 != 0)
			[_stream readIntoBuffer: buffer
				    exactLength: (size_t)(512 - (size % 512))];
	}
}
@end

@implementation OFTarArchive_FileWriteStream
- (instancetype)initWithStream: (OFStream *)stream
			 entry: (OFTarArchiveEntry *)entry