From dbffb91706dd6ed13e49f3f17cce1f379e2da7e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Wallm=C3=A9nius?= Date: Sun, 20 Apr 2008 14:07:21 +0000 Subject: [PATCH] Oops, our snprintf doesn't support some fancy features so use something that works instead :) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17187 a1c6a512-1295-4272-9138-f99709370657 --- apps/talk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/talk.c b/apps/talk.c index e9d54fdd31..0635e506fe 100644 --- a/apps/talk.c +++ b/apps/talk.c @@ -826,6 +826,7 @@ int talk_value_decimal(long n, int unit, int decimals, bool enqueue) }; char tbuf[8]; + char fmt[] = "%0nd"; if (talk_temp_disable_count > 0) return -1; /* talking has been disabled */ @@ -865,7 +866,9 @@ int talk_value_decimal(long n, int unit, int decimals, bool enqueue) n = -n; } - snprintf(tbuf, sizeof(tbuf), "%0*d", decimals, n % pow10[decimals]); + fmt[2] = '0' + decimals; + + snprintf(tbuf, sizeof(tbuf), fmt, n % pow10[decimals]); talk_fractional(tbuf, n / pow10[decimals], unit_id); return 0;