| 410c925a | 27-Jan-2022 |
Andre Przywara <andre.przywara@arm.com> |
fix(libc): snprintf: include stdint.h
The snprintf code uses the uintptr_t type, which is defined in stdint.h. We do not include this header explicitly, but get the definition indirectly through som
fix(libc): snprintf: include stdint.h
The snprintf code uses the uintptr_t type, which is defined in stdint.h. We do not include this header explicitly, but get the definition indirectly through some other header doing so.
However this breaks when snprintf is compiled in isolation (for instance for unit-testing), so let's add this #include to make things right.
Change-Id: I1299767ee482f5cf1af30c4df2e8f7e596969b41 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
show more ...
|
| b30dd403 | 24-Jan-2022 |
Andre Przywara <andre.przywara@arm.com> |
fix(libc): limit snprintf radix value
In our unsigned_num_print() function we first print the integer into a local buffer, then put this through alignment and padding and output the result. For this
fix(libc): limit snprintf radix value
In our unsigned_num_print() function we first print the integer into a local buffer, then put this through alignment and padding and output the result. For this we use a local buffer, sized by the maximum possible length of the largest possible number.
However this assumes that the radix is not smaller than 10, which is indeed the smallest value we pass into this static function at the moment. To prevent accidents in the future, should we add support for other radices, add an assert to enforce our assumption.
Unfortunately this cannot be a static assert (CASSERT), since the compiler is not smart enough to see that the argument is always coming from a literal.
Change-Id: Ic204462600d9f4c281d899cf9f2c698a0a33a874 Signed-off-by: Andre Przywara <andre.przywara@arm.com>
show more ...
|
| d56b957c | 28-Jan-2021 |
Madhukar Pappireddy <madhukar.pappireddy@arm.com> |
libc: Import strtoull from FreeBSD project
From commit: 21571b1d140ae7bb44e94c0afba2ec61456b275b The coding guidelines[1] in TF-A forbid the use of ato*() functions in favour of strto*(). However, t
libc: Import strtoull from FreeBSD project
From commit: 21571b1d140ae7bb44e94c0afba2ec61456b275b The coding guidelines[1] in TF-A forbid the use of ato*() functions in favour of strto*(). However, the TF-A libc does not provide an implementation of strto*(), making this rule impossible to satisfy.
Also made small changes to fit into TF-A project. Added the source files to the libc makefile
[1] https://trustedfirmware-a.readthedocs.io/en/latest/process/coding-guidelines.html#libc-functions-that-are-banned-or-to-be-used-with-caution
Change-Id: I2e94a0b227ec39f6f4530dc50bb477999d27730f Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
show more ...
|
| 587c1556 | 28-Jan-2021 |
Madhukar Pappireddy <madhukar.pappireddy@arm.com> |
libc: Import strtoll from FreeBSD project
From commit: 21571b1d140ae7bb44e94c0afba2ec61456b275b The coding guidelines[1] in TF-A forbid the use of ato*() functions in favour of strto*(). However, th
libc: Import strtoll from FreeBSD project
From commit: 21571b1d140ae7bb44e94c0afba2ec61456b275b The coding guidelines[1] in TF-A forbid the use of ato*() functions in favour of strto*(). However, the TF-A libc does not provide an implementation of strto*(), making this rule impossible to satisfy.
Also made small changes to fit into TF-A project. Added the source files to the libc makefile
[1] https://trustedfirmware-a.readthedocs.io/en/latest/process/coding-guidelines.html#libc-functions-that-are-banned-or-to-be-used-with-caution
Change-Id: I9cb581574d46de73c3d6917ebf78935fc5ac075a Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
show more ...
|
| 15c1c147 | 27-Jan-2021 |
Madhukar Pappireddy <madhukar.pappireddy@arm.com> |
libc: Import strtoul from FreeBSD project
From commit: 21571b1d140ae7bb44e94c0afba2ec61456b275b The coding guidelines[1] in TF-A forbid the use of ato*() functions in favour of strto*(). However, th
libc: Import strtoul from FreeBSD project
From commit: 21571b1d140ae7bb44e94c0afba2ec61456b275b The coding guidelines[1] in TF-A forbid the use of ato*() functions in favour of strto*(). However, the TF-A libc does not provide an implementation of strto*(), making this rule impossible to satisfy.
Also made small changes to fit into TF-A project. Added the source files to the libc makefile
[1] https://trustedfirmware-a.readthedocs.io/en/latest/process/coding-guidelines.html#libc-functions-that-are-banned-or-to-be-used-with-caution
Change-Id: I8c3b92751d1ce226c966f7c81fedd83f0846865e Signed-off-by: Madhukar Pappireddy <madhukar.pappireddy@arm.com>
show more ...
|
| 7981c504 | 20-Jan-2021 |
Heyi Guo <guoheyi@linux.alibaba.com> |
libc/snprintf: use macro to reduce duplicated code
Add macro CHECK_AND_PUT_CHAR to check buffer capacity, save one character to buffer, and then increase character counter by one in one single state
libc/snprintf: use macro to reduce duplicated code
Add macro CHECK_AND_PUT_CHAR to check buffer capacity, save one character to buffer, and then increase character counter by one in one single statement, so that 4 similar code pieces can be cleaned.
Signed-off-by: Heyi Guo <guoheyi@linux.alibaba.com> Change-Id: I2add6b4bd6c24ea3c0d2499a44924e3e8db0f4d1
show more ...
|
| c6546154 | 27-Oct-2020 |
Heyi Guo <guoheyi@linux.alibaba.com> |
libc/snprintf: add support to print "%" character
Enable snprintf()/vsnprintf() in TF-A to print "%" character as C standard, which may be used in platform porting to print percentage information.
libc/snprintf: add support to print "%" character
Enable snprintf()/vsnprintf() in TF-A to print "%" character as C standard, which may be used in platform porting to print percentage information.
Signed-off-by: Heyi Guo <guoheyi@linux.alibaba.com> Change-Id: I9b296372a1002046eabac1df5e8eb99a27efd4a8
show more ...
|