Branch Coverage

gz.c
Criterion Covered Total %
branch 38 68 55.8


line true false branch
31 0 11 case GZ_MODE_AUTO: return encoding ? -1 : (MAX_WBITS | 32); /* 47 decode */
71 67 67 if (used + need <= *cap) return GZ_OK;
72 12 55 want = *cap ? *cap : 4096;
73 287 67 while (want < used + need) {
75 0 287 if (doubled <= want) return GZ_ERR_MEM; /* overflow */
79 0 67 if (!p) return GZ_ERR_MEM;
98 31 0 chunk = (opts && opts->chunk_size) ? opts->chunk_size : GZ_DEFAULT_CHUNK;
31 0 chunk = (opts && opts->chunk_size) ? opts->chunk_size : GZ_DEFAULT_CHUNK;
100 31 0 wbits = wbits_for_mode(opts ? opts->mode : GZ_MODE_AUTO, 0);
101 0 31 if (wbits == -1) return GZ_ERR_OPT;
108 0 31 if (z_rc != Z_OK) return GZ_ERR_INIT;
113 31 0 if (in_len == 0) {
116 0 0 if (!*out) return GZ_ERR_MEM;
124 0 70 if (err != GZ_OK) goto fail;
133 29 41 if (z_rc == Z_STREAM_END) break;
134 0 41 if (z_rc == Z_BUF_ERROR && z.avail_in == 0) {
0 0 if (z_rc == Z_BUF_ERROR && z.avail_in == 0) {
138 1 40 if (z_rc != Z_OK) {
147 1 39 if (z.avail_in == 0 && z.avail_out > 0) {
1 0 if (z.avail_in == 0 && z.avail_out > 0) {
178 0 25 if (!opts) return GZ_ERR_OPT;
180 25 0 chunk = opts->chunk_size ? opts->chunk_size : GZ_DEFAULT_CHUNK;
185 25 0 if (level < 0 || level > 9) return GZ_ERR_OPT;
0 25 if (level < 0 || level > 9) return GZ_ERR_OPT;
186 25 0 if (mem_level < 1 || mem_level > 9) return GZ_ERR_OPT;
0 25 if (mem_level < 1 || mem_level > 9) return GZ_ERR_OPT;
187 1 24 if (opts->mode == GZ_MODE_AUTO) return GZ_ERR_OPT;
190 0 24 if (wbits == -1) return GZ_ERR_OPT;
197 24 0 if (z_rc != Z_OK) return GZ_ERR_INIT;
201 0 64 if (err != GZ_OK) goto fail;
210 24 40 if (z_rc == Z_STREAM_END) break;
211 40 0 if (z_rc == Z_OK) continue; /* needs more output room */
212 0 0 if (z_rc == Z_BUF_ERROR && z.avail_out == 0) continue;
0 0 if (z_rc == Z_BUF_ERROR && z.avail_out == 0) continue;