fix bug with fractional seconds on some locales (SF#1858012: https://sourceforge...
authorJosh Coalson <jcoalson@users.sourceforce.net>
Sat, 3 Jan 2009 01:49:01 +0000 (01:49 +0000)
committerJosh Coalson <jcoalson@users.sourceforce.net>
Sat, 3 Jan 2009 01:49:01 +0000 (01:49 +0000)
doc/html/changelog.html
src/flac/utils.c

index ea4ee13..30013f4 100644 (file)
@@ -86,6 +86,7 @@
                                        <li>Added a new options <span class="argument"><a href="documentation_tools_flac.html#flac_options_preserve_modtime">--preserve-modtime</a></span> and <span class="argument"><a href="documentation_tools_flac.html#flac_options_no_preserve_modtime">--no-preserve-modtime</a></span> to specify whether or not output files should copy the timestamp and permissions from their input files.  The default is <span class="argument"><a href="documentation_tools_flac.html#flac_options_preserve_modtime">--preserve-modtime</a></span> as in previous versions.  (<a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=1805428&amp;group_id=13478&amp;atid=363478">SF #1805428</a>).</li>
                                        <li>The <span class="argument"><a href="documentation_tools_flac.html#flac_options_sector_align">--sector-align</a></span> option of <span class="commandname">flac</span> has been deprecated and may not exist in future versions.  <a href="http://www.etree.org/shnutils/shntool/">shntool</a> provides similar functionality. (<a href="https://sourceforge.net/tracker/index.php?func=detail&amp;aid=1805946&amp;group_id=13478&amp;atid=363478">SF #1805946</a>)</li>
                                        <li>Fix bug where <span class="commandname">flac</span> was disallowing use of <span class="argument">--replay-gain</span> when encoding from stdin (<a href="https://sourceforge.net/tracker2/?func=detail&aid=1840124&group_id=13478&atid=113478">SF #1840124</a>).</li>
+                                       <li>Fix bug with fractional seconds on some locales (<a href="https://sourceforge.net/tracker2/?func=detail&aid=1858012&group_id=13478&atid=113478">SF #1858012</a>).</li>
                                </ul>
                        </li>
                        <li>
index 625716d..287f628 100644 (file)
@@ -55,7 +55,7 @@ static FLAC__bool local__parse_timecode_(const char *s, double *value)
 {
        double ret;
        unsigned i;
-       char c;
+       char c, *endptr;
 
        /* parse [0-9][0-9]*: */
        c = *s++;
@@ -74,12 +74,9 @@ static FLAC__bool local__parse_timecode_(const char *s, double *value)
        /* parse [0-9]*[.,]?[0-9]* i.e. a sign-less rational number (. or , OK for fractional seconds, to support different locales) */
        if(strspn(s, "1234567890.,") != strlen(s))
                return false;
-       {
-               const char *p = strpbrk(s, ".,");
-               if(p && 0 != strpbrk(++p, ".,"))
-                       return false;
-       }
-       ret += atof(s);
+       ret += strtod(s, &endptr);
+       if (endptr == s || *endptr)
+               return false;
 
        *value = ret;
        return true;