File tree Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Expand file tree Collapse file tree 1 file changed +4
-6
lines changed Original file line number Diff line number Diff line change @@ -202,10 +202,7 @@ size_t Print::println(const Printable& x)
202202
203203size_t Print::printNumber (unsigned long n, uint8_t base)
204204{
205- char buf[8 * sizeof (long ) + 1 ]; // Assumes 8-bit chars plus zero byte.
206- char *str = &buf[sizeof (buf) - 1 ];
207-
208- *str = ' \0 ' ;
205+ size_t written = 0 ;
209206
210207 // prevent crash if called with base == 1
211208 if (base < 2 ) base = 10 ;
@@ -214,10 +211,11 @@ size_t Print::printNumber(unsigned long n, uint8_t base)
214211 char c = n % base;
215212 n /= base;
216213
217- *--str = c < 10 ? c + ' 0' : c + ' A' - 10 ;
214+ c = (c < 10 ? c + ' 0' : c + ' A' - 10 );
215+ written += write (&c, 1 );
218216 } while (n);
219217
220- return write (str) ;
218+ return written ;
221219}
222220
223221size_t Print::printFloat (double number, uint8_t digits)
You can’t perform that action at this time.
0 commit comments