Differences From Artifact [4f6abee812]:
- File src/OFTarArchive.m — part of check-in [6b6856298d] at 2017-10-01 18:09:11 on branch trunk — OFTarArchive: Support for star numbers (user: js, size: 9358) [annotate] [blame] [check-ins using]
To Artifact [deb3b00a60]:
- File
src/OFTarArchive.m
— part of check-in
[2f4e0df8be]
at
2017-10-17 00:33:37
on branch trunk
— Do not use implicit method return types
Instead, explicitly declare them, as OF_ASSUME_NONNULL_{BEGIN,END} does
not apply to implicit return types. This means that after this commit,
all init methods have a nonnull return type, as they should have. (user: js, size: 9442) [annotate] [blame] [check-ins using]
| ︙ | ︙ | |||
37 38 39 40 41 42 43 |
{
OFTarArchiveEntry *_entry;
OF_KINDOF(OFStream *) _stream;
uint64_t _toRead;
bool _atEndOfStream;
}
| | | | | | | | 37 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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
{
OFTarArchiveEntry *_entry;
OF_KINDOF(OFStream *) _stream;
uint64_t _toRead;
bool _atEndOfStream;
}
- (instancetype)initWithStream: (OFStream *)stream
entry: (OFTarArchiveEntry *)entry;
- (void)of_skip;
@end
@interface OFTarArchive_FileWriteStream: OFStream
{
OFTarArchiveEntry *_entry;
OFStream *_stream;
uint64_t _toWrite;
}
- (instancetype)initWithStream: (OFStream *)stream
entry: (OFTarArchiveEntry *)entry;
@end
@implementation OFTarArchive: OFObject
+ (instancetype)archiveWithStream: (OF_KINDOF(OFStream *))stream
mode: (OFString *)mode
{
return [[[self alloc] initWithStream: stream
mode: mode] autorelease];
}
#ifdef OF_HAVE_FILES
+ (instancetype)archiveWithPath: (OFString *)path
mode: (OFString *)mode
{
return [[[self alloc] initWithPath: path
mode: mode] autorelease];
}
#endif
- (instancetype)initWithStream: (OF_KINDOF(OFStream *))stream
mode: (OFString *)mode
{
self = [super init];
@try {
_stream = [stream retain];
if ([mode isEqual: @"r"])
|
| ︙ | ︙ | |||
121 122 123 124 125 126 127 | @throw e; } return self; } #ifdef OF_HAVE_FILES | | | | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
@throw e;
}
return self;
}
#ifdef OF_HAVE_FILES
- (instancetype)initWithPath: (OFString *)path
mode: (OFString *)mode
{
OFFile *file;
if ([mode isEqual: @"a"])
file = [[OFFile alloc] initWithPath: path
mode: @"r+"];
else
|
| ︙ | ︙ | |||
258 259 260 261 262 263 264 | [_stream release]; _stream = nil; } @end @implementation OFTarArchive_FileReadStream | | | | 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 |
[_stream release];
_stream = nil;
}
@end
@implementation OFTarArchive_FileReadStream
- (instancetype)initWithStream: (OFStream *)stream
entry: (OFTarArchiveEntry *)entry
{
self = [super init];
@try {
_entry = [entry copy];
_stream = [stream retain];
_toRead = [entry size];
|
| ︙ | ︙ | |||
380 381 382 383 384 385 386 | [_stream readIntoBuffer: buffer exactLength: 512 - (size % 512)]; } } @end @implementation OFTarArchive_FileWriteStream | | | | 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
[_stream readIntoBuffer: buffer
exactLength: 512 - (size % 512)];
}
}
@end
@implementation OFTarArchive_FileWriteStream
- (instancetype)initWithStream: (OFStream *)stream
entry: (OFTarArchiveEntry *)entry
{
self = [super init];
@try {
_entry = [entry copy];
_stream = [stream retain];
_toWrite = [entry size];
|
| ︙ | ︙ |