mirror of
https://github.com/mpv-player/mpv
synced 2025-04-24 20:29:53 +00:00
Make more option-parsing related function arguments const.
Prerequisite for making stream_open filename const in a proper way. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30737 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
b99077dc4c
commit
42096a34d5
@ -37,10 +37,10 @@
|
|||||||
#define MAX_PROFILE_DEPTH 20
|
#define MAX_PROFILE_DEPTH 20
|
||||||
|
|
||||||
static int
|
static int
|
||||||
parse_profile(const m_option_t *opt, const char *name, char *param, void *dst, int src);
|
parse_profile(const m_option_t *opt, const char *name, const char *param, void *dst, int src);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_profile(const m_option_t *opt, void* dst, void* src);
|
set_profile(const m_option_t *opt, void* dst, const void* src);
|
||||||
|
|
||||||
static int
|
static int
|
||||||
show_profile(m_option_t *opt, char* name, char *param);
|
show_profile(m_option_t *opt, char* name, char *param);
|
||||||
@ -515,7 +515,7 @@ m_config_set_profile(m_config_t* config, m_profile_t* p) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
parse_profile(const m_option_t *opt, const char *name, char *param, void *dst, int src)
|
parse_profile(const m_option_t *opt, const char *name, const char *param, void *dst, int src)
|
||||||
{
|
{
|
||||||
m_config_t* config = opt->priv;
|
m_config_t* config = opt->priv;
|
||||||
char** list = NULL;
|
char** list = NULL;
|
||||||
@ -551,7 +551,7 @@ parse_profile(const m_option_t *opt, const char *name, char *param, void *dst, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
set_profile(const m_option_t *opt, void *dst, void *src) {
|
set_profile(const m_option_t *opt, void *dst, const void *src) {
|
||||||
m_config_t* config = opt->priv;
|
m_config_t* config = opt->priv;
|
||||||
m_profile_t* p;
|
m_profile_t* p;
|
||||||
char** list = NULL;
|
char** list = NULL;
|
||||||
|
58
m_option.c
58
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
|
// 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)
|
if(dst && src)
|
||||||
memcpy(dst,src,opt->type->size);
|
memcpy(dst,src,opt->type->size);
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ static char* dup_printf(const char *fmt, ...) {
|
|||||||
|
|
||||||
#define VAL(x) (*(int*)(x))
|
#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 (src == M_CONFIG_FILE) {
|
||||||
if(!param) return M_OPT_MISSING_PARAM;
|
if(!param) return M_OPT_MISSING_PARAM;
|
||||||
if (!strcasecmp(param, "yes") || /* any other language? */
|
if (!strcasecmp(param, "yes") || /* any other language? */
|
||||||
@ -153,7 +153,7 @@ const m_option_type_t m_option_type_flag = {
|
|||||||
|
|
||||||
// Integer
|
// 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;
|
long long tmp_int;
|
||||||
char *endptr;
|
char *endptr;
|
||||||
src = 0;
|
src = 0;
|
||||||
@ -226,7 +226,7 @@ const m_option_type_t m_option_type_int64 = {
|
|||||||
#undef VAL
|
#undef VAL
|
||||||
#define VAL(x) (*(double*)(x))
|
#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;
|
double tmp_float;
|
||||||
char* endptr;
|
char* endptr;
|
||||||
src = 0;
|
src = 0;
|
||||||
@ -296,7 +296,7 @@ const m_option_type_t m_option_type_double = {
|
|||||||
#undef VAL
|
#undef VAL
|
||||||
#define VAL(x) (*(float*)(x))
|
#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;
|
double tmp;
|
||||||
int r= parse_double(opt, name, param, &tmp, src);
|
int r= parse_double(opt, name, param, &tmp, src);
|
||||||
if(r==1 && dst) VAL(dst) = tmp;
|
if(r==1 && dst) VAL(dst) = tmp;
|
||||||
@ -325,7 +325,7 @@ const m_option_type_t m_option_type_float = {
|
|||||||
#undef VAL
|
#undef VAL
|
||||||
#define VAL(x) (*(off_t*)(x))
|
#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;
|
off_t tmp_off;
|
||||||
char dummy;
|
char dummy;
|
||||||
|
|
||||||
@ -381,7 +381,7 @@ const m_option_type_t m_option_type_position = {
|
|||||||
#undef VAL
|
#undef VAL
|
||||||
#define VAL(x) (*(char**)(x))
|
#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)
|
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;
|
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) {
|
if(dst && src) {
|
||||||
#ifndef NO_FREE
|
#ifndef NO_FREE
|
||||||
if(VAL(dst)) free(VAL(dst)); //FIXME!!!
|
if(VAL(dst)) free(VAL(dst)); //FIXME!!!
|
||||||
@ -561,10 +561,10 @@ static char *get_nextsep(char *ptr, char sep, int modify) {
|
|||||||
return ptr;
|
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);
|
int n = 0,len = strlen(opt->name);
|
||||||
char *str;
|
char *str;
|
||||||
char *ptr = param, *last_ptr, **res;
|
char *ptr = (char *)param, *last_ptr, **res;
|
||||||
int op = OP_NONE;
|
int op = OP_NONE;
|
||||||
|
|
||||||
if(opt->name[len-1] == '*' && ((int)strlen(name) > len - 1)) {
|
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;
|
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;
|
int n;
|
||||||
char **d,**s;
|
char **d,**s;
|
||||||
|
|
||||||
@ -743,7 +743,7 @@ static void free_func_pf(void* src) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parser for func_param and func_full
|
// 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;
|
m_func_save_t *s,*p;
|
||||||
|
|
||||||
if(!dst)
|
if(!dst)
|
||||||
@ -764,7 +764,7 @@ static int parse_func_pf(const m_option_t* opt,const char *name, char *param, vo
|
|||||||
return 1;
|
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;
|
m_func_save_t *d = NULL, *s,* last = NULL;
|
||||||
|
|
||||||
if(!(dst && src)) return;
|
if(!(dst && src)) return;
|
||||||
@ -790,7 +790,7 @@ static void copy_func_pf(const m_option_t* opt,void* dst, void* src) {
|
|||||||
|
|
||||||
/////////////////// Func_param
|
/////////////////// 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;
|
m_func_save_t* s;
|
||||||
|
|
||||||
if(!src) return;
|
if(!src) return;
|
||||||
@ -819,7 +819,7 @@ const m_option_type_t m_option_type_func_param = {
|
|||||||
|
|
||||||
/////////////////// Func_full
|
/////////////////// 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;
|
m_func_save_t* s;
|
||||||
|
|
||||||
if(!src) return;
|
if(!src) return;
|
||||||
@ -849,13 +849,13 @@ const m_option_type_t m_option_type_func_full = {
|
|||||||
#undef VAL
|
#undef VAL
|
||||||
#define VAL(x) (*(int*)(x))
|
#define VAL(x) (*(int*)(x))
|
||||||
|
|
||||||
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) {
|
||||||
if(dst)
|
if(dst)
|
||||||
VAL(dst) += 1;
|
VAL(dst) += 1;
|
||||||
return 0;
|
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) {
|
||||||
int i;
|
int i;
|
||||||
if(opt->priv) ((m_opt_default_func_t)opt->priv)(opt,opt->name);
|
if(opt->priv) ((m_opt_default_func_t)opt->priv)(opt,opt->name);
|
||||||
for(i = 0 ; i < VAL(src) ; i++)
|
for(i = 0 ; i < VAL(src) ; i++)
|
||||||
@ -877,7 +877,7 @@ const m_option_type_t m_option_type_func = {
|
|||||||
|
|
||||||
/////////////////// Print
|
/////////////////// 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)
|
if(opt->type == CONF_TYPE_PRINT_INDIRECT)
|
||||||
mp_msg(MSGT_CFGPARSER, MSGL_INFO, "%s", *(char **) opt->p);
|
mp_msg(MSGT_CFGPARSER, MSGL_INFO, "%s", *(char **) opt->p);
|
||||||
else if(opt->type == CONF_TYPE_PRINT_FUNC)
|
else if(opt->type == CONF_TYPE_PRINT_FUNC)
|
||||||
@ -934,7 +934,7 @@ const m_option_type_t m_option_type_print_func = {
|
|||||||
#undef VAL
|
#undef VAL
|
||||||
#define VAL(x) (*(char***)(x))
|
#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 *subparam;
|
||||||
char *subopt;
|
char *subopt;
|
||||||
int nr = 0,i,r;
|
int nr = 0,i,r;
|
||||||
@ -1104,7 +1104,7 @@ static struct {
|
|||||||
{ NULL, 0 }
|
{ 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;
|
uint32_t fmt = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -1194,7 +1194,7 @@ static struct {
|
|||||||
{ NULL, 0 }
|
{ 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;
|
uint32_t fmt = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -1257,7 +1257,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;
|
double time;
|
||||||
|
|
||||||
@ -1292,7 +1292,7 @@ const m_option_type_t m_option_type_time = {
|
|||||||
|
|
||||||
// Time or size (-endpos)
|
// 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;
|
m_time_size_t ts;
|
||||||
char unit[4];
|
char unit[4];
|
||||||
double end_at;
|
double end_at;
|
||||||
@ -1523,7 +1523,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,
|
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;
|
char** opts;
|
||||||
int r;
|
int r;
|
||||||
m_obj_params_t* p = opt->priv;
|
m_obj_params_t* p = opt->priv;
|
||||||
@ -1637,7 +1637,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 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;
|
char** str_list = NULL;
|
||||||
int r,i,idx_max = 0;
|
int r,i,idx_max = 0;
|
||||||
char* rem_id = "_removed_marker_";
|
char* rem_id = "_removed_marker_";
|
||||||
@ -1696,7 +1696,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,
|
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);
|
int n = 0,r,len = strlen(opt->name);
|
||||||
char *str;
|
char *str;
|
||||||
char *ptr, *last_ptr;
|
char *ptr, *last_ptr;
|
||||||
@ -1849,7 +1849,7 @@ static void free_obj_settings_list(void* dst) {
|
|||||||
VAL(dst) = NULL;
|
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;
|
m_obj_settings_t *d,*s;
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
@ -1893,7 +1893,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,
|
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_obj_presets_t* obj_p = (m_obj_presets_t*)opt->priv;
|
||||||
m_struct_t *in_desc,*out_desc;
|
m_struct_t *in_desc,*out_desc;
|
||||||
int s,i;
|
int s,i;
|
||||||
@ -1965,7 +1965,7 @@ const m_option_type_t m_option_type_obj_presets = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int parse_custom_url(const m_option_t* opt,const char *name,
|
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;
|
int pos1, pos2, r, v6addr = 0;
|
||||||
char *ptr1=NULL, *ptr2=NULL, *ptr3=NULL, *ptr4=NULL;
|
char *ptr1=NULL, *ptr2=NULL, *ptr3=NULL, *ptr4=NULL;
|
||||||
m_struct_t* desc = opt->priv;
|
m_struct_t* desc = opt->priv;
|
||||||
|
22
m_option.h
22
m_option.h
@ -68,7 +68,7 @@ extern const m_option_type_t m_option_type_func;
|
|||||||
typedef void (*m_opt_default_func_t)(const m_option_t *, const char*);
|
typedef void (*m_opt_default_func_t)(const m_option_t *, const char*);
|
||||||
|
|
||||||
/// Callback used by m_option_type_func_full options.
|
/// Callback used by m_option_type_func_full options.
|
||||||
typedef int (*m_opt_func_full_t)(const m_option_t *, const char *, char *);
|
typedef int (*m_opt_func_full_t)(const m_option_t *, const char *, const char *);
|
||||||
|
|
||||||
/// Callback used by m_option_type_func_param options.
|
/// Callback used by m_option_type_func_param options.
|
||||||
typedef int (*m_opt_func_param_t)(const m_option_t *, const char *);
|
typedef int (*m_opt_func_param_t)(const m_option_t *, const char *);
|
||||||
@ -198,9 +198,9 @@ extern const m_obj_params_t m_span_params_def;
|
|||||||
|
|
||||||
/// Option type description
|
/// Option type description
|
||||||
struct m_option_type {
|
struct m_option_type {
|
||||||
char* name;
|
const char* name;
|
||||||
/// Syntax description, etc
|
/// Syntax description, etc
|
||||||
char* comments;
|
const char* comments;
|
||||||
/// Size needed for the data.
|
/// Size needed for the data.
|
||||||
unsigned int size;
|
unsigned int size;
|
||||||
/// See \ref OptionTypeFlags.
|
/// See \ref OptionTypeFlags.
|
||||||
@ -218,7 +218,7 @@ struct m_option_type {
|
|||||||
* \return On error a negative value is returned, on success the number of arguments
|
* \return On error a negative value is returned, on success the number of arguments
|
||||||
* consumed. For details see \ref OptionParserReturn.
|
* consumed. For details see \ref OptionParserReturn.
|
||||||
*/
|
*/
|
||||||
int (*parse)(const m_option_t* opt,const char *name, char *param, void* dst, int src);
|
int (*parse)(const m_option_t* opt,const char *name, const char *param, void* dst, int src);
|
||||||
|
|
||||||
/// Print back a value in string form.
|
/// Print back a value in string form.
|
||||||
/** \param opt The option to print.
|
/** \param opt The option to print.
|
||||||
@ -241,21 +241,21 @@ struct m_option_type {
|
|||||||
* \param dst Pointer to the destination memory.
|
* \param dst Pointer to the destination memory.
|
||||||
* \param src Pointer to the source memory.
|
* \param src Pointer to the source memory.
|
||||||
*/
|
*/
|
||||||
void (*save)(const m_option_t* opt,void* dst, void* src);
|
void (*save)(const m_option_t* opt,void* dst, const void* src);
|
||||||
|
|
||||||
/// Set the value in the program (dst) from a save slot.
|
/// Set the value in the program (dst) from a save slot.
|
||||||
/** \param opt The option to copy.
|
/** \param opt The option to copy.
|
||||||
* \param dst Pointer to the destination memory.
|
* \param dst Pointer to the destination memory.
|
||||||
* \param src Pointer to the source memory.
|
* \param src Pointer to the source memory.
|
||||||
*/
|
*/
|
||||||
void (*set)(const m_option_t* opt,void* dst, void* src);
|
void (*set)(const m_option_t* opt,void* dst, const void* src);
|
||||||
|
|
||||||
/// Copy the data between two save slots. If NULL and size is > 0 a memcpy will be used.
|
/// Copy the data between two save slots. If NULL and size is > 0 a memcpy will be used.
|
||||||
/** \param opt The option to copy.
|
/** \param opt The option to copy.
|
||||||
* \param dst Pointer to the destination memory.
|
* \param dst Pointer to the destination memory.
|
||||||
* \param src Pointer to the source memory.
|
* \param src Pointer to the source memory.
|
||||||
*/
|
*/
|
||||||
void (*copy)(const m_option_t* opt,void* dst, void* src);
|
void (*copy)(const m_option_t* opt,void* dst, const void* src);
|
||||||
//@}
|
//@}
|
||||||
|
|
||||||
/// Free the data allocated for a save slot.
|
/// Free the data allocated for a save slot.
|
||||||
@ -483,7 +483,7 @@ const m_option_t* m_option_list_find(const m_option_t* list,const char* name);
|
|||||||
|
|
||||||
/// Helper to parse options, see \ref m_option_type::parse.
|
/// Helper to parse options, see \ref m_option_type::parse.
|
||||||
inline static int
|
inline static int
|
||||||
m_option_parse(const m_option_t* opt,const char *name, char *param, void* dst, int src) {
|
m_option_parse(const m_option_t* opt,const char *name, const char *param, void* dst, int src) {
|
||||||
return opt->type->parse(opt,name,param,dst,src);
|
return opt->type->parse(opt,name,param,dst,src);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -498,21 +498,21 @@ m_option_print(const m_option_t* opt, const void* val_ptr) {
|
|||||||
|
|
||||||
/// Helper around \ref m_option_type::save.
|
/// Helper around \ref m_option_type::save.
|
||||||
inline static void
|
inline static void
|
||||||
m_option_save(const m_option_t* opt,void* dst, void* src) {
|
m_option_save(const m_option_t* opt,void* dst, const void* src) {
|
||||||
if(opt->type->save)
|
if(opt->type->save)
|
||||||
opt->type->save(opt,dst,src);
|
opt->type->save(opt,dst,src);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper around \ref m_option_type::set.
|
/// Helper around \ref m_option_type::set.
|
||||||
inline static void
|
inline static void
|
||||||
m_option_set(const m_option_t* opt,void* dst, void* src) {
|
m_option_set(const m_option_t* opt,void* dst, const void* src) {
|
||||||
if(opt->type->set)
|
if(opt->type->set)
|
||||||
opt->type->set(opt,dst,src);
|
opt->type->set(opt,dst,src);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper around \ref m_option_type::copy.
|
/// Helper around \ref m_option_type::copy.
|
||||||
inline static void
|
inline static void
|
||||||
m_option_copy(const m_option_t* opt,void* dst, void* src) {
|
m_option_copy(const m_option_t* opt,void* dst, const void* src) {
|
||||||
if(opt->type->copy)
|
if(opt->type->copy)
|
||||||
opt->type->copy(opt,dst,src);
|
opt->type->copy(opt,dst,src);
|
||||||
else if(opt->type->size > 0)
|
else if(opt->type->size > 0)
|
||||||
|
@ -68,7 +68,7 @@ m_struct_alloc(const m_struct_t* st) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
m_struct_set(const m_struct_t* st, void* obj, char* field, char* param) {
|
m_struct_set(const m_struct_t* st, void* obj, const char* field, const char* param) {
|
||||||
const m_option_t* f = m_struct_get_field(st,field);
|
const m_option_t* f = m_struct_get_field(st,field);
|
||||||
|
|
||||||
if(!f) {
|
if(!f) {
|
||||||
|
@ -88,7 +88,7 @@ m_struct_alloc(const m_struct_t* st);
|
|||||||
* \return 0 on error, 1 on success.
|
* \return 0 on error, 1 on success.
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
m_struct_set(const m_struct_t* st, void* obj, char* field, char* param);
|
m_struct_set(const m_struct_t* st, void* obj, const char* field, const char* param);
|
||||||
|
|
||||||
/// Reset a field (or all if field == NULL) to defaults.
|
/// Reset a field (or all if field == NULL) to defaults.
|
||||||
/** \param st Struct definition.
|
/** \param st Struct definition.
|
||||||
|
Loading…
Reference in New Issue
Block a user