summaryrefslogtreecommitdiffstats
path: root/m_option.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2009-03-07 01:04:41 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2009-03-07 01:04:41 +0200
commite0172b96e3b6cc6a8b62ee5a52f780941a43de8b (patch)
treef652f6d15740667d5434e526db3fd12a0573aa0f /m_option.c
parent0c6f667896620943ee6ae899d6e36c3da5c98c54 (diff)
parent7e253f01715811e0c4f5f5b54317b098f2cd59d9 (diff)
downloadmpv-e0172b96e3b6cc6a8b62ee5a52f780941a43de8b.tar.bz2
mpv-e0172b96e3b6cc6a8b62ee5a52f780941a43de8b.tar.xz
Merge svn changes up to r28862
Diffstat (limited to 'm_option.c')
-rw-r--r--m_option.c29
1 files changed, 24 insertions, 5 deletions
diff --git a/m_option.c b/m_option.c
index e3e338808c..39f8ddd4f8 100644
--- a/m_option.c
+++ b/m_option.c
@@ -137,16 +137,16 @@ const m_option_type_t m_option_type_flag = {
// Integer
static int parse_int(const m_option_t* opt,const char *name, char *param, void* dst, int src) {
- long tmp_int;
+ long long tmp_int;
char *endptr;
src = 0;
if (param == NULL)
return M_OPT_MISSING_PARAM;
- tmp_int = strtol(param, &endptr, 10);
+ tmp_int = strtoll(param, &endptr, 10);
if (*endptr)
- tmp_int = strtol(param, &endptr, 0);
+ tmp_int = strtoll(param, &endptr, 0);
if (*endptr) {
mp_msg(MSGT_CFGPARSER, MSGL_ERR, "The %s option must be an integer: %s\n",name, param);
return M_OPT_INVALID;
@@ -162,13 +162,19 @@ 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 +191,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