ref: 69778917e402941035a4fdb9fdfb6b2bb71bac11
parent: e0e9c9962ab93d08f9f7f5ddee482e77fb44e8fe
author: cbagwell <cbagwell>
date: Sun Feb 19 14:26:59 EST 2006
Fix for file extension parser on output filenames.
--- a/Changelog
+++ b/Changelog
@@ -14,6 +14,7 @@
bugs and stuck in infinite loop.
o Stop SoX from crashing when file type could not be auto
determined (bug 1417776).
+ o Output filenames with multiple '.' confused SoX. (Christian Hammers)
sox-12.17.9
-----------
--- a/src/stio.c
+++ b/src/stio.c
@@ -191,12 +191,9 @@
/* Use filename extension to determine audio type. */
chop = ft->filename + len;
- while (chop > ft->filename && *chop != LASTCHAR)
+ while (chop > ft->filename && *chop != LASTCHAR && *chop != '.')
chop--;
- while (chop < ft->filename+len && *chop != '.')
- chop++;
-
if (*chop == '.')
{
chop++;
@@ -206,10 +203,13 @@
else
ft->filetype = strdup(filetype);
- if (!ft->filename || !ft->filetype)
+ if (!ft->filename)
+ {
+ st_warn("Unknown output file format for 'NULL'.");
goto output_error;
+ }
- if (st_gettype(ft) != ST_SUCCESS)
+ if (!ft->filetype || st_gettype(ft) != ST_SUCCESS)
{
st_warn("Unknown output file format for '%s': %s",
ft->filename,