Mercurial > mplayer.hg
changeset 30123:0f5f75b4a015
Simplify range-checking functions for subopt parsing.
author | reimar |
---|---|
date | Fri, 01 Jan 2010 13:23:16 +0000 |
parents | 1772a5171ac7 |
children | 248d9886d0b0 |
files | libao2/ao_alsa.c libvo/vo_jpeg.c libvo/vo_png.c subopt-helper.c |
diffstat | 4 files changed, 5 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/libao2/ao_alsa.c Fri Jan 01 13:18:49 2010 +0000 +++ b/libao2/ao_alsa.c Fri Jan 01 13:23:16 2010 +0000 @@ -265,9 +265,7 @@ static int str_maxlen(void *strp) { strarg_t *str = strp; - if (str->len > ALSA_DEVICE_SIZE) - return 0; - return 1; + return str->len <= ALSA_DEVICE_SIZE; } static int try_open_device(const char *device, int open_mode, int try_ac3)
--- a/libvo/vo_jpeg.c Fri Jan 01 13:18:49 2010 +0000 +++ b/libvo/vo_jpeg.c Fri Jan 01 13:23:16 2010 +0000 @@ -333,9 +333,7 @@ static int int_zero_hundred(void *valp) { int *val = valp; - if ( (*val >=0) && (*val<=100) ) - return 1; - return 0; + return *val >= 0 && *val <= 100; } static int preinit(const char *arg)
--- a/libvo/vo_png.c Fri Jan 01 13:18:49 2010 +0000 +++ b/libvo/vo_png.c Fri Jan 01 13:23:16 2010 +0000 @@ -286,9 +286,7 @@ static int int_zero_to_nine(void *value) { int *sh = value; - if ( (*sh < 0) || (*sh > 9) ) - return 0; - return 1; + return *sh >= 0 && *sh <= 9; } static const opt_t subopts[] = {
--- a/subopt-helper.c Fri Jan 01 13:18:49 2010 +0000 +++ b/subopt-helper.c Fri Jan 01 13:23:16 2010 +0000 @@ -303,17 +303,13 @@ int int_non_neg(void *iptr) { int *i = iptr; - if ( *i < 0 ) { return 0; } - - return 1; + return *i >= 0; } /** \brief Test if i is positive. */ int int_pos(void *iptr) { int *i = iptr; - if ( *i > 0 ) { return 1; } - - return 0; + return *i > 0; } /*** little helpers */