summaryrefslogtreecommitdiff
path: root/lib/str.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix VS2019 Code Analysis warningsPete Batard2021-07-161-1/+1
| | | | | | | | | | When compiling for x64, Visual Studio 2019's Code Analysis produces the following warnings: C:\Projects\gnu-efi\lib\print.c(1380): warning C26451: Arithmetic overflow: Using operator '+' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '+' to avoid overflow (io.2). C:\Projects\gnu-efi\lib\smbios.c(47): warning C26451: Arithmetic overflow: Using operator '+' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '+' to avoid overflow (io.2). C:\Projects\gnu-efi\lib\str.c(289): warning C26451: Arithmetic overflow: Using operator '-' on a 4 byte value and then casting the result to a 8 byte value. Cast the value to the wider type before calling operator '-' to avoid overflow (io.2). Fix these by adding an explicit cast to UINTN.
* lib/str: simplify Atoi()Heinrich Schuchardt2021-06-221-1/+1
| | | | | | | | | | Checking that str is non-zero is superfluous in (*str && *str == ' ') 0x20 is always non-zero. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* lisb/str.c: simplify xtoi()Heinrich Schuchardt2021-04-041-1/+1
| | | | | | If str == ' ', str has to be non-zero. No extra check is needed. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
* gnu-efi: add some more common string functions.Peter Jones2018-03-141-0/+53
| | | | | | | | | | | | | | This adds bounded string helper functions: StrnLen() StrnCpy() StrnCat() StpnCpy() And the unbounded function StpCpy(). Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
* Commit 3dd05c and subsequent ones introduced the use of the GNUNigel Croxon2016-03-251-18/+16
| | | | | | | | | | | | | | | | | | | | | specific __attribute__((__unused__)), which breaks MSVC compilation... I'll use this as a reminder that gnu-efi is compiled with more than GNU toolchains, and that contributors might want to be careful about adding GNU-specific extensions... This patch does the following: Create a new eficompiler.h header that sets all compiler-specific options and extensions Create a new EFI_UNUSED macro to be used in lieu of __attribute__((__unused__)) and applies it to the relevant sources Move the ALIGN(x) macro, previously defined in efisetjmp.h to the new header Oh, and it also fixes a bunch of trailing whitespaces (because my code editor is set to do just that by default). Signed-off-by: Pete Batard <pbatard@users.sf.net> Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
* This makes "-Werror=unused-parameter" not fail.Nigel Croxon2016-03-031-4/+6
| | | | | Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Nigel Croxon <nigel.croxon@hpe.com>
* The gnu-efi-3.0 toplevel subdirectory is really annoying. Kill it.Nigel Croxon2014-11-251-0/+379
Signed-off-by: Peter Jones <pjones@redhat.com> Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>