mirror of
https://github.com/claunia/flac.git
synced 2025-12-16 18:54:26 +00:00
fix bug with fractional seconds on some locales (SF#1858012: https://sourceforge.net/tracker2/?func=detail&aid=1858012&group_id=13478&atid=113478)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user