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/sox.c (1 of 93 files). Show all

Unified · Split

src/sox.c+15−15
@@ -128,8 +128,8 @@ static void sigint(int s); · 127 unmodified lines
128128 /* Array's tracking input and output files */
129129 static file_options_t *file_opts[MAX_FILES];
130130 static ft_t file_desc[MAX_FILES];
131−static int file_count = 0;
132−static int input_count = 0;
131+static size_t file_count = 0;
132+static size_t input_count = 0;
133133
134134 /* We parse effects into a temporary effects table and then place into
135135 * the real effects table. This makes it easier to reorder some effects
@@ -179,7 +179,7 @@ static void sox_output_message(int level, st_output_message_t m) · 43 unmodified lines
179179 int main(int argc, char **argv)
180180 {
181181 file_options_t *fo;
182− int i;
182+ size_t i;
183183
184184 myname = argv[0];
185185
@@ -202,8 +202,8 @@ int main(int argc, char **argv) · 16 unmodified lines
202202
203203 fo = (file_options_t *)calloc(sizeof(file_options_t), 1);
204204 fo->info.size = -1;
205− fo->info.encoding = -1;
206− fo->info.channels = -1;
205+ fo->info.encoding = ST_ENCODING_UNKNOWN;
206+ fo->info.channels = 0;
207207 fo->info.compression = HUGE_VAL;
208208 fo->volume = 1.0;
209209 file_opts[file_count++] = fo;
@@ -551,7 +551,7 @@ static int compare_input(ft_t ft1, ft_t ft2) · 341 unmodified lines
551551 return ST_SUCCESS;
552552 }
553553
554−void optimize_trim(void)
554+static void optimize_trim(void)
555555 {
556556 /* Speed hack. If the "trim" effect is the first effect then
557557 * peak inside its "effect descriptor" and see what the
@@ -585,9 +585,9 @@ void optimize_trim(void) · 27 unmodified lines
585585 */
586586
587587 static void process(void) {
588− int e, f, flowstatus = ST_SUCCESS;
589− int current_input;
590− st_size_t s;
588+ int e, flowstatus = ST_SUCCESS;
589+ size_t current_input;
590+ st_size_t s, f;
591591 st_ssize_t ilen[MAX_INPUT_FILES];
592592 st_sample_t *ibuf[MAX_INPUT_FILES];
593593
@@ -626,9 +626,9 @@ static void process(void) { · 32 unmodified lines
626626 options->info.rate = file_desc[0]->info.rate;
627627 if (options->info.size == -1)
628628 options->info.size = file_desc[0]->info.size;
629− if (options->info.encoding == -1)
629+ if (options->info.encoding == ST_ENCODING_UNKNOWN)
630630 options->info.encoding = file_desc[0]->info.encoding;
631− if (options->info.channels == -1)
631+ if (options->info.channels == 0)
632632 options->info.channels = file_desc[0]->info.channels;
633633
634634 if (options->comment != NULL)
@@ -1263,7 +1263,7 @@ static void reserve_effect_buf(void) · 628 unmodified lines
12631263 static int flow_effect_out(void)
12641264 {
12651265 int e, havedata, flowstatus = 0;
1266− int len, total;
1266+ size_t len, total;
12671267
12681268 do {
12691269 /* run entire chain BACKWARDS: pull, don't push.*/
@@ -1330,9 +1330,9 @@ static int flow_effect_out(void) · 60 unmodified lines
13301330
13311331 len = st_write(file_desc[file_count-1],
13321332 &efftab[neffects-1].obuf[total],
1333− (st_ssize_t)efftab[neffects-1].olen-total);
1333+ efftab[neffects-1].olen-total);
13341334
1335− if (len < 0 || file_desc[file_count-1]->file.eof)
1335+ if (len != efftab[neffects-1].olen-total || file_desc[file_count-1]->file.eof)
13361336 {
13371337 st_warn("Error writing: %s",
13381338 file_desc[file_count-1]->st_errstr);
@@ -1877,7 +1877,7 @@ static void usage_effect(char *effect) · 538 unmodified lines
18771877
18781878 void cleanup(void)
18791879 {
1880− int i;
1880+ size_t i;
18811881 struct stat st;
18821882 char *fn;
18831883

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