From bca8edd856cee3a3b469ef9fe2770a191b590fde Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Sat, 22 Mar 2008 09:28:15 +0000 Subject: Small simplification - take advantage of the fact that x/y/width/height are non-negative integers when validating the viewport bounds. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16736 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/wps_parser.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'apps') diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c index be3d2fb882..a791440d0e 100644 --- a/apps/gui/wps_parser.c +++ b/apps/gui/wps_parser.c @@ -564,9 +564,7 @@ static int parse_viewport(const char *wps_bufptr, #ifdef HAVE_REMOTE_LCD if (wps_data->remote_wps) { - if ((vp->x >= LCD_REMOTE_WIDTH) || - ((vp->x + vp->width) >= LCD_REMOTE_WIDTH) || - (vp->y >= LCD_REMOTE_HEIGHT) || + if (((vp->x + vp->width) >= LCD_REMOTE_WIDTH) || ((vp->y + vp->height) >= LCD_REMOTE_HEIGHT)) { return WPS_ERROR_INVALID_PARAM; @@ -575,8 +573,7 @@ static int parse_viewport(const char *wps_bufptr, else #else { - if ((vp->x >= LCD_WIDTH) || - (vp->y >= LCD_HEIGHT) || + if (((vp->x + vp->width) >= LCD_WIDTH) || ((vp->y + vp->height) >= LCD_HEIGHT)) { return WPS_ERROR_INVALID_PARAM; -- cgit v1.2.3