ObjFW  Diff

Differences From Artifact [6412c1538f]:

To Artifact [651ec2f405]:


10
11
12
13
14
15
16


17
18
19
20
21
22
23
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25







+
+







 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#include <errno.h>

#import "OFTarArchive.h"
#import "OFTarArchiveEntry.h"
#import "OFTarArchiveEntry+Private.h"
#import "OFDate.h"
#import "OFSeekableStream.h"
#import "OFStream.h"
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441

442
443
444




445
446
447
448

449
450

451
452
453
454
455
456
457
427
428
429
430
431
432
433


434
435
436
437
438
439
440

441

442
443
444
445
446
447
448
449
450

451
452

453
454
455
456
457
458
459
460







-
-







-
+
-


+
+
+
+



-
+

-
+







	[_entry release];

	[super dealloc];
}

- (size_t)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length
{
	size_t bytesWritten;

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

	if ((uint64_t)length > _toWrite)
		@throw [OFOutOfRangeException exception];

	@try {
		bytesWritten = [_stream writeBuffer: buffer
		[_stream writeBuffer: buffer length: length];
					     length: length];
	} @catch (OFWriteFailedException *e) {
		_toWrite -= e.bytesWritten;

		if (e.errNo == EWOULDBLOCK)
			return e.bytesWritten;

		@throw e;
	}

	_toWrite -= bytesWritten;
	_toWrite -= length;

	return bytesWritten;
	return length;
}

- (bool)lowlevelIsAtEndOfStream
{
	if (_stream == nil)
		@throw [OFNotOpenException exceptionWithObject: self];