︙ | | | ︙ | |
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
{
OFTarArchiveEntry *_entry;
OFStream *_stream;
uint64_t _toRead;
bool _atEndOfStream;
}
- initWithEntry: (OFTarArchiveEntry *)entry
stream: (OFStream *)stream;
- (void)of_skip;
@end
@interface OFTarArchive_FileWriteStream: OFStream
{
OFTarArchiveEntry *_entry;
OFStream *_stream;
uint64_t _toWrite;
}
- initWithEntry: (OFTarArchiveEntry *)entry
stream: (OFStream *)stream;
@end
static void
stringToBuffer(unsigned char *buffer, OFString *string, size_t length)
{
size_t UTF8StringLength = [string UTF8StringLength];
|
>
|
<
>
|
<
|
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
{
OFTarArchiveEntry *_entry;
OFStream *_stream;
uint64_t _toRead;
bool _atEndOfStream;
}
- initWithStream: (OFStream *)stream
entry: (OFTarArchiveEntry *)entry;
- (void)of_skip;
@end
@interface OFTarArchive_FileWriteStream: OFStream
{
OFTarArchiveEntry *_entry;
OFStream *_stream;
uint64_t _toWrite;
}
- initWithStream: (OFStream *)stream
entry: (OFTarArchiveEntry *)entry;
@end
static void
stringToBuffer(unsigned char *buffer, OFString *string, size_t length)
{
size_t UTF8StringLength = [string UTF8StringLength];
|
︙ | | | ︙ | |
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
return nil;
}
entry = [[[OFTarArchiveEntry alloc]
of_initWithHeader: buffer.c] autorelease];
_lastReturnedStream = [[OFTarArchive_FileReadStream alloc]
initWithEntry: entry
stream: _stream];
return entry;
}
- (OFStream *)streamForReadingCurrentEntry
{
if (_mode != OF_TAR_ARCHIVE_MODE_READ)
|
<
|
>
|
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
|
return nil;
}
entry = [[[OFTarArchiveEntry alloc]
of_initWithHeader: buffer.c] autorelease];
_lastReturnedStream = [[OFTarArchive_FileReadStream alloc]
initWithStream: _stream
entry: entry];
return entry;
}
- (OFStream *)streamForReadingCurrentEntry
{
if (_mode != OF_TAR_ARCHIVE_MODE_READ)
|
︙ | | | ︙ | |
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
stringToBuffer(buffer + 148,
[OFString stringWithFormat: @"%06" PRIo16, checksum], 7);
[_stream writeBuffer: buffer
length: sizeof(buffer)];
_lastReturnedStream = [[OFTarArchive_FileWriteStream alloc]
initWithEntry: entry
stream: _stream];
objc_autoreleasePoolPop(pool);
return [[_lastReturnedStream retain] autorelease];
}
- (void)close
|
<
|
>
|
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
|
stringToBuffer(buffer + 148,
[OFString stringWithFormat: @"%06" PRIo16, checksum], 7);
[_stream writeBuffer: buffer
length: sizeof(buffer)];
_lastReturnedStream = [[OFTarArchive_FileWriteStream alloc]
initWithStream: _stream
entry: entry];
objc_autoreleasePoolPop(pool);
return [[_lastReturnedStream retain] autorelease];
}
- (void)close
|
︙ | | | ︙ | |
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
[_stream release];
_stream = nil;
}
@end
@implementation OFTarArchive_FileReadStream
- initWithEntry: (OFTarArchiveEntry *)entry
stream: (OFStream *)stream
{
self = [super init];
@try {
_entry = [entry copy];
_stream = [stream retain];
_toRead = [entry size];
|
>
|
<
|
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
[_stream release];
_stream = nil;
}
@end
@implementation OFTarArchive_FileReadStream
- initWithStream: (OFStream *)stream
entry: (OFTarArchiveEntry *)entry
{
self = [super init];
@try {
_entry = [entry copy];
_stream = [stream retain];
_toRead = [entry size];
|
︙ | | | ︙ | |
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
|
if (size % 512 != 0)
[_stream readIntoBuffer: buffer
exactLength: 512 - ((size_t)size % 512)];
}
@end
@implementation OFTarArchive_FileWriteStream
- initWithEntry: (OFTarArchiveEntry *)entry
stream: (OFStream *)stream
{
self = [super init];
@try {
_entry = [entry copy];
_stream = [stream retain];
_toWrite = [entry size];
|
>
|
<
|
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
|
if (size % 512 != 0)
[_stream readIntoBuffer: buffer
exactLength: 512 - ((size_t)size % 512)];
}
@end
@implementation OFTarArchive_FileWriteStream
- initWithStream: (OFStream *)stream
entry: (OFTarArchiveEntry *)entry
{
self = [super init];
@try {
_entry = [entry copy];
_stream = [stream retain];
_toWrite = [entry size];
|
︙ | | | ︙ | |