diff options
author | Grigori Goronzy <greg@blackbox> | 2010-01-03 14:54:02 +0100 |
---|---|---|
committer | Grigori Goronzy <greg@blackbox> | 2010-01-05 23:52:02 +0100 |
commit | 9826dd0f7cc53881de23fac317a7190e47f78401 (patch) | |
tree | c97999e1eafe6fdbc7747921ffc1c77d28561ab6 /libass/ass_utils.c | |
parent | 4f791cc8c8e2f0a5ab8bd8fbd1c85d007a17830e (diff) | |
download | libass-9826dd0f7cc53881de23fac317a7190e47f78401.tar.bz2 libass-9826dd0f7cc53881de23fac317a7190e47f78401.tar.xz |
Replace strtod with locale-independent strtod
strtod respects the locale and in some locales, the decimal separator is
not a point, leading to parsing errors in tags like \pos(23.4,5), which
are perfectly valid.
As there isn't a really portable way to use a particular locale just for
one call to strtod, reimplement it. The implementation was taken from
the 1.8 branch of Ruby.
Diffstat (limited to 'libass/ass_utils.c')
-rw-r--r-- | libass/ass_utils.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libass/ass_utils.c b/libass/ass_utils.c index 6ca78b8..59fdbdf 100644 --- a/libass/ass_utils.c +++ b/libass/ass_utils.c @@ -34,7 +34,7 @@ int mystrtoi(char **p, int *res) { double temp_res; char *start = *p; - temp_res = strtod(*p, p); + temp_res = ass_strtod(*p, p); *res = (int) (temp_res + (temp_res > 0 ? 0.5 : -0.5)); if (*p != start) return 1; @@ -46,7 +46,7 @@ int mystrtoll(char **p, long long *res) { double temp_res; char *start = *p; - temp_res = strtod(*p, p); + temp_res = ass_strtod(*p, p); *res = (int) (temp_res + (temp_res > 0 ? 0.5 : -0.5)); if (*p != start) return 1; @@ -67,7 +67,7 @@ int mystrtou32(char **p, int base, uint32_t *res) int mystrtod(char **p, double *res) { char *start = *p; - *res = strtod(*p, p); + *res = ass_strtod(*p, p); if (*p != start) return 1; else |