[MPlayer-cvslog] r30165 - in trunk: libao2/ao_alsa.c libvo/vo_jpeg.c libvo/vo_png.c subopt-helper.c
reimar
subversion at mplayerhq.hu
Fri Jan 1 14:23:17 CET 2010
Author: reimar
Date: Fri Jan 1 14:23:16 2010
New Revision: 30165
Log:
Simplify range-checking functions for subopt parsing.
Modified:
trunk/libao2/ao_alsa.c
trunk/libvo/vo_jpeg.c
trunk/libvo/vo_png.c
trunk/subopt-helper.c
Modified: trunk/libao2/ao_alsa.c
==============================================================================
--- trunk/libao2/ao_alsa.c Fri Jan 1 14:18:49 2010 (r30164)
+++ trunk/libao2/ao_alsa.c Fri Jan 1 14:23:16 2010 (r30165)
@@ -265,9 +265,7 @@ static void print_help (void)
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)
Modified: trunk/libvo/vo_jpeg.c
==============================================================================
--- trunk/libvo/vo_jpeg.c Fri Jan 1 14:18:49 2010 (r30164)
+++ trunk/libvo/vo_jpeg.c Fri Jan 1 14:23:16 2010 (r30165)
@@ -333,9 +333,7 @@ static void check_events(void)
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)
Modified: trunk/libvo/vo_png.c
==============================================================================
--- trunk/libvo/vo_png.c Fri Jan 1 14:18:49 2010 (r30164)
+++ trunk/libvo/vo_png.c Fri Jan 1 14:23:16 2010 (r30165)
@@ -286,9 +286,7 @@ static void check_events(void){}
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[] = {
Modified: trunk/subopt-helper.c
==============================================================================
--- trunk/subopt-helper.c Fri Jan 1 14:18:49 2010 (r30164)
+++ trunk/subopt-helper.c Fri Jan 1 14:23:16 2010 (r30165)
@@ -303,17 +303,13 @@ static char const * parse_str( char cons
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 */
More information about the MPlayer-cvslog
mailing list