History

wav: improve error message for unsupported formats

Mans Rullgard committed 6 years ago

Commit 0da8e4c1 parent f1057621 file · +9 −6Browse files

Unified · Split

src/wav.c+9−6
@@ -626,11 +626,14 @@ static const struct wave_format *wav_find_format(unsigned tag) · 625 unmodified lines
626 return NULL;626 return NULL;
627}627}
628 628
629static int wavfail(sox_format_t *ft, int tag)629static int wavfail(sox_format_t *ft, int tag, const char *name)
630{630{
631 lsx_fail_errno(ft, SOX_EHDR,631 if (name)
632 "WAV file encoding '%s' (%04x) is not supported",632 lsx_fail_errno(ft, SOX_EHDR, "WAVE format '%s' (%04x) not supported",
633 wav_format_str(tag), tag);633 name, tag);
634 else
635 lsx_fail_errno(ft, SOX_EHDR, "Unknown WAVE format %04x", tag);
636
634 return SOX_EOF;637 return SOX_EOF;
635}638}
636 639
@@ -721,7 +724,7 @@ static int wav_read_fmt(sox_format_t *ft, uint32_t len) · 84 unmodified lines
721 724
722 fmt = wav_find_format(wav->formatTag);725 fmt = wav_find_format(wav->formatTag);
723 if (!fmt)726 if (!fmt)
724 return wavfail(ft, wav->formatTag);727 return wavfail(ft, wav->formatTag, NULL);
725 728
726 /* format handler might override */729 /* format handler might override */
727 ft->encoding.encoding = fmt->encoding;730 ft->encoding.encoding = fmt->encoding;
@@ -730,7 +733,7 @@ static int wav_read_fmt(sox_format_t *ft, uint32_t len) · 2 unmodified lines
730 if (fmt->read_fmt(ft, len))733 if (fmt->read_fmt(ft, len))
731 return SOX_EOF;734 return SOX_EOF;
732 } else if (!fmt->encoding) {735 } else if (!fmt->encoding) {
733 return wavfail(ft, wav->formatTag);736 return wavfail(ft, wav->formatTag, fmt->name);
734 }737 }
735 738
736 /* User options take precedence */739 /* User options take precedence */

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