forked from len0rd/rockbox
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
This commit is contained in:
parent
8d194f08d7
commit
23e46b3d98
1 changed files with 8 additions and 4 deletions
|
@ -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++;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue