summaryrefslogtreecommitdiffstats
path: root/m_option.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-03-10 01:46:46 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-03-10 01:50:55 +0200
commite74708f6194ef0af2bdf37e857ed232027fa46ba (patch)
treef7b53476abeb1cc8ccbe1c49113e9722c51b7800 /m_option.c
parent2ad00b5319603b22f9b0858bb14d016f673157cb (diff)
parentcb8796857c8bd851e3b97d729af149e3f003b851 (diff)
downloadmpv-e74708f6194ef0af2bdf37e857ed232027fa46ba.tar.bz2
mpv-e74708f6194ef0af2bdf37e857ed232027fa46ba.tar.xz
Merge svn changes up to r30748
Diffstat (limited to 'm_option.c')
-rw-r--r--m_option.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/m_option.c b/m_option.c
index 0b11e67e5d..b37a94966d 100644
--- a/m_option.c
+++ b/m_option.c
@@ -57,7 +57,7 @@ const m_option_t* m_option_list_find(const m_option_t* list,const char* name) {
// Default function that just does a memcpy
-static void copy_opt(const m_option_t* opt,void* dst,void* src) {
+static void copy_opt(const m_option_t* opt,void* dst,const void* src) {
if(dst && src)
memcpy(dst,src,opt->type->size);
}
@@ -93,7 +93,7 @@ static char* dup_printf(const char *fmt, ...) {
#define VAL(x) (*(int*)(x))
-static int parse_flag(const m_option_t* opt,const char *name, char *param, void* dst, int src) {
+static int parse_flag(const m_option_t* opt,const char *name, const char *param, void* dst, int src) {
if (src == M_CONFIG_FILE) {
if(!param) return M_OPT_MISSING_PARAM;
if (!strcasecmp(param, "yes") || /* any other language? */
@@ -153,7 +153,7 @@ 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) {
+static int parse_int(const m_option_t* opt,const char *name, const char *param, void* dst, int src) {
long long tmp_int;
char *endptr;
src = 0;
@@ -226,7 +226,7 @@ const m_option_type_t m_option_type_int64 = {
#undef VAL
#define VAL(x) (*(double*)(x))
-static int parse_double(const m_option_t* opt,const char *name, char *param, void* dst, int src) {
+static int parse_double(const m_option_t* opt,const char *name, const char *param, void* dst, int src) {
double tmp_float;
char* endptr;
src = 0;
@@ -296,7 +296,7 @@ const m_option_type_t m_option_type_double = {
#undef VAL
#define VAL(x) (*(float*)(x))
-static int parse_float(const m_option_t* opt,const char *name, char *param, void* dst, int src) {
+static int parse_float(const m_option_t* opt,const char *name, const char *param, void* dst, int src) {
double tmp;
int r= parse_double(opt, name, param, &tmp, src);
if(r==1 && dst) VAL(dst) = tmp;
@@ -325,7 +325,7 @@ const m_option_type_t m_option_type_float = {
#undef VAL
#define VAL(x) (*(off_t*)(x))
-static int parse_position(const m_option_t* opt,const char *name, char *param, void* dst, int src) {
+static int parse_position(const m_option_t* opt,const char *name, const char *param, void* dst, int src) {
off_t tmp_off;
char dummy;
@@ -381,7 +381,7 @@ const m_option_type_t m_option_type_position = {
#undef VAL
#define VAL(x) (*(char**)(x))
-static int parse_str(const m_option_t* opt,const char *name, char *param, void* dst, int src) {
+static int parse_str(const m_option_t* opt,const char *name, const char *param, void* dst, int src) {
if (param == NULL)
@@ -413,7 +413,7 @@ static char* print_str(const m_option_t* opt, const void* val) {
return (val && VAL(val) && strlen(VAL(val)) > 0) ? strdup(VAL(val)) : NULL;
}
-static void copy_str(const m_option_t* opt,void* dst, void* src) {
+static void copy_str(const m_option_t* opt,void* dst, const void* src) {
if(dst && src) {
#ifndef NO_FREE
if(VAL(dst)) free(VAL(dst)); //FIXME!!!
@@ -561,10 +561,10 @@ static char *get_nextsep(char *ptr, char sep, int modify) {
return ptr;
}
-static int parse_str_list(const m_option_t* opt,const char *name, char *param, void* dst, int src) {
+static int parse_str_list(const m_option_t* opt,const char *name, const char *param, void* dst, int src) {
int n = 0,len = strlen(opt->name);
char *str;
- char *ptr = param, *last_ptr, **res;
+ char *ptr = (char *)param, *last_ptr, **res;
int op = OP_NONE;
if(opt->name[len-1] == '*' && ((int)strlen(name) > len - 1)) {
@@ -648,7 +648,7 @@ static int parse_str_list(const m_option_t* opt,const char *name, char *param, v
return 1;
}
-static void copy_str_list(const m_option_t* opt,void* dst, void* src) {
+static void copy_str_list(const m_option_t* opt,void* dst, const void* src) {
int n;
char **d,**s;
@@ -743,7 +743,7 @@ static void free_func_pf(void* src) {
}
// Parser for func_param and func_full
-static int parse_func_pf(const m_option_t* opt,const char *name, char *param, void* dst, int src) {
+static int parse_func_pf(const m_option_t* opt,const char *name, const char *param, void* dst, int src) {
m_func_save_t *s,*p;
if(!dst)
@@ -764,7 +764,7 @@ static int parse_func_pf(const m_option_t* opt,const char *name, char *param, vo
return 1;
}
-static void copy_func_pf(const m_option_t* opt,void* dst, void* src) {
+static void copy_func_pf(const m_option_t* opt,void* dst, const void* src) {
m_func_save_t *d = NULL, *s,* last = NULL;
if(!(dst && src)) return;
@@ -790,7 +790,7 @@ static void copy_func_pf(const m_option_t* opt,void* dst, void* src) {
/////////////////// Func_param
-static void set_func_param(const m_option_t* opt, void* dst, void* src) {
+static void set_func_param(const m_option_t* opt, void* dst, const void* src) {
m_func_save_t* s;
if(!src) return;
@@ -817,7 +817,7 @@ const m_option_type_t m_option_type_func_param = {
/////////////////// Func_full
-static void set_func_full(const m_option_t* opt, void* dst, void* src) {
+static void set_func_full(const m_option_t* opt, void* dst, const void* src) {
m_func_save_t* s;
if(!src) return;
@@ -846,11 +846,11 @@ const m_option_type_t m_option_type_func_full = {
#undef VAL
-static int parse_func(const m_option_t* opt,const char *name, char *param, void* dst, int src) {
+static int parse_func(const m_option_t* opt,const char *name, const char *param, void* dst, int src) {
return 0;
}
-static void set_func(const m_option_t* opt,void* dst, void* src) {
+static void set_func(const m_option_t* opt,void* dst, const void* src) {
((m_opt_func_t) opt->p)(opt);
}
@@ -869,7 +869,7 @@ const m_option_type_t m_option_type_func = {
/////////////////// Print
-static int parse_print(const m_option_t* opt,const char *name, char *param, void* dst, int src) {
+static int parse_print(const m_option_t* opt,const char *name, const char *param, void* dst, int src) {
if(opt->type == CONF_TYPE_PRINT_INDIRECT)
mp_msg(MSGT_CFGPARSER, MSGL_INFO, "%s", *(char **) opt->p);
else if(opt->type == CONF_TYPE_PRINT_FUNC)
@@ -926,7 +926,7 @@ const m_option_type_t m_option_type_print_func = {
#undef VAL
#define VAL(x) (*(char***)(x))
-static int parse_subconf(const m_option_t* opt,const char *name, char *param, void* dst, int src) {
+static int parse_subconf(const m_option_t* opt,const char *name, const char *param, void* dst, int src) {
char *subparam;
char *subopt;
int nr = 0,i,r;
@@ -1003,7 +1003,7 @@ static int parse_subconf(const m_option_t* opt,const char *name, char *param, vo
subparam[0] == 0 ? NULL : subparam,NULL,src);
if(r < 0) return r;
if(dst) {
- lst = (char**)realloc(lst,2 * (nr+2) * sizeof(char*));
+ lst = realloc(lst,2 * (nr+2) * sizeof(char*));
lst[2*nr] = strdup(subopt);
lst[2*nr+1] = subparam[0] == 0 ? NULL : strdup(subparam);
memset(&lst[2*(nr+1)],0,2*sizeof(char*));
@@ -1096,7 +1096,7 @@ static struct {
{ NULL, 0 }
};
-static int parse_imgfmt(const m_option_t* opt,const char *name, char *param, void* dst, int src) {
+static int parse_imgfmt(const m_option_t* opt,const char *name, const char *param, void* dst, int src) {
uint32_t fmt = 0;
int i;
@@ -1186,7 +1186,7 @@ static struct {
{ NULL, 0 }
};
-static int parse_afmt(const m_option_t* opt,const char *name, char *param, void* dst, int src) {
+static int parse_afmt(const m_option_t* opt,const char *name, const char *param, void* dst, int src) {
uint32_t fmt = 0;
int i;
@@ -1249,7 +1249,7 @@ static double parse_timestring(const char *str)
}
-static int parse_time(const m_option_t* opt,const char *name, char *param, void* dst, int src)
+static int parse_time(const m_option_t* opt,const char *name, const char *param, void* dst, int src)
{
double time;
@@ -1284,7 +1284,7 @@ const m_option_type_t m_option_type_time = {
// Time or size (-endpos)
-static int parse_time_size(const m_option_t* opt,const char *name, char *param, void* dst, int src) {
+static int parse_time_size(const m_option_t* opt,const char *name, const char *param, void* dst, int src) {
m_time_size_t ts;
char unit[4];
double end_at;
@@ -1515,7 +1515,7 @@ static int get_obj_params(const char* opt_name, const char* name,char* params,
}
static int parse_obj_params(const m_option_t* opt,const char *name,
- char *param, void* dst, int src) {
+ const char *param, void* dst, int src) {
char** opts;
int r;
m_obj_params_t* p = opt->priv;
@@ -1629,7 +1629,7 @@ static int parse_obj_settings(const char* opt,char* str,const m_obj_list_t* list
static void free_obj_settings_list(void* dst);
-static int obj_settings_list_del(const char *opt_name,char *param,void* dst, int src) {
+static int obj_settings_list_del(const char *opt_name,const char *param,void* dst, int src) {
char** str_list = NULL;
int r,i,idx_max = 0;
char* rem_id = "_removed_marker_";
@@ -1688,7 +1688,7 @@ static int obj_settings_list_del(const char *opt_name,char *param,void* dst, int
}
static int parse_obj_settings_list(const m_option_t* opt,const char *name,
- char *param, void* dst, int src) {
+ const char *param, void* dst, int src) {
int n = 0,r,len = strlen(opt->name);
char *str;
char *ptr, *last_ptr;
@@ -1841,7 +1841,7 @@ static void free_obj_settings_list(void* dst) {
VAL(dst) = NULL;
}
-static void copy_obj_settings_list(const m_option_t* opt,void* dst, void* src) {
+static void copy_obj_settings_list(const m_option_t* opt,void* dst, const void* src) {
m_obj_settings_t *d,*s;
int n;
@@ -1885,7 +1885,7 @@ const m_option_type_t m_option_type_obj_settings_list = {
static int parse_obj_presets(const m_option_t* opt,const char *name,
- char *param, void* dst, int src) {
+ const char *param, void* dst, int src) {
m_obj_presets_t* obj_p = (m_obj_presets_t*)opt->priv;
m_struct_t *in_desc,*out_desc;
int s,i;
@@ -1957,7 +1957,7 @@ const m_option_type_t m_option_type_obj_presets = {
};
static int parse_custom_url(const m_option_t* opt,const char *name,
- char *url, void* dst, int src) {
+ const char *url, void* dst, int src) {
int pos1, pos2, r, v6addr = 0;
char *ptr1=NULL, *ptr2=NULL, *ptr3=NULL, *ptr4=NULL;
m_struct_t* desc = opt->priv;