summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2009-10-18 23:58:42 +0000
committerThomas Martitz <kugel@rockbox.org>2009-10-18 23:58:42 +0000
commitc26949c54ba9442cc8095d0775d43644f34627a3 (patch)
treef89227950d100ec41dcf5893dcdb29aea515b88f /apps
parent3cc5345bc5336fe9803d2775c4a705043d967b2e (diff)
downloadrockbox-c26949c54ba9442cc8095d0775d43644f34627a3.tar.gz
rockbox-c26949c54ba9442cc8095d0775d43644f34627a3.zip
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
Diffstat (limited to 'apps')
-rw-r--r--apps/gui/skin_engine/skin_tokens.c13
1 files 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)
123/* a few convinience macros for the id3 == NULL case 123/* a few convinience macros for the id3 == NULL case
124 * depends on a few variable names in get_token_value() */ 124 * depends on a few variable names in get_token_value() */
125 125
126#define HANDLE_NULL_ID3(id3field) (LIKELY(id3) ? (id3field) : na_str) 126#define HANDLE_NULL_ID3(id3field) (LIKELY(id3) ? (id3field) : NULL)
127 127
128#define HANDLE_NULL_ID3_NUM_ZERO { if (UNLIKELY(!id3)) return zero_str; } 128#define HANDLE_NULL_ID3_NUM_ZERO { if (UNLIKELY(!id3)) return zero_str; }
129 129
@@ -151,7 +151,6 @@ const char *get_token_value(struct gui_wps *gwps,
151 struct wps_data *data = gwps->data; 151 struct wps_data *data = gwps->data;
152 struct wps_state *state = gwps->state; 152 struct wps_state *state = gwps->state;
153 int elapsed, length; 153 int elapsed, length;
154 static const char * const na_str = "n/a";
155 static const char * const zero_str = "0"; 154 static const char * const zero_str = "0";
156 155
157 if (!data || !state) 156 if (!data || !state)
@@ -418,8 +417,7 @@ const char *get_token_value(struct gui_wps *gwps,
418 return buf; 417 return buf;
419 418
420 case WPS_TOKEN_FILE_NAME: 419 case WPS_TOKEN_FILE_NAME:
421 if (!id3) return na_str; 420 if (LIKELY(id3) && get_dir(buf, buf_size, id3->path, 0)) {
422 if (get_dir(buf, buf_size, id3->path, 0)) {
423 /* Remove extension */ 421 /* Remove extension */
424 char* sep = strrchr(buf, '.'); 422 char* sep = strrchr(buf, '.');
425 if (NULL != sep) { 423 if (NULL != sep) {
@@ -432,8 +430,9 @@ const char *get_token_value(struct gui_wps *gwps,
432 } 430 }
433 431
434 case WPS_TOKEN_FILE_NAME_WITH_EXTENSION: 432 case WPS_TOKEN_FILE_NAME_WITH_EXTENSION:
435 if (!id3) return na_str; 433 if (LIKELY(id3))
436 return get_dir(buf, buf_size, id3->path, 0); 434 return get_dir(buf, buf_size, id3->path, 0);
435 return NULL;
437 436
438 case WPS_TOKEN_FILE_PATH: 437 case WPS_TOKEN_FILE_PATH:
439 return HANDLE_NULL_ID3(id3->path); 438 return HANDLE_NULL_ID3(id3->path);
@@ -449,7 +448,7 @@ const char *get_token_value(struct gui_wps *gwps,
449 case WPS_TOKEN_FILE_DIRECTORY: 448 case WPS_TOKEN_FILE_DIRECTORY:
450 if (LIKELY(id3)) 449 if (LIKELY(id3))
451 return get_dir(buf, buf_size, id3->path, token->value.i); 450 return get_dir(buf, buf_size, id3->path, token->value.i);
452 return na_str; 451 return NULL;
453 452
454 case WPS_TOKEN_BATTERY_PERCENT: 453 case WPS_TOKEN_BATTERY_PERCENT:
455 { 454 {