ObjFW  Check-in [fb8b5e652d]

Overview
Comment:OFZIPArchiveEntry: Add -[description].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: fb8b5e652d45a22b7238a147ecd3e03653c0f05f03bd093d75fce96f93192899
User & Date: js on 2013-08-15 17:55:31
Other Links: manifest | tags
Context
2013-08-15
18:44
Add OF_HAVE_CLASS_EXTENSIONS. check-in: a5bfaa315b user: js tags: trunk
17:55
OFZIPArchiveEntry: Add -[description]. check-in: fb8b5e652d user: js tags: trunk
17:43
OFHTTPResponse: Include self in -[description]. check-in: c0616f3c1e user: js tags: trunk
Changes

Modified src/OFZIPArchive.m from [01aaa2fa44] to [8fc2a5d079].

40
41
42
43
44
45
46

47
48
49
50
51
52
53
 * FIXME: Current limitations:
 *  - Compressed files cannot be read.
 *  - Encrypted files cannot be read.
 *  - Split archives are not supported.
 *  - Write support is missing.
 *  - The ZIP has to be a file on the local file system.
 *  - No support for ZIP64.

 */

@interface OFZIPArchive_LocalFileHeader: OFObject
{
@public
	uint16_t _minVersion, _generalPurposeBitFlag, _compressionMethod;
	uint16_t _lastModifiedFileTime, _lastModifiedFileDate;







>







40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
 * FIXME: Current limitations:
 *  - Compressed files cannot be read.
 *  - Encrypted files cannot be read.
 *  - Split archives are not supported.
 *  - Write support is missing.
 *  - The ZIP has to be a file on the local file system.
 *  - No support for ZIP64.
 *  - No support for data descriptors (useless without compression anyway).
 */

@interface OFZIPArchive_LocalFileHeader: OFObject
{
@public
	uint16_t _minVersion, _generalPurposeBitFlag, _compressionMethod;
	uint16_t _lastModifiedFileTime, _lastModifiedFileDate;

Modified src/OFZIPArchiveEntry.h from [4725414a3f] to [0761b5b8e6].

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
	OFString *_fileComment;
	uint16_t _startDiskNumber, _internalAttributes;
	uint32_t _externalAttributes, _localFileHeaderOffset;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, copy) OFString *fileName, *fileComment;

@property (readonly, retain) OFDate *modificationDate;
@property (readonly) off_t uncompressedSize, compressedSize;
@property (readonly) uint32_t CRC32;
#endif

- (instancetype)OF_initWithFile: (OFFile*)file;

/*!
 * @brief Returns the file name of the entry.
 *
 * @return The file name of the entry
 */
- (OFString*)fileName;

/*!
 * @brief Returns the comment of the entry's file.
 *
 * @return The comment of the entry's file
 */
- (OFString*)fileComment;

/*!
 * @brief Returns the last modification date of the entry's file.
 *
 * @return The last modification date of the entry's file
 */
- (OFDate*)modificationDate;

/*!
 * @brief Returns the uncompressed size of the entry's file.
 *
 * @return The uncompressed size of the entry's file
 */
- (off_t)uncompressedSize;

/*!
 * @brief Returns the compressed size of the entry's file.
 *
 * @return The compressed size of the entry's file
 */
- (off_t)compressedSize;

/*!
 * @brief Returns the CRC32 checksum of the entry's file.
 *
 * @return The CRC32 checksum of the entry's file
 */
- (uint32_t)CRC32;







>

<




















|

|

|









|

|

|







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
	OFString *_fileComment;
	uint16_t _startDiskNumber, _internalAttributes;
	uint32_t _externalAttributes, _localFileHeaderOffset;
}

#ifdef OF_HAVE_PROPERTIES
@property (readonly, copy) OFString *fileName, *fileComment;
@property (readonly) off_t compressedSize, uncompressedSize;
@property (readonly, retain) OFDate *modificationDate;

@property (readonly) uint32_t CRC32;
#endif

- (instancetype)OF_initWithFile: (OFFile*)file;

/*!
 * @brief Returns the file name of the entry.
 *
 * @return The file name of the entry
 */
