ObjFW  Diff

Differences From Artifact [060412ff27]:

To Artifact [23b893292f]:


77
78
79
80
81
82
83
84
85




86
87
88
89
90
91
92
	self = [super init];

	@try {
		void *pool = objc_autoreleasePoolPush();
		OFString *targetFileName;

		_fileName = [stringFromBuffer(header, 100) copy];
		_mode = (uint32_t)octalValueFromBuffer(
		    header + 100, 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];







|
|
>
>
>
>







77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
	self = [super init];

	@try {
		void *pool = objc_autoreleasePoolPush();
		OFString *targetFileName;

		_fileName = [stringFromBuffer(header, 100) copy];
		_mode = (uint16_t)octalValueFromBuffer(
		    header + 100, 8, UINT16_MAX);
		_UID = (uint16_t)octalValueFromBuffer(
		    header + 108, 8, UINT16_MAX);
		_GID = (uint16_t)octalValueFromBuffer(
		    header + 116, 8, UINT16_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];
184
185
186
187
188
189
190
191
192
193
194










195
196
197
198
199
200
201
}

- (OFString *)fileName
{
	return _fileName;
}

- (uint32_t)mode
{
	return _mode;
}











- (uint64_t)size
{
	return _size;
}

- (OFDate *)modificationDate







|



>
>
>
>
>
>
>
>
>
>







188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
}

- (OFString *)fileName
{
	return _fileName;
}

- (uint16_t)mode
{
	return _mode;
}

- (uint16_t)UID
{
	return _UID;
}

- (uint16_t)GID
{
	return _GID;
}

- (uint64_t)size
{
	return _size;
}

- (OFDate *)modificationDate
235
236
237
238
239
240
241


242
243
244
245
246
247
248
249
250
251

252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270



271
272
273
274
275
276
277

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


	     @"\tSize = %" PRIu64 @"\n"
	     @"\tModification date = %@\n"
	     @"\tType = %u\n"
	     @"\tTarget file name = %@\n"
	     @"\tOwner = %@\n"
	     @"\tGroup = %@\n"
	     @"\tDevice major = %" PRIu32 @"\n"
	     @"\tDevice minor = %" PRIu32 @"\n"
	     @">",
	    [self class], _fileName, _mode, _size, _modificationDate, _type,

	    _targetFileName, _owner, _group, _deviceMajor, _deviceMinor];

	[ret retain];

	objc_autoreleasePoolPop(pool);

	return [ret autorelease];
}

- (void)of_writeToStream: (OFStream *)stream
{
	unsigned char buffer[512];
	uint64_t modificationDate;
	uint16_t checksum = 0;

	stringToBuffer(buffer, _fileName, 100);
	stringToBuffer(buffer + 100,
	    [OFString stringWithFormat: @"%06" PRIo32 " ", _mode], 8);
	memcpy(buffer + 108, "000000 \0" "000000 \0", 16);



	stringToBuffer(buffer + 124,
	    [OFString stringWithFormat: @"%011" PRIo64 " ", _size], 12);
	modificationDate = [_modificationDate timeIntervalSince1970];
	stringToBuffer(buffer + 136,
	    [OFString stringWithFormat: @"%011" PRIo64 " ", modificationDate],
	    12);








>
>









|
>
|
















|
|
>
>
>







249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297

- (OFString *)description
{
	void *pool = objc_autoreleasePoolPush();
	OFString *ret = [OFString stringWithFormat: @"<%@:\n"
	     @"\tFile name = %@\n"
	     @"\tMode = %06o\n"
	     @"\tUID = %u\n",
	     @"\tGID = %u\n",
	     @"\tSize = %" PRIu64 @"\n"
	     @"\tModification date = %@\n"
	     @"\tType = %u\n"
	     @"\tTarget file name = %@\n"
	     @"\tOwner = %@\n"
	     @"\tGroup = %@\n"
	     @"\tDevice major = %" PRIu32 @"\n"
	     @"\tDevice minor = %" PRIu32 @"\n"
	     @">",
	    [self class], _fileName, _mode, _UID, _GID, _size,
	    _modificationDate, _type, _targetFileName, _owner, _group,
	    _deviceMajor, _deviceMinor];

	[ret retain];

	objc_autoreleasePoolPop(pool);

	return [ret autorelease];
}

- (void)of_writeToStream: (OFStream *)stream
{
	unsigned char buffer[512];
	uint64_t modificationDate;
	uint16_t checksum = 0;

	stringToBuffer(buffer, _fileName, 100);
	stringToBuffer(buffer + 100,
	    [OFString stringWithFormat: @"%06" PRIo16 " ", _mode], 8);
	stringToBuffer(buffer + 108,
	    [OFString stringWithFormat: @"%06" PRIo16 " ", _UID], 8);
	stringToBuffer(buffer + 116,
	    [OFString stringWithFormat: @"%06" PRIo16 " ", _GID], 8);
	stringToBuffer(buffer + 124,
	    [OFString stringWithFormat: @"%011" PRIo64 " ", _size], 12);
	modificationDate = [_modificationDate timeIntervalSince1970];
	stringToBuffer(buffer + 136,
	    [OFString stringWithFormat: @"%011" PRIo64 " ", modificationDate],
	    12);