diff options
| author | Franklin Wei <git@fwei.tk> | 2017-08-16 11:35:32 -0400 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2017-08-16 11:40:42 -0400 |
| commit | c78ff7f6153d2a787bfd8cb3410dff8db74b2789 (patch) | |
| tree | e3a507a1a25640d4c8e2cbedc464d38e6af5575c /apps/plugins/puzzles/src/rect.c | |
| parent | bf25f3e6e7b1518b0dd499676ac298172dc25fa1 (diff) | |
| download | rockbox-c78ff7f6153d2a787bfd8cb3410dff8db74b2789.zip rockbox-c78ff7f6153d2a787bfd8cb3410dff8db74b2789.tar.gz rockbox-c78ff7f6153d2a787bfd8cb3410dff8db74b2789.tar.bz2 rockbox-c78ff7f6153d2a787bfd8cb3410dff8db74b2789.tar.xz | |
puzzles: fix floating-point formatting
This is pretty ad-hoc, but the only other ways are to rewrite
sprintf (which would use too much memory on the c200v2), or
implement support for floats in rockbox's formatter, neither of
which are acceptable.
Change-Id: I70d59fd3e90a16e2db9ae0a84cd8c14807f50b46
Diffstat (limited to 'apps/plugins/puzzles/src/rect.c')
| -rw-r--r-- | apps/plugins/puzzles/src/rect.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/apps/plugins/puzzles/src/rect.c b/apps/plugins/puzzles/src/rect.c index 465e143..0c06c74 100644 --- a/apps/plugins/puzzles/src/rect.c +++ b/apps/plugins/puzzles/src/rect.c @@ -163,7 +163,10 @@ static char *encode_params(const game_params *params, int full) sprintf(data, "%dx%d", params->w, params->h); if (full && params->expandfactor) - sprintf(data + strlen(data), "e%g", params->expandfactor); + { + sprintf(data + strlen(data), "e"); + ftoa(data + strlen(data), 256, params->expandfactor); + } if (full && !params->unique) strcat(data, "a"); @@ -191,7 +194,7 @@ static config_item *game_configure(const game_params *params) ret[2].name = "Expansion factor"; ret[2].type = C_STRING; - sprintf(buf, "%g", params->expandfactor); + ftoa(buf, 80, params->expandfactor); ret[2].sval = dupstr(buf); ret[2].ival = 0; |