- (OFString*)fileName;

/*!
 * @brief Returns the comment of the entry's file.
 *
 * @return The comment of the entry's file
 */
- (OFString*)fileComment;

/*!
 * @brief Returns the compressed size of the entry's file.
 *
 * @return The compressed size of the entry's file
 */
- (off_t)compressedSize;

/*!
 * @brief Returns the uncompressed size of the entry's file.
 *
 * @return The uncompressed size of the entry's file
 */
- (off_t)uncompressedSize;

/*!
 * @brief Returns the last modification date of the entry's file.
 *
 * @return The last modification date of the entry's file
 */
- (OFDate*)modificationDate;

/*!
 * @brief Returns the CRC32 checksum of the entry's file.
 *
 * @return The CRC32 checksum of the entry's file
 */
- (uint32_t)CRC32;

Modified src/OFZIPArchiveEntry.m from [cdf0fba920] to [fabc446b26].

91
92
93
94
95
96
97










98
99
100
101
102
103
104
	OF_GETTER(_fileName, true)
}

- (OFString*)fileComment
{
	OF_GETTER(_fileComment, true)
}











- (OFDate*)modificationDate
{
	void *pool = objc_autoreleasePoolPush();
	uint_fast16_t year = ((_lastModifiedFileDate & 0xFE00) >> 9) + 1980;
	uint_fast8_t month = (_lastModifiedFileDate & 0x1E0) >> 5;
	uint_fast8_t day = (_lastModifiedFileDate & 0x1F);







>
>
>
>
>
>
>
>
>
>







91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
	OF_GETTER(_fileName, true)
}

- (OFString*)fileComment
{
	OF_GETTER(_fileComment, true)
}

- (off_t)compressedSize
{
	return _compressedSize;
}

- (off_t)uncompressedSize
{
	return _uncompressedSize;
}

- (OFDate*)modificationDate
{
	void *pool = objc_autoreleasePoolPush();
	uint_fast16_t year = ((_lastModifiedFileDate & 0xFE00) >> 9) + 1980;
	uint_fast8_t month = (_lastModifiedFileDate & 0x1E0) >> 5;
	uint_fast8_t day = (_lastModifiedFileDate & 0x1F);
116
117
118
119
120
121
122
123
124
125
126
127
128
129


130
131











132
133

134
135
136
137
138
139
140
141
142
143
						format: @"%Y-%m-%d %H:%M:%S"];

	objc_autoreleasePoolPop(pool);

	return [date autorelease];
}

- (off_t)uncompressedSize
{
	return _uncompressedSize;
}

- (off_t)compressedSize
{


	return _compressedSize;
}












- (uint32_t)CRC32

{
	return _CRC32;
}

- (uint16_t)OF_madeWithVersion
{
	return _madeWithVersion;
}

- (uint16_t)OF_minVersion







|

|


|

>
>
|
|
>
>
>
>
>
>
>
>
>
>
>

<
>
|
|








126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155

156
157
158
159
160
161
162
163
164
165
166
						format: @"%Y-%m-%d %H:%M:%S"];

	objc_autoreleasePoolPop(pool);

	return [date autorelease];
}

- (uint32_t)CRC32
{
	return _CRC32;
}

- (OFString*)description
{
	void *pool = objc_autoreleasePoolPush();
	OFDate *modificationDate = [self modificationDate];
	OFString *ret;

	ret = [[OFString alloc] initWithFormat: @"<%@: %p\n"
	    @"\tFile name = %@\n"
	    @"\tFile comment = %@\n"
	    @"\tCompressed size = %jd\n"
	    @"\tUncompressed size = %jd\n"
	    @"\tModification date = %@\n"
	    @"\tCRC32 = %" @PRIu32 @"\n"
	    @"}",
	    [self class], self, _fileName, _fileComment,
	    (intmax_t)_compressedSize, (intmax_t)_uncompressedSize,
	    modificationDate, _CRC32];


	objc_autoreleasePoolPop(pool);

	return [ret autorelease];
}

- (uint16_t)OF_madeWithVersion
{
	return _madeWithVersion;
}

- (uint16_t)OF_minVersion