Differences From Artifact [d5ac892200]:
- File
src/OFTarArchive.m
— part of check-in
[790b5344d6]
at
2018-05-26 23:04:24
on branch trunk
— Add OFLHAArchive
This is currently limited to reading uncompressed LHA level 2 files. (user: js, size: 9874) [annotate] [blame] [check-ins using]
To Artifact [370be37c72]:
- File src/OFTarArchive.m — part of check-in [54fe3999b7] at 2018-06-17 01:01:26 on branch trunk — OFLHAArchive: Add write and append support (user: js, size: 9891) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
105 106 107 108 109 110 111 | uint32_t u32[1024 / sizeof(uint32_t)]; } buffer; bool empty = true; if (![_stream isKindOfClass: [OFSeekableStream class]]) @throw [OFInvalidArgumentException exception]; | | | | | | | | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | uint32_t u32[1024 / sizeof(uint32_t)]; } buffer; bool empty = true; if (![_stream isKindOfClass: [OFSeekableStream class]]) @throw [OFInvalidArgumentException exception]; [_stream seekToOffset: -1024 whence: SEEK_END]; [_stream readIntoBuffer: buffer.c exactLength: 1024]; for (size_t i = 0; i < 1024 / sizeof(uint32_t); i++) if (buffer.u32[i] != 0) empty = false; if (!empty) @throw [OFInvalidFormatException exception]; [_stream seekToOffset: -1024 whence: SEEK_END]; } _encoding = OF_STRING_ENCODING_UTF_8; } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ | |||
400 401 402 403 404 405 406 | [_stream readIntoBuffer: buffer exactLength: (size_t)(512 - (size % 512))]; } } @end @implementation OFTarArchive_FileWriteStream | | | 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 | [_stream readIntoBuffer: buffer exactLength: (size_t)(512 - (size % 512))]; } } @end @implementation OFTarArchive_FileWriteStream - (instancetype)of_initWithStream: (OF_KINDOF(OFStream *))stream entry: (OFTarArchiveEntry *)entry { self = [super init]; @try { _entry = [entry copy]; _stream = [stream retain]; |
︙ | ︙ |