ObjFW  Diff

Differences From Artifact [8adcdb3a6b]:

To Artifact [4aad919281]:


1
2
3
4
5
6
7
8
9
10
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
 * the packaging of this file.
 *

|
|







1
2
3
4
5
6
7
8
9
10
/*
 * Copyright (c) 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016
 *   Jonathan Schleifer <js@heap.zone>
 *
 * All rights reserved.
 *
 * This file is part of ObjFW. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
 * the packaging of this file.
 *
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309














310
311
312
313
314
315
316

#ifndef DEFLATE64
+ (instancetype)streamWithStream: (OFStream*)stream
{
	return [[[self alloc] initWithStream: stream] autorelease];
}

- init
{
	OF_INVALID_INIT_METHOD
}

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

	_stream = [stream retain];
	_bitIndex = 8;	/* 0-7 address the bit, 8 means fetch next byte */
	_slidingWindowMask = 0x7FFF;

	return self;
}

- (void)dealloc
{
	[_stream release];

	[super dealloc];
}
#endif















- (size_t)lowlevelReadIntoBuffer: (void*)buffer_
			  length: (size_t)length
{
	uint8_t *buffer = buffer_;
	uint_fast16_t bits, i, tmp;
	uint16_t value;







<
<
<
<
<


|


<
<











>
>
>
>
>
>
>
>
>
>
>
>
>
>







280
281
282
283
284
285
286





287
288
289
290
291


292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323

#ifndef DEFLATE64
+ (instancetype)streamWithStream: (OFStream*)stream
{
	return [[[self alloc] initWithStream: stream] autorelease];
}






- initWithStream: (OFStream*)stream
{
	self = [self init];

	_stream = [stream retain];



	return self;
}

- (void)dealloc
{
	[_stream release];

	[super dealloc];
}
#endif

- init
{
	self = [super init];

	_bitIndex = 8;	/* 0-7 address the bit, 8 means fetch next byte */
#ifdef DEFLATE64
	_slidingWindowMask = 0xFFFF;
#else
	_slidingWindowMask = 0x7FFF;
#endif

	return self;
}

- (size_t)lowlevelReadIntoBuffer: (void*)buffer_
			  length: (size_t)length
{
	uint8_t *buffer = buffer_;
	uint_fast16_t bits, i, tmp;
	uint16_t value;