Skip to content

Commit

Permalink
Fix extra space in non-decimal numbers
Browse files Browse the repository at this point in the history
Fix extra space in non-decimal numbers (#16365)
  • Loading branch information
arendst committed Aug 28, 2022
1 parent 5b1b4d1 commit 212cbe7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/default/Ext-printf/src/ext_printf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ int32_t ext_vsnprintf_P(char * out_buf, size_t buf_len, const char * fmt_P, va_l
if (isnan(number) || isinf(number)) {
new_val_str = "null";
} else {
dtostrf(*(float*)cur_val, (decimals + 2), decimals, hex);
uint32_t len = (decimals) ? decimals +2 : 1;
dtostrf(*(float*)cur_val, len, decimals, hex);

if (truncate) {
uint32_t last = strlen(hex) - 1;
Expand Down

0 comments on commit 212cbe7

Please sign in to comment.