diff options
author | Joel Challis <git@zvecr.com> | 2020-03-01 18:46:40 +0000 |
---|---|---|
committer | Florian Didron <fdidron@users.noreply.github.com> | 2020-06-12 17:00:27 +0900 |
commit | b3b8c6af3c7e8ec72a92af6015308ada6c2cd08a (patch) | |
tree | 0f7302719d4d5512c8d1dee94cb87a72b9fd5c57 /tmk_core | |
parent | ae484e34a06c6aa50c64db10ee58420ff7676722 (diff) |
Short term fix for conflicting types for 'tfp_printf' (#8157)
format code according to conventions [skip ci]
Diffstat (limited to 'tmk_core')
-rw-r--r-- | tmk_core/common/chibios/printf.c | 18 | ||||
-rw-r--r-- | tmk_core/common/chibios/printf.h | 6 |
2 files changed, 14 insertions, 10 deletions
diff --git a/tmk_core/common/chibios/printf.c b/tmk_core/common/chibios/printf.c index 3a81acd312..a99752bb3d 100644 --- a/tmk_core/common/chibios/printf.c +++ b/tmk_core/common/chibios/printf.c @@ -96,10 +96,10 @@ static int a2d(char ch) { return -1; } -static char a2i(char ch, char** src, int base, int* nump) { - char* p = *src; - int num = 0; - int digit; +static char a2i(char ch, const char** src, int base, int* nump) { + const char* p = *src; + int num = 0; + int digit; while ((digit = a2d(ch)) >= 0) { if (digit > base) break; num = num * base + digit; @@ -119,7 +119,7 @@ static void putchw(void* putp, putcf putf, int n, char z, char* bf) { while ((ch = *bf++)) putf(putp, ch); } -void tfp_format(void* putp, putcf putf, char* fmt, va_list va) { +void tfp_format(void* putp, putcf putf, const char* fmt, va_list va) { // This used to handle max of 12, but binary support jumps this to at least 32 char bf[36]; @@ -211,19 +211,23 @@ void init_printf(void* putp, void (*putf)(void*, char)) { stdout_putp = putp; } -void tfp_printf(char* fmt, ...) { +int tfp_printf(const char* fmt, ...) { va_list va; va_start(va, fmt); tfp_format(stdout_putp, stdout_putf, fmt, va); va_end(va); + + return 1; } static void putcp(void* p, char c) { *(*((char**)p))++ = c; } -void tfp_sprintf(char* s, char* fmt, ...) { +int tfp_sprintf(char* s, const char* fmt, ...) { va_list va; va_start(va, fmt); tfp_format(&s, putcp, fmt, va); putcp(&s, 0); va_end(va); + + return 1; } diff --git a/tmk_core/common/chibios/printf.h b/tmk_core/common/chibios/printf.h index 2cdf55ed90..775459e1e8 100644 --- a/tmk_core/common/chibios/printf.h +++ b/tmk_core/common/chibios/printf.h @@ -99,10 +99,10 @@ regs Kusti, 23.10.2004 void init_printf(void* putp, void (*putf)(void*, char)); -void tfp_printf(char* fmt, ...); -void tfp_sprintf(char* s, char* fmt, ...); +int tfp_printf(const char* fmt, ...); +int tfp_sprintf(char* s, const char* fmt, ...); -void tfp_format(void* putp, void (*putf)(void*, char), char* fmt, va_list va); +void tfp_format(void* putp, void (*putf)(void*, char), const char* fmt, va_list va); #define printf tfp_printf #define sprintf tfp_sprintf |