ObjFW  Diff

Differences From Artifact [be9beadf26]:

To Artifact [95db2a693c]:


59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

struct huffman_tree {
	struct huffman_tree *leafs[2];
	uint16_t value;
};

@interface OFDeflateStream ()
- (void)OF_initDecompression;
@end

#ifndef DEFLATE64
static const uint8_t numDistanceCodes = 30;
static const uint8_t lengthCodes[29] = {
	/* indices are -257, values -3 */
	0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,







|







59
60
61
62
63
64
65
66
67
68
69
70
71
72
73

struct huffman_tree {
	struct huffman_tree *leafs[2];
	uint16_t value;
};

@interface OFDeflateStream ()
- (void)of_initDecompression;
@end

#ifndef DEFLATE64
static const uint8_t numDistanceCodes = 30;
static const uint8_t lengthCodes[29] = {
	/* indices are -257, values -3 */
	0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
			releaseTree(_decompression->context.huffman.distTree);
	}

	[super dealloc];
}
#endif

- (void)OF_initDecompression
{
	_decompression = [self allocMemoryWithSize: sizeof(*_decompression)];
	memset(_decompression, 0, sizeof(*_decompression));

	/* 0-7 address the bit, 8 means fetch next byte */
	_decompression->bitIndex = 8;
#ifdef DEFLATE64







|







322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
			releaseTree(_decompression->context.huffman.distTree);
	}

	[super dealloc];
}
#endif

- (void)of_initDecompression
{
	_decompression = [self allocMemoryWithSize: sizeof(*_decompression)];
	memset(_decompression, 0, sizeof(*_decompression));

	/* 0-7 address the bit, 8 means fetch next byte */
	_decompression->bitIndex = 8;
#ifdef DEFLATE64
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
	uint16_t bits, tmp;
	uint16_t value;
	size_t bytesWritten = 0;
	uint8_t *slidingWindow;
	uint16_t slidingWindowIndex;

	if (ivars == NULL) {
		[self OF_initDecompression];
		ivars = _decompression;
	}

	if (ivars->atEndOfStream)
		@throw [OFReadFailedException exceptionWithObject: self
						  requestedLength: length];








|







348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
	uint16_t bits, tmp;
	uint16_t value;
	size_t bytesWritten = 0;
	uint8_t *slidingWindow;
	uint16_t slidingWindowIndex;

	if (ivars == NULL) {
		[self of_initDecompression];
		ivars = _decompression;
	}

	if (ivars->atEndOfStream)
		@throw [OFReadFailedException exceptionWithObject: self
						  requestedLength: length];