Branch Coverage

src/wav.c
Criterion Covered Total %
branch 115 190 60.5


line true false branch
31 0 11 if ( !_check_buf(infile, &buf, 12, WAV_BLOCK_SIZE) ) {
36 8 3 if ( !strncmp( (char *)buffer_ptr(&buf), "RIFF", 4 ) ) {
43 0 8 if ( strncmp( (char *)buffer_ptr(&buf), "WAVE", 4 ) ) {
55 3 0 else if ( !strncmp( (char *)buffer_ptr(&buf), "FORM", 4 ) ) {
65 3 0 if ( bptr[0] == 'A' && bptr[1] == 'I' && bptr[2] == 'F' && (bptr[3] == 'F' || bptr[3] == 'C') ) {
3 0 if ( bptr[0] == 'A' && bptr[1] == 'I' && bptr[2] == 'F' && (bptr[3] == 'F' || bptr[3] == 'C') ) {
3 0 if ( bptr[0] == 'A' && bptr[1] == 'I' && bptr[2] == 'F' && (bptr[3] == 'F' || bptr[3] == 'C') ) {
1 2 if ( bptr[0] == 'A' && bptr[1] == 'I' && bptr[2] == 'F' && (bptr[3] == 'F' || bptr[3] == 'C') ) {
1 0 if ( bptr[0] == 'A' && bptr[1] == 'I' && bptr[2] == 'F' && (bptr[3] == 'F' || bptr[3] == 'C') ) {
87 0 11 if (err) return err;
97 29 5 while ( offset < file_size - 8 ) {
102 0 29 if ( !_check_buf(infile, buf, 8, WAV_BLOCK_SIZE) ) {
113 3 26 if ( chunk_size % 2 ) {
123 8 21 if ( !strcmp( chunk_id, "data" ) ) {
130 2 6 if ( !my_hv_fetch( info, "song_length_ms" ) ) {
132 2 0 if (bitrate != NULL) {
133 2 0 my_hv_store( info, "song_length_ms", newSVuv( (chunk_size / (SvIV(*bitrate) / 8.)) * 1000 ) );
139 2 6 if (chunk_size > file_size - offset) {
145 4 2 if ( file_size > offset + chunk_size ) {
151 20 1 else if ( !strcmp( chunk_id, "id3 " ) || !strcmp( chunk_id, "ID3 " ) || !strcmp( chunk_id, "ID32" ) ) {
20 0 else if ( !strcmp( chunk_id, "id3 " ) || !strcmp( chunk_id, "ID3 " ) || !strcmp( chunk_id, "ID32" ) ) {
0 20 else if ( !strcmp( chunk_id, "id3 " ) || !strcmp( chunk_id, "ID3 " ) || !strcmp( chunk_id, "ID32" ) ) {
155 1 0 if (
156 1 0 (bptr[0] == 'I' && bptr[1] == 'D' && bptr[2] == '3') &&
1 0 (bptr[0] == 'I' && bptr[1] == 'D' && bptr[2] == '3') &&
1 0 (bptr[0] == 'I' && bptr[1] == 'D' && bptr[2] == '3') &&
157 1 0 bptr[3] < 0xff && bptr[4] < 0xff &&
1 0 bptr[3] < 0xff && bptr[4] < 0xff &&
158 1 0 bptr[6] < 0x80 && bptr[7] < 0x80 && bptr[8] < 0x80 && bptr[9] < 0x80
1 0 bptr[6] < 0x80 && bptr[7] < 0x80 && bptr[8] < 0x80 && bptr[9] < 0x80
1 0 bptr[6] < 0x80 && bptr[7] < 0x80 && bptr[8] < 0x80 && bptr[9] < 0x80
170 1 19 if (chunk_size > file_size - offset) {
176 0 19 if ( !_check_buf(infile, buf, chunk_size, WAV_BLOCK_SIZE) ) {
180 8 11 if ( !strcmp( chunk_id, "fmt " ) ) {
183 2 9 else if ( !strcmp( chunk_id, "LIST" ) ) {
186 3 6 else if ( !strcmp( chunk_id, "PEAK" ) ) {
189 6 0 else if ( !strcmp( chunk_id, "fact" ) ) {
192 6 0 if ( chunk_size == 4 ) {
195 6 0 if (samplerate != NULL) {
198 6 0 my_hv_store( info, "song_length_ms", newSVuv( ((uint64_t)num_samples * 1000) / SvIV(*samplerate) ) );
207 0 0 if (
209 0 0 || !strcmp(chunk_id, "otom") // Wavosaur?
210 0 0 || !strcmp(chunk_id, "PAD ") // Padding
247 3 5 if ( chunk_size > 16 ) {
251 3 0 if (extra_len && chunk_size > 18) {
2 1 if (extra_len && chunk_size > 18) {
258 8 0 if (channels <= 2 && bps == 16) {
1 7 if (channels <= 2 && bps == 16) {
259 0 1 if (samplerate == 44100 || samplerate == 48000)
0 0 if (samplerate == 44100 || samplerate == 48000)
261 0 0 else if (samplerate >= 8000 && samplerate <= 32000)
0 0 else if (samplerate >= 8000 && samplerate <= 32000)
278 0 2 if ( !strcmp( type_id, "adtl" ) ) {
283 2 0 else if ( !strcmp( type_id, "INFO" ) ) {
284 11 2 while ( pos < chunk_size ) {
299 0 11 if ( len > chunk_size - pos ) {
308 21 0 while ( len && bptr[len - 1] == '\0' ) {
10 11 while ( len && bptr[len - 1] == '\0' ) {
322 0 11 if ( (len + nulls) % 2 ) {
341 4 0 if ( entry != NULL ) {
342 4 0 channels = SvIV(*entry);
348 8 4 while ( channels-- ) {
351 2 6 my_hv_store( peak, "value", newSVnv( big_endian ? buffer_get_float32(buf) : buffer_get_float32_le(buf) ) );
352 2 6 my_hv_store( peak, "position", newSVuv( big_endian ? buffer_get_int(buf) : buffer_get_int_le(buf) ) );
365 9 2 while ( offset < file_size - 8 ) {
370 0 9 if ( !_check_buf(infile, buf, 8, WAV_BLOCK_SIZE) ) {
381 0 9 if ( chunk_size % 2 ) {
391 3 6 if ( !strcmp( chunk_id, "SSND" ) ) {
394 0 3 if ( !_check_buf(infile, buf, 8, WAV_BLOCK_SIZE) ) {
407 2 1 if ( file_size > offset + chunk_size ) {
413 6 0 else if ( !strcmp( chunk_id, "id3 " ) || !strcmp( chunk_id, "ID3 " ) || !strcmp( chunk_id, "ID32" ) ) {
4 2 else if ( !strcmp( chunk_id, "id3 " ) || !strcmp( chunk_id, "ID3 " ) || !strcmp( chunk_id, "ID32" ) ) {
0 4 else if ( !strcmp( chunk_id, "id3 " ) || !strcmp( chunk_id, "ID3 " ) || !strcmp( chunk_id, "ID32" ) ) {
417 2 0 if (
418 2 0 (bptr[0] == 'I' && bptr[1] == 'D' && bptr[2] == '3') &&
2 0 (bptr[0] == 'I' && bptr[1] == 'D' && bptr[2] == '3') &&
2 0 (bptr[0] == 'I' && bptr[1] == 'D' && bptr[2] == '3') &&
419 2 0 bptr[3] < 0xff && bptr[4] < 0xff &&
2 0 bptr[3] < 0xff && bptr[4] < 0xff &&
420 2 0 bptr[6] < 0x80 && bptr[7] < 0x80 && bptr[8] < 0x80 && bptr[9] < 0x80
2 0 bptr[6] < 0x80 && bptr[7] < 0x80 && bptr[8] < 0x80 && bptr[9] < 0x80
2 0 bptr[6] < 0x80 && bptr[7] < 0x80 && bptr[8] < 0x80 && bptr[9] < 0x80
427 1 1 if (chunk_size < 0 || offset + chunk_size > file_size) {
1 0 if (chunk_size < 0 || offset + chunk_size > file_size) {
438 0 4 if (chunk_size > file_size - offset) {
444 0 4 if ( !_check_buf(infile, buf, chunk_size, WAV_BLOCK_SIZE) ) {
448 3 1 if ( !strcmp( chunk_id, "COMM" ) ) {
451 1 0 else if ( !strcmp( chunk_id, "PEAK" ) ) {
480 1 2 if (chunk_size > 18) {
490 3 0 if (channels <= 2 && bits_per_sample == 16) {
2 1 if (channels <= 2 && bits_per_sample == 16) {
491 0 2 if (samplerate == 44100 || samplerate == 48000)
0 0 if (samplerate == 44100 || samplerate == 48000)
493 0 0 else if (samplerate >= 8000 && samplerate <= 32000)
0 0 else if (samplerate >= 8000 && samplerate <= 32000)