14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
*/
#include "config.h"
#import "OFLHAArchive.h"
#import "OFLHAArchiveEntry.h"
#import "OFLHAArchiveEntry+Private.h"
#ifdef OF_HAVE_FILES
# import "OFFile.h"
#endif
#import "OFLHADecompressingStream.h"
#import "OFStream.h"
#import "OFSeekableStream.h"
#import "OFString.h"
#import "crc16.h"
#import "OFChecksumMismatchException.h"
#import "OFInvalidArgumentException.h"
#import "OFNotImplementedException.h"
#import "OFNotOpenException.h"
#import "OFOutOfRangeException.h"
#import "OFTruncatedDataException.h"
#import "OFWriteFailedException.h"
|
>
<
<
|
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
*/
#include "config.h"
#import "OFLHAArchive.h"
#import "OFLHAArchiveEntry.h"
#import "OFLHAArchiveEntry+Private.h"
#import "OFCRC16.h"
#ifdef OF_HAVE_FILES
# import "OFFile.h"
#endif
#import "OFLHADecompressingStream.h"
#import "OFStream.h"
#import "OFSeekableStream.h"
#import "OFString.h"
#import "OFChecksumMismatchException.h"
#import "OFInvalidArgumentException.h"
#import "OFNotImplementedException.h"
#import "OFNotOpenException.h"
#import "OFOutOfRangeException.h"
#import "OFTruncatedDataException.h"
#import "OFWriteFailedException.h"
|
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
|
if (length > _toRead)
length = _toRead;
ret = [_decompressedStream readIntoBuffer: buffer length: length];
_toRead -= ret;
_CRC16 = of_crc16(_CRC16, buffer, ret);
if (_toRead == 0) {
_atEndOfStream = true;
if (_CRC16 != _entry.CRC16) {
OFString *actualChecksum = [OFString stringWithFormat:
@"%04" PRIX16, _CRC16];
|
|
|
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
|
if (length > _toRead)
length = _toRead;
ret = [_decompressedStream readIntoBuffer: buffer length: length];
_toRead -= ret;
_CRC16 = OFCRC16(_CRC16, buffer, ret);
if (_toRead == 0) {
_atEndOfStream = true;
if (_CRC16 != _entry.CRC16) {
OFString *actualChecksum = [OFString stringWithFormat:
@"%04" PRIX16, _CRC16];
|
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
|
@throw [OFOutOfRangeException exception];
@try {
bytesWritten = (uint32_t)[_stream writeBuffer: buffer
length: length];
} @catch (OFWriteFailedException *e) {
_bytesWritten += e.bytesWritten;
_CRC16 = of_crc16(_CRC16, buffer, e.bytesWritten);
@throw e;
}
_bytesWritten += (uint32_t)bytesWritten;
_CRC16 = of_crc16(_CRC16, buffer, bytesWritten);
return bytesWritten;
}
- (bool)lowlevelIsAtEndOfStream
{
if (_stream == nil)
|
|
|
|
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
|
@throw [OFOutOfRangeException exception];
@try {
bytesWritten = (uint32_t)[_stream writeBuffer: buffer
length: length];
} @catch (OFWriteFailedException *e) {
_bytesWritten += e.bytesWritten;
_CRC16 = OFCRC16(_CRC16, buffer, e.bytesWritten);
@throw e;
}
_bytesWritten += (uint32_t)bytesWritten;
_CRC16 = OFCRC16(_CRC16, buffer, bytesWritten);
return bytesWritten;
}
- (bool)lowlevelIsAtEndOfStream
{
if (_stream == nil)
|