mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-21 16:05:44 -07:00
Stop using a zero precision specifier with sprintf ("%.0d") to cause
zero to be generated as the empty string rather than "0". Instead, do the job by the obvious approach of not calling sprintf at all if the number is zero. Works around a bug in Emscripten's C library, whose sprintf doesn't correctly handle that corner case. [originally from svn r9893]
This commit is contained in:
5
towers.c
5
towers.c
@ -741,7 +741,10 @@ done
|
|||||||
desc = snewn(40*a, char);
|
desc = snewn(40*a, char);
|
||||||
p = desc;
|
p = desc;
|
||||||
for (i = 0; i < 4*w; i++) {
|
for (i = 0; i < 4*w; i++) {
|
||||||
p += sprintf(p, "%s%.0d", i?"/":"", clues[i]);
|
if (i)
|
||||||
|
*p++ = '/';
|
||||||
|
if (clues[i])
|
||||||
|
p += sprintf(p, "%d", clues[i]);
|
||||||
}
|
}
|
||||||
for (i = 0; i < a; i++)
|
for (i = 0; i < a; i++)
|
||||||
if (grid[i])
|
if (grid[i])
|
||||||
|
Reference in New Issue
Block a user