diff options
author | Thomas Martitz <kugel@rockbox.org> | 2009-07-22 21:14:47 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2009-07-22 21:14:47 +0000 |
commit | 23e46b3d98444cdb2ef542635e82b610eb314997 (patch) | |
tree | 1fa2d98551591d24870c5f12107f4b8fe114f0ce /apps | |
parent | 8d194f08d784d221897c024f295003ea73b957d6 (diff) | |
download | rockbox-23e46b3d98444cdb2ef542635e82b610eb314997.tar.gz rockbox-23e46b3d98444cdb2ef542635e82b610eb314997.zip |
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')
-rw-r--r-- | apps/gui/wps_parser.c | 12 |
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, | |||
1168 | struct wps_token *token, struct wps_data *wps_data) | 1168 | struct wps_token *token, struct wps_data *wps_data) |
1169 | { | 1169 | { |
1170 | (void)token; | 1170 | (void)token; |
1171 | unsigned i; | 1171 | unsigned i, imax; |
1172 | struct touchregion *region; | 1172 | struct touchregion *region; |
1173 | const char *ptr = wps_bufptr; | 1173 | const char *ptr = wps_bufptr; |
1174 | const char *action; | 1174 | const char *action; |
@@ -1218,11 +1218,15 @@ static int parse_touchregion(const char *wps_bufptr, | |||
1218 | } | 1218 | } |
1219 | else | 1219 | else |
1220 | region->repeat = false; | 1220 | region->repeat = false; |
1221 | 1221 | ||
1222 | imax = ARRAYLEN(touchactions); | ||
1222 | while ((region->action == ACTION_NONE) && | 1223 | while ((region->action == ACTION_NONE) && |
1223 | (i < sizeof(touchactions)/sizeof(*touchactions))) | 1224 | (i < imax)) |
1224 | { | 1225 | { |
1225 | if (!strncmp(touchactions[i].s, action, strlen(touchactions[i].s))) | 1226 | /* try to match with one of our touchregion screens */ |
1227 | int len = strlen(touchactions[i].s); | ||
1228 | if (!strncmp(touchactions[i].s, action, len) | ||
1229 | && *(action+len) == '|') | ||
1226 | region->action = touchactions[i].action; | 1230 | region->action = touchactions[i].action; |
1227 | i++; | 1231 | i++; |
1228 | } | 1232 | } |