2 * zlib wrappers to make sure we don't silently miss errors
7 static const char *zerr_to_string(int status
)
11 return "out of memory";
13 return "wrong version";
15 return "needs dictionary";
17 return "data stream error";
19 return "stream consistency error";
21 return "unknown error";
25 void git_inflate_init(z_streamp strm
)
27 int status
= inflateInit(strm
);
31 die("inflateInit: %s (%s)", zerr_to_string(status
),
32 strm
->msg
? strm
->msg
: "no message");
35 void git_inflate_end(z_streamp strm
)
37 int status
= inflateEnd(strm
);
41 error("inflateEnd: %s (%s)", zerr_to_string(status
),
42 strm
->msg
? strm
->msg
: "no message");
45 int git_inflate(z_streamp strm
, int flush
)
47 int status
= inflate(strm
, flush
);
50 /* Z_BUF_ERROR: normal, needs more space in the output buffer */
57 die("inflate: out of memory");
61 error("inflate: %s (%s)", zerr_to_string(status
),
62 strm
->msg
? strm
->msg
: "no message");