History

Fix read and write return types: now st_size_t, like the size inputs.

To support this change, turn on lots more compiler warnings, and fix all the warnings generated.

rrt committed 19 years ago

Commit 4d743c41 parent ce1f8f393 files · +875 −1236Browse files

Showing the changes to src/aiff.c (1 of 93 files). Show all

Unified · Split

src/aiff.c+16−18
@@ -74,7 +74,7 @@ static int textChunk(char **text, char *chunkDescription, ft_t ft); · 73 unmodified lines
7474 static int commentChunk(char **text, char *chunkDescription, ft_t ft);
7575 static void reportInstrument(ft_t ft);
7676
77−int st_aiffseek(ft_t ft, st_size_t offset)
77+static int st_aiffseek(ft_t ft, st_size_t offset)
7878 {
7979 aiff_t aiff = (aiff_t ) ft->priv;
8080 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
9999 return(ft->st_errno);
100100 }
101101
102−int st_aiffstartread(ft_t ft)
102+static int st_aiffstartread(ft_t ft)
103103 {
104104 aiff_t aiff = (aiff_t ) ft->priv;
105105 char buf[5];
@@ -408,7 +408,7 @@ int st_aiffstartread(ft_t ft) · 302 unmodified lines
408408 if (foundcomm) {
409409 ft->info.channels = channels;
410410 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)
412412 st_report("AIFF only supports signed data. Forcing to signed.");
413413 ft->info.encoding = ST_ENCODING_SIGN2;
414414 if (bits <= 8)
@@ -441,9 +441,9 @@ int st_aiffstartread(ft_t ft) · 26 unmodified lines
441441 return(ST_EOF);
442442 }
443443 } else {
444− if ((ft->info.channels == -1)
444+ if ((ft->info.channels == 0)
445445 || (ft->info.rate == 0)
446− || (ft->info.encoding == -1)
446+ || (ft->info.encoding == ST_ENCODING_UNKNOWN)
447447 || (ft->info.size == -1)) {
448448 st_report("You must specify # channels, sample rate, signed/unsigned,");
449449 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
633633 st_debug("%-10s \"%s\"", chunkDescription, *text);
634634 /* make sure we read the whole chunk */
635635 if (totalReadLength < chunksize) {
636− int i;
636+ size_t i;
637637 char c;
638638 for (i=0; i < chunksize - totalReadLength; i++ ) {
639639 st_readbuf(ft, &c, 1, 1);
@@ -642,14 +642,12 @@ static int commentChunk(char **text, char *chunkDescription, ft_t ft) · 2 unmodified lines
642642 return(ST_SUCCESS);
643643 }
644644
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)
646646 {
647647 aiff_t aiff = (aiff_t ) ft->priv;
648648 st_ssize_t done;
649649
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)
653651 len = aiff->nsamples;
654652 done = st_rawread(ft, buf, len);
655653 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
658656 return done;
659657 }
660658
661−int st_aiffstopread(ft_t ft)
659+static int st_aiffstopread(ft_t ft)
662660 {
663661 char buf[5];
664662 uint32_t chunksize;
@@ -701,7 +699,7 @@ int st_aiffstopread(ft_t ft) · 36 unmodified lines
701699 Strictly spoken this is not legal, but the playaiff utility
702700 will still be able to play the resulting file. */
703701
704−int st_aiffstartwrite(ft_t ft)
702+static int st_aiffstartwrite(ft_t ft)
705703 {
706704 aiff_t aiff = (aiff_t ) ft->priv;
707705 int rc;
@@ -726,7 +724,7 @@ int st_aiffstartwrite(ft_t ft) · 18 unmodified lines
726724 ft->info.encoding = ST_ENCODING_SIGN2;
727725 ft->info.size = ST_SIZE_WORD;
728726 }
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)
730728 st_report("AIFF only supports signed data. Forcing to signed.");
731729 ft->info.encoding = ST_ENCODING_SIGN2; /* We have a fixed encoding */
732730
@@ -739,7 +737,7 @@ int st_aiffstartwrite(ft_t ft) · 6 unmodified lines
739737 return(aiffwriteheader(ft, 0x7f000000L / (ft->info.size*ft->info.channels)));
740738 }
741739
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)
743741 {
744742 aiff_t aiff = (aiff_t ) ft->priv;
745743 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
747745 return(len);
748746 }
749747
750−int st_aiffstopwrite(ft_t ft)
748+static int st_aiffstopwrite(ft_t ft)
751749 {
752750 aiff_t aiff = (aiff_t ) ft->priv;
753751 int rc;
@@ -914,7 +912,7 @@ static int aiffwriteheader(ft_t ft, st_size_t nframes) · 160 unmodified lines
914912 return(ST_SUCCESS);
915913 }
916914
917−int st_aifcstartwrite(ft_t ft)
915+static int st_aifcstartwrite(ft_t ft)
918916 {
919917 aiff_t aiff = (aiff_t ) ft->priv;
920918 int rc;
@@ -939,7 +937,7 @@ int st_aifcstartwrite(ft_t ft) · 18 unmodified lines
939937 ft->info.encoding = ST_ENCODING_SIGN2;
940938 ft->info.size = ST_SIZE_WORD;
941939 }
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)
943941 st_report("AIFC only supports signed data. Forcing to signed.");
944942 ft->info.encoding = ST_ENCODING_SIGN2; /* We have a fixed encoding */
945943
@@ -952,7 +950,7 @@ int st_aifcstartwrite(ft_t ft) · 6 unmodified lines
952950 return(aifcwriteheader(ft, 0x7f000000L / (ft->info.size*ft->info.channels)));
953951 }
954952
955−int st_aifcstopwrite(ft_t ft)
953+static int st_aifcstopwrite(ft_t ft)
956954 {
957955 aiff_t aiff = (aiff_t ) ft->priv;
958956 int rc;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t