diff options
Diffstat (limited to 'src/text.h')
-rw-r--r-- | src/text.h | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -2,6 +2,7 @@ | |||
2 | #define GBAEXP_TILES_H | 2 | #define GBAEXP_TILES_H |
3 | 3 | ||
4 | #include <stdarg.h> | 4 | #include <stdarg.h> |
5 | #include <stdio.h> | ||
5 | 6 | ||
6 | #include "common.h" | 7 | #include "common.h" |
7 | #include "bd-font.c" | 8 | #include "bd-font.c" |
@@ -75,11 +76,9 @@ txt_printf(char *msg, ...) { | |||
75 | va_list arg_list; | 76 | va_list arg_list; |
76 | va_start(arg_list, msg); | 77 | va_start(arg_list, msg); |
77 | char c; | 78 | char c; |
78 | char prev_c; | ||
79 | while ((c = *msg++) != '\0') { | 79 | while ((c = *msg++) != '\0') { |
80 | if (c != '%') { | 80 | if (c != '%') { |
81 | txt_putc(c); | 81 | txt_putc(c); |
82 | prev_c = c; | ||
83 | continue; | 82 | continue; |
84 | } | 83 | } |
85 | c = *msg++; | 84 | c = *msg++; |
@@ -88,19 +87,19 @@ txt_printf(char *msg, ...) { | |||
88 | txt_puts(va_arg(arg_list, char *)); | 87 | txt_puts(va_arg(arg_list, char *)); |
89 | } break; | 88 | } break; |
90 | case 'd': { | 89 | case 'd': { |
91 | char buf[32] = {0}; | 90 | char buf[12] = {0}; |
92 | int x = va_arg(arg_list, int); | 91 | int x = va_arg(arg_list, int); |
93 | sprintf(buf, "%d", x); | 92 | sprintf(buf, "%d", x); |
94 | txt_puts(buf); | 93 | txt_puts(buf); |
95 | } break; | 94 | } break; |
96 | case 'u': { | 95 | case 'u': { |
97 | char buf[32] = {0}; | 96 | char buf[12] = {0}; |
98 | unsigned int x = va_arg(arg_list, unsigned int); | 97 | unsigned int x = va_arg(arg_list, unsigned int); |
99 | sprintf(buf, "%u", x); | 98 | sprintf(buf, "%u", x); |
100 | txt_puts(buf); | 99 | txt_puts(buf); |
101 | } break; | 100 | } break; |
102 | case 'x': { | 101 | case 'x': { |
103 | char buf[32] = {0}; | 102 | char buf[12] = {0}; |
104 | unsigned int x = va_arg(arg_list, unsigned int); | 103 | unsigned int x = va_arg(arg_list, unsigned int); |
105 | sprintf(buf, "%x", x); | 104 | sprintf(buf, "%x", x); |
106 | txt_puts(buf); | 105 | txt_puts(buf); |