Overview
Comment: | OFTarArchive: Support for star numbers |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
6b6856298d4c4b4f314f83e442356b5e |
User & Date: | js on 2017-10-01 18:09:11 |
Other Links: | manifest | tags |
Context
2017-10-01
| ||
21:06 | Fix compilation with GCC check-in: f97084d9c3 user: js tags: trunk | |
18:09 | OFTarArchive: Support for star numbers check-in: 6b6856298d user: js tags: trunk | |
14:05 | Disable -Wnullable-to-nonnull-conversion again check-in: e47c219327 user: js tags: trunk | |
Changes
Modified src/OFIntrospection.m from [cd2923612d] to [952618548a].
︙ | ︙ | |||
367 368 369 370 371 372 373 | #if defined(OF_OBJFW_RUNTIME) - (instancetype)of_initWithIvar: (struct objc_ivar *)ivar { self = [super init]; @try { | > | > > | | | 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | #if defined(OF_OBJFW_RUNTIME) - (instancetype)of_initWithIvar: (struct objc_ivar *)ivar { self = [super init]; @try { if (ivar->name != NULL) _name = [[OFString alloc] initWithUTF8String: ivar->name]; _typeEncoding = ivar->type; _offset = ivar->offset; } @catch (id e) { [self release]; @throw e; } return self; } #elif defined(OF_APPLE_RUNTIME) - (instancetype)of_initWithIvar: (Ivar)ivar { self = [super init]; @try { const char *name = ivar_getName(ivar); if (name != NULL) _name = [[OFString alloc] initWithUTF8String: name]; _typeEncoding = ivar_getTypeEncoding(ivar); _offset = ivar_getOffset(ivar); } @catch (id e) { [self release]; @throw e; } |
︙ | ︙ |
Modified src/OFMutableTarArchiveEntry.h from [05ac9802be] to [816968613e].
︙ | ︙ | |||
30 31 32 33 34 35 36 | * The file name of the entry. */ @property (readwrite, copy, nonatomic) OFString *fileName; /*! * The mode of the entry. */ | | | | | 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | * The file name of the entry. */ @property (readwrite, copy, nonatomic) OFString *fileName; /*! * The mode of the entry. */ @property (readwrite, nonatomic) uint32_t mode; /*! * The UID of the owner. */ @property (readwrite, nonatomic) uint32_t UID; /*! * The GID of the group. */ @property (readwrite, nonatomic) uint32_t GID; /*! * The size of the file. */ @property (readwrite, nonatomic) uint64_t size; /*! |
︙ | ︙ |
Modified src/OFMutableTarArchiveEntry.m from [51881174be] to [f0f930a3ee].
︙ | ︙ | |||
36 37 38 39 40 41 42 | - (void)setFileName: (OFString *)fileName { OFString *old = _fileName; _fileName = [fileName copy]; [old release]; } | | | | | 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | - (void)setFileName: (OFString *)fileName { OFString *old = _fileName; _fileName = [fileName copy]; [old release]; } - (void)setMode: (uint32_t)mode { _mode = mode; } - (void)setUID: (uint32_t)UID { _UID = UID; } - (void)setGID: (uint32_t)GID { _GID = GID; } - (void)setSize: (uint64_t)size { _size = size; |
︙ | ︙ |
Modified src/OFTarArchive.m from [5865d323f0] to [4f6abee812].
︙ | ︙ | |||
155 156 157 158 159 160 161 | [super dealloc]; } - (OFTarArchiveEntry *)nextEntry { OFTarArchiveEntry *entry; union { | | | 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 | [super dealloc]; } - (OFTarArchiveEntry *)nextEntry { OFTarArchiveEntry *entry; union { unsigned char c[512]; uint32_t u32[512 / sizeof(uint32_t)]; } buffer; bool empty = true; if (_mode != OF_TAR_ARCHIVE_MODE_READ) @throw [OFInvalidArgumentException exception]; |
︙ | ︙ |
Modified src/OFTarArchiveEntry+Private.h from [3a30f14045] to [89501a0a5d].
︙ | ︙ | |||
17 18 19 20 21 22 23 | #import "OFTarArchiveEntry.h" OF_ASSUME_NONNULL_BEGIN @class OFStream; @interface OFTarArchiveEntry () | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 | #import "OFTarArchiveEntry.h" OF_ASSUME_NONNULL_BEGIN @class OFStream; @interface OFTarArchiveEntry () - (instancetype)of_initWithHeader: (unsigned char [_Nonnull 512])header OF_METHOD_FAMILY(init); - (void)of_writeToStream: (OFStream *)stream; @end OF_ASSUME_NONNULL_END |
Modified src/OFTarArchiveEntry.h from [751dab67dd] to [1927c987a7].
︙ | ︙ | |||
46 47 48 49 50 51 52 | * @class OFTarArchiveEntry OFTarArchiveEntry.h ObjFW/OFTarArchiveEntry.h * * @brief A class which represents an entry of a tar archive. */ @interface OFTarArchiveEntry: OFObject <OFCopying, OFMutableCopying> { OFString *_fileName; | | | | | | | 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 86 87 88 | * @class OFTarArchiveEntry OFTarArchiveEntry.h ObjFW/OFTarArchiveEntry.h * * @brief A class which represents an entry of a tar archive. */ @interface OFTarArchiveEntry: OFObject <OFCopying, OFMutableCopying> { OFString *_fileName; uint32_t _mode; uint64_t _size; uint32_t _UID, _GID; OFDate *_modificationDate; of_tar_archive_entry_type_t _type; OFString *_Nullable _targetFileName; OFString *_Nullable _owner, *_Nullable _group; uint32_t _deviceMajor, _deviceMinor; } /*! * The file name of the entry. */ @property (readonly, copy, nonatomic) OFString *fileName; /*! * The mode of the entry. */ @property (readonly, nonatomic) uint32_t mode; /*! * The UID of the owner. */ @property (readonly, nonatomic) uint32_t UID; /*! * The GID of the group. */ @property (readonly, nonatomic) uint32_t GID; /*! * The size of the file. */ @property (readonly, nonatomic) uint64_t size; /*! |
︙ | ︙ |
Modified src/OFTarArchiveEntry.m from [23b893292f] to [aa9fa8f2dc].
︙ | ︙ | |||
22 23 24 25 26 27 28 | #import "OFTarArchiveEntry+Private.h" #import "OFStream.h" #import "OFDate.h" #import "OFOutOfRangeException.h" static OFString * | | | | > > > > > > > > > | | | | | | | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | #import "OFTarArchiveEntry+Private.h" #import "OFStream.h" #import "OFDate.h" #import "OFOutOfRangeException.h" static OFString * stringFromBuffer(const unsigned char *buffer, size_t length) { for (size_t i = 0; i < length; i++) if (buffer[i] == '\0') length = i; return [OFString stringWithUTF8String: (const char *)buffer length: length]; } static void stringToBuffer(unsigned char *buffer, OFString *string, size_t length) { size_t UTF8StringLength = [string UTF8StringLength]; if (UTF8StringLength > length) @throw [OFOutOfRangeException exception]; memcpy(buffer, [string UTF8String], UTF8StringLength); for (size_t i = UTF8StringLength; i < length; i++) buffer[i] = '\0'; } static uintmax_t octalValueFromBuffer(const unsigned char *buffer, size_t length, uintmax_t max) { uintmax_t value; if (length == 0) return 0; if (buffer[0] == 0x80) { for (size_t i = 1; i < length; i++) value = (value << 8) | buffer[i]; } else value = [stringFromBuffer(buffer, length) octalValue]; if (value > max) @throw [OFOutOfRangeException exception]; return value; } @implementation OFTarArchiveEntry + (instancetype)entryWithFileName: (OFString *)fileName { return [[[self alloc] initWithFileName: fileName] autorelease]; } - init { OF_INVALID_INIT_METHOD } - (instancetype)of_initWithHeader: (unsigned char [512])header { self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); OFString *targetFileName; _fileName = [stringFromBuffer(header, 100) copy]; _mode = (uint32_t)octalValueFromBuffer( header + 100, 8, UINT32_MAX); _UID = (uint32_t)octalValueFromBuffer( header + 108, 8, UINT32_MAX); _GID = (uint32_t)octalValueFromBuffer( header + 116, 8, UINT32_MAX); _size = (uint64_t)octalValueFromBuffer( header + 124, 12, UINT64_MAX); _modificationDate = [[OFDate alloc] initWithTimeIntervalSince1970: (of_time_interval_t)octalValueFromBuffer( header + 136, 12, UINTMAX_MAX)]; _type = header[156]; |
︙ | ︙ | |||
188 189 190 191 192 193 194 | } - (OFString *)fileName { return _fileName; } | | | | | 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | } - (OFString *)fileName { return _fileName; } - (uint32_t)mode { return _mode; } - (uint32_t)UID { return _UID; } - (uint32_t)GID { return _GID; } - (uint64_t)size { return _size; |
︙ | ︙ |