Go to the documentation of this file.
89 #define CHUNK (1U << LGCHUNK)
95 fprintf(
stderr,
"gzappend error: %s%s\n", msg1, msg2);
131 if (rot >=
len) rot %=
len;
132 if (rot == 0)
return;
135 last = list + (
len - 1);
146 if (rot ==
len - 1) {
148 memmove(list + 1, list,
len - 1);
185 if (
len == -1)
bye(
"error reading ",
in->name);
186 in->left = (unsigned)
len;
198 #define read1(in) (in->left == 0 ? readmore(in) : 0, \
199 in->left--, *(in->next)++)
208 bypass =
n & ~((1U <<
in->size) - 1);
211 bye(
"seeking ",
in->name);
216 bye(
"unexpected end of ",
in->name);
228 val += (unsigned)
read1(
in) << 8;
241 if (
read1(
in) != 8)
bye(
"unknown compression method in",
in->name);
243 if (
flags & 0xe0)
bye(
"unknown header flags set in",
in->name);
261 int ret, lastbit, left, full;
263 unsigned long crc,
tot;
264 unsigned char *window;
271 if (gz.
fd == -1)
bye(
"cannot open ",
name);
273 if (gz.
buf == NULL)
bye(
"out of memory",
"");
281 window = malloc(
DSIZE);
282 if (window == NULL)
bye(
"out of memory",
"");
287 if (
ret !=
Z_OK)
bye(
"out of memory",
" or library mismatch");
314 bye(
"invalid compressed data--format violated in",
name);
343 if (crc !=
read4(&gz))
344 bye(
"invalid compressed data--crc mismatch in ",
name);
346 if ((
tot & 0xffffffffUL) !=
read4(&gz))
347 bye(
"invalid compressed data--length mismatch in",
name);
352 "gzappend warning: junk at end of gzip file overwritten\n");
357 *gz.
buf = (
unsigned char)(*gz.
buf ^ (1 << ((8 - lastbit) & 7)));
392 unsigned char *
in, *
out;
399 fprintf(
stderr,
"gzappend warning: %s not found, skipping ...\n",
406 if (
in == NULL ||
out == NULL)
bye(
"out of memory",
"");
414 "gzappend warning: error reading %s, skipping rest ...\n",
430 if (
len == -1)
bye(
"writing gzip file",
"");
431 left -= (unsigned)
len;
439 out[0] = (
unsigned char)(strm->
adler);
440 out[1] = (
unsigned char)(strm->
adler >> 8);
441 out[2] = (
unsigned char)(strm->
adler >> 16);
442 out[3] = (
unsigned char)(strm->
adler >> 24);
450 if (
ret == -1)
bye(
"writing gzip file",
"");
459 if (fd > 0)
close(fd);
466 int main(
int argc,
char **argv)
477 "gzappend 1.2 (11 Oct 2012) Copyright (C) 2003, 2012 Mark Adler\n"
480 "usage: gzappend [-level] file.gz [ addthis [ andthis ... ]]\n");
486 if (argv[0][0] ==
'-') {
487 if (argv[0][1] <
'0' || argv[0][1] >
'9' || argv[0][2] != 0)
488 bye(
"invalid compression level",
"");
489 level = argv[0][1] -
'0';
490 if (*++argv == NULL)
bye(
"no gzip file name after options",
"");
498 gztack(NULL, gd, &strm, 1);
501 gztack(*argv, gd, &strm, argv[1] == NULL);
502 }
while (*++argv != NULL);
void bye(char *msg1, char *msg2)
int ZEXPORT inflateEnd(z_streamp strm)
#define Z_DEFAULT_COMPRESSION
int ZEXPORT inflate(z_streamp strm, int flush)
const grpc_generator::File * file
unsigned long read4(file *in)
unsigned gcd(unsigned a, unsigned b)
_Use_decl_annotations_ int __cdecl printf(const char *_Format,...)
int ZEXPORT deflateSetDictionary(z_streamp strm, const Bytef *dictionary, uInt dictLength)
z_const unsigned char * next
int main(int argc, char **argv)
void rotate(unsigned char *list, unsigned len, unsigned rot)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
int gzscan(char *name, z_stream *strm, int level)
int ZEXPORT deflateEnd(z_streamp strm)
int read(izstream &zs, T *x, Items items)
void gztack(char *name, int gd, z_stream *strm, int last)
void skip(file *in, unsigned n)
UniquePtr< SSL_SESSION > ret
int ZEXPORT deflate(z_streamp strm, int flush)
int ZEXPORT deflatePrime(z_streamp strm, int bits, int value)
#define deflateInit2(strm, level, method, windowBits, memLevel, strategy)
unsigned long ZEXPORT crc32(unsigned long crc, const unsigned char FAR *buf, uInt len)
#define inflateInit2(strm, windowBits)
#define Z_DEFAULT_STRATEGY
grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:59