summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Kerkmann <karlk90@pm.me>2022-07-07 14:14:09 +0200
committerGitHub <noreply@github.com>2022-07-07 14:14:09 +0200
commit643f6367a19649a0f5af6d43f2ed7f0e93b21f70 (patch)
treeb51ba73169e3558dc724a25d995ecbd912c336bf
parent8224f62806b66f0825b68fd8c00436ee57a28e9a (diff)
[Fix] Patches after printf library update (#17584)
* Add missing '(' to print_bin_reverse32 declaration * Fix insufficient character buffers on satisfaction75 * Remove \0 character in format string and use corrected offset math instead on rocketboard 16 * Replace snprintf_ with snprintf for djinn * Explicitly ignore format checks for tracktyl manuform that uses %b specifier * Print properly escaped version string in command.c, as PRODUCT or other defines can contain constructs like 'Vendor keyboard 66%' which will be interpreted as a format specifier
-rw-r--r--keyboards/cannonkeys/satisfaction75/satisfaction_oled.c4
-rw-r--r--keyboards/handwired/tractyl_manuform/tractyl_manuform.c22
-rw-r--r--keyboards/rocketboard_16/keymaps/default/keymap.c4
-rw-r--r--keyboards/rocketboard_16/keymaps/via/keymap.c4
-rw-r--r--keyboards/tzarc/djinn/graphics/theme_djinn_default.c10
-rw-r--r--quantum/command.c2
-rw-r--r--quantum/logging/print.h2
7 files changed, 24 insertions, 24 deletions
diff --git a/keyboards/cannonkeys/satisfaction75/satisfaction_oled.c b/keyboards/cannonkeys/satisfaction75/satisfaction_oled.c
index fff8b65bd7..1e8465387c 100644
--- a/keyboards/cannonkeys/satisfaction75/satisfaction_oled.c
+++ b/keyboards/cannonkeys/satisfaction75/satisfaction_oled.c
@@ -145,7 +145,7 @@ static char* get_time(void) {
hour = 12;
}
- static char time_str[8] = "";
+ static char time_str[11] = "";
sprintf(time_str, "%02d:%02d%s", hour, minute, is_pm ? "pm" : "am");
return time_str;
@@ -162,7 +162,7 @@ static char* get_date(void) {
day = day_config;
}
- static char date_str[11] = "";
+ static char date_str[15] = "";
sprintf(date_str, "%04d-%02d-%02d", year, month, day);
return date_str;
diff --git a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c
index c68234d8d8..d3e2e02975 100644
--- a/keyboards/handwired/tractyl_manuform/tractyl_manuform.c
+++ b/keyboards/handwired/tractyl_manuform/tractyl_manuform.c
@@ -247,17 +247,17 @@ static bool has_shift_mod(void) {
*/
__attribute__((unused)) static void debug_charybdis_config_to_console(charybdis_config_t* config) {
# ifdef CONSOLE_ENABLE
- dprintf("(charybdis) process_record_kb: config = {\n"
- "\traw = 0x%04X,\n"
- "\t{\n"
- "\t\tis_dragscroll_enabled=%b\n"
- "\t\tis_sniping_enabled=%b\n"
- "\t\tdefault_dpi=0x%02X (%ld)\n"
- "\t\tsniping_dpi=0x%01X (%ld)\n"
- "\t}\n"
- "}\n",
- config->raw, config->is_dragscroll_enabled, config->is_sniping_enabled, config->pointer_default_dpi, get_pointer_default_dpi(config), config->pointer_sniping_dpi, get_pointer_sniping_dpi(config));
-# endif // CONSOLE_ENABLE
+ IGNORE_FORMAT_WARNING(dprintf("(charybdis) process_record_kb: config = {\n"
+ "\traw = 0x%04X,\n"
+ "\t{\n"
+ "\t\tis_dragscroll_enabled=%b\n"
+ "\t\tis_sniping_enabled=%b\n"
+ "\t\tdefault_dpi=0x%02X (%ld)\n"
+ "\t\tsniping_dpi=0x%01X (%ld)\n"
+ "\t}\n"
+ "}\n",
+ config->raw, config->is_dragscroll_enabled, config->is_sniping_enabled, config->pointer_default_dpi, get_pointer_default_dpi(config), config->pointer_sniping_dpi, get_pointer_sniping_dpi(config)));
+# endif // CONSOLE_ENABLE
}
bool process_record_kb(uint16_t keycode, keyrecord_t* record) {
diff --git a/keyboards/rocketboard_16/keymaps/default/keymap.c b/keyboards/rocketboard_16/keymaps/default/keymap.c
index ce26a834d0..dc83cbd62b 100644
--- a/keyboards/rocketboard_16/keymaps/default/keymap.c
+++ b/keyboards/rocketboard_16/keymaps/default/keymap.c
@@ -107,10 +107,10 @@ static void oled_write_ln_centered(const char * data, bool inverted)
char line_buf[21];
// Amount to offset string from left side
- uint8_t offset = (21 - strlen(data))/2;
+ uint8_t offset = (22 - strlen(data)) / 2;
// Formatted string centering... look, it works, don't ask how...
- snprintf(line_buf, 21, "%*s%s%*s\0", offset, "", data, offset, ""); // Centers data within 21 character buffer with null termination
+ snprintf(line_buf, 21, "%*s%s%*s", offset, "", data, offset, ""); // Centers data within 21 character buffer
oled_write_ln(line_buf, inverted);
}
diff --git a/keyboards/rocketboard_16/keymaps/via/keymap.c b/keyboards/rocketboard_16/keymaps/via/keymap.c
index ce26a834d0..08b8e65b4f 100644
--- a/keyboards/rocketboard_16/keymaps/via/keymap.c
+++ b/keyboards/rocketboard_16/keymaps/via/keymap.c
@@ -107,10 +107,10 @@ static void oled_write_ln_centered(const char * data, bool inverted)
char line_buf[21];
// Amount to offset string from left side
- uint8_t offset = (21 - strlen(data))/2;
+ uint8_t offset = (22 - strlen(data))/2;
// Formatted string centering... look, it works, don't ask how...
- snprintf(line_buf, 21, "%*s%s%*s\0", offset, "", data, offset, ""); // Centers data within 21 character buffer with null termination
+ snprintf(line_buf, 21, "%*s%s%*s", offset, "", data, offset, ""); // Centers data within 21 character buffer
oled_write_ln(line_buf, inverted);
}
diff --git a/keyboards/tzarc/djinn/graphics/theme_djinn_default.c b/keyboards/tzarc/djinn/graphics/theme_djinn_default.c
index 616a3c2430..a4e87bd341 100644
--- a/keyboards/tzarc/djinn/graphics/theme_djinn_default.c
+++ b/keyboards/tzarc/djinn/graphics/theme_djinn_default.c
@@ -158,7 +158,7 @@ void draw_ui_user(void) {
if (hue_redraw || rgb_effect_redraw) {
static int max_rgb_xpos = 0;
xpos = 16;
- snprintf_(buf, sizeof(buf), "rgb: %s", rgb_matrix_name(curr_effect));
+ snprintf(buf, sizeof(buf), "rgb: %s", rgb_matrix_name(curr_effect));
for (int i = 5; i < sizeof(buf); ++i) {
if (buf[i] == 0)
@@ -187,7 +187,7 @@ void draw_ui_user(void) {
static int max_layer_xpos = 0;
xpos = 16;
- snprintf_(buf, sizeof(buf), "layer: %s", layer_name);
+ snprintf(buf, sizeof(buf), "layer: %s", layer_name);
xpos += qp_drawtext_recolor(lcd, xpos, ypos, thintel, buf, curr_hue, 255, 255, curr_hue, 255, 0);
if (max_layer_xpos < xpos) {
max_layer_xpos = xpos;
@@ -200,7 +200,7 @@ void draw_ui_user(void) {
if (hue_redraw || power_state_redraw) {
static int max_power_xpos = 0;
xpos = 16;
- snprintf_(buf, sizeof(buf), "power: %s", usbpd_str(kb_state.current_setting));
+ snprintf(buf, sizeof(buf), "power: %s", usbpd_str(kb_state.current_setting));
xpos += qp_drawtext_recolor(lcd, xpos, ypos, thintel, buf, curr_hue, 255, 255, curr_hue, 255, 0);
if (max_power_xpos < xpos) {
max_power_xpos = xpos;
@@ -213,7 +213,7 @@ void draw_ui_user(void) {
if (hue_redraw || scan_redraw) {
static int max_scans_xpos = 0;
xpos = 16;
- snprintf_(buf, sizeof(buf), "scans: %d", (int)theme_state.scan_rate);
+ snprintf(buf, sizeof(buf), "scans: %d", (int)theme_state.scan_rate);
xpos += qp_drawtext_recolor(lcd, xpos, ypos, thintel, buf, curr_hue, 255, 255, curr_hue, 255, 0);
if (max_scans_xpos < xpos) {
max_scans_xpos = xpos;
@@ -226,7 +226,7 @@ void draw_ui_user(void) {
if (hue_redraw || wpm_redraw) {
static int max_wpm_xpos = 0;
xpos = 16;
- snprintf_(buf, sizeof(buf), "wpm: %d", (int)get_current_wpm());
+ snprintf(buf, sizeof(buf), "wpm: %d", (int)get_current_wpm());
xpos += qp_drawtext_recolor(lcd, xpos, ypos, thintel, buf, curr_hue, 255, 255, curr_hue, 255, 0);
if (max_wpm_xpos < xpos) {
max_wpm_xpos = xpos;
diff --git a/quantum/command.c b/quantum/command.c
index 2e94cb44b8..84757b9b01 100644
--- a/quantum/command.c
+++ b/quantum/command.c
@@ -161,7 +161,7 @@ static void command_common_help(void) {
}
static void print_version(void) {
- print(/* clang-format off */
+ xprintf("%s", /* clang-format off */
"\n\t- Version -\n"
"VID: " STR(VENDOR_ID) "(" STR(MANUFACTURER) ") "
"PID: " STR(PRODUCT_ID) "(" STR(PRODUCT) ") "
diff --git a/quantum/logging/print.h b/quantum/logging/print.h
index 5fbf189505..4c4195de50 100644
--- a/quantum/logging/print.h
+++ b/quantum/logging/print.h
@@ -100,7 +100,7 @@ void print_set_sendchar(sendchar_func_t func);
#define print_bin32(i) IGNORE_FORMAT_WARNING(xprintf("%032lb", i))
#define print_bin_reverse8(i) IGNORE_FORMAT_WARNING(xprintf("%08b", bitrev(i)))
#define print_bin_reverse16(i) IGNORE_FORMAT_WARNING(xprintf("%016b", bitrev16(i)))
-#define print_bin_reverse32(i) IGNORE_FORMAT_WARNINGxprintf("%032lb", bitrev32(i)))
+#define print_bin_reverse32(i) IGNORE_FORMAT_WARNING(xprintf("%032lb", bitrev32(i)))
/* print value utility */
#define print_val_dec(v) xprintf(#v ": %u\n", v)
#define print_val_decs(v) xprintf(#v ": %d\n", v)