decompress_inflate.c (a02001086bbfb4da35d1228bebc2f1b442db455f) | decompress_inflate.c (2d3862d26e67a59340ba1cf1748196c76c5787de) |
---|---|
1#ifdef STATIC | 1#ifdef STATIC |
2#define PREBOOT |
|
2/* Pre-boot environment: included */ 3 4/* prevent inclusion of _LINUX_KERNEL_H in pre-boot environment: lots 5 * errors about console_printk etc... on ARM */ 6#define _LINUX_KERNEL_H 7 8#include "zlib_inflate/inftrees.c" 9#include "zlib_inflate/inffast.c" --- 18 unchanged lines hidden (view full) --- 28#define GZIP_IOBUF_SIZE (16*1024) 29 30static long INIT nofill(void *buffer, unsigned long len) 31{ 32 return -1; 33} 34 35/* Included from initramfs et al code */ | 3/* Pre-boot environment: included */ 4 5/* prevent inclusion of _LINUX_KERNEL_H in pre-boot environment: lots 6 * errors about console_printk etc... on ARM */ 7#define _LINUX_KERNEL_H 8 9#include "zlib_inflate/inftrees.c" 10#include "zlib_inflate/inffast.c" --- 18 unchanged lines hidden (view full) --- 29#define GZIP_IOBUF_SIZE (16*1024) 30 31static long INIT nofill(void *buffer, unsigned long len) 32{ 33 return -1; 34} 35 36/* Included from initramfs et al code */ |
36STATIC int INIT gunzip(unsigned char *buf, long len, | 37STATIC int INIT __gunzip(unsigned char *buf, long len, |
37 long (*fill)(void*, unsigned long), 38 long (*flush)(void*, unsigned long), | 38 long (*fill)(void*, unsigned long), 39 long (*flush)(void*, unsigned long), |
39 unsigned char *out_buf, | 40 unsigned char *out_buf, long out_len, |
40 long *pos, 41 void(*error)(char *x)) { 42 u8 *zbuf; 43 struct z_stream_s *strm; 44 int rc; | 41 long *pos, 42 void(*error)(char *x)) { 43 u8 *zbuf; 44 struct z_stream_s *strm; 45 int rc; |
45 size_t out_len; | |
46 47 rc = -1; 48 if (flush) { 49 out_len = 0x8000; /* 32 K */ 50 out_buf = malloc(out_len); 51 } else { | 46 47 rc = -1; 48 if (flush) { 49 out_len = 0x8000; /* 32 K */ 50 out_buf = malloc(out_len); 51 } else { |
52 out_len = ((size_t)~0) - (size_t)out_buf; /* no limit */ | 52 if (!out_len) 53 out_len = ((size_t)~0) - (size_t)out_buf; /* no limit */ |
53 } 54 if (!out_buf) { 55 error("Out of memory while allocating output buffer"); 56 goto gunzip_nomem1; 57 } 58 59 if (buf) 60 zbuf = buf; --- 115 unchanged lines hidden (view full) --- 176 free(zbuf); 177gunzip_nomem2: 178 if (flush) 179 free(out_buf); 180gunzip_nomem1: 181 return rc; /* returns Z_OK (0) if successful */ 182} 183 | 54 } 55 if (!out_buf) { 56 error("Out of memory while allocating output buffer"); 57 goto gunzip_nomem1; 58 } 59 60 if (buf) 61 zbuf = buf; --- 115 unchanged lines hidden (view full) --- 177 free(zbuf); 178gunzip_nomem2: 179 if (flush) 180 free(out_buf); 181gunzip_nomem1: 182 return rc; /* returns Z_OK (0) if successful */ 183} 184 |
184#define decompress gunzip | 185#ifndef PREBOOT 186STATIC int INIT gunzip(unsigned char *buf, long len, 187 long (*fill)(void*, unsigned long), 188 long (*flush)(void*, unsigned long), 189 unsigned char *out_buf, 190 long *pos, 191 void (*error)(char *x)) 192{ 193 return __gunzip(buf, len, fill, flush, out_buf, 0, pos, error); 194} 195#else 196STATIC int INIT __decompress(unsigned char *buf, long len, 197 long (*fill)(void*, unsigned long), 198 long (*flush)(void*, unsigned long), 199 unsigned char *out_buf, long out_len, 200 long *pos, 201 void (*error)(char *x)) 202{ 203 return __gunzip(buf, len, fill, flush, out_buf, out_len, pos, error); 204} 205#endif |