Commit Graph

13 Commits

Author SHA1 Message Date
Callum Farmer
a093fe0378
Make CompareGuid match EDK2 ABI
* return BOOLEAN instead of INTN
* Use EFIAPI
* Opposite return codes

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-08-03 16:21:38 +01:00
Callum Farmer
d9b395ac03
Make CopyMemC call CopyMem
* The last part of this: I hope :)
* ISO C permits overwriting of Src even if it marks Src as CONST
* UEFI marks Src as NON CONST, so forward calls via this function
* Allows us to keep in-line with shim without causing Werror havoc with other downstreams

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-07-04 15:29:04 +01:00
Callum Farmer
c339e077c8
Restore old CopyMem as CopyMemC
CopyMemC cos CONST Src

Reverts 6b9dae0bef

Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-05-19 13:56:07 +01:00
Callum Farmer
6b9dae0bef
Fixup string functions for new CopyMem
Signed-off-by: Callum Farmer <gmbr3@opensuse.org>
2024-04-27 18:26:21 +01:00
Callum Farmer
f5bb548df5
Align RTLIB CopyMem/SetMem with normal versions
Looks like 699e452654 broke rEFInd
(189e405630/)
2024-04-25 15:27:26 +01:00
Pete Batard
41e4d11d11 Fix CopyMem() not handling overlaps
Per https://github.com/tianocore/edk2/blob/master/MdePkg/Include/Library/BaseMemoryLib.h
"(CopyMem) must handle the case where SourceBuffer overlaps DestinationBuffer".

Having the gnu-efi version of CopyMem differ from the EDK2 version can lead to
extremely hard to troubleshoot issues as well as very unexpected results. So
make sure our version follows the same guidelines.
2021-03-08 14:58:21 -05:00
Nigel Croxon
d34132e62f * Fixed typeo lib/error.c EFI_WARN_UNKNOWN_GLYPH definition.
On couple of locations in runtime string library (rtstr.c)
there are calls to non-runtime variant of StrLen function.
* Another issue is with formatting 1394 paths.
The F1394_DEVICE_PATH::Guid is formatted as %g, but 1394
GUID is 8 byte integer, not EFI_GUID and therefore should
be formatted as e.g. %016lx (as edk2 does).
* Beyond what's mentioned above, changed the format of the
harddrive path, so it's in line with edk2 format and spec
(2.7 errata A, chapter 10.6.1.6, table 102).

Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
Signed-off-by: manison <manison@users.sf.net>
2019-01-09 07:03:46 -05:00
Gary Lin
5bb5032fda Set '\0' properly in StrnCpy()
The arguments to SetMem() were wrong. Besides, SetMem() should start at
"Dest + Size" since "Size" will be smaller than "Len" if they are not
equal.

Signed-off-by: Gary Lin <glin@suse.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-10-12 08:17:20 -04:00
Gary Lin
ba250504b9 Implement StrnCat() without StrnCpy()
StrnCpy() doesn't guarantee the dest string will be null-terminated, so
we shouldn't use StrnCpy().

Signed-off-by: Gary Lin <glin@suse.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-10-11 08:35:12 -04:00
Gary Lin
6058ffcd54 Set '\0' properly in StpnCpy()
The arguments to SetMem() were wrong. Besides, SetMem() should start at
"Dest + Size" since "Size" will be smaller than "Len" if they are not
equal.

Signed-off-by: Gary Lin <glin@suse.com>
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
2018-10-11 08:35:06 -04:00
Pete Batard
85f1c797f6 Fix conversion from 'UINTN' to 'UINT8' warnings
* MSVC generates two of the following in rtstr.c:
  warning C4244: 'function': conversion from 'UINTN' to 'UINT8', possible loss of data
2018-05-01 08:00:48 -04:00
Peter Jones
9485c65f6d gnu-efi: add some more common string functions.
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>
2018-03-14 14:50:23 -04:00
Nigel Croxon
530d68ba19 The gnu-efi-3.0 toplevel subdirectory is really annoying. Kill it.
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Nigel Croxon <nigel.croxon@hp.com>
2014-11-25 10:09:50 -05:00