diff options
author | Joel Challis <git@zvecr.com> | 2020-03-01 18:46:40 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-02 05:46:40 +1100 |
commit | e7fb873ee281d93dbf96f369bd3a0a50e766eda3 (patch) | |
tree | 61c192c27793a1b02d09c8b8bcf59a7a4645b47f | |
parent | 629950e51bb0f3f12d84520426f93449e0e4e9b7 (diff) | |
download | qmk_firmware-e7fb873ee281d93dbf96f369bd3a0a50e766eda3.tar.gz qmk_firmware-e7fb873ee281d93dbf96f369bd3a0a50e766eda3.zip |
Short term fix for conflicting types for 'tfp_printf' (#8157)
-rw-r--r-- | tmk_core/common/chibios/printf.c | 14 | ||||
-rw-r--r-- | tmk_core/common/chibios/printf.h | 6 |
2 files changed, 12 insertions, 8 deletions
diff --git a/tmk_core/common/chibios/printf.c b/tmk_core/common/chibios/printf.c index 3a81acd31..17c1e6341 100644 --- a/tmk_core/common/chibios/printf.c +++ b/tmk_core/common/chibios/printf.c | |||
@@ -96,8 +96,8 @@ static int a2d(char ch) { | |||
96 | return -1; | 96 | return -1; |
97 | } | 97 | } |
98 | 98 | ||
99 | static char a2i(char ch, char** src, int base, int* nump) { | 99 | static char a2i(char ch, const char** src, int base, int* nump) { |
100 | char* p = *src; | 100 | const char* p = *src; |
101 | int num = 0; | 101 | int num = 0; |
102 | int digit; | 102 | int digit; |
103 | while ((digit = a2d(ch)) >= 0) { | 103 | while ((digit = a2d(ch)) >= 0) { |
@@ -119,7 +119,7 @@ static void putchw(void* putp, putcf putf, int n, char z, char* bf) { | |||
119 | while ((ch = *bf++)) putf(putp, ch); | 119 | while ((ch = *bf++)) putf(putp, ch); |
120 | } | 120 | } |
121 | 121 | ||
122 | void tfp_format(void* putp, putcf putf, char* fmt, va_list va) { | 122 | void tfp_format(void* putp, putcf putf, const char* fmt, va_list va) { |
123 | // This used to handle max of 12, but binary support jumps this to at least 32 | 123 | // This used to handle max of 12, but binary support jumps this to at least 32 |
124 | char bf[36]; | 124 | char bf[36]; |
125 | 125 | ||
@@ -211,19 +211,23 @@ void init_printf(void* putp, void (*putf)(void*, char)) { | |||
211 | stdout_putp = putp; | 211 | stdout_putp = putp; |
212 | } | 212 | } |
213 | 213 | ||
214 | void tfp_printf(char* fmt, ...) { | 214 | int tfp_printf(const char* fmt, ...) { |
215 | va_list va; | 215 | va_list va; |
216 | va_start(va, fmt); | 216 | va_start(va, fmt); |
217 | tfp_format(stdout_putp, stdout_putf, fmt, va); | 217 | tfp_format(stdout_putp, stdout_putf, fmt, va); |
218 | va_end(va); | 218 | va_end(va); |
219 | |||
220 | return 1; | ||
219 | } | 221 | } |
220 | 222 | ||
221 | static void putcp(void* p, char c) { *(*((char**)p))++ = c; } | 223 | static void putcp(void* p, char c) { *(*((char**)p))++ = c; } |
222 | 224 | ||
223 | void tfp_sprintf(char* s, char* fmt, ...) { | 225 | int tfp_sprintf(char* s, const char* fmt, ...) { |
224 | va_list va; | 226 | va_list va; |
225 | va_start(va, fmt); | 227 | va_start(va, fmt); |
226 | tfp_format(&s, putcp, fmt, va); | 228 | tfp_format(&s, putcp, fmt, va); |
227 | putcp(&s, 0); | 229 | putcp(&s, 0); |
228 | va_end(va); | 230 | va_end(va); |
231 | |||
232 | return 1; | ||
229 | } | 233 | } |
diff --git a/tmk_core/common/chibios/printf.h b/tmk_core/common/chibios/printf.h index 2cdf55ed9..775459e1e 100644 --- a/tmk_core/common/chibios/printf.h +++ b/tmk_core/common/chibios/printf.h | |||
@@ -99,10 +99,10 @@ regs Kusti, 23.10.2004 | |||
99 | 99 | ||
100 | void init_printf(void* putp, void (*putf)(void*, char)); | 100 | void init_printf(void* putp, void (*putf)(void*, char)); |
101 | 101 | ||
102 | void tfp_printf(char* fmt, ...); | 102 | int tfp_printf(const char* fmt, ...); |
103 | void tfp_sprintf(char* s, char* fmt, ...); | 103 | int tfp_sprintf(char* s, const char* fmt, ...); |
104 | 104 | ||
105 | void tfp_format(void* putp, void (*putf)(void*, char), char* fmt, va_list va); | 105 | void tfp_format(void* putp, void (*putf)(void*, char), const char* fmt, va_list va); |
106 | 106 | ||
107 | #define printf tfp_printf | 107 | #define printf tfp_printf |
108 | #define sprintf tfp_sprintf | 108 | #define sprintf tfp_sprintf |