From 61c652601396c1fcb9a68b886faa76131aefc3b7 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Sat, 11 Oct 2008 13:49:38 +0000 Subject: * Make %t stricter by aborting if a value is not given. * Move the default value for %mv back into wps_parser.c where it belongs * Add the debug line for the %mv tag git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18773 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/gwps-common.c | 2 -- apps/gui/wps_debug.c | 5 ++++- apps/gui/wps_parser.c | 12 ++++++++++++ 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/apps/gui/gwps-common.c b/apps/gui/gwps-common.c index 806ce19..a81b855 100644 --- a/apps/gui/gwps-common.c +++ b/apps/gui/gwps-common.c @@ -1389,8 +1389,6 @@ static const char *get_token_value(struct gui_wps *gwps, return NULL; #endif case WPS_TOKEN_BUTTON_VOLUME: - if (token->value.i == 0) - token->value.i = HZ; if (data->button_time_volume && TIME_BEFORE(current_tick, data->button_time_volume + token->value.i)) diff --git a/apps/gui/wps_debug.c b/apps/gui/wps_debug.c index f843b98..5a18218 100644 --- a/apps/gui/wps_debug.c +++ b/apps/gui/wps_debug.c @@ -431,7 +431,10 @@ static char *get_token_desc(struct wps_token *token, struct wps_data *data, snprintf(buf, bufsize, "enable VP:%d", token->value.i); break; - + case WPS_TOKEN_BUTTON_VOLUME: + snprintf(buf, bufsize, "Volume button timeout:%d", + token->value.i); + break; default: snprintf(buf, bufsize, "FIXME (code: %d)", token->type); diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c index 96e8d66..fc207ef 100644 --- a/apps/gui/wps_parser.c +++ b/apps/gui/wps_parser.c @@ -802,6 +802,18 @@ static int parse_timeout(const char *wps_bufptr, if (have_tenth == false) val *= 10; + if (val == 0 && skip == 0) + { + /* decide what to do if no value was specified */ + switch (token->type) + { + case WPS_TOKEN_SUBLINE_TIMEOUT: + return -1; + case WPS_TOKEN_BUTTON_VOLUME: + val = HZ; + break; + } + } token->value.i = val; return skip; -- cgit v1.1