Mercurial > mplayer.hg
comparison m_option.c @ 25229:4f611a555224
Option print functions may not and do not modify value
author | reimar |
---|---|
date | Sun, 02 Dec 2007 15:56:38 +0000 |
parents | cc170348a763 |
children | 52f6429a9ba7 |
comparison
equal
deleted
inserted
replaced
25228:475c6659f31c | 25229:4f611a555224 |
---|---|
112 if(dst) VAL(dst) = opt->max; | 112 if(dst) VAL(dst) = opt->max; |
113 return 0; | 113 return 0; |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 static char* print_flag(const m_option_t* opt, void* val) { | 117 static char* print_flag(const m_option_t* opt, const void* val) { |
118 if(VAL(val) == opt->min) | 118 if(VAL(val) == opt->min) |
119 return strdup("no"); | 119 return strdup("no"); |
120 else | 120 else |
121 return strdup("yes"); | 121 return strdup("yes"); |
122 } | 122 } |
165 if(dst) VAL(dst) = tmp_int; | 165 if(dst) VAL(dst) = tmp_int; |
166 | 166 |
167 return 1; | 167 return 1; |
168 } | 168 } |
169 | 169 |
170 static char* print_int(const m_option_t* opt, void* val) { | 170 static char* print_int(const m_option_t* opt, const void* val) { |
171 opt = NULL; | 171 opt = NULL; |
172 return dup_printf("%d",VAL(val)); | 172 return dup_printf("%d",VAL(val)); |
173 } | 173 } |
174 | 174 |
175 const m_option_type_t m_option_type_int = { | 175 const m_option_type_t m_option_type_int = { |
237 | 237 |
238 if(dst) VAL(dst) = tmp_float; | 238 if(dst) VAL(dst) = tmp_float; |
239 return 1; | 239 return 1; |
240 } | 240 } |
241 | 241 |
242 static char* print_double(const m_option_t* opt, void* val) { | 242 static char* print_double(const m_option_t* opt, const void* val) { |
243 opt = NULL; | 243 opt = NULL; |
244 return dup_printf("%f",VAL(val)); | 244 return dup_printf("%f",VAL(val)); |
245 } | 245 } |
246 | 246 |
247 const m_option_type_t m_option_type_double = { | 247 const m_option_type_t m_option_type_double = { |
265 int r= parse_double(opt, name, param, &tmp, src); | 265 int r= parse_double(opt, name, param, &tmp, src); |
266 if(r==1 && dst) VAL(dst) = tmp; | 266 if(r==1 && dst) VAL(dst) = tmp; |
267 return r; | 267 return r; |
268 } | 268 } |
269 | 269 |
270 static char* print_float(const m_option_t* opt, void* val) { | 270 static char* print_float(const m_option_t* opt, const void* val) { |
271 opt = NULL; | 271 opt = NULL; |
272 return dup_printf("%f",VAL(val)); | 272 return dup_printf("%f",VAL(val)); |
273 } | 273 } |
274 | 274 |
275 const m_option_type_t m_option_type_float = { | 275 const m_option_type_t m_option_type_float = { |
320 if(dst) | 320 if(dst) |
321 VAL(dst) = tmp_off; | 321 VAL(dst) = tmp_off; |
322 return 1; | 322 return 1; |
323 } | 323 } |
324 | 324 |
325 static char* print_position(const m_option_t* opt, void* val) { | 325 static char* print_position(const m_option_t* opt, const void* val) { |
326 return dup_printf("%"PRId64,(int64_t)VAL(val)); | 326 return dup_printf("%"PRId64,(int64_t)VAL(val)); |
327 } | 327 } |
328 | 328 |
329 const m_option_type_t m_option_type_position = { | 329 const m_option_type_t m_option_type_position = { |
330 "Position", | 330 "Position", |
371 | 371 |
372 return 1; | 372 return 1; |
373 | 373 |
374 } | 374 } |
375 | 375 |
376 static char* print_str(const m_option_t* opt, void* val) { | 376 static char* print_str(const m_option_t* opt, const void* val) { |
377 return (val && VAL(val) && strlen(VAL(val)) > 0) ? strdup(VAL(val)) : NULL; | 377 return (val && VAL(val) && strlen(VAL(val)) > 0) ? strdup(VAL(val)) : NULL; |
378 } | 378 } |
379 | 379 |
380 static void copy_str(const m_option_t* opt,void* dst, void* src) { | 380 static void copy_str(const m_option_t* opt,void* dst, void* src) { |
381 if(dst && src) { | 381 if(dst && src) { |
634 d[n] = s[n] ? strdup(s[n]) : NULL; | 634 d[n] = s[n] ? strdup(s[n]) : NULL; |
635 | 635 |
636 VAL(dst) = d; | 636 VAL(dst) = d; |
637 } | 637 } |
638 | 638 |
639 static char* print_str_list(const m_option_t* opt, void* src) { | 639 static char* print_str_list(const m_option_t* opt, const void* src) { |
640 char **lst = NULL; | 640 char **lst = NULL; |
641 char *ret = NULL,*last = NULL; | 641 char *ret = NULL,*last = NULL; |
642 int i; | 642 int i; |
643 | 643 |
644 if(!(src && VAL(src))) return NULL; | 644 if(!(src && VAL(src))) return NULL; |