From c26949c54ba9442cc8095d0775d43644f34627a3 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Sun, 18 Oct 2009 23:58:42 +0000 Subject: [PATCH] r23208 broke conditional use of metadata and filename tags. Return NULL instead of "n/a" to make it work again. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23253 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/skin_engine/skin_tokens.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index 6b29091fe6..aeb7bdbbde 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c @@ -123,7 +123,7 @@ static char* get_dir(char* buf, int buf_size, const char* path, int level) /* a few convinience macros for the id3 == NULL case * depends on a few variable names in get_token_value() */ -#define HANDLE_NULL_ID3(id3field) (LIKELY(id3) ? (id3field) : na_str) +#define HANDLE_NULL_ID3(id3field) (LIKELY(id3) ? (id3field) : NULL) #define HANDLE_NULL_ID3_NUM_ZERO { if (UNLIKELY(!id3)) return zero_str; } @@ -151,7 +151,6 @@ const char *get_token_value(struct gui_wps *gwps, struct wps_data *data = gwps->data; struct wps_state *state = gwps->state; int elapsed, length; - static const char * const na_str = "n/a"; static const char * const zero_str = "0"; if (!data || !state) @@ -418,8 +417,7 @@ const char *get_token_value(struct gui_wps *gwps, return buf; case WPS_TOKEN_FILE_NAME: - if (!id3) return na_str; - if (get_dir(buf, buf_size, id3->path, 0)) { + if (LIKELY(id3) && get_dir(buf, buf_size, id3->path, 0)) { /* Remove extension */ char* sep = strrchr(buf, '.'); if (NULL != sep) { @@ -432,8 +430,9 @@ const char *get_token_value(struct gui_wps *gwps, } case WPS_TOKEN_FILE_NAME_WITH_EXTENSION: - if (!id3) return na_str; - return get_dir(buf, buf_size, id3->path, 0); + if (LIKELY(id3)) + return get_dir(buf, buf_size, id3->path, 0); + return NULL; case WPS_TOKEN_FILE_PATH: return HANDLE_NULL_ID3(id3->path); @@ -449,7 +448,7 @@ const char *get_token_value(struct gui_wps *gwps, case WPS_TOKEN_FILE_DIRECTORY: if (LIKELY(id3)) return get_dir(buf, buf_size, id3->path, token->value.i); - return na_str; + return NULL; case WPS_TOKEN_BATTERY_PERCENT: {