if you have a function that takes const arguments and then
e.g. tries to copy StrCmp, gcc will give you warnings about those calls, and the warnings are right. These clutter up other things you might miss that you should be more concerned about. You could work around it through vigorous typecasting to non-const types, but why should you have to? All of these functions are rigorously defined as not changing their input - it is const, and should be marked as such. Signed-off-by: Peter Jones <pjones@redhat.com> Please enter the commit message for your changes. Lines starting
This commit is contained in:
parent
e7a2d1299b
commit
94009cecd7
@ -23,7 +23,9 @@ Revision History
|
||||
typedef UINT16 CHAR16;
|
||||
typedef UINT8 CHAR8;
|
||||
typedef UINT8 BOOLEAN;
|
||||
|
||||
#ifndef CONST
|
||||
#define CONST const
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE ((BOOLEAN) 1)
|
||||
#define FALSE ((BOOLEAN) 0)
|
||||
|
@ -186,34 +186,34 @@ SetMem (
|
||||
VOID
|
||||
CopyMem (
|
||||
IN VOID *Dest,
|
||||
IN VOID *Src,
|
||||
IN CONST VOID *Src,
|
||||
IN UINTN len
|
||||
);
|
||||
|
||||
INTN
|
||||
CompareMem (
|
||||
IN VOID *Dest,
|
||||
IN VOID *Src,
|
||||
IN CONST VOID *Dest,
|
||||
IN CONST VOID *Src,
|
||||
IN UINTN len
|
||||
);
|
||||
|
||||
INTN
|
||||
StrCmp (
|
||||
IN CHAR16 *s1,
|
||||
IN CHAR16 *s2
|
||||
IN CONST CHAR16 *s1,
|
||||
IN CONST CHAR16 *s2
|
||||
);
|
||||
|
||||
INTN
|
||||
StrnCmp (
|
||||
IN CHAR16 *s1,
|
||||
IN CHAR16 *s2,
|
||||
IN CONST CHAR16 *s1,
|
||||
IN CONST CHAR16 *s2,
|
||||
IN UINTN len
|
||||
);
|
||||
|
||||
INTN
|
||||
StriCmp (
|
||||
IN CHAR16 *s1,
|
||||
IN CHAR16 *s2
|
||||
IN CONST CHAR16 *s1,
|
||||
IN CONST CHAR16 *s2
|
||||
);
|
||||
|
||||
VOID
|
||||
@ -229,51 +229,51 @@ StrUpr (
|
||||
VOID
|
||||
StrCpy (
|
||||
IN CHAR16 *Dest,
|
||||
IN CHAR16 *Src
|
||||
IN CONST CHAR16 *Src
|
||||
);
|
||||
|
||||
VOID
|
||||
StrCat (
|
||||
IN CHAR16 *Dest,
|
||||
IN CHAR16 *Src
|
||||
IN CONST CHAR16 *Src
|
||||
);
|
||||
|
||||
UINTN
|
||||
StrLen (
|
||||
IN CHAR16 *s1
|
||||
IN CONST CHAR16 *s1
|
||||
);
|
||||
|
||||
UINTN
|
||||
StrSize (
|
||||
IN CHAR16 *s1
|
||||
IN CONST CHAR16 *s1
|
||||
);
|
||||
|
||||
CHAR16 *
|
||||
StrDuplicate (
|
||||
IN CHAR16 *Src
|
||||
IN CONST CHAR16 *Src
|
||||
);
|
||||
|
||||
UINTN
|
||||
strlena (
|
||||
IN CHAR8 *s1
|
||||
IN CONST CHAR8 *s1
|
||||
);
|
||||
|
||||
UINTN
|
||||
strcmpa (
|
||||
IN CHAR8 *s1,
|
||||
IN CHAR8 *s2
|
||||
IN CONST CHAR8 *s1,
|
||||
IN CONST CHAR8 *s2
|
||||
);
|
||||
|
||||
UINTN
|
||||
strncmpa (
|
||||
IN CHAR8 *s1,
|
||||
IN CHAR8 *s2,
|
||||
IN CONST CHAR8 *s1,
|
||||
IN CONST CHAR8 *s2,
|
||||
IN UINTN len
|
||||
);
|
||||
|
||||
UINTN
|
||||
xtoi (
|
||||
CHAR16 *str
|
||||
CONST CHAR16 *str
|
||||
);
|
||||
|
||||
UINTN
|
||||
|
@ -42,23 +42,23 @@ VOID
|
||||
RUNTIMEFUNCTION
|
||||
RtCopyMem (
|
||||
IN VOID *Dest,
|
||||
IN VOID *Src,
|
||||
IN CONST VOID *Src,
|
||||
IN UINTN len
|
||||
);
|
||||
|
||||
INTN
|
||||
RUNTIMEFUNCTION
|
||||
RtCompareMem (
|
||||
IN VOID *Dest,
|
||||
IN VOID *Src,
|
||||
IN CONST VOID *Dest,
|
||||
IN CONST VOID *Src,
|
||||
IN UINTN len
|
||||
);
|
||||
|
||||
INTN
|
||||
RUNTIMEFUNCTION
|
||||
RtStrCmp (
|
||||
IN CHAR16 *s1,
|
||||
IN CHAR16 *s2
|
||||
IN CONST CHAR16 *s1,
|
||||
IN CONST CHAR16 *s2
|
||||
);
|
||||
|
||||
|
||||
@ -66,26 +66,26 @@ VOID
|
||||
RUNTIMEFUNCTION
|
||||
RtStrCpy (
|
||||
IN CHAR16 *Dest,
|
||||
IN CHAR16 *Src
|
||||
IN CONST CHAR16 *Src
|
||||
);
|
||||
|
||||
VOID
|
||||
RUNTIMEFUNCTION
|
||||
RtStrCat (
|
||||
IN CHAR16 *Dest,
|
||||
IN CHAR16 *Src
|
||||
IN CONST CHAR16 *Src
|
||||
);
|
||||
|
||||
UINTN
|
||||
RUNTIMEFUNCTION
|
||||
RtStrLen (
|
||||
IN CHAR16 *s1
|
||||
IN CONST CHAR16 *s1
|
||||
);
|
||||
|
||||
UINTN
|
||||
RUNTIMEFUNCTION
|
||||
RtStrSize (
|
||||
IN CHAR16 *s1
|
||||
IN CONST CHAR16 *s1
|
||||
);
|
||||
|
||||
INTN
|
||||
|
@ -111,7 +111,7 @@ SetMem (
|
||||
VOID
|
||||
CopyMem (
|
||||
IN VOID *Dest,
|
||||
IN VOID *Src,
|
||||
IN CONST VOID *Src,
|
||||
IN UINTN len
|
||||
)
|
||||
{
|
||||
@ -120,8 +120,8 @@ CopyMem (
|
||||
|
||||
INTN
|
||||
CompareMem (
|
||||
IN VOID *Dest,
|
||||
IN VOID *Src,
|
||||
IN CONST VOID *Dest,
|
||||
IN CONST VOID *Src,
|
||||
IN UINTN len
|
||||
)
|
||||
{
|
||||
|
@ -64,14 +64,13 @@ VOID
|
||||
RUNTIMEFUNCTION
|
||||
RtCopyMem (
|
||||
IN VOID *Dest,
|
||||
IN VOID *Src,
|
||||
IN CONST VOID *Src,
|
||||
IN UINTN len
|
||||
)
|
||||
{
|
||||
CHAR8 *d, *s;
|
||||
|
||||
CHAR8 *d;
|
||||
CONST CHAR8 *s = Src;
|
||||
d = Dest;
|
||||
s = Src;
|
||||
while (len--) {
|
||||
*(d++) = *(s++);
|
||||
}
|
||||
@ -83,15 +82,12 @@ RtCopyMem (
|
||||
INTN
|
||||
RUNTIMEFUNCTION
|
||||
RtCompareMem (
|
||||
IN VOID *Dest,
|
||||
IN VOID *Src,
|
||||
IN CONST VOID *Dest,
|
||||
IN CONST VOID *Src,
|
||||
IN UINTN len
|
||||
)
|
||||
{
|
||||
CHAR8 *d, *s;
|
||||
|
||||
d = Dest;
|
||||
s = Src;
|
||||
CONST CHAR8 *d = Dest, *s = Src;
|
||||
while (len--) {
|
||||
if (*d != *s) {
|
||||
return *d - *s;
|
||||
|
@ -23,8 +23,8 @@ Revision History
|
||||
INTN
|
||||
RUNTIMEFUNCTION
|
||||
RtStrCmp (
|
||||
IN CHAR16 *s1,
|
||||
IN CHAR16 *s2
|
||||
IN CONST CHAR16 *s1,
|
||||
IN CONST CHAR16 *s2
|
||||
)
|
||||
// compare strings
|
||||
{
|
||||
@ -47,7 +47,7 @@ VOID
|
||||
RUNTIMEFUNCTION
|
||||
RtStrCpy (
|
||||
IN CHAR16 *Dest,
|
||||
IN CHAR16 *Src
|
||||
IN CONST CHAR16 *Src
|
||||
)
|
||||
// copy strings
|
||||
{
|
||||
@ -64,7 +64,7 @@ VOID
|
||||
RUNTIMEFUNCTION
|
||||
RtStrCat (
|
||||
IN CHAR16 *Dest,
|
||||
IN CHAR16 *Src
|
||||
IN CONST CHAR16 *Src
|
||||
)
|
||||
{
|
||||
RtStrCpy(Dest+StrLen(Dest), Src);
|
||||
@ -76,7 +76,7 @@ RtStrCat (
|
||||
UINTN
|
||||
RUNTIMEFUNCTION
|
||||
RtStrLen (
|
||||
IN CHAR16 *s1
|
||||
IN CONST CHAR16 *s1
|
||||
)
|
||||
// string length
|
||||
{
|
||||
@ -92,7 +92,7 @@ RtStrLen (
|
||||
UINTN
|
||||
RUNTIMEFUNCTION
|
||||
RtStrSize (
|
||||
IN CHAR16 *s1
|
||||
IN CONST CHAR16 *s1
|
||||
)
|
||||
// string size
|
||||
{
|
||||
|
@ -20,8 +20,8 @@ Revision History
|
||||
|
||||
INTN
|
||||
StrCmp (
|
||||
IN CHAR16 *s1,
|
||||
IN CHAR16 *s2
|
||||
IN CONST CHAR16 *s1,
|
||||
IN CONST CHAR16 *s2
|
||||
)
|
||||
// compare strings
|
||||
{
|
||||
@ -30,8 +30,8 @@ StrCmp (
|
||||
|
||||
INTN
|
||||
StrnCmp (
|
||||
IN CHAR16 *s1,
|
||||
IN CHAR16 *s2,
|
||||
IN CONST CHAR16 *s1,
|
||||
IN CONST CHAR16 *s2,
|
||||
IN UINTN len
|
||||
)
|
||||
// compare strings
|
||||
@ -70,15 +70,15 @@ LibStubStrLwrUpr (
|
||||
|
||||
INTN
|
||||
StriCmp (
|
||||
IN CHAR16 *s1,
|
||||
IN CHAR16 *s2
|
||||
IN CONST CHAR16 *s1,
|
||||
IN CONST CHAR16 *s2
|
||||
)
|
||||
// compare strings
|
||||
{
|
||||
if (UnicodeInterface == &LibStubUnicodeInterface)
|
||||
return UnicodeInterface->StriColl(UnicodeInterface, s1, s2);
|
||||
return UnicodeInterface->StriColl(UnicodeInterface, (CHAR16 *)s1, (CHAR16 *)s2);
|
||||
else
|
||||
return uefi_call_wrapper(UnicodeInterface->StriColl, 3, UnicodeInterface, s1, s2);
|
||||
return uefi_call_wrapper(UnicodeInterface->StriColl, 3, UnicodeInterface, (CHAR16 *)s1, (CHAR16 *)s2);
|
||||
}
|
||||
|
||||
VOID
|
||||
@ -106,7 +106,7 @@ StrUpr (
|
||||
VOID
|
||||
StrCpy (
|
||||
IN CHAR16 *Dest,
|
||||
IN CHAR16 *Src
|
||||
IN CONST CHAR16 *Src
|
||||
)
|
||||
// copy strings
|
||||
{
|
||||
@ -116,7 +116,7 @@ StrCpy (
|
||||
VOID
|
||||
StrCat (
|
||||
IN CHAR16 *Dest,
|
||||
IN CHAR16 *Src
|
||||
IN CONST CHAR16 *Src
|
||||
)
|
||||
{
|
||||
RtStrCat(Dest, Src);
|
||||
@ -124,7 +124,7 @@ StrCat (
|
||||
|
||||
UINTN
|
||||
StrLen (
|
||||
IN CHAR16 *s1
|
||||
IN CONST CHAR16 *s1
|
||||
)
|
||||
// string length
|
||||
{
|
||||
@ -133,7 +133,7 @@ StrLen (
|
||||
|
||||
UINTN
|
||||
StrSize (
|
||||
IN CHAR16 *s1
|
||||
IN CONST CHAR16 *s1
|
||||
)
|
||||
// string size
|
||||
{
|
||||
@ -142,7 +142,7 @@ StrSize (
|
||||
|
||||
CHAR16 *
|
||||
StrDuplicate (
|
||||
IN CHAR16 *Src
|
||||
IN CONST CHAR16 *Src
|
||||
)
|
||||
// duplicate a string
|
||||
{
|
||||
@ -159,7 +159,7 @@ StrDuplicate (
|
||||
|
||||
UINTN
|
||||
strlena (
|
||||
IN CHAR8 *s1
|
||||
IN CONST CHAR8 *s1
|
||||
)
|
||||
// string length
|
||||
{
|
||||
@ -171,8 +171,8 @@ strlena (
|
||||
|
||||
UINTN
|
||||
strcmpa (
|
||||
IN CHAR8 *s1,
|
||||
IN CHAR8 *s2
|
||||
IN CONST CHAR8 *s1,
|
||||
IN CONST CHAR8 *s2
|
||||
)
|
||||
// compare strings
|
||||
{
|
||||
@ -190,8 +190,8 @@ strcmpa (
|
||||
|
||||
UINTN
|
||||
strncmpa (
|
||||
IN CHAR8 *s1,
|
||||
IN CHAR8 *s2,
|
||||
IN CONST CHAR8 *s1,
|
||||
IN CONST CHAR8 *s2,
|
||||
IN UINTN len
|
||||
)
|
||||
// compare strings
|
||||
@ -213,7 +213,7 @@ strncmpa (
|
||||
|
||||
UINTN
|
||||
xtoi (
|
||||
CHAR16 *str
|
||||
CONST CHAR16 *str
|
||||
)
|
||||
// convert hex string to uint
|
||||
{
|
||||
@ -244,7 +244,7 @@ xtoi (
|
||||
|
||||
UINTN
|
||||
Atoi (
|
||||
CHAR16 *str
|
||||
CONST CHAR16 *str
|
||||
)
|
||||
// convert hex string to uint
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user