From 4fff8a8384cb9a32e46627637da8cf4b78ce9270 Mon Sep 17 00:00:00 2001 From: Mike Date: Sat, 31 Aug 2024 13:13:06 +0100 Subject: [PATCH] `dtostrf_p` doesn't handle advertised range (#2879) Code indicates range of +/- 4294967040.0 but that isn't achievable using `ltoa` (signed) call. --- Sming/System/stringconversion.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sming/System/stringconversion.cpp b/Sming/System/stringconversion.cpp index 43cb89cb81..9432a46ee8 100644 --- a/Sming/System/stringconversion.cpp +++ b/Sming/System/stringconversion.cpp @@ -160,7 +160,7 @@ char *dtostrf_p(double floatVar, int minStringWidthIncDecimalPoint, int numDigit int_part = (unsigned long) floatVar; //print the int part into num - char* s = ltoa(int_part, buf, 10); + char* s = ultoa(int_part, buf, 10); //adjust end pointer buf += strlen(s); //go to end of string @@ -171,7 +171,7 @@ char *dtostrf_p(double floatVar, int minStringWidthIncDecimalPoint, int numDigit *buf++ = '.'; // print the decimal point //print the fraction part into temp - s = ltoa( ((floatVar - int_part) * mult), temp, 10); + s = ultoa( ((floatVar - int_part) * mult), temp, 10); i = processedFracLen - strlen(s) + 1;