To support this change, turn on lots more compiler warnings, and fix all the warnings generated.
Showing the changes to src/raw.c (1 of 93 files). Show all
Unified · Split
| @@ -134,7 +134,7 @@ int st_rawstartwrite(ft_t ft) · 133 unmodified lines | |||
| 134 | return ST_SUCCESS; | 134 | return ST_SUCCESS; |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | void st_ub_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 137 | void st_ub_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED) |
| 138 | { | 138 | { |
| 139 | while (len) | 139 | while (len) |
| 140 | { | 140 | { |
| @@ -148,7 +148,7 @@ void st_ub_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char sw · 7 unmodified lines | |||
| 148 | } | 148 | } |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | void st_sb_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 151 | void st_sb_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED) |
| 152 | { | 152 | { |
| 153 | while (len) | 153 | while (len) |
| 154 | { | 154 | { |
| @@ -162,7 +162,7 @@ void st_sb_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char sw · 7 unmodified lines | |||
| 162 | } | 162 | } |
| 163 | } | 163 | } |
| 164 | 164 | ||
| 165 | void st_ulaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 165 | static void st_ulaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED) |
| 166 | { | 166 | { |
| 167 | while (len) | 167 | while (len) |
| 168 | { | 168 | { |
| @@ -176,7 +176,7 @@ void st_ulaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char · 7 unmodified lines | |||
| 176 | } | 176 | } |
| 177 | } | 177 | } |
| 178 | 178 | ||
| 179 | void st_alaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 179 | static void st_alaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED) |
| 180 | { | 180 | { |
| 181 | while (len) | 181 | while (len) |
| 182 | { | 182 | { |
| @@ -190,7 +190,7 @@ void st_alaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char · 7 unmodified lines | |||
| 190 | } | 190 | } |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | void st_inv_ulaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 193 | static void st_inv_ulaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED) |
| 194 | { | 194 | { |
| 195 | while (len) | 195 | while (len) |
| 196 | { | 196 | { |
| @@ -204,7 +204,7 @@ void st_inv_ulaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, c · 7 unmodified lines | |||
| 204 | } | 204 | } |
| 205 | } | 205 | } |
| 206 | 206 | ||
| 207 | void st_inv_alaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 207 | static void st_inv_alaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED) |
| 208 | { | 208 | { |
| 209 | while (len) | 209 | while (len) |
| 210 | { | 210 | { |
| @@ -219,7 +219,7 @@ void st_inv_alaw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, c · 8 unmodified lines | |||
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | 221 | ||
| 222 | void st_uw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 222 | void st_uw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount UNUSED) |
| 223 | { | 223 | { |
| 224 | while (len) | 224 | while (len) |
| 225 | { | 225 | { |
| @@ -235,7 +235,7 @@ void st_uw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char sw · 9 unmodified lines | |||
| 235 | } | 235 | } |
| 236 | } | 236 | } |
| 237 | 237 | ||
| 238 | void st_sw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 238 | void st_sw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount UNUSED) |
| 239 | { | 239 | { |
| 240 | while (len) | 240 | while (len) |
| 241 | { | 241 | { |
| @@ -266,12 +266,12 @@ static int24_t st_24_read_one(char const * * buffer, char swap) · 24 unmodified lines | |||
| 266 | datum >>= 8; | 266 | datum >>= 8; |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | return swap? st_swap24(datum) : datum; | 269 | return swap ? (int24_t)(st_swap24(datum)) : datum; |
| 270 | } | 270 | } |
| 271 | 271 | ||
| 272 | 272 | ||
| 273 | 273 | ||
| 274 | void st_u24_read_buf(st_sample_t * buf1, char const * buf2, st_size_t len, char const swap, st_size_t * clippedCount) | 274 | static void st_u24_read_buf(st_sample_t * buf1, char const * buf2, st_size_t len, char const swap, st_size_t * clippedCount UNUSED) |
| 275 | { | 275 | { |
| 276 | while (len--) | 276 | while (len--) |
| 277 | { | 277 | { |
| @@ -282,7 +282,7 @@ void st_u24_read_buf(st_sample_t * buf1, char const * buf2, st_size_t len, char · 4 unmodified lines | |||
| 282 | 282 | ||
| 283 | 283 | ||
| 284 | 284 | ||
| 285 | void st_s24_read_buf(st_sample_t * buf1, char const * buf2, st_size_t len, char const swap, st_size_t * clippedCount) | 285 | static void st_s24_read_buf(st_sample_t * buf1, char const * buf2, st_size_t len, char const swap, st_size_t * clippedCount UNUSED) |
| 286 | { | 286 | { |
| 287 | while (len--) | 287 | while (len--) |
| 288 | { | 288 | { |
| @@ -293,7 +293,7 @@ void st_s24_read_buf(st_sample_t * buf1, char const * buf2, st_size_t len, char · 4 unmodified lines | |||
| 293 | 293 | ||
| 294 | 294 | ||
| 295 | 295 | ||
| 296 | void st_udw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 296 | static void st_udw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount UNUSED) |
| 297 | { | 297 | { |
| 298 | while (len) | 298 | while (len) |
| 299 | { | 299 | { |
| @@ -309,7 +309,7 @@ void st_udw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char s · 9 unmodified lines | |||
| 309 | } | 309 | } |
| 310 | } | 310 | } |
| 311 | 311 | ||
| 312 | void st_dw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 312 | static void st_dw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount UNUSED) |
| 313 | { | 313 | { |
| 314 | while (len) | 314 | while (len) |
| 315 | { | 315 | { |
| @@ -325,7 +325,7 @@ void st_dw_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char sw · 9 unmodified lines | |||
| 325 | } | 325 | } |
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | void st_f32_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 328 | static void st_f32_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) |
| 329 | { | 329 | { |
| 330 | while (len) | 330 | while (len) |
| 331 | { | 331 | { |
| @@ -341,7 +341,7 @@ void st_f32_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char s · 9 unmodified lines | |||
| 341 | } | 341 | } |
| 342 | } | 342 | } |
| 343 | 343 | ||
| 344 | void st_f64_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 344 | static void st_f64_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char swap, st_size_t * clippedCount) |
| 345 | { | 345 | { |
| 346 | while (len) | 346 | while (len) |
| 347 | { | 347 | { |
| @@ -366,18 +366,12 @@ void st_f64_read_buf(st_sample_t *buf1, char const * buf2, st_size_t len, char s · 18 unmodified lines | |||
| 366 | * functions will cause a loss of data! Need to have sox implement | 366 | * functions will cause a loss of data! Need to have sox implement |
| 367 | * a consistent buffering protocol. | 367 | * a consistent buffering protocol. |
| 368 | */ | 368 | */ |
| 369 | st_ssize_t st_rawread(ft_t ft, st_sample_t *buf, st_size_t nsamp) | 369 | st_size_t st_rawread(ft_t ft, st_sample_t *buf, st_size_t nsamp) |
| 370 | { | 370 | { |
| 371 | st_size_t len, done = 0; | 371 | st_size_t len, done = 0; |
| 372 | void (*read_buf)(st_sample_t *, char const *, st_size_t, char, st_size_t *) = 0; | 372 | void (*read_buf)(st_sample_t *, char const *, st_size_t, char, st_size_t *) = 0; |
| 373 | size_t i; | 373 | size_t i; |
| 374 | 374 | ||
| 375 | if (nsamp < 0) | ||
| 376 | { | ||
| 377 | st_fail_errno(ft,ST_EINVAL,"st_rawread requires positive sizes"); | ||
| 378 | return ST_EOF; | ||
| 379 | } | ||
| 380 | |||
| 381 | switch(ft->info.size) { | 375 | switch(ft->info.size) { |
| 382 | case ST_SIZE_BYTE: | 376 | case ST_SIZE_BYTE: |
| 383 | switch(ft->info.encoding) | 377 | switch(ft->info.encoding) |
| @@ -527,7 +521,7 @@ int st_rawstopread(ft_t ft) · 143 unmodified lines | |||
| 527 | return ST_SUCCESS; | 521 | return ST_SUCCESS; |
| 528 | } | 522 | } |
| 529 | 523 | ||
| 530 | void st_ub_write_buf(char* buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 524 | void st_ub_write_buf(char* buf1, st_sample_t const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount) |
| 531 | { | 525 | { |
| 532 | while (len) | 526 | while (len) |
| 533 | { | 527 | { |
| @@ -536,7 +530,7 @@ void st_ub_write_buf(char* buf1, st_sample_t const * buf2, st_size_t len, char s · 2 unmodified lines | |||
| 536 | } | 530 | } |
| 537 | } | 531 | } |
| 538 | 532 | ||
| 539 | void st_sb_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 533 | void st_sb_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount) |
| 540 | { | 534 | { |
| 541 | while (len) | 535 | while (len) |
| 542 | { | 536 | { |
| @@ -545,8 +539,8 @@ void st_sb_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char s · 2 unmodified lines | |||
| 545 | } | 539 | } |
| 546 | } | 540 | } |
| 547 | 541 | ||
| 548 | void st_ulaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, | 542 | static void st_ulaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, |
| 549 | char swap, st_size_t * clippedCount) | 543 | char swap UNUSED, st_size_t * clippedCount) |
| 550 | { | 544 | { |
| 551 | while (len) | 545 | while (len) |
| 552 | { | 546 | { |
| @@ -555,8 +549,8 @@ void st_ulaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, · 2 unmodified lines | |||
| 555 | } | 549 | } |
| 556 | } | 550 | } |
| 557 | 551 | ||
| 558 | void st_alaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, | 552 | static void st_alaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, |
| 559 | char swap, st_size_t * clippedCount) | 553 | char swap UNUSED, st_size_t * clippedCount) |
| 560 | { | 554 | { |
| 561 | while (len) | 555 | while (len) |
| 562 | { | 556 | { |
| @@ -565,8 +559,8 @@ void st_alaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, · 2 unmodified lines | |||
| 565 | } | 559 | } |
| 566 | } | 560 | } |
| 567 | 561 | ||
| 568 | void st_inv_ulaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, | 562 | static void st_inv_ulaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, |
| 569 | char swap, st_size_t * clippedCount) | 563 | char swap UNUSED, st_size_t * clippedCount) |
| 570 | { | 564 | { |
| 571 | while (len) | 565 | while (len) |
| 572 | { | 566 | { |
| @@ -575,8 +569,8 @@ void st_inv_ulaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, · 2 unmodified lines | |||
| 575 | } | 569 | } |
| 576 | } | 570 | } |
| 577 | 571 | ||
| 578 | void st_inv_alaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, | 572 | static void st_inv_alaw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, |
| 579 | char swap, st_size_t * clippedCount) | 573 | char swap UNUSED, st_size_t * clippedCount) |
| 580 | { | 574 | { |
| 581 | while (len) | 575 | while (len) |
| 582 | { | 576 | { |
| @@ -639,7 +633,7 @@ static void st_24_write_one(char * * const buf1, int24_t datum, char const swap) · 56 unmodified lines | |||
| 639 | 633 | ||
| 640 | 634 | ||
| 641 | 635 | ||
| 642 | void st_u24_write_buf(char * buf1, st_sample_t const * buf2, st_size_t len, char const swap, st_size_t * clippedCount) | 636 | static void st_u24_write_buf(char * buf1, st_sample_t const * buf2, st_size_t len, char const swap, st_size_t * clippedCount) |
| 643 | { | 637 | { |
| 644 | while (len--) | 638 | while (len--) |
| 645 | { | 639 | { |
| @@ -650,7 +644,7 @@ void st_u24_write_buf(char * buf1, st_sample_t const * buf2, st_size_t len, char · 4 unmodified lines | |||
| 650 | 644 | ||
| 651 | 645 | ||
| 652 | 646 | ||
| 653 | void st_s24_write_buf(char * buf1, st_sample_t const * buf2, st_size_t len, char const swap, st_size_t * clippedCount) | 647 | static void st_s24_write_buf(char * buf1, st_sample_t const * buf2, st_size_t len, char const swap, st_size_t * clippedCount) |
| 654 | { | 648 | { |
| 655 | while (len--) | 649 | while (len--) |
| 656 | { | 650 | { |
| @@ -661,7 +655,7 @@ void st_s24_write_buf(char * buf1, st_sample_t const * buf2, st_size_t len, char · 4 unmodified lines | |||
| 661 | 655 | ||
| 662 | 656 | ||
| 663 | 657 | ||
| 664 | void st_udw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 658 | static void st_udw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount UNUSED) |
| 665 | { | 659 | { |
| 666 | while (len) | 660 | while (len) |
| 667 | { | 661 | { |
| @@ -677,7 +671,7 @@ void st_udw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char · 9 unmodified lines | |||
| 677 | } | 671 | } |
| 678 | } | 672 | } |
| 679 | 673 | ||
| 680 | void st_dw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 674 | static void st_dw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap UNUSED, st_size_t * clippedCount UNUSED) |
| 681 | { | 675 | { |
| 682 | while (len) | 676 | while (len) |
| 683 | { | 677 | { |
| @@ -693,7 +687,7 @@ void st_dw_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char s · 9 unmodified lines | |||
| 693 | } | 687 | } |
| 694 | } | 688 | } |
| 695 | 689 | ||
| 696 | void st_f32_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 690 | static void st_f32_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount) |
| 697 | { | 691 | { |
| 698 | while (len) | 692 | while (len) |
| 699 | { | 693 | { |
| @@ -709,7 +703,7 @@ void st_f32_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char · 9 unmodified lines | |||
| 709 | } | 703 | } |
| 710 | } | 704 | } |
| 711 | 705 | ||
| 712 | void st_f64_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount) | 706 | static void st_f64_write_buf(char *buf1, st_sample_t const * buf2, st_size_t len, char swap, st_size_t * clippedCount) |
| 713 | { | 707 | { |
| 714 | while (len) | 708 | while (len) |
| 715 | { | 709 | { |
| @@ -744,7 +738,7 @@ static void writeflush(ft_t ft) · 28 unmodified lines | |||
| 744 | * functions will cause a loss of data! Need to have sox implement | 738 | * functions will cause a loss of data! Need to have sox implement |
| 745 | * a consistent buffering protocol. | 739 | * a consistent buffering protocol. |
| 746 | */ | 740 | */ |
| 747 | st_ssize_t st_rawwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp) | 741 | st_size_t st_rawwrite(ft_t ft, const st_sample_t *buf, st_size_t nsamp) |
| 748 | { | 742 | { |
| 749 | st_size_t len, done = 0; | 743 | st_size_t len, done = 0; |
| 750 | void (*write_buf)(char *, st_sample_t const *, st_size_t, char, st_size_t *) = 0; | 744 | void (*write_buf)(char *, st_sample_t const *, st_size_t, char, st_size_t *) = 0; |
| @@ -873,7 +867,7 @@ int st_rawstopwrite(ft_t ft) · 122 unmodified lines | |||
| 873 | */ | 867 | */ |
| 874 | 868 | ||
| 875 | #define STARTREAD(NAME,SIZE,STYLE) \ | 869 | #define STARTREAD(NAME,SIZE,STYLE) \ |
| 876 | int NAME(ft_t ft) \ | 870 | static int NAME(ft_t ft) \ |
| 877 | { \ | 871 | { \ |
| 878 | ft->info.size = SIZE; \ | 872 | ft->info.size = SIZE; \ |
| 879 | ft->info.encoding = STYLE; \ | 873 | ft->info.encoding = STYLE; \ |
| @@ -882,7 +876,7 @@ int NAME(ft_t ft) \ · 2 unmodified lines | |||
| 882 | } | 876 | } |
| 883 | 877 | ||
| 884 | #define STARTWRITE(NAME,SIZE,STYLE)\ | 878 | #define STARTWRITE(NAME,SIZE,STYLE)\ |
| 885 | int NAME(ft_t ft) \ | 879 | static int NAME(ft_t ft) \ |
| 886 | { \ | 880 | { \ |
| 887 | ft->info.size = SIZE; \ | 881 | ft->info.size = SIZE; \ |
| 888 | ft->info.encoding = STYLE; \ | 882 | ft->info.encoding = STYLE; \ |
| @@ -930,7 +924,7 @@ void rawdefaults(ft_t ft) · 41 unmodified lines | |||
| 930 | { | 924 | { |
| 931 | if (ft->info.rate == 0) | 925 | if (ft->info.rate == 0) |
| 932 | ft->info.rate = 8000; | 926 | ft->info.rate = 8000; |
| 933 | if (ft->info.channels == -1) | 927 | if (ft->info.channels == 0) |
| 934 | ft->info.channels = 1; | 928 | ft->info.channels = 1; |
| 935 | } | 929 | } |
| 936 | 930 | ||