X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=lib%2Fdecompress_bunzip2.c;h=600f473a5610a5fb8ccf90b84089fc029d7b412b;hb=94e2bd688820aed72b4f8092f88c2ccf64e003de;hp=5d3ddb5fcfd9760937d337086bb608cb3be8c5e3;hpb=bc22c17e12c130dc929218a95aa347e0f3fd05dc;p=safe%2Fjmp%2Flinux-2.6 diff --git a/lib/decompress_bunzip2.c b/lib/decompress_bunzip2.c index 5d3ddb5..600f473 100644 --- a/lib/decompress_bunzip2.c +++ b/lib/decompress_bunzip2.c @@ -45,9 +45,12 @@ */ -#ifndef STATIC +#ifdef STATIC +#define PREBOOT +#else #include -#endif /* !STATIC */ +#include +#endif /* STATIC */ #include @@ -680,9 +683,7 @@ STATIC int INIT bunzip2(unsigned char *buf, int len, set_error_fn(error_fn); if (flush) outbuf = malloc(BZIP2_IOBUF_SIZE); - else - len -= 4; /* Uncompressed size hack active in pre-boot - environment */ + if (!outbuf) { error("Could not allocate output bufer"); return -1; @@ -732,4 +733,14 @@ exit_0: return i; } -#define decompress bunzip2 +#ifdef PREBOOT +STATIC int INIT decompress(unsigned char *buf, int len, + int(*fill)(void*, unsigned int), + int(*flush)(void*, unsigned int), + unsigned char *outbuf, + int *pos, + void(*error_fn)(char *x)) +{ + return bunzip2(buf, len - 4, fill, flush, outbuf, pos, error_fn); +} +#endif