From 031e5cce385d3f96b1caa1d53495332a7eb03749 Mon Sep 17 00:00:00 2001 From: Steve McIntyre Date: Tue, 23 Mar 2021 23:49:46 +0000 Subject: New upstream version 15.3 --- Cryptlib/SysCall/BaseStrings.c | 50 +++++++++--------------------------------- 1 file changed, 10 insertions(+), 40 deletions(-) (limited to 'Cryptlib/SysCall/BaseStrings.c') diff --git a/Cryptlib/SysCall/BaseStrings.c b/Cryptlib/SysCall/BaseStrings.c index 5c86ff69..29a16100 100644 --- a/Cryptlib/SysCall/BaseStrings.c +++ b/Cryptlib/SysCall/BaseStrings.c @@ -1,9 +1,9 @@ -#include +#include -char * -AsciiStrCat(char *Destination, char *Source) +CHAR8 * +AsciiStrCat(CHAR8 *Destination, const CHAR8 *Source) { - UINTN dest_len = strlena((CHAR8 *)Destination); + UINTN dest_len = strlen((CHAR8 *)Destination); UINTN i; for (i = 0; Source[i] != '\0'; i++) @@ -14,7 +14,7 @@ AsciiStrCat(char *Destination, char *Source) } CHAR8 * -AsciiStrCpy(CHAR8 *Destination, CHAR8 *Source) +AsciiStrCpy(CHAR8 *Destination, const CHAR8 *Source) { UINTN i; @@ -25,8 +25,8 @@ AsciiStrCpy(CHAR8 *Destination, CHAR8 *Source) return Destination; } -char * -AsciiStrnCpy(char *Destination, char *Source, UINTN count) +CHAR8 * +AsciiStrnCpy(CHAR8 *Destination, const CHAR8 *Source, UINTN count) { UINTN i; @@ -59,45 +59,15 @@ WriteUnaligned32(UINT32 *Buffer, UINT32 Value) } UINTN -AsciiStrSize(CHAR8 *string) +AsciiStrSize(const CHAR8 *string) { - return strlena(string) + 1; -} - -int -strcmp (const char *str1, const char *str2) -{ - return strcmpa((CHAR8 *)str1,(CHAR8 *)str2); -} - -inline static char -toupper (char c) -{ - return ((c >= 'a' && c <= 'z') ? c - ('a' - 'A') : c); -} - -/* Based on AsciiStriCmp() in edk2 MdePkg/Library/BaseLib/String.c */ -int -strcasecmp (const char *str1, const char *str2) -{ - char c1, c2; - - c1 = toupper (*str1); - c2 = toupper (*str2); - while ((*str1 != '\0') && (c1 == c2)) { - str1++; - str2++; - c1 = toupper (*str1); - c2 = toupper (*str2); - } - - return c1 - c2; + return strlen(string) + 1; } /* Based on AsciiStrDecimalToUintnS() in edk2 * MdePkg/Library/BaseLib/SafeString.c */ UINTN -AsciiStrDecimalToUintn(const char *String) +AsciiStrDecimalToUintn(const CHAR8 *String) { UINTN Result; -- cgit v1.2.3