2 * zlib wrappers to make sure we don't silently miss errors
7 void git_inflate_init(z_streamp strm
)
11 switch (inflateInit(strm
)) {
16 err
= "out of memory";
19 err
= "wrong version";
24 die("inflateInit: %s (%s)", err
, strm
->msg
? strm
->msg
: "no message");
27 void git_inflate_end(z_streamp strm
)
29 if (inflateEnd(strm
) != Z_OK
)
30 error("inflateEnd: %s", strm
->msg
? strm
->msg
: "failed");
33 int git_inflate(z_streamp strm
, int flush
)
35 int ret
= inflate(strm
, flush
);
39 /* Out of memory is fatal. */
41 die("inflate: out of memory");
43 /* Data corruption errors: we may want to recover from them (fsck) */
45 err
= "needs dictionary"; break;
47 err
= "data stream error"; break;
49 err
= "stream consistency error"; break;
51 err
= "unknown error"; break;
53 /* Z_BUF_ERROR: normal, needs more space in the output buffer */
59 error("inflate: %s (%s)", err
, strm
->msg
? strm
->msg
: "no message");