mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
Build unbzip2.sys as export driver, instead of unbzip2.dll
svn path=/trunk/; revision=2587
This commit is contained in:
parent
f17ca2d3d9
commit
a5549b5653
6 changed files with 37 additions and 21 deletions
|
@ -1,17 +1,18 @@
|
|||
PATH_TO_TOP = ../..
|
||||
TARGET_TYPE = dynlink
|
||||
TARGET_TYPE = export_driver
|
||||
TARGET_NAME = unbzip2
|
||||
TARGET_NORC = yes
|
||||
TARGET_LFLAGS = -nostartfiles -ffreestanding
|
||||
|
||||
TARGET_CFLAGS=-Wall -Winline -Os -fomit-frame-pointer -fno-strength-reduce -DBZ_NO_STDIO -DBZ_DECOMPRESS_ONLY $(BIGFILES)
|
||||
TARGET_CFLAGS=-Wall -Winline -Os -fomit-frame-pointer -fno-strength-reduce -DBZ_NO_STDIO -DBZ_DECOMPRESS_ONLY $(BIGFILES) -g
|
||||
|
||||
TARGET_OBJECTS = bzlib.o randtable.o crctable.o decompress.o huffman.o dllmain.o
|
||||
|
||||
TARGET_GCCLIBS = gcc
|
||||
|
||||
include $(PATH_TO_TOP)/rules.mak
|
||||
include $(TOOLS_PATH)/helper.mk
|
||||
|
||||
test.exe: test.o ../../dk/w32/lib/unbzip2.a
|
||||
$(CC) -g -o test.exe test.o ../../dk/w32/lib/unbzip2.a
|
||||
$(CC) -s -Os -o test.exe test.o ../../dk/w32/lib/unbzip2.a
|
||||
test.o: test.c
|
||||
$(CC) -g -c test.c
|
||||
$(CC) -s -Os -c test.c
|
||||
|
|
|
@ -73,6 +73,12 @@
|
|||
bzBuffToBuffDecompress. Fixed.
|
||||
--*/
|
||||
|
||||
#ifdef BZ_DECOMPRESS_ONLY
|
||||
#define __NTDRIVER__
|
||||
#include <ntddk.h>
|
||||
#include <debug.h>
|
||||
#endif
|
||||
|
||||
#include "bzlib_private.h"
|
||||
|
||||
|
||||
|
@ -112,26 +118,19 @@ int bz_config_ok ( void )
|
|||
return 1;
|
||||
}
|
||||
|
||||
|
||||
_stdcall void *(*BZ2_malloc)( unsigned long size );
|
||||
_stdcall void (*BZ2_free)( void *ptr );
|
||||
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
static
|
||||
void* default_bzalloc ( void* opaque, Int32 items, Int32 size )
|
||||
{
|
||||
void* v = BZ2_malloc ( items * size );
|
||||
return v;
|
||||
return ExAllocatePool( PagedPool, items * size );
|
||||
}
|
||||
|
||||
static
|
||||
void default_bzfree ( void* opaque, void* addr )
|
||||
{
|
||||
if (addr != NULL) BZ2_free ( addr );
|
||||
ExFreePool( addr );
|
||||
}
|
||||
|
||||
|
||||
#ifndef BZ_DECOMPRESS_ONLY
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
|
@ -550,6 +549,8 @@ int BZ_API(BZ2_bzDecompressInit)
|
|||
return BZ_OK;
|
||||
}
|
||||
|
||||
#ifndef BZ_DECOMPRESS_ONLY
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
static
|
||||
void unRLE_obuf_to_output_FAST ( DState* s )
|
||||
|
@ -691,6 +692,8 @@ void unRLE_obuf_to_output_FAST ( DState* s )
|
|||
}
|
||||
}
|
||||
|
||||
#endif // BZ_DECOMPRESS_ONLY
|
||||
|
||||
/*---------------------------------------------------*/
|
||||
__inline__ Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab )
|
||||
{
|
||||
|
@ -812,9 +815,13 @@ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm )
|
|||
while (True) {
|
||||
if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR;
|
||||
if (s->state == BZ_X_OUTPUT) {
|
||||
#ifndef BZ_DECOMPRESS_ONLY
|
||||
if (s->smallDecompress)
|
||||
unRLE_obuf_to_output_SMALL ( s ); else
|
||||
unRLE_obuf_to_output_FAST ( s );
|
||||
#else
|
||||
unRLE_obuf_to_output_SMALL ( s );
|
||||
#endif
|
||||
if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) {
|
||||
BZ_FINALISE_CRC ( s->calculatedBlockCRC );
|
||||
if (s->verbosity >= 3)
|
||||
|
@ -1250,7 +1257,7 @@ int BZ_API(BZ2_bzBuffToBuffCompress)
|
|||
{
|
||||
bz_stream strm;
|
||||
int ret;
|
||||
|
||||
CHECKPOINT;
|
||||
if (dest == NULL || destLen == NULL ||
|
||||
source == NULL ||
|
||||
blockSize100k < 1 || blockSize100k > 9 ||
|
||||
|
@ -1262,10 +1269,11 @@ int BZ_API(BZ2_bzBuffToBuffCompress)
|
|||
strm.bzalloc = NULL;
|
||||
strm.bzfree = NULL;
|
||||
strm.opaque = NULL;
|
||||
CHECKPOINT;
|
||||
ret = BZ2_bzCompressInit ( &strm, blockSize100k,
|
||||
verbosity, workFactor );
|
||||
if (ret != BZ_OK) return ret;
|
||||
|
||||
CHECKPOINT;
|
||||
strm.next_in = source;
|
||||
strm.next_out = dest;
|
||||
strm.avail_in = sourceLen;
|
||||
|
@ -1277,14 +1285,17 @@ int BZ_API(BZ2_bzBuffToBuffCompress)
|
|||
|
||||
/* normal termination */
|
||||
*destLen -= strm.avail_out;
|
||||
CHECKPOINT;
|
||||
BZ2_bzCompressEnd ( &strm );
|
||||
return BZ_OK;
|
||||
|
||||
output_overflow:
|
||||
CHECKPOINT;
|
||||
BZ2_bzCompressEnd ( &strm );
|
||||
return BZ_OUTBUFF_FULL;
|
||||
|
||||
errhandler:
|
||||
CHECKPOINT;
|
||||
BZ2_bzCompressEnd ( &strm );
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -310,6 +310,7 @@ BZ_EXTERN const char * BZ_API(BZ2_bzerror) (
|
|||
|
||||
extern _stdcall void *(*BZ2_malloc)( unsigned long size );
|
||||
extern _stdcall void (*BZ2_free)( void *ptr );
|
||||
_stdcall void BZ2_set_malloc_free( _stdcall void *(*malloc)(unsigned long size), _stdcall void (*free)(void *ptr) );
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
#ifdef BZ_DECOMPRESS_ONLY
|
||||
|
||||
int _stdcall DriverEntry( void *a, void *b )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
int _stdcall DllMain( unsigned long a, unsigned long b, unsigned long c )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
#endif
|
||||
void bz_internal_error ( int errcode )
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -2,5 +2,3 @@ LIBRARY unbzip2.dll
|
|||
|
||||
EXPORTS
|
||||
BZ2_bzBuffToBuffDecompress@24
|
||||
BZ2_malloc
|
||||
BZ2_free
|
||||
|
|
|
@ -2,5 +2,4 @@ LIBRARY unbzip2.dll
|
|||
|
||||
EXPORTS
|
||||
BZ2_bzBuffToBuffDecompress=BZ2_bzBuffToBuffDecompress@24
|
||||
BZ2_malloc
|
||||
BZ2_free
|
||||
|
||||
|
|
Loading…
Reference in a new issue