aboutsummaryrefslogtreecommitdiff
path: root/src/graphics
diff options
context:
space:
mode:
Diffstat (limited to 'src/graphics')
-rw-r--r--src/graphics/drawer.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/graphics/drawer.c b/src/graphics/drawer.c
index 35a16a6..04d3e89 100644
--- a/src/graphics/drawer.c
+++ b/src/graphics/drawer.c
@@ -69,16 +69,16 @@ void write_hex32(struct Drawer* d, unsigned long val)
void write_c10(struct Drawer* d, unsigned long val, unsigned int c)
{
- static char out[] = "0000000000";
- char* s = (char*)out+10;
+ static char out[] = "0000000000\0";
+ char* s = (char*)out+9;
unsigned long tmp = val;
- if(tmp == 0)
- s--;
- while (tmp != 0) {
- s--;
+ for(int i = 0; i < 10; i++) {
unsigned char rem = tmp%10;
tmp /= 10;
*s = rem + 0x30;
+ if (tmp==0)
+ break;
+ s--;
}
write_cstring(d, s, c);
}