24 #if defined(MSDOS) || defined(OS2) || defined(WIN32) || defined(__CYGWIN__)
27 # define SET_BINARY_MODE(file) setmode(fileno(file), O_BINARY)
29 # define SET_BINARY_MODE(file)
61 *err = aprintf(__VA_ARGS__); \
104 unsigned long crc = 0;
105 unsigned long len = 0;
106 unsigned long buf = 0;
111 fwrite(
"\x1f\x8b\x08\0\0\0\0\0\0\xff", 1, 10,
out);
122 unsigned long long memb;
127 unsigned char dat[
CHUNK];
145 unsigned char scrap[
CHUNK];
150 BYE(
"out of memory");
152 BYE(
"input invalid: %s",
strm.msg);
154 BYE(
"internal error");
162 BYE(
"overflow error");
181 if (
strm.data_type & 0x80) {
237 if (
num - prev < 3) {
244 unsigned long last = (
unsigned long)1 << prev;
246 if (((
buf >> prev) & 7) == 3) {
251 if (
num - prev < 10) {
259 if (((
buf >> prev) & 0x3ff) == 3) {
267 else if (((
buf >> prev) & 6) == 0) {
270 num = (prev + 10) & ~7;
301 int mix = (
strm.data_type & 0x80) &&
bits;
321 fwrite(put, 1,
end - put,
out);
332 if (
strm.data_type & 0x40) {
363 else if (
strm.data_type & 0x80)
372 if ((
strm.data_type & 0xc0) == 0xc0) {
388 part = (part >> 8) + ((
unsigned long)(*put++) << 24);
393 if (len2 < 0 || (
unsigned long long)len2 != memb)
394 BYE(
"overflow error");
398 else if (tail == 8) {
407 BYE(
"internal error");
425 if (
state != BETWEEN)
426 BYE(
"input invalid: incomplete gzip stream");
440 putc(crc >> 16,
out);
441 putc(crc >> 24,
out);
449 if (ferror(
in) || ferror(
out))
450 BYE(
"i/o error: %s", strerror(errno));
467 fprintf(stderr,
"gznorm error: %s\n",
err);
int bits(struct state *s, int need)
const lzma_allocator const uint8_t * in
const lzma_allocator const uint8_t size_t uint8_t * out
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags long
char * aprintf(char *fmt,...)
#define SET_BINARY_MODE(file)
int gzip_normalize(FILE *in, FILE *out, char **err)
RZ_API void Ht_() free(HtName_(Ht) *ht)
int ZEXPORT inflate(z_streamp strm, int flush)
int ZEXPORT inflateReset(z_streamp strm)
int ZEXPORT inflateEnd(z_streamp strm)
void * malloc(size_t size)
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode static oldfd struct tms static buf static getgid static geteuid const char static filename static arg static mask struct ustat static ubuf static getppid static setsid static egid sigset_t static set struct timeval struct timezone static tz fd_set fd_set fd_set struct timeval static timeout const char char static bufsiz const char static swapflags void static offset const char static length static mode static who const char struct statfs static buf unsigned unsigned num
static void struct sockaddr socklen_t static fromlen static backlog static fork char char char static envp int struct rusage static rusage struct utsname static buf struct sembuf unsigned
uLong ZEXPORT crc32_combine(uLong crc1, uLong crc2, z_off_t len2)
#define inflateInit2(strm, windowBits)