Differences From Artifact [91482cd774]:
- File
src/OFTarArchiveEntry.m
— part of check-in
[d74f244ab7]
at
2020-08-12 20:56:32
on branch trunk
— Avoid using (u)intmax_t in methods
It is not guaranteed that a type encoding for it exists. (user: js, size: 8043) [annotate] [blame] [check-ins using]
To Artifact [5e09222260]:
- File
src/OFTarArchiveEntry.m
— part of check-in
[25c985fec1]
at
2020-08-25 00:11:24
on branch trunk
— OFNumber: Remove (u)int{8,16,32,64} methods
Since C guarantees minimum sizes for char, short, int, long and long
long, these can be used instead. (user: js, size: 8110) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
92 93 94 95 96 97 98 | self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); OFString *targetFileName; _fileName = [stringFromBuffer(header, 100, encoding) copy]; | | | | | | | | | | 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | self = [super init]; @try { void *pool = objc_autoreleasePoolPush(); OFString *targetFileName; _fileName = [stringFromBuffer(header, 100, encoding) copy]; _mode = (unsigned long)octalValueFromBuffer( header + 100, 8, ULONG_MAX); _UID = (unsigned long)octalValueFromBuffer( header + 108, 8, ULONG_MAX); _GID = (unsigned long)octalValueFromBuffer( header + 116, 8, ULONG_MAX); _size = (unsigned long long)octalValueFromBuffer( header + 124, 12, ULLONG_MAX); _modificationDate = [[OFDate alloc] initWithTimeIntervalSince1970: (of_time_interval_t)octalValueFromBuffer( header + 136, 12, ULLONG_MAX)]; _type = header[156]; targetFileName = stringFromBuffer(header + 157, 100, encoding); |
︙ | ︙ | |||
121 122 123 124 125 126 127 | OFString *prefix; _owner = [stringFromBuffer(header + 265, 32, encoding) copy]; _group = [stringFromBuffer(header + 297, 32, encoding) copy]; | | | | | | 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | OFString *prefix; _owner = [stringFromBuffer(header + 265, 32, encoding) copy]; _group = [stringFromBuffer(header + 297, 32, encoding) copy]; _deviceMajor = (unsigned long)octalValueFromBuffer( header + 329, 8, ULONG_MAX); _deviceMinor = (unsigned long)octalValueFromBuffer( header + 337, 8, ULONG_MAX); prefix = stringFromBuffer(header + 345, 155, encoding); if (prefix.length > 0) { OFString *fileName = [OFString stringWithFormat: @"%@/%@", prefix, _fileName]; [_fileName release]; |
︙ | ︙ | |||
205 206 207 208 209 210 211 | } - (OFString *)fileName { return _fileName; } | | | | | | 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | } - (OFString *)fileName { return _fileName; } - (unsigned long)mode { return _mode; } - (unsigned long)UID { return _UID; } - (unsigned long)GID { return _GID; } - (unsigned long long)size { return _size; } - (OFDate *)modificationDate { return _modificationDate; |
︙ | ︙ | |||
250 251 252 253 254 255 256 | } - (OFString *)group { return _group; } | | | | 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 | } - (OFString *)group { return _group; } - (unsigned long)deviceMajor { return _deviceMajor; } - (unsigned long)deviceMinor { return _deviceMinor; } - (OFString *)description { void *pool = objc_autoreleasePoolPush(); |
︙ | ︙ | |||
291 292 293 294 295 296 297 | return [ret autorelease]; } - (void)of_writeToStream: (OFStream *)stream encoding: (of_string_encoding_t)encoding { unsigned char buffer[512]; | | | | 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | return [ret autorelease]; } - (void)of_writeToStream: (OFStream *)stream encoding: (of_string_encoding_t)encoding { unsigned char buffer[512]; unsigned long long modificationDate; uint16_t checksum = 0; stringToBuffer(buffer, _fileName, 100, encoding); stringToBuffer(buffer + 100, [OFString stringWithFormat: @"%06" PRIo16 " ", _mode], 8, OF_STRING_ENCODING_ASCII); stringToBuffer(buffer + 108, [OFString stringWithFormat: @"%06" PRIo16 " ", _UID], 8, OF_STRING_ENCODING_ASCII); stringToBuffer(buffer + 116, [OFString stringWithFormat: @"%06" PRIo16 " ", _GID], 8, OF_STRING_ENCODING_ASCII); stringToBuffer(buffer + 124, [OFString stringWithFormat: @"%011" PRIo64 " ", _size], 12, OF_STRING_ENCODING_ASCII); modificationDate = _modificationDate.timeIntervalSince1970; stringToBuffer(buffer + 136, [OFString stringWithFormat: @"%011llo", modificationDate], 12, OF_STRING_ENCODING_ASCII); /* * During checksumming, the checksum field is expected to be set to 8 * spaces. */ memset(buffer + 148, ' ', 8); |
︙ | ︙ |