Searched hist:c1f5a0925ddf84981d9e176d146bfddb48eb45d1 (Results 1 – 1 of 1) sorted by relevance
| /rk3399_ARM-atf/lib/libc/ |
| H A D | snprintf.c | c1f5a0925ddf84981d9e176d146bfddb48eb45d1 Tue Dec 21 12:35:54 UTC 2021 Andre Przywara <andre.przywara@arm.com> fix(libc): fix snprintf corner cases
The number formatting routine in snprintf was trying to be clever with the buffer handling, but tripped over its own feet: snprintf() users expect output to be emitted, even if not everything fits into the buffer. The current code gives up completely when the buffer is too small.
Fix those issues and simplify the code on the way, by consequently using the CHECK_AND_PUT_CHAR() macro, which both checks for the buffer size correctly, but also keeps track of the number of should-be-printed characters for the return value.
Change-Id: Ifd2b03b9a73f9279abed53081a2d88720ecbdbc1 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
|