To support this change, turn on lots more compiler warnings, and fix all the warnings generated.
Showing the changes to src/aiff.c (1 of 93 files). Show all
Unified · Split
| @@ -74,7 +74,7 @@ static int textChunk(char **text, char *chunkDescription, ft_t ft); · 73 unmodified lines | ||
| 74 | 74 | static int commentChunk(char **text, char *chunkDescription, ft_t ft); |
| 75 | 75 | static void reportInstrument(ft_t ft); |
| 76 | 76 | |
| 77 | −int st_aiffseek(ft_t ft, st_size_t offset) | |
| 77 | +static int st_aiffseek(ft_t ft, st_size_t offset) | |
| 78 | 78 | { |
| 79 | 79 | aiff_t aiff = (aiff_t ) ft->priv; |
| 80 | 80 | st_size_t new_offset, channel_block, alignment; |
| @@ -99,7 +99,7 @@ int st_aiffseek(ft_t ft, st_size_t offset) · 18 unmodified lines | ||
| 99 | 99 | return(ft->st_errno); |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | −int st_aiffstartread(ft_t ft) | |
| 102 | +static int st_aiffstartread(ft_t ft) | |
| 103 | 103 | { |
| 104 | 104 | aiff_t aiff = (aiff_t ) ft->priv; |
| 105 | 105 | char buf[5]; |
| @@ -408,7 +408,7 @@ int st_aiffstartread(ft_t ft) · 302 unmodified lines | ||
| 408 | 408 | if (foundcomm) { |
| 409 | 409 | ft->info.channels = channels; |
| 410 | 410 | ft->info.rate = rate; |
| 411 | − if (ft->info.encoding != -1 && ft->info.encoding != ST_ENCODING_SIGN2) | |
| 411 | + if (ft->info.encoding != ST_ENCODING_UNKNOWN && ft->info.encoding != ST_ENCODING_SIGN2) | |
| 412 | 412 | st_report("AIFF only supports signed data. Forcing to signed."); |
| 413 | 413 | ft->info.encoding = ST_ENCODING_SIGN2; |
| 414 | 414 | if (bits <= 8) |
| @@ -441,9 +441,9 @@ int st_aiffstartread(ft_t ft) · 26 unmodified lines | ||
| 441 | 441 | return(ST_EOF); |
| 442 | 442 | } |
| 443 | 443 | } else { |
| 444 | − if ((ft->info.channels == -1) | |
| 444 | + if ((ft->info.channels == 0) | |
| 445 | 445 | || (ft->info.rate == 0) |
| 446 | − || (ft->info.encoding == -1) | |
| 446 | + || (ft->info.encoding == ST_ENCODING_UNKNOWN) | |
| 447 | 447 | || (ft->info.size == -1)) { |
| 448 | 448 | st_report("You must specify # channels, sample rate, signed/unsigned,"); |
| 449 | 449 | st_report("and 8/16 on the command line."); |
| @@ -633,7 +633,7 @@ static int commentChunk(char **text, char *chunkDescription, ft_t ft) · 183 unmodified lines | ||
| 633 | 633 | st_debug("%-10s \"%s\"", chunkDescription, *text); |
| 634 | 634 | /* make sure we read the whole chunk */ |
| 635 | 635 | if (totalReadLength < chunksize) { |
| 636 | − int i; | |
| 636 | + size_t i; | |
| 637 | 637 | char c; |
| 638 | 638 | for (i=0; i < chunksize - totalReadLength; i++ ) { |
| 639 | 639 | st_readbuf(ft, &c, 1, 1); |
| @@ -642,14 +642,12 @@ static int commentChunk(char **text, char *chunkDescription, ft_t ft) · 2 unmodified lines | ||
| 642 | 642 | return(ST_SUCCESS); |
| 643 | 643 | } |
| 644 | 644 | |
| 645 | −st_ssize_t st_aiffread(ft_t ft, st_sample_t *buf, st_size_t len) | |
| 645 | +static st_size_t st_aiffread(ft_t ft, st_sample_t *buf, st_size_t len) | |
| 646 | 646 | { |
| 647 | 647 | aiff_t aiff = (aiff_t ) ft->priv; |
| 648 | 648 | st_ssize_t done; |
| 649 | 649 | |
| 650 | − if (len < 0) | |
| 651 | − return ST_EOF; | |
| 652 | − else if ((st_size_t)len > aiff->nsamples) | |
| 650 | + if ((st_size_t)len > aiff->nsamples) | |
| 653 | 651 | len = aiff->nsamples; |
| 654 | 652 | done = st_rawread(ft, buf, len); |
| 655 | 653 | if (done == 0 && aiff->nsamples != 0) |
| @@ -658,7 +656,7 @@ st_ssize_t st_aiffread(ft_t ft, st_sample_t *buf, st_size_t len) · 2 unmodified lines | ||
| 658 | 656 | return done; |
| 659 | 657 | } |
| 660 | 658 | |
| 661 | −int st_aiffstopread(ft_t ft) | |
| 659 | +static int st_aiffstopread(ft_t ft) | |
| 662 | 660 | { |
| 663 | 661 | char buf[5]; |
| 664 | 662 | uint32_t chunksize; |
| @@ -701,7 +699,7 @@ int st_aiffstopread(ft_t ft) · 36 unmodified lines | ||
| 701 | 699 | Strictly spoken this is not legal, but the playaiff utility |
| 702 | 700 | will still be able to play the resulting file. */ |
| 703 | 701 | |
| 704 | −int st_aiffstartwrite(ft_t ft) | |
| 702 | +static int st_aiffstartwrite(ft_t ft) | |
| 705 | 703 | { |
| 706 | 704 | aiff_t aiff = (aiff_t ) ft->priv; |
| 707 | 705 | int rc; |
| @@ -726,7 +724,7 @@ int st_aiffstartwrite(ft_t ft) · 18 unmodified lines | ||
| 726 | 724 | ft->info.encoding = ST_ENCODING_SIGN2; |
| 727 | 725 | ft->info.size = ST_SIZE_WORD; |
| 728 | 726 | } |
| 729 | − if (ft->info.encoding != -1 && ft->info.encoding != ST_ENCODING_SIGN2) | |
| 727 | + if (ft->info.encoding != ST_ENCODING_UNKNOWN && ft->info.encoding != ST_ENCODING_SIGN2) | |
| 730 | 728 | st_report("AIFF only supports signed data. Forcing to signed."); |
| 731 | 729 | ft->info.encoding = ST_ENCODING_SIGN2; /* We have a fixed encoding */ |
| 732 | 730 | |
| @@ -739,7 +737,7 @@ int st_aiffstartwrite(ft_t ft) · 6 unmodified lines | ||
| 739 | 737 | return(aiffwriteheader(ft, 0x7f000000L / (ft->info.size*ft->info.channels))); |
| 740 | 738 | } |
| 741 | 739 | |
| 742 | −st_ssize_t st_aiffwrite(ft_t ft, const st_sample_t *buf, st_size_t len) | |
| 740 | +static st_size_t st_aiffwrite(ft_t ft, const st_sample_t *buf, st_size_t len) | |
| 743 | 741 | { |
| 744 | 742 | aiff_t aiff = (aiff_t ) ft->priv; |
| 745 | 743 | aiff->nsamples += len; |
| @@ -747,7 +745,7 @@ st_ssize_t st_aiffwrite(ft_t ft, const st_sample_t *buf, st_size_t len) · 1 unmodified line | ||
| 747 | 745 | return(len); |
| 748 | 746 | } |
| 749 | 747 | |
| 750 | −int st_aiffstopwrite(ft_t ft) | |
| 748 | +static int st_aiffstopwrite(ft_t ft) | |
| 751 | 749 | { |
| 752 | 750 | aiff_t aiff = (aiff_t ) ft->priv; |
| 753 | 751 | int rc; |
| @@ -914,7 +912,7 @@ static int aiffwriteheader(ft_t ft, st_size_t nframes) · 160 unmodified lines | ||
| 914 | 912 | return(ST_SUCCESS); |
| 915 | 913 | } |
| 916 | 914 | |
| 917 | −int st_aifcstartwrite(ft_t ft) | |
| 915 | +static int st_aifcstartwrite(ft_t ft) | |
| 918 | 916 | { |
| 919 | 917 | aiff_t aiff = (aiff_t ) ft->priv; |
| 920 | 918 | int rc; |
| @@ -939,7 +937,7 @@ int st_aifcstartwrite(ft_t ft) · 18 unmodified lines | ||
| 939 | 937 | ft->info.encoding = ST_ENCODING_SIGN2; |
| 940 | 938 | ft->info.size = ST_SIZE_WORD; |
| 941 | 939 | } |
| 942 | − if (ft->info.encoding != -1 && ft->info.encoding != ST_ENCODING_SIGN2) | |
| 940 | + if (ft->info.encoding != ST_ENCODING_UNKNOWN && ft->info.encoding != ST_ENCODING_SIGN2) | |
| 943 | 941 | st_report("AIFC only supports signed data. Forcing to signed."); |
| 944 | 942 | ft->info.encoding = ST_ENCODING_SIGN2; /* We have a fixed encoding */ |
| 945 | 943 | |
| @@ -952,7 +950,7 @@ int st_aifcstartwrite(ft_t ft) · 6 unmodified lines | ||
| 952 | 950 | return(aifcwriteheader(ft, 0x7f000000L / (ft->info.size*ft->info.channels))); |
| 953 | 951 | } |
| 954 | 952 | |
| 955 | −int st_aifcstopwrite(ft_t ft) | |
| 953 | +static int st_aifcstopwrite(ft_t ft) | |
| 956 | 954 | { |
| 957 | 955 | aiff_t aiff = (aiff_t ) ft->priv; |
| 958 | 956 | int rc; |