Merge pull request #6 from gmbr3/RuntimeError
Align RTLIB CopyMem/SetMem with normal versions
This commit is contained in:
commit
bfaaec428b
@ -45,6 +45,7 @@ RtZeroMem (
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
RUNTIMEFUNCTION
|
||||
RtSetMem (
|
||||
IN VOID *Buffer,
|
||||
@ -53,10 +54,11 @@ RtSetMem (
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
RUNTIMEFUNCTION
|
||||
RtCopyMem (
|
||||
IN VOID *Dest,
|
||||
IN CONST VOID *Src,
|
||||
IN VOID *Src,
|
||||
IN UINTN len
|
||||
);
|
||||
|
||||
|
@ -42,6 +42,7 @@ RtZeroMem (
|
||||
#pragma RUNTIME_CODE(RtSetMem)
|
||||
#endif
|
||||
VOID
|
||||
EFIAPI
|
||||
RUNTIMEFUNCTION
|
||||
RtSetMem (
|
||||
IN VOID *Buffer,
|
||||
@ -61,10 +62,11 @@ RtSetMem (
|
||||
#pragma RUNTIME_CODE(RtCopyMem)
|
||||
#endif
|
||||
VOID
|
||||
EFIAPI
|
||||
RUNTIMEFUNCTION
|
||||
RtCopyMem (
|
||||
IN VOID *Dest,
|
||||
IN CONST VOID *Src,
|
||||
IN VOID *Src,
|
||||
IN UINTN len
|
||||
)
|
||||
{
|
||||
|
@ -69,10 +69,13 @@ RtStrnCpy (
|
||||
)
|
||||
// copy strings
|
||||
{
|
||||
CHAR16 CopySrc = *Src;
|
||||
CHAR16 *PCopySrc = &CopySrc;
|
||||
|
||||
UINTN Size = RtStrnLen(Src, Len);
|
||||
if (Size != Len)
|
||||
RtSetMem(Dest + Size, (Len - Size) * sizeof(CHAR16), '\0');
|
||||
RtCopyMem(Dest, Src, Size * sizeof(CHAR16));
|
||||
RtCopyMem(Dest, PCopySrc, Size * sizeof(CHAR16));
|
||||
}
|
||||
|
||||
#ifndef __GNUC__
|
||||
@ -105,10 +108,13 @@ RtStpnCpy (
|
||||
)
|
||||
// copy strings
|
||||
{
|
||||
CHAR16 CopySrc = *Src;
|
||||
CHAR16 *PCopySrc = &CopySrc;
|
||||
|
||||
UINTN Size = RtStrnLen(Src, Len);
|
||||
if (Size != Len)
|
||||
RtSetMem(Dest + Size, (Len - Size) * sizeof(CHAR16), '\0');
|
||||
RtCopyMem(Dest, Src, Size * sizeof(CHAR16));
|
||||
RtCopyMem(Dest, PCopySrc, Size * sizeof(CHAR16));
|
||||
return Dest + Size;
|
||||
}
|
||||
|
||||
@ -137,10 +143,12 @@ RtStrnCat (
|
||||
)
|
||||
{
|
||||
UINTN DestSize, Size;
|
||||
CHAR16 CopySrc = *Src;
|
||||
CHAR16 *PCopySrc = &CopySrc;
|
||||
|
||||
DestSize = RtStrLen(Dest);
|
||||
Size = RtStrnLen(Src, Len);
|
||||
RtCopyMem(Dest + DestSize, Src, Size * sizeof(CHAR16));
|
||||
RtCopyMem(Dest + DestSize, PCopySrc, Size * sizeof(CHAR16));
|
||||
Dest[DestSize + Size] = '\0';
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user