ObjFW  Diff

Differences From Artifact [b94a906de8]:

To Artifact [656f2fecb7]:


344
345
346
347
348
349
350
351

352
353
354
355
356

357
358
359
360
361
362
363
344
345
346
347
348
349
350

351
352
353
354
355

356
357
358
359
360
361
362
363







-
+




-
+







		@throw [OFOutOfRangeException exception];

	commentLength = [_fileComment cStringLengthWithEncoding: encoding];
	if (commentLength > UINT16_MAX)
		@throw [OFOutOfRangeException exception];

	fileNameLength = [_fileName cStringLengthWithEncoding: encoding];
	if (fileNameLength > UINT8_MAX)
	if (fileNameLength > UINT8_MAX - 1)
		@throw [OFOutOfRangeException exception];

	directoryNameLength =
	    [_directoryName cStringLengthWithEncoding: encoding];
	if (directoryNameLength > UINT8_MAX)
	if (directoryNameLength > UINT8_MAX - 1)
		@throw [OFOutOfRangeException exception];

	[data addItems: "\xDC\xA7\xC4\xFD" count: 4];
	/* Header type */
	[data addItem: "\x02"];
	[data addItem: &_compressionMethod];

409
410
411
412
413
414
415






416
417
418
419
420
421
422
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428







+
+
+
+
+
+








	/*
	 * CRC16 is filled when writing the next header, as the CRC needs to
	 * include the next header offset.
	 */
	[data increaseCountBy: 2];

	/* Include \0 */
	if (fileNameLength > 0)
		fileNameLength++;
	if (directoryNameLength > 0)
		directoryNameLength++;

	tmp8 = (uint8_t)fileNameLength;
	[data addItem: &tmp8];
	tmp8 = (uint8_t)directoryNameLength;
	[data addItem: &tmp8];

	[data addItems: [_fileName cStringWithEncoding: encoding]
		 count: fileNameLength];