ObjFW  Check-in [e320edd7de]

Overview
Comment:OFZooArchiveEntry: Add time zone
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e320edd7de373f7fae17ba48b18c295bf51886e94075e60ce1f9ef86db6b6482
User & Date: js on 2024-03-02 09:49:44
Other Links: manifest | tags
Context
2024-03-02
10:54
OFZooArchiveEntry: Add minimum version needed check-in: 09be65bfcd user: js tags: trunk
09:49
OFZooArchiveEntry: Add time zone check-in: e320edd7de user: js tags: trunk
09:31
ofarc: Don't list/extract deleted files by default check-in: 08eb6b5bca user: js tags: trunk
Changes

Modified src/OFZooArchiveEntry.h from [a47e00ad23] to [888bd21f4c].

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
	uint16_t _lastModifiedFileDate, _lastModifiedFileTime;
	uint16_t _CRC16;
	unsigned long long _uncompressedSize, _compressedSize;
	bool _deleted;
	OFString *_Nullable _fileComment;
	OFString *_fileName, *_Nullable _directoryName;
	OFNumber *_Nullable _POSIXPermissions;
	uint8_t _timeZone;
	OF_RESERVE_IVARS(OFZooArchiveEntry, 4)
}

/**
 * @brief The compression method of the entry.
 */
@property (readonly, nonatomic) uint8_t compressionMethod;

/**
 * @brief The CRC16 of the file.
 */
@property (readonly, nonatomic) uint16_t CRC16;

/**
 * @brief Whether the file was deleted.
 */
@property (readonly, nonatomic, getter=isDeleted) bool deleted;







- (instancetype)init OF_UNAVAILABLE;
@end

OF_ASSUME_NONNULL_END







|


















>
>
>
>
>
>




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
	uint16_t _lastModifiedFileDate, _lastModifiedFileTime;
	uint16_t _CRC16;
	unsigned long long _uncompressedSize, _compressedSize;
	bool _deleted;
	OFString *_Nullable _fileComment;
	OFString *_fileName, *_Nullable _directoryName;
	OFNumber *_Nullable _POSIXPermissions;
	int8_t _timeZone;
	OF_RESERVE_IVARS(OFZooArchiveEntry, 4)
}

/**
 * @brief The compression method of the entry.
 */
@property (readonly, nonatomic) uint8_t compressionMethod;

/**
 * @brief The CRC16 of the file.
 */
@property (readonly, nonatomic) uint16_t CRC16;

/**
 * @brief Whether the file was deleted.
 */
@property (readonly, nonatomic, getter=isDeleted) bool deleted;

/**
 * @brief The time zone in which the file was stored, as an offset in hours
 *	  from UTC (as a float).
 */
@property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFNumber *timeZone;

- (instancetype)init OF_UNAVAILABLE;
@end

OF_ASSUME_NONNULL_END

Modified src/OFZooArchiveEntry.m from [8b961835b0] to [25d38787ab].

211
212
213
214
215
216
217








218
219
220
221
222
223
224
		    -(OFTimeInterval)_timeZone * 900] retain];
	}

	objc_autoreleasePoolPop(pool);

	return [date autorelease];
}









- (OFString *)description
{
	void *pool = objc_autoreleasePoolPush();
	OFString *ret = [OFString stringWithFormat:
	    @"<%@:\n"
	    @"\tFile name = %@\n"







>
>
>
>
>
>
>
>







211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
		    -(OFTimeInterval)_timeZone * 900] retain];
	}

	objc_autoreleasePoolPop(pool);

	return [date autorelease];
}

- (OFNumber *)timeZone
{
	if (_timeZone == 0x7F)
		return nil;

	return [OFNumber numberWithFloat: (float)_timeZone / 4];
}

- (OFString *)description
{
	void *pool = objc_autoreleasePoolPush();
	OFString *ret = [OFString stringWithFormat:
	    @"<%@:\n"
	    @"\tFile name = %@\n"

Modified utils/ofarc/ZooArchive.m from [7815482be6] to [cd6d242d9c].

175
176
177
178
179
180
181






















182
183
184
185
186
187
188
			    @"CRC16: %[crc16]",
			    @"crc16", CRC16)];
			[OFStdOut writeString: @"\t"];
			[OFStdOut writeLine: OF_LOCALIZED(
			    @"list_modification_date",
			    @"Modification date: %[date]",
			    @"date", modificationDate)];























			if (entry.POSIXPermissions != nil) {
				OFString *permissionsString = [OFString
				    stringWithFormat: @"%llo",
				    entry.POSIXPermissions
				    .unsignedLongLongValue];








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
			    @"CRC16: %[crc16]",
			    @"crc16", CRC16)];
			[OFStdOut writeString: @"\t"];
			[OFStdOut writeLine: OF_LOCALIZED(
			    @"list_modification_date",
			    @"Modification date: %[date]",
			    @"date", modificationDate)];

			if (entry.timeZone != nil) {
				float timeZone = entry.timeZone.floatValue;
				int hours = (int)timeZone;
				unsigned char minutes = (timeZone - hours) * 60;
				OFString *timeZoneString;

				if (hours > 0)
					timeZoneString = [OFString
					    stringWithFormat: @"UTC+%02d:%02u",
							      hours, minutes];
				else
					timeZoneString = [OFString
					    stringWithFormat: @"UTC-%02d:%02u",
							      -hours, minutes];

				[OFStdOut writeString: @"\t"];
				[OFStdOut writeLine: OF_LOCALIZED(
				    @"list_timezone",
				    @"Time zone: %[timezone]",
				    @"timezone", timeZoneString)];
			}

			if (entry.POSIXPermissions != nil) {
				OFString *permissionsString = [OFString
				    stringWithFormat: @"%llo",
				    entry.POSIXPermissions
				    .unsignedLongLongValue];

Modified utils/ofarc/localization/de.json from [f7f6a86a4c] to [6bed0b4b85].

124
125
126
127
128
129
130

131
132
133
134
135
136
137
    list_osid: "Betriebssystem-Identifikator: %[osid]",
    list_extensions: "Erweiterungen: %[extensions]",
    list_version_made_by: "Erstellt mit Version: %[version]",
    list_min_version_needed: "Mindestens benötigte Version: %[version]",
    list_general_purpose_bit_flag: "General Purpose Bit Flag: %[gpbf]",
    list_extra_field: "Extra-Feld: %[extra]",
    list_comment: "Kommentar: %[comment]",

    list_deleted: [
        "Gelöscht: ",
        [
            {"deleted == 0": "Nein"},
            {"": "Ja"}
        ]
    ],







>







124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
    list_osid: "Betriebssystem-Identifikator: %[osid]",
    list_extensions: "Erweiterungen: %[extensions]",
    list_version_made_by: "Erstellt mit Version: %[version]",
    list_min_version_needed: "Mindestens benötigte Version: %[version]",
    list_general_purpose_bit_flag: "General Purpose Bit Flag: %[gpbf]",
    list_extra_field: "Extra-Feld: %[extra]",
    list_comment: "Kommentar: %[comment]",
    list_timezone: "Zeitzone: %[timezone]",
    list_deleted: [
        "Gelöscht: ",
        [
            {"deleted == 0": "Nein"},
            {"": "Ja"}
        ]
    ],