diff options
author | Dave Chapman <dave@dchapman.com> | 2008-03-22 09:28:15 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2008-03-22 09:28:15 +0000 |
commit | bca8edd856cee3a3b469ef9fe2770a191b590fde (patch) | |
tree | 69bd8fbb9b49d5cade86c1a899ae2b84fb07aa2d | |
parent | 45b2d8802d1e8fcc47fd1148adb7b1173ad5b311 (diff) | |
download | rockbox-bca8edd856cee3a3b469ef9fe2770a191b590fde.tar.gz rockbox-bca8edd856cee3a3b469ef9fe2770a191b590fde.zip |
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
-rw-r--r-- | apps/gui/wps_parser.c | 7 |
1 files changed, 2 insertions, 5 deletions
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, | |||
564 | #ifdef HAVE_REMOTE_LCD | 564 | #ifdef HAVE_REMOTE_LCD |
565 | if (wps_data->remote_wps) | 565 | if (wps_data->remote_wps) |
566 | { | 566 | { |
567 | if ((vp->x >= LCD_REMOTE_WIDTH) || | 567 | if (((vp->x + vp->width) >= LCD_REMOTE_WIDTH) || |
568 | ((vp->x + vp->width) >= LCD_REMOTE_WIDTH) || | ||
569 | (vp->y >= LCD_REMOTE_HEIGHT) || | ||
570 | ((vp->y + vp->height) >= LCD_REMOTE_HEIGHT)) | 568 | ((vp->y + vp->height) >= LCD_REMOTE_HEIGHT)) |
571 | { | 569 | { |
572 | return WPS_ERROR_INVALID_PARAM; | 570 | return WPS_ERROR_INVALID_PARAM; |
@@ -575,8 +573,7 @@ static int parse_viewport(const char *wps_bufptr, | |||
575 | else | 573 | else |
576 | #else | 574 | #else |
577 | { | 575 | { |
578 | if ((vp->x >= LCD_WIDTH) || | 576 | if (((vp->x + vp->width) >= LCD_WIDTH) || |
579 | (vp->y >= LCD_HEIGHT) || | ||
580 | ((vp->y + vp->height) >= LCD_HEIGHT)) | 577 | ((vp->y + vp->height) >= LCD_HEIGHT)) |
581 | { | 578 | { |
582 | return WPS_ERROR_INVALID_PARAM; | 579 | return WPS_ERROR_INVALID_PARAM; |