aboutsummaryrefslogtreecommitdiffstats
path: root/lib/decompress_bunzip2.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/decompress_bunzip2.c')
-rw-r--r--lib/decompress_bunzip2.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/lib/decompress_bunzip2.c b/lib/decompress_bunzip2.c
index a4e971dee102..a7b80c1d6a0d 100644
--- a/lib/decompress_bunzip2.c
+++ b/lib/decompress_bunzip2.c
@@ -49,7 +49,6 @@
49#define PREBOOT 49#define PREBOOT
50#else 50#else
51#include <linux/decompress/bunzip2.h> 51#include <linux/decompress/bunzip2.h>
52#include <linux/slab.h>
53#endif /* STATIC */ 52#endif /* STATIC */
54 53
55#include <linux/decompress/mm.h> 54#include <linux/decompress/mm.h>
@@ -107,6 +106,8 @@ struct bunzip_data {
107 unsigned char selectors[32768]; /* nSelectors = 15 bits */ 106 unsigned char selectors[32768]; /* nSelectors = 15 bits */
108 struct group_data groups[MAX_GROUPS]; /* Huffman coding tables */ 107 struct group_data groups[MAX_GROUPS]; /* Huffman coding tables */
109 int io_error; /* non-zero if we have IO error */ 108 int io_error; /* non-zero if we have IO error */
109 int byteCount[256];
110 unsigned char symToByte[256], mtfSymbol[256];
110}; 111};
111 112
112 113
@@ -158,14 +159,16 @@ static int INIT get_next_block(struct bunzip_data *bd)
158 int *base = NULL; 159 int *base = NULL;
159 int *limit = NULL; 160 int *limit = NULL;
160 int dbufCount, nextSym, dbufSize, groupCount, selector, 161 int dbufCount, nextSym, dbufSize, groupCount, selector,
161 i, j, k, t, runPos, symCount, symTotal, nSelectors, 162 i, j, k, t, runPos, symCount, symTotal, nSelectors, *byteCount;
162 byteCount[256]; 163 unsigned char uc, *symToByte, *mtfSymbol, *selectors;
163 unsigned char uc, symToByte[256], mtfSymbol[256], *selectors;
164 unsigned int *dbuf, origPtr; 164 unsigned int *dbuf, origPtr;
165 165
166 dbuf = bd->dbuf; 166 dbuf = bd->dbuf;
167 dbufSize = bd->dbufSize; 167 dbufSize = bd->dbufSize;
168 selectors = bd->selectors; 168 selectors = bd->selectors;
169 byteCount = bd->byteCount;
170 symToByte = bd->symToByte;
171 mtfSymbol = bd->mtfSymbol;
169 172
170 /* Read in header signature and CRC, then validate signature. 173 /* Read in header signature and CRC, then validate signature.
171 (last block signature means CRC is for whole file, return now) */ 174 (last block signature means CRC is for whole file, return now) */
@@ -678,13 +681,12 @@ STATIC int INIT bunzip2(unsigned char *buf, int len,
678 int(*flush)(void*, unsigned int), 681 int(*flush)(void*, unsigned int),
679 unsigned char *outbuf, 682 unsigned char *outbuf,
680 int *pos, 683 int *pos,
681 void(*error_fn)(char *x)) 684 void(*error)(char *x))
682{ 685{
683 struct bunzip_data *bd; 686 struct bunzip_data *bd;
684 int i = -1; 687 int i = -1;
685 unsigned char *inbuf; 688 unsigned char *inbuf;
686 689
687 set_error_fn(error_fn);
688 if (flush) 690 if (flush)
689 outbuf = malloc(BZIP2_IOBUF_SIZE); 691 outbuf = malloc(BZIP2_IOBUF_SIZE);
690 692
@@ -747,8 +749,8 @@ STATIC int INIT decompress(unsigned char *buf, int len,
747 int(*flush)(void*, unsigned int), 749 int(*flush)(void*, unsigned int),
748 unsigned char *outbuf, 750 unsigned char *outbuf,
749 int *pos, 751 int *pos,
750 void(*error_fn)(char *x)) 752 void(*error)(char *x))
751{ 753{
752 return bunzip2(buf, len - 4, fill, flush, outbuf, pos, error_fn); 754 return bunzip2(buf, len - 4, fill, flush, outbuf, pos, error);
753} 755}
754#endif 756#endif