File tree 1 file changed +4
-6
lines changed
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)
202
202
203
203
size_t Print::printNumber (unsigned long n, uint8_t base)
204
204
{
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 ;
209
206
210
207
// prevent crash if called with base == 1
211
208
if (base < 2 ) base = 10 ;
@@ -214,10 +211,11 @@ size_t Print::printNumber(unsigned long n, uint8_t base)
214
211
char c = n % base;
215
212
n /= base;
216
213
217
- *--str = c < 10 ? c + ' 0' : c + ' A' - 10 ;
214
+ c = (c < 10 ? c + ' 0' : c + ' A' - 10 );
215
+ written += write (&c, 1 );
218
216
} while (n);
219
217
220
- return write (str) ;
218
+ return written ;
221
219
}
222
220
223
221
size_t Print::printFloat (double number, uint8_t digits)
You can’t perform that action at this time.
0 commit comments