Branch Coverage

bzlib.c
Criterion Covered Total %
branch 147 452 32.5


line true false branch
115 143 0 if (addr != NULL) free ( addr );
128 5888 23 for (i = 0; i < 256; i++) s->inUse[i] = False;
145 0 66 if (s->state_in_ch < 256 && s->state_in_len > 0)
0 0 if (s->state_in_ch < 256 && s->state_in_len > 0)
161 0 21 if (!bz_config_ok()) return BZ_CONFIG_ERROR;
163 21 0 if (strm == NULL ||
21 0 if (strm == NULL ||
164 21 0 blockSize100k < 1 || blockSize100k > 9 ||
21 0 blockSize100k < 1 || blockSize100k > 9 ||
165 0 21 workFactor < 0 || workFactor > 250)
168 21 0 if (workFactor == 0) workFactor = 30;
169 21 0 if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc;
170 21 0 if (strm->bzfree == NULL) strm->bzfree = default_bzfree;
173 0 21 if (s == NULL) return BZ_MEM_ERROR;
185 21 0 if (s->arr1 == NULL || s->arr2 == NULL || s->ftab == NULL) {
21 0 if (s->arr1 == NULL || s->arr2 == NULL || s->ftab == NULL) {
0 21 if (s->arr1 == NULL || s->arr2 == NULL || s->ftab == NULL) {
186 0 0 if (s->arr1 != NULL) BZFREE(s->arr1);
187 0 0 if (s->arr2 != NULL) BZFREE(s->arr2);
188 0 0 if (s->ftab != NULL) BZFREE(s->ftab);
189 0 0 if (s != NULL) BZFREE(s);
224 6504 2256 for (i = 0; i < s->state_in_len; i++) {
258 21 2 if (s->state_in_ch < 256) add_pair_to_block ( s );
297 205 23 if (s->mode == BZ_M_RUNNING) {
302 0 125600 if (s->nblock >= s->nblockMAX) break;
304 205 125395 if (s->strm->avail_in == 0) break;
306 121147 4248 ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
118891 2256 ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
4248 2256 ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
0 4248 ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
2235 21 ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
310 0 125395 if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++;
318 0 23 if (s->nblock >= s->nblockMAX) break;
320 23 0 if (s->strm->avail_in == 0) break;
322 0 0 if (s->avail_in_expect == 0) break;
324 0 0 ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
0 0 ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
0 0 ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
0 0 ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
0 0 ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) );
328 0 0 if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++;
345 20 62729 if (s->strm->avail_out == 0) break;
348 23 62706 if (s->state_out_pos >= s->numZ) break;
356 0 62706 if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
373 43 228 if (s->state == BZ_S_OUTPUT) {
375 20 23 if (s->state_out_pos < s->numZ) break;
376 21 2 if (s->mode == BZ_M_FINISHING &&
21 0 if (s->mode == BZ_M_FINISHING &&
377 21 0 s->avail_in_expect == 0 &&
381 2 0 if (s->mode == BZ_M_FLUSHING &&
2 0 if (s->mode == BZ_M_FLUSHING &&
382 2 0 s->avail_in_expect == 0 &&
386 228 0 if (s->state == BZ_S_INPUT) {
388 23 205 if (s->mode != BZ_M_RUNNING && s->avail_in_expect == 0) {
23 0 if (s->mode != BZ_M_RUNNING && s->avail_in_expect == 0) {
394 0 205 if (s->nblock >= s->nblockMAX) {
399 205 0 if (s->strm->avail_in == 0) {
406 43 205 return progress_in || progress_out;
43 0 return progress_in || progress_out;
415 0 248 if (strm == NULL) return BZ_PARAM_ERROR;
417 0 248 if (s == NULL) return BZ_PARAM_ERROR;
418 0 248 if (s->strm != strm) return BZ_PARAM_ERROR;
427 205 23 if (action == BZ_RUN) {
429 205 0 return progress ? BZ_RUN_OK : BZ_PARAM_ERROR;
432 2 21 if (action == BZ_FLUSH) {
438 21 0 if (action == BZ_FINISH) {
447 0 4 if (action != BZ_FLUSH) return BZ_SEQUENCE_ERROR;
448 0 4 if (s->avail_in_expect != s->strm->avail_in)
451 4 0 if (s->avail_in_expect > 0 || !isempty_RL(s) ||
4 0 if (s->avail_in_expect > 0 || !isempty_RL(s) ||
2 2 if (s->avail_in_expect > 0 || !isempty_RL(s) ||
457 0 39 if (action != BZ_FINISH) return BZ_SEQUENCE_ERROR;
458 0 39 if (s->avail_in_expect != s->strm->avail_in)
461 0 39 if (!progress) return BZ_SEQUENCE_ERROR;
462 39 0 if (s->avail_in_expect > 0 || !isempty_RL(s) ||
39 0 if (s->avail_in_expect > 0 || !isempty_RL(s) ||
18 21 if (s->avail_in_expect > 0 || !isempty_RL(s) ||
475 0 21 if (strm == NULL) return BZ_PARAM_ERROR;
477 0 21 if (s == NULL) return BZ_PARAM_ERROR;
478 0 21 if (s->strm != strm) return BZ_PARAM_ERROR;
480 21 0 if (s->arr1 != NULL) BZFREE(s->arr1);
481 21 0 if (s->arr2 != NULL) BZFREE(s->arr2);
482 21 0 if (s->ftab != NULL) BZFREE(s->ftab);
503 0 30 if (!bz_config_ok()) return BZ_CONFIG_ERROR;
505 0 30 if (strm == NULL) return BZ_PARAM_ERROR;
506 0 30 if (small != 0 && small != 1) return BZ_PARAM_ERROR;
0 0 if (small != 0 && small != 1) return BZ_PARAM_ERROR;
507 30 0 if (verbosity < 0 || verbosity > 4) return BZ_PARAM_ERROR;
0 30 if (verbosity < 0 || verbosity > 4) return BZ_PARAM_ERROR;
509 30 0 if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc;
510 30 0 if (strm->bzfree == NULL) strm->bzfree = default_bzfree;
513 0 30 if (s == NULL) return BZ_MEM_ERROR;
544 0 63 if (s->blockRandomised) {
549 0 0 if (s->strm->avail_out == 0) return False;
550 0 0 if (s->state_out_len == 0) break;
557 0 0 if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
561 0 0 if (s->nblock_used == s->save_nblock+1) return False;
564 0 0 if (s->nblock_used > s->save_nblock+1)
569 0 0 BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
0 0 BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
0 0 BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
571 0 0 if (s->nblock_used == s->save_nblock+1) continue;
572 0 0 if (k1 != s->k0) { s->k0 = k1; continue; };
575 0 0 BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
0 0 BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
0 0 BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
577 0 0 if (s->nblock_used == s->save_nblock+1) continue;
578 0 0 if (k1 != s->k0) { s->k0 = k1; continue; };
581 0 0 BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
0 0 BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
0 0 BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
583 0 0 if (s->nblock_used == s->save_nblock+1) continue;
584 0 0 if (k1 != s->k0) { s->k0 = k1; continue; };
586 0 0 BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
0 0 BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
0 0 BZ_GET_FAST(k1); BZ_RAND_UPD_MASK;
589 0 0 BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK;
0 0 BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK;
0 0 BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK;
615 14461 29 if (c_state_out_len > 0) {
617 0 42908 if (cs_avail_out == 0) goto return_notr;
618 14461 28447 if (c_state_out_len == 1) break;
627 34 435116 if (cs_avail_out == 0) {
637 0 435145 if (c_nblock_used > s_save_nblockPP)
641 29 435116 if (c_nblock_used == s_save_nblockPP) {
645 0 435116 BZ_GET_FAST_C(k1); c_nblock_used++;
646 420689 14427 if (k1 != c_k0) {
649 0 14427 if (c_nblock_used == s_save_nblockPP)
653 0 14427 BZ_GET_FAST_C(k1); c_nblock_used++;
654 0 14427 if (c_nblock_used == s_save_nblockPP) continue;
655 407 14020 if (k1 != c_k0) { c_k0 = k1; continue; };
658 0 14020 BZ_GET_FAST_C(k1); c_nblock_used++;
659 0 14020 if (c_nblock_used == s_save_nblockPP) continue;
660 14020 0 if (k1 != c_k0) { c_k0 = k1; continue; };
662 0 0 BZ_GET_FAST_C(k1); c_nblock_used++;
664 0 0 BZ_GET_FAST_C(c_k0); c_nblock_used++;
670 0 63 if (s->strm->total_out_lo32 < total_out_lo32_old)
701 0 0 if (indx >= cftab[mid]) nb = mid; else na = mid;
703 0 0 while (na - nb != 1);
717 0 0 if (s->blockRandomised) {
722 0 0 if (s->strm->avail_out == 0) return False;
723 0 0 if (s->state_out_len == 0) break;
730 0 0 if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
734 0 0 if (s->nblock_used == s->save_nblock+1) return False;
737 0 0 if (s->nblock_used > s->save_nblock+1)
742 0 0 BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
0 0 BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
0 0 BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
744 0 0 if (s->nblock_used == s->save_nblock+1) continue;
745 0 0 if (k1 != s->k0) { s->k0 = k1; continue; };
748 0 0 BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
0 0 BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
0 0 BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
750 0 0 if (s->nblock_used == s->save_nblock+1) continue;
751 0 0 if (k1 != s->k0) { s->k0 = k1; continue; };
754 0 0 BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
0 0 BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
0 0 BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
756 0 0 if (s->nblock_used == s->save_nblock+1) continue;
757 0 0 if (k1 != s->k0) { s->k0 = k1; continue; };
759 0 0 BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
0 0 BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
0 0 BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK;
762 0 0 BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK;
0 0 BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK;
0 0 BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK;
771 0 0 if (s->strm->avail_out == 0) return False;
772 0 0 if (s->state_out_len == 0) break;
779 0 0 if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++;
783 0 0 if (s->nblock_used == s->save_nblock+1) return False;
786 0 0 if (s->nblock_used > s->save_nblock+1)
791 0 0 BZ_GET_SMALL(k1); s->nblock_used++;
792 0 0 if (s->nblock_used == s->save_nblock+1) continue;
793 0 0 if (k1 != s->k0) { s->k0 = k1; continue; };
796 0 0 BZ_GET_SMALL(k1); s->nblock_used++;
797 0 0 if (s->nblock_used == s->save_nblock+1) continue;
798 0 0 if (k1 != s->k0) { s->k0 = k1; continue; };
801 0 0 BZ_GET_SMALL(k1); s->nblock_used++;
802 0 0 if (s->nblock_used == s->save_nblock+1) continue;
803 0 0 if (k1 != s->k0) { s->k0 = k1; continue; };
805 0 0 BZ_GET_SMALL(k1); s->nblock_used++;
807 0 0 BZ_GET_SMALL(s->k0); s->nblock_used++;
819 0 51133 if (strm == NULL) return BZ_PARAM_ERROR;
821 0 51133 if (s == NULL) return BZ_PARAM_ERROR;
822 0 51133 if (s->strm != strm) return BZ_PARAM_ERROR;
825 0 51162 if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR;
826 63 51099 if (s->state == BZ_X_OUTPUT) {
827 0 63 if (s->smallDecompress)
830 0 63 if (corrupt) return BZ_DATA_ERROR;
831 29 34 if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) {
29 0 if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) {
837 0 29 if (s->calculatedBlockCRC != s->storedBlockCRC)
848 51128 0 if (s->state >= BZ_X_MAGIC_1) {
850 29 51099 if (r == BZ_STREAM_END) {
854 0 29 if (s->calculatedCombinedCRC != s->storedCombinedCRC)
858 51070 29 if (s->state != BZ_X_OUTPUT) return r;
872 0 30 if (strm == NULL) return BZ_PARAM_ERROR;
874 0 30 if (s == NULL) return BZ_PARAM_ERROR;
875 0 30 if (s->strm != strm) return BZ_PARAM_ERROR;
877 29 1 if (s->tt != NULL) BZFREE(s->tt);
878 0 30 if (s->ll16 != NULL) BZFREE(s->ll16);
879 0 30 if (s->ll4 != NULL) BZFREE(s->ll4);
1266 0 0 if (dest == NULL || destLen == NULL ||
0 0 if (dest == NULL || destLen == NULL ||
0 0 if (dest == NULL || destLen == NULL ||
1267 0 0 source == NULL ||
1268 0 0 blockSize100k < 1 || blockSize100k > 9 ||
0 0 blockSize100k < 1 || blockSize100k > 9 ||
1269 0 0 verbosity < 0 || verbosity > 4 ||
0 0 verbosity < 0 || verbosity > 4 ||
1270 0 0 workFactor < 0 || workFactor > 250)
1273 0 0 if (workFactor == 0) workFactor = 30;
1279 0 0 if (ret != BZ_OK) return ret;
1287 0 0 if (ret == BZ_FINISH_OK) goto output_overflow;
1288 0 0 if (ret != BZ_STREAM_END) goto errhandler;
1317 0 0 if (dest == NULL || destLen == NULL ||
0 0 if (dest == NULL || destLen == NULL ||
0 0 if (dest == NULL || destLen == NULL ||
1318 0 0 source == NULL ||
1319 0 0 (small != 0 && small != 1) ||
0 0 (small != 0 && small != 1) ||
1320 0 0 verbosity < 0 || verbosity > 4)
1327 0 0 if (ret != BZ_OK) return ret;
1335 0 0 if (ret == BZ_OK) goto output_overflow_or_eof;
1336 0 0 if (ret != BZ_STREAM_END) goto errhandler;
1344 0 0 if (strm.avail_out > 0) {