MCPcopy Create free account
hub / github.com/git/git / zlib_post_call

Function zlib_post_call

git-zlib.c:56–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56static void zlib_post_call(git_zstream *s, int status)
57{
58 size_t bytes_consumed;
59 size_t bytes_produced;
60
61 bytes_consumed = s->z.next_in - s->next_in;
62 bytes_produced = s->z.next_out - s->next_out;
63 /*
64 * zlib's total_out/total_in are uLong which may wrap for >4GB.
65 * We track our own totals and verify only the low bits match.
66 */
67 if ((s->z.total_out & ULONG_MAX_VALUE) !=
68 ((zlib_uLong_cap(s->total_out) + bytes_produced) & ULONG_MAX_VALUE))
69 BUG("total_out mismatch");
70 /*
71 * zlib does not update total_in when it returns Z_NEED_DICT,
72 * causing a mismatch here. Skip the sanity check in that case.
73 */
74 if (status != Z_NEED_DICT &&
75 (s->z.total_in & ULONG_MAX_VALUE) !=
76 ((zlib_uLong_cap(s->total_in) + bytes_consumed) & ULONG_MAX_VALUE))
77 BUG("total_in mismatch");
78
79 s->total_out += bytes_produced;
80 s->total_in += bytes_consumed;
81 /* zlib-ng marks `next_in` as `const`, so we have to cast it away. */
82 s->next_in = (unsigned char *) s->z.next_in;
83 s->next_out = s->z.next_out;
84 s->avail_in -= bytes_consumed;
85 s->avail_out -= bytes_produced;
86}
87
88void git_inflate_init(git_zstream *strm)
89{

Callers 9

git_inflate_initFunction · 0.85
git_inflate_endFunction · 0.85
git_inflateFunction · 0.85
git_deflate_initFunction · 0.85
do_git_deflate_initFunction · 0.85
git_deflate_abortFunction · 0.85
git_deflate_end_gentlyFunction · 0.85
git_deflateFunction · 0.85

Calls 1

zlib_uLong_capFunction · 0.85

Tested by

no test coverage detected