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 | d56ecb131c1664a9a0791df9af7fa2e003fc47db (patch) | |
tree | 1614079d7034f1549c0b4163d26d1e3eaeeeebe5 /libass/ass_utils.c | |
parent | e3da71a5b792bd7373d2452bfd14d87c2f78a0e0 (diff) | |
download | libass-d56ecb131c1664a9a0791df9af7fa2e003fc47db.tar.bz2 libass-d56ecb131c1664a9a0791df9af7fa2e003fc47db.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 d48685c..91b55eb 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; } |