Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] printf update aftermath #17584

Merged
merged 1 commit into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions keyboards/cannonkeys/satisfaction75/satisfaction_oled.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
22 changes: 11 additions & 11 deletions keyboards/handwired/tractyl_manuform/tractyl_manuform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions keyboards/rocketboard_16/keymaps/default/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions keyboards/rocketboard_16/keymaps/via/keymap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
10 changes: 5 additions & 5 deletions keyboards/tzarc/djinn/graphics/theme_djinn_default.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion quantum/command.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) ") "
Expand Down
2 changes: 1 addition & 1 deletion quantum/logging/print.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down