summaryrefslogtreecommitdiffstats
path: root/m_option.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-03-02 11:17:50 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-03-02 11:17:50 +0000
commit39bb720ef8418d1c0db87b773f5467b16b395d96 (patch)
tree21087f0a58d56d66219916388bb9a078d73b7557 /m_option.c
parentb9102d0b06e8f7cd9c0c4d762a09af3bdf292a19 (diff)
downloadmpv-39bb720ef8418d1c0db87b773f5467b16b395d96.tar.bz2
mpv-39bb720ef8418d1c0db87b773f5467b16b395d96.tar.xz
Add a 64 bit integer type to the suboption parser.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28794 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'm_option.c')
-rw-r--r--m_option.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/m_option.c b/m_option.c
index 80dc4c0e9c..71ad21651c 100644
--- a/m_option.c
+++ b/m_option.c
@@ -162,13 +162,20 @@ static int parse_int(const m_option_t* opt,const char *name, char *param, void*
return M_OPT_OUT_OF_RANGE;
}
- if(dst) VAL(dst) = tmp_int;
+ if(dst) {
+ if (opt->type->size == sizeof(int64_t))
+ *(int64_t *)dst = tmp_int;
+ else
+ VAL(dst) = tmp_int;
+ }
return 1;
}
static char* print_int(const m_option_t* opt, const void* val) {
opt = NULL;
+ if (opt->type->size == sizeof(int64_t))
+ return dup_printf("%"PRId64, *(const int64_t *)val);
return dup_printf("%d",VAL(val));
}
@@ -185,6 +192,19 @@ const m_option_type_t m_option_type_int = {
NULL
};
+const m_option_type_t m_option_type_int64 = {
+ "Integer64",
+ "",
+ sizeof(int64_t),
+ 0,
+ parse_int,
+ print_int,
+ copy_opt,
+ copy_opt,
+ NULL,
+ NULL
+};
+
// Float
#undef VAL