Branch Coverage

src/ape.c
Criterion Covered Total %
branch 115 172 66.8


line true false branch
37 13 0 if (!(tag->flags & APE_CHECKED_APE)) {
38 0 13 if ((ret = _ape_get_tag_info(tag)) < 0) {
43 12 1 if ((tag->flags & APE_HAS_APE) && !(tag->flags & APE_CHECKED_FIELDS)) {
12 0 if ((tag->flags & APE_HAS_APE) && !(tag->flags & APE_CHECKED_FIELDS)) {
44 1 11 if ((ret = _ape_parse_fields(tag)) < 0) {
65 0 13 if (file_size < APE_MINIMUM_TAG_SIZE) {
71 13 0 if (!(tag->flags & APE_NO_ID3)) {
73 0 13 if (file_size < APE_ID3_MIN_TAG_SIZE) {
83 0 13 if ((PerlIO_seek(tag->fd, file_size - APE_ID3_MIN_TAG_SIZE, SEEK_SET)) == -1) {
87 0 13 if (PerlIO_read(tag->fd, &id3, APE_ID3_MIN_TAG_SIZE) < APE_ID3_MIN_TAG_SIZE) {
91 4 9 if (id3[0] == 'T' && id3[1] == 'A' && id3[2] == 'G') {
4 0 if (id3[0] == 'T' && id3[1] == 'A' && id3[2] == 'G') {
4 0 if (id3[0] == 'T' && id3[1] == 'A' && id3[2] == 'G') {
100 0 13 if (file_size < APE_MINIMUM_TAG_SIZE + id3_length) {
108 0 13 if (PerlIO_seek(tag->fd, file_size - APE_TAG_FOOTER_LEN - id3_length, SEEK_SET) == -1) {
114 0 13 if (!_check_buf(tag->fd, &tag->tag_footer, APE_TAG_FOOTER_LEN, APE_TAG_FOOTER_LEN)) {
121 2 11 if (memcmp(APE_PREAMBLE, &compare, 8)) {
127 1 1 if ( bptr[0] == 'L' && bptr[1] == 'Y' && bptr[2] == 'R'
1 0 if ( bptr[0] == 'L' && bptr[1] == 'Y' && bptr[2] == 'R'
1 0 if ( bptr[0] == 'L' && bptr[1] == 'Y' && bptr[2] == 'R'
128 1 0 && bptr[3] == 'I' && bptr[4] == 'C' && bptr[5] == 'S'
1 0 && bptr[3] == 'I' && bptr[4] == 'C' && bptr[5] == 'S'
1 0 && bptr[3] == 'I' && bptr[4] == 'C' && bptr[5] == 'S'
129 1 0 && bptr[6] == '2' && bptr[7] == '0' && bptr[8] == '0'
1 0 && bptr[6] == '2' && bptr[7] == '0' && bptr[8] == '0'
1 0 && bptr[6] == '2' && bptr[7] == '0' && bptr[8] == '0'
136 0 1 if ( (PerlIO_seek(tag->fd, file_size - (160 + lyrics_size + 15), SEEK_SET)) == -1 ) {
141 0 1 if ( !_check_buf(tag->fd, &tag->tag_footer, APE_TAG_FOOTER_LEN, APE_TAG_FOOTER_LEN) ) {
147 0 1 if (memcmp(APE_PREAMBLE, &compare, 8)) {
172 0 12 if (tag->size < APE_MINIMUM_TAG_SIZE) {
176 0 12 if (tag->size > APE_MAXIMUM_TAG_SIZE) {
180 0 12 if (tag->size + (uint32_t)id3_length > (unsigned long)file_size) {
184 0 12 if (tag->item_count > APE_MAXIMUM_ITEM_COUNT) {
188 0 12 if (tag->item_count > (tag->size - APE_MINIMUM_TAG_SIZE)/APE_ITEM_MINIMUM_SIZE) {
192 1 11 if (PerlIO_seek(tag->fd, (file_size -(long)tag->size - id3_length - (lyrics_size ? (lyrics_size + 15) : 0)), SEEK_SET) == -1) {
0 12 if (PerlIO_seek(tag->fd, (file_size -(long)tag->size - id3_length - (lyrics_size ? (lyrics_size + 15) : 0)), SEEK_SET) == -1) {
196 1 11 tag->offset = file_size -(long)tag->size - id3_length - (lyrics_size ? (lyrics_size + 15) : 0);
203 9 3 if (tag->footer_flags & APE_TAG_CONTAINS_HEADER) {
205 0 9 if (!_check_buf(tag->fd, &tag->tag_header, APE_TAG_HEADER_LEN, APE_TAG_HEADER_LEN)) {
213 9 0 if (memcmp(APE_PREAMBLE, &compare, 8) ||
0 9 if (memcmp(APE_PREAMBLE, &compare, 8) ||
214 0 0 (tmp_ptr[8] != '\0' && tmp_ptr[8] != '\1')) {
218 0 9 if (tag->size != (buffer_get_int_le(&tag->tag_header) + APE_TAG_HEADER_LEN)) {
222 0 9 if (tag->item_count != buffer_get_int_le(&tag->tag_header)) {
228 0 3 if (PerlIO_seek(tag->fd, APE_TAG_HEADER_LEN, SEEK_CUR) == -1) {
235 0 12 if (!_check_buf(tag->fd, &tag->tag_data, data_size, data_size)) {
242 12 0 if (my_hv_exists(tag->info, "audio_size")) {
243 12 0 int audio_size = SvIV(*(my_hv_fetch(tag->info, "audio_size")));
244 1 11 if (lyrics_size > 0)
259 0 12 if (tag->num_fields >= APE_MAXIMUM_ITEM_COUNT) {
263 114 11 for (i = 0; i < tag->item_count; i++) {
264 1 113 if ((ret = _ape_parse_field(tag)) != 0) {
269 0 11 if (buffer_len(&tag->tag_data) != 0) {
293 1 113 if (buffer_len(&tag->tag_data) < 8)
300 1175 113 while (tmp_ptr[0] != '\0') {
310 1607 110 while (tmp_ptr[0] != '\0' && val_length <= size) {
1604 3 while (tmp_ptr[0] != '\0' && val_length <= size) {
319 4 109 if (flags & APE_TAG_TYPE_BINARY) {
324 3 1 if ( sv_len(key) == 17 && !memcmp( upcase(SvPVX(key)), "COVER ART (FRONT)", 17 ) ) {
3 0 if ( sv_len(key) == 17 && !memcmp( upcase(SvPVX(key)), "COVER ART (FRONT)", 17 ) ) {
325 1 2 if ( _env_true("AUDIO_SCAN_NO_ARTWORK") ) {
339 3 1 if ( value == NULL ) {
346 104 5 else if (val_length >= size - 1) {
353 0 104 if (_ape_check_validity(tag, flags, SvPVX(key), SvPVX(value)) != 0) {
370 9 4 while ( done < size ) {
373 113 5 while (tmp_ptr[0] != '\0' && done < size) {
109 4 while (tmp_ptr[0] != '\0' && done < size) {
385 1 8 if (_ape_check_validity(tag, flags, SvPVX(key), SvPVX(tmp_val)) != 0) {
398 4 4 if ( done < size ) {
410 0 112 if (size + buffer_len(&tag->tag_data) + APE_ITEM_MINIMUM_SIZE > data_size) {
429 0 113 if (flags > 7) {
437 0 113 if (key_length < 2) {
441 0 113 if (key_length > 255) {
445 2 111 if (key_length == 3) {
451 2 0 if (strncasecmp(key, "id3", 3) == 0 ||
2 0 if (strncasecmp(key, "id3", 3) == 0 ||
452 0 2 strncasecmp(key, "tag", 3) == 0 ||
462 8 105 if (key_length == 4 && strncasecmp(key, "oggs", 4) == 0) {
0 8 if (key_length == 4 && strncasecmp(key, "oggs", 4) == 0) {
467 1135 112 for (c = key; c < key_end; c++) {
468 1135 0 if ((unsigned char)(*c) < 0x20 || (unsigned char)(*c) > 0x7f) {
1 1134 if ((unsigned char)(*c) < 0x20 || (unsigned char)(*c) > 0x7f) {
473 106 6 if (tag->version > 1) {
475 106 0 if (((flags & APE_ITEM_TYPE_FLAGS) & 2) == 0 && !is_utf8_string((unsigned char*)(value), strlen(value))) {
0 106 if (((flags & APE_ITEM_TYPE_FLAGS) & 2) == 0 && !is_utf8_string((unsigned char*)(value), strlen(value))) {
491 0 13 if (tag == NULL) {