summaryrefslogtreecommitdiff
path: root/apps/gui/wps_parser.c
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-07-22 21:14:47 +0000
committerThomas Martitz <kugel@rockbox.org>2009-07-22 21:14:47 +0000
commit23e46b3d98444cdb2ef542635e82b610eb314997 (patch)
tree1fa2d98551591d24870c5f12107f4b8fe114f0ce /apps/gui/wps_parser.c
parent8d194f08d784d221897c024f295003ea73b957d6 (diff)
touchscreen regions:
a) check for trailing '|' so that it doesn't match wrong strings (a not-yet-existing "playlist" would match the existing "play") b) don't recalculate the array length in each iteration git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21998 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/wps_parser.c')
-rw-r--r--apps/gui/wps_parser.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index 8ae83924c2..248269ddcb 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -1168,7 +1168,7 @@ static int parse_touchregion(const char *wps_bufptr,
struct wps_token *token, struct wps_data *wps_data)
{
(void)token;
- unsigned i;
+ unsigned i, imax;
struct touchregion *region;
const char *ptr = wps_bufptr;
const char *action;
@@ -1218,11 +1218,15 @@ static int parse_touchregion(const char *wps_bufptr,
}
else
region->repeat = false;
-
+
+ imax = ARRAYLEN(touchactions);
while ((region->action == ACTION_NONE) &&
- (i < sizeof(touchactions)/sizeof(*touchactions)))
+ (i < imax))
{
- if (!strncmp(touchactions[i].s, action, strlen(touchactions[i].s)))
+ /* try to match with one of our touchregion screens */
+ int len = strlen(touchactions[i].s);
+ if (!strncmp(touchactions[i].s, action, len)
+ && *(action+len) == '|')
region->action = touchactions[i].action;
i++;
}