diff options
author | eugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-02-27 23:06:47 +0000 |
---|---|---|
committer | eugeni <eugeni@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2009-02-27 23:06:47 +0000 |
commit | 00d6bb12b9c499db81d2e2599fcbc63424d833d3 (patch) | |
tree | a0d51e565ff0ca3f6b2ac96712e1dce339552397 /libass/ass_utils.c | |
parent | a1f50bf3484c4dff9ee562a7d7ca206c4eda37fc (diff) | |
download | mpv-00d6bb12b9c499db81d2e2599fcbc63424d833d3.tar.bz2 mpv-00d6bb12b9c499db81d2e2599fcbc63424d833d3.tar.xz |
Support fractional arguments for some override tags.
Done by parsing all integers as doubles first and then converting them to the
nearest integer. Patch by Grigori G (greg chown ath cx).
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28752 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libass/ass_utils.c')
-rw-r--r-- | libass/ass_utils.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libass/ass_utils.c b/libass/ass_utils.c index d48685c631..91b55eb803 100644 --- a/libass/ass_utils.c +++ b/libass/ass_utils.c @@ -32,8 +32,21 @@ int mystrtoi(char** p, int base, int* res) { + // NOTE: base argument is ignored, but not used in libass anyway + double temp_res; char* start = *p; - *res = strtol(*p, p, base); + temp_res = strtod(*p, p); + *res = (int) (temp_res + 0.5); + if (*p != start) return 1; + else return 0; +} + +int mystrtoll(char** p, int base, long long* res) +{ + double temp_res; + char* start = *p; + temp_res = strtod(*p, p); + *res = (long long) (temp_res + 0.5); if (*p != start) return 1; else return 0; } |