Mercurial > mplayer.hg
comparison m_option.c @ 36582:b28f3ff37ae7
Use av_unused for unused arguments instead of various hacks.
author | reimar |
---|---|
date | Mon, 20 Jan 2014 22:08:48 +0000 |
parents | 4e3c56728d1e |
children | d339a982071d |
comparison
equal
deleted
inserted
replaced
36581:292a9e879fd0 | 36582:b28f3ff37ae7 |
---|---|
34 //#include "m_config.h" | 34 //#include "m_config.h" |
35 #include "mp_msg.h" | 35 #include "mp_msg.h" |
36 #include "mp_global.h" | 36 #include "mp_global.h" |
37 #include "stream/url.h" | 37 #include "stream/url.h" |
38 #include "libavutil/avstring.h" | 38 #include "libavutil/avstring.h" |
39 #include "libavutil/attributes.h" | |
39 | 40 |
40 // Don't free for 'production' atm | 41 // Don't free for 'production' atm |
41 #ifndef MP_DEBUG | 42 #ifndef MP_DEBUG |
42 //#define NO_FREE | 43 //#define NO_FREE |
43 #endif | 44 #endif |
153 NULL | 154 NULL |
154 }; | 155 }; |
155 | 156 |
156 // Integer | 157 // Integer |
157 | 158 |
158 static int parse_int(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { | 159 static int parse_int(const m_option_t* opt,const char *name, const char *param, void* dst, int av_unused src) { |
159 long long tmp_int; | 160 long long tmp_int; |
160 char *endptr; | 161 char *endptr; |
161 src = 0; | |
162 | 162 |
163 if (param == NULL) | 163 if (param == NULL) |
164 return M_OPT_MISSING_PARAM; | 164 return M_OPT_MISSING_PARAM; |
165 | 165 |
166 tmp_int = strtoll(param, &endptr, 10); | 166 tmp_int = strtoll(param, &endptr, 10); |
226 // Float | 226 // Float |
227 | 227 |
228 #undef VAL | 228 #undef VAL |
229 #define VAL(x) (*(double*)(x)) | 229 #define VAL(x) (*(double*)(x)) |
230 | 230 |
231 static int parse_double(const m_option_t* opt,const char *name, const char *param, void* dst, int src) { | 231 static int parse_double(const m_option_t* opt,const char *name, const char *param, void* dst, int av_unused src) { |
232 double tmp_float; | 232 double tmp_float; |
233 char* endptr; | 233 char* endptr; |
234 src = 0; | |
235 | 234 |
236 if (param == NULL) | 235 if (param == NULL) |
237 return M_OPT_MISSING_PARAM; | 236 return M_OPT_MISSING_PARAM; |
238 | 237 |
239 tmp_float = strtod(param, &endptr); | 238 tmp_float = strtod(param, &endptr); |
275 | 274 |
276 if(dst) VAL(dst) = tmp_float; | 275 if(dst) VAL(dst) = tmp_float; |
277 return 1; | 276 return 1; |
278 } | 277 } |
279 | 278 |
280 static char* print_double(const m_option_t* opt, const void* val) { | 279 static char* print_double(const m_option_t* av_unused opt, const void* val) { |
281 opt = NULL; | |
282 return dup_printf("%f",VAL(val)); | 280 return dup_printf("%f",VAL(val)); |
283 } | 281 } |
284 | 282 |
285 const m_option_type_t m_option_type_double = { | 283 const m_option_type_t m_option_type_double = { |
286 "Double", | 284 "Double", |
303 int r= parse_double(opt, name, param, &tmp, src); | 301 int r= parse_double(opt, name, param, &tmp, src); |
304 if(r==1 && dst) VAL(dst) = tmp; | 302 if(r==1 && dst) VAL(dst) = tmp; |
305 return r; | 303 return r; |
306 } | 304 } |
307 | 305 |
308 static char* print_float(const m_option_t* opt, const void* val) { | 306 static char* print_float(const m_option_t* av_unused opt, const void* val) { |
309 opt = NULL; | |
310 return dup_printf("%f",VAL(val)); | 307 return dup_printf("%f",VAL(val)); |
311 } | 308 } |
312 | 309 |
313 const m_option_type_t m_option_type_float = { | 310 const m_option_type_t m_option_type_float = { |
314 "Float", | 311 "Float", |