]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellLib/UefiShellLib.c
EmbeddedPkg/PrePiLib: Correct function name
[mirror_edk2.git] / ShellPkg / Library / UefiShellLib / UefiShellLib.c
index 580a1ee612d6c641d0e310b2ad7e630a5ad73732..f3d6e42b2082f83c8d8eec1f0a3951410a74f0a2 100644 (file)
@@ -3,7 +3,7 @@
 \r
   (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
   Copyright 2016-2018 Dell Technologies.<BR>\r
-  Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
   This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
@@ -72,6 +72,7 @@ FullyQualifyPath(
 {\r
   CONST CHAR16         *WorkingPath;\r
   CONST CHAR16         *InputPath;\r
+  CHAR16               *CharPtr;\r
   CHAR16               *InputFileSystem;\r
   UINTN                FileSystemCharCount;\r
   CHAR16               *FullyQualifiedPath;\r
@@ -131,7 +132,10 @@ FullyQualifyPath(
         // truncate the new path after the file system part.\r
         //\r
         StrCpyS(FullyQualifiedPath, Size/sizeof(CHAR16), WorkingPath);\r
-        *(StrStr(FullyQualifiedPath, L":") + 1) = CHAR_NULL;\r
+        CharPtr = StrStr(FullyQualifiedPath, L":");\r
+        if (CharPtr != NULL) {\r
+          *(CharPtr + 1) = CHAR_NULL;\r
+        }\r
       } else {\r
         //\r
         // Relative path: start with the working directory and append "\".\r
@@ -3736,33 +3740,6 @@ ShellFileExists(
   return (EFI_SUCCESS);\r
 }\r
 \r
-/**\r
-  Convert a Unicode character to upper case only if\r
-  it maps to a valid small-case ASCII character.\r
-\r
-  This internal function only deal with Unicode character\r
-  which maps to a valid small-case ASCII character, i.e.\r
-  L'a' to L'z'. For other Unicode character, the input character\r
-  is returned directly.\r
-\r
-  @param  Char  The character to convert.\r
-\r
-  @retval LowerCharacter   If the Char is with range L'a' to L'z'.\r
-  @retval Unchanged        Otherwise.\r
-\r
-**/\r
-CHAR16\r
-InternalShellCharToUpper (\r
-  IN      CHAR16                    Char\r
-  )\r
-{\r
-  if (Char >= L'a' && Char <= L'z') {\r
-    return (CHAR16) (Char - (L'a' - L'A'));\r
-  }\r
-\r
-  return Char;\r
-}\r
-\r
 /**\r
   Convert a Unicode character to numerical value.\r
 \r
@@ -3785,7 +3762,7 @@ InternalShellHexCharToUintn (
     return Char - L'0';\r
   }\r
 \r
-  return (10 + InternalShellCharToUpper (Char) - L'A');\r
+  return (10 + CharToUpper (Char) - L'A');\r
 }\r
 \r
 /**\r
@@ -3845,7 +3822,7 @@ InternalShellStrHexToUint64 (
     String++;\r
   }\r
 \r
-  if (InternalShellCharToUpper (*String) == L'X') {\r
+  if (CharToUpper (*String) == L'X') {\r
     if (*(String - 1) != L'0') {\r
       return 0;\r
     }\r