ObjFW  Diff

Differences From Artifact [75090f7155]:

To Artifact [7d2a571c32]:


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#import "OFDataArray.h"
#import "OFDate.h"
#import "OFStream.h"

#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"

extern uint32_t of_zip_archive_read_field32(uint8_t**, uint16_t*);
extern uint64_t of_zip_archive_read_field64(uint8_t**, uint16_t*);

OFString*
of_zip_archive_entry_version_to_string(uint16_t version)
{
	const char *attrCompat = NULL;

	switch (version >> 8) {
	case OF_ZIP_ARCHIVE_ENTRY_ATTR_COMPAT_MSDOS:
		attrCompat = "MS-DOS or OS/2";







|
|

|







24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#import "OFDataArray.h"
#import "OFDate.h"
#import "OFStream.h"

#import "OFInvalidArgumentException.h"
#import "OFInvalidFormatException.h"

extern uint32_t of_zip_archive_read_field32(uint8_t **, uint16_t *);
extern uint64_t of_zip_archive_read_field64(uint8_t **, uint16_t *);

OFString *
of_zip_archive_entry_version_to_string(uint16_t version)
{
	const char *attrCompat = NULL;

	switch (version >> 8) {
	case OF_ZIP_ARCHIVE_ENTRY_ATTR_COMPAT_MSDOS:
		attrCompat = "MS-DOS or OS/2";
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
@synthesize CRC32 = _CRC32;
@synthesize versionSpecificAttributes = _versionSpecificAttributes;
@synthesize generalPurposeBitFlag = _generalPurposeBitFlag;
@synthesize OF_lastModifiedFileTime = _lastModifiedFileTime;
@synthesize OF_lastModifiedFileDate = _lastModifiedFileDate;
@synthesize OF_localFileHeaderOffset = _localFileHeaderOffset;

- (instancetype)OF_initWithStream: (OFStream*)stream
{
	self = [super init];

	@try {
		void *pool = objc_autoreleasePoolPush();
		uint16_t fileNameLength, extraFieldLength, fileCommentLength;
		of_string_encoding_t encoding;







|







151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
@synthesize CRC32 = _CRC32;
@synthesize versionSpecificAttributes = _versionSpecificAttributes;
@synthesize generalPurposeBitFlag = _generalPurposeBitFlag;
@synthesize OF_lastModifiedFileTime = _lastModifiedFileTime;
@synthesize OF_lastModifiedFileDate = _lastModifiedFileDate;
@synthesize OF_localFileHeaderOffset = _localFileHeaderOffset;

- (instancetype)OF_initWithStream: (OFStream *)stream
{
	self = [super init];

	@try {
		void *pool = objc_autoreleasePoolPush();
		uint16_t fileNameLength, extraFieldLength, fileCommentLength;
		of_string_encoding_t encoding;
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
	[_fileName release];
	[_extraField release];
	[_fileComment release];

	[super dealloc];
}

- (OFDate*)modificationDate
{
	void *pool = objc_autoreleasePoolPush();
	uint16_t year = ((_lastModifiedFileDate & 0xFE00) >> 9) + 1980;
	uint8_t month = (_lastModifiedFileDate & 0x1E0) >> 5;
	uint8_t day = (_lastModifiedFileDate & 0x1F);
	uint8_t hour = (_lastModifiedFileTime & 0xF800) >> 11;
	uint8_t minute = (_lastModifiedFileTime & 0x7E0) >> 5;







|







233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
	[_fileName release];
	[_extraField release];
	[_fileComment release];

	[super dealloc];
}

- (OFDate *)modificationDate
{
	void *pool = objc_autoreleasePoolPush();
	uint16_t year = ((_lastModifiedFileDate & 0xFE00) >> 9) + 1980;
	uint8_t month = (_lastModifiedFileDate & 0x1E0) >> 5;
	uint8_t day = (_lastModifiedFileDate & 0x1F);
	uint8_t hour = (_lastModifiedFileTime & 0xF800) >> 11;
	uint8_t minute = (_lastModifiedFileTime & 0x7E0) >> 5;
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
						format: @"%Y-%m-%d %H:%M:%S"];

	objc_autoreleasePoolPop(pool);

	return [date autorelease];
}

- (OFDataArray*)extraField
{
	return [[_extraField copy] autorelease];
}

- (OFString*)description
{
	void *pool = objc_autoreleasePoolPush();
	OFString *ret = [OFString stringWithFormat: @"<%@:\n"
	    @"\tFile name = %@\n"
	    @"\tFile comment = %@\n"
	    @"\tGeneral purpose bit flag = %u\n"
	    @"\tCompression method = %u\n"







|




|







257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
						format: @"%Y-%m-%d %H:%M:%S"];

	objc_autoreleasePoolPop(pool);

	return [date autorelease];
}

- (OFDataArray *)extraField
{
	return [[_extraField copy] autorelease];
}

- (OFString *)description
{
	void *pool = objc_autoreleasePoolPush();
	OFString *ret = [OFString stringWithFormat: @"<%@:\n"
	    @"\tFile name = %@\n"
	    @"\tFile comment = %@\n"
	    @"\tGeneral purpose bit flag = %u\n"
	    @"\tCompression method = %u\n"