File: XADMSZipHandle.m

package info (click to toggle)
unar 1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 6,664 kB
  • sloc: ansic: 52,939; objc: 39,563; cpp: 4,074; makefile: 99; perl: 10
file content (43 lines) | stat: -rw-r--r-- 852 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#import "XADMSZipHandle.h"

#ifndef __MACTYPES__
#define Byte zlibByte
#include <zlib.h>
#undef Byte
#else
#include <zlib.h>
#endif

@implementation XADMSZipHandle

-(int)produceCABBlockWithInputBuffer:(uint8_t *)buffer length:(int)length atOffset:(off_t)pos length:(int)uncomplength
{
	z_stream zs;
	memset(&zs,0,sizeof(zs));

	inflateInit2(&zs,-MAX_WBITS);
	if(pos!=0) inflateSetDictionary(&zs,outbuffer,lastlength);

	zs.avail_in=length-2;
	zs.next_in=buffer+2;

	zs.next_out=outbuffer;
	zs.avail_out=uncomplength; //sizeof(outbuffer);

	/*int err=*/inflate(&zs,0);
	inflateEnd(&zs);
	/*if(err==Z_STREAM_END)
	{
		if(seekback) [parent skipBytes:-(off_t)zs.avail_in];
		[self endStream];
		break;
	}
	else if(err!=Z_OK) [self _raiseZlib];*/

	[self setBlockPointer:outbuffer];

	lastlength=sizeof(outbuffer)-zs.avail_out;
	return lastlength;
}

@end