Skip to content

Commit

Permalink
Option print functions may not and do not modify value
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25257 b3059339-0415-0410-9bf9-f77b7e298cf2
  • Loading branch information
reimar committed Dec 2, 2007
1 parent 9870aa5 commit 2e18988
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions m_option.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ static int parse_flag(const m_option_t* opt,const char *name, char *param, void*
}
}

static char* print_flag(const m_option_t* opt, void* val) {
static char* print_flag(const m_option_t* opt, const void* val) {
if(VAL(val) == opt->min)
return strdup("no");
else
Expand Down Expand Up @@ -167,7 +167,7 @@ static int parse_int(const m_option_t* opt,const char *name, char *param, void*
return 1;
}

static char* print_int(const m_option_t* opt, void* val) {
static char* print_int(const m_option_t* opt, const void* val) {
opt = NULL;
return dup_printf("%d",VAL(val));
}
Expand Down Expand Up @@ -239,7 +239,7 @@ static int parse_double(const m_option_t* opt,const char *name, char *param, voi
return 1;
}

static char* print_double(const m_option_t* opt, void* val) {
static char* print_double(const m_option_t* opt, const void* val) {
opt = NULL;
return dup_printf("%f",VAL(val));
}
Expand Down Expand Up @@ -267,7 +267,7 @@ static int parse_float(const m_option_t* opt,const char *name, char *param, void
return r;
}

static char* print_float(const m_option_t* opt, void* val) {
static char* print_float(const m_option_t* opt, const void* val) {
opt = NULL;
return dup_printf("%f",VAL(val));
}
Expand Down Expand Up @@ -322,7 +322,7 @@ static int parse_position(const m_option_t* opt,const char *name, char *param, v
return 1;
}

static char* print_position(const m_option_t* opt, void* val) {
static char* print_position(const m_option_t* opt, const void* val) {
return dup_printf("%"PRId64,(int64_t)VAL(val));
}

Expand Down Expand Up @@ -373,7 +373,7 @@ static int parse_str(const m_option_t* opt,const char *name, char *param, void*

}

static char* print_str(const m_option_t* opt, void* val) {
static char* print_str(const m_option_t* opt, const void* val) {
return (val && VAL(val) && strlen(VAL(val)) > 0) ? strdup(VAL(val)) : NULL;
}

Expand Down Expand Up @@ -636,7 +636,7 @@ static void copy_str_list(const m_option_t* opt,void* dst, void* src) {
VAL(dst) = d;
}

static char* print_str_list(const m_option_t* opt, void* src) {
static char* print_str_list(const m_option_t* opt, const void* src) {
char **lst = NULL;
char *ret = NULL,*last = NULL;
int i;
Expand Down
4 changes: 2 additions & 2 deletions m_option.h
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ struct m_option_type {
* \return An allocated string containing the text value or (void*)-1
* on error.
*/
char* (*print)(const m_option_t* opt, void* val);
char* (*print)(const m_option_t* opt, const void* val);

/** \name
* These functions are called to save/set/restore the status of the
Expand Down Expand Up @@ -461,7 +461,7 @@ m_option_parse(const m_option_t* opt,const char *name, char *param, void* dst, i

/// Helper to print options, see \ref m_option_type::print.
inline static char*
m_option_print(const m_option_t* opt, void* val_ptr) {
m_option_print(const m_option_t* opt, const void* val_ptr) {
if(opt->type->print)
return opt->type->print(opt,val_ptr);
else
Expand Down

0 comments on commit 2e18988

Please sign in to comment.