diff options
Diffstat (limited to 'apps/gui/skin_engine/skin_tokens.c')
-rw-r--r-- | apps/gui/skin_engine/skin_tokens.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/apps/gui/skin_engine/skin_tokens.c b/apps/gui/skin_engine/skin_tokens.c index cbf732fe10..1cff83eb9a 100644 --- a/apps/gui/skin_engine/skin_tokens.c +++ b/apps/gui/skin_engine/skin_tokens.c | |||
@@ -70,6 +70,7 @@ | |||
70 | #if CONFIG_TUNER | 70 | #if CONFIG_TUNER |
71 | #include "radio.h" | 71 | #include "radio.h" |
72 | #include "tuner.h" | 72 | #include "tuner.h" |
73 | #include "fixedpoint.h" | ||
73 | #endif | 74 | #endif |
74 | #include "list.h" | 75 | #include "list.h" |
75 | 76 | ||
@@ -432,23 +433,11 @@ const char *get_id3_token(struct wps_token *token, struct mp3entry *id3, | |||
432 | /* Returns buf */ | 433 | /* Returns buf */ |
433 | static char *format_freq_MHz(int freq, int freq_step, char *buf, int buf_size) | 434 | static char *format_freq_MHz(int freq, int freq_step, char *buf, int buf_size) |
434 | { | 435 | { |
435 | int scale, div; | 436 | int decimals = (freq_step < 100000) + 1; |
436 | char *fmt; | 437 | int scale = ipow(10, 6 - decimals); |
437 | if (freq_step < 100000) | 438 | int div = 1000000 / scale; |
438 | { | ||
439 | /* Format with two digits after decimal point */ | ||
440 | scale = 10000; | ||
441 | fmt = "%d.%02d"; | ||
442 | } | ||
443 | else | ||
444 | { | ||
445 | /* Format with one digit after decimal point */ | ||
446 | scale = 100000; | ||
447 | fmt = "%d.%d"; | ||
448 | } | ||
449 | div = 1000000 / scale; | ||
450 | freq = freq / scale; | 439 | freq = freq / scale; |
451 | snprintf(buf, buf_size, fmt, freq/div, freq%div); | 440 | snprintf(buf, buf_size, "%d.%.*d", freq/div, decimals, freq%div); |
452 | return buf; | 441 | return buf; |
453 | } | 442 | } |
454 | 443 | ||