]> git.proxmox.com Git - mirror_edk2.git/commitdiff
change file global variable to function local.
authorjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 13 Apr 2011 23:37:50 +0000 (23:37 +0000)
committerjcarsey <jcarsey@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 13 Apr 2011 23:37:50 +0000 (23:37 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11539 6f19259b-4bc3-4df7-8a09-765794883524

ShellPkg/Library/UefiShellLib/UefiShellLib.c

index ba0395dec2a45b333ddd156ab8d36751bf969d9e..d4a80e403c3e5d6aca248754da1321ffa1d0d232 100644 (file)
@@ -34,8 +34,6 @@ EFI_SHELL_PROTOCOL            *mEfiShellProtocol;
 EFI_SHELL_PARAMETERS_PROTOCOL *mEfiShellParametersProtocol;\r
 EFI_HANDLE                    mEfiShellEnvironment2Handle;\r
 FILE_HANDLE_FUNCTION_MAP      FileFunctionMap;\r
 EFI_SHELL_PARAMETERS_PROTOCOL *mEfiShellParametersProtocol;\r
 EFI_HANDLE                    mEfiShellEnvironment2Handle;\r
 FILE_HANDLE_FUNCTION_MAP      FileFunctionMap;\r
-CHAR16                        *mPostReplaceFormat;\r
-CHAR16                        *mPostReplaceFormat2;\r
 \r
 /**\r
   Check if a Unicode character is a hexadecimal character.\r
 \r
 /**\r
   Check if a Unicode character is a hexadecimal character.\r
@@ -177,10 +175,6 @@ ShellLibConstructorWorker (
   )\r
 {\r
   EFI_STATUS  Status;\r
   )\r
 {\r
   EFI_STATUS  Status;\r
-  mPostReplaceFormat = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize));\r
-  ASSERT (mPostReplaceFormat != NULL);\r
-  mPostReplaceFormat2 = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize));\r
-  ASSERT (mPostReplaceFormat2 != NULL);\r
 \r
   //\r
   // UEFI 2.0 shell interfaces (used preferentially)\r
 \r
   //\r
   // UEFI 2.0 shell interfaces (used preferentially)\r
@@ -295,8 +289,6 @@ ShellLibConstructor (
   mEfiShellParametersProtocol = NULL;\r
   mEfiShellInterface          = NULL;\r
   mEfiShellEnvironment2Handle = NULL;\r
   mEfiShellParametersProtocol = NULL;\r
   mEfiShellInterface          = NULL;\r
   mEfiShellEnvironment2Handle = NULL;\r
-  mPostReplaceFormat          = NULL;\r
-  mPostReplaceFormat2         = NULL;\r
 \r
   //\r
   // verify that auto initialize is not set false\r
 \r
   //\r
   // verify that auto initialize is not set false\r
@@ -354,15 +346,6 @@ ShellLibDestructor (
   }\r
   mEfiShellEnvironment2Handle = NULL;\r
 \r
   }\r
   mEfiShellEnvironment2Handle = NULL;\r
 \r
-  if (mPostReplaceFormat != NULL) {\r
-    FreePool(mPostReplaceFormat);\r
-  }\r
-  if (mPostReplaceFormat2 != NULL) {\r
-    FreePool(mPostReplaceFormat2);\r
-  }\r
-  mPostReplaceFormat          = NULL;\r
-  mPostReplaceFormat2         = NULL;\r
-\r
   return (EFI_SUCCESS);\r
 }\r
 \r
   return (EFI_SUCCESS);\r
 }\r
 \r
@@ -1655,6 +1638,9 @@ ShellFindFilePath (
         if (TestPath[StrLen(TestPath)-1] != L'\\') {\r
           StrCat(TestPath, L"\\");\r
         }\r
         if (TestPath[StrLen(TestPath)-1] != L'\\') {\r
           StrCat(TestPath, L"\\");\r
         }\r
+        if (FileName[0] == L'\\') {\r
+          FileName++;\r
+        }\r
         StrCat(TestPath, FileName);\r
         if (StrStr(Walker, L";") != NULL) {\r
           Walker = StrStr(Walker, L";") + 1;\r
         StrCat(TestPath, FileName);\r
         if (StrStr(Walker, L";") != NULL) {\r
           Walker = StrStr(Walker, L";") + 1;\r
@@ -2614,6 +2600,11 @@ InternalShellPrintWorker(
   CHAR16            *ResumeLocation;\r
   CHAR16            *FormatWalker;\r
   UINTN             OriginalAttribute;\r
   CHAR16            *ResumeLocation;\r
   CHAR16            *FormatWalker;\r
   UINTN             OriginalAttribute;\r
+  CHAR16            *mPostReplaceFormat;\r
+  CHAR16            *mPostReplaceFormat2;\r
+\r
+  mPostReplaceFormat = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize));\r
+  mPostReplaceFormat2 = AllocateZeroPool (PcdGet16 (PcdShellPrintBufferSize));\r
 \r
   Status            = EFI_SUCCESS;\r
   OriginalAttribute = gST->ConOut->Mode->Attribute;\r
 \r
   Status            = EFI_SUCCESS;\r
   OriginalAttribute = gST->ConOut->Mode->Attribute;\r
@@ -2705,6 +2696,9 @@ InternalShellPrintWorker(
   }\r
 \r
   gST->ConOut->SetAttribute(gST->ConOut, OriginalAttribute);\r
   }\r
 \r
   gST->ConOut->SetAttribute(gST->ConOut, OriginalAttribute);\r
+\r
+  SHELL_FREE_NON_NULL(mPostReplaceFormat);\r
+  SHELL_FREE_NON_NULL(mPostReplaceFormat2);\r
   return (Status);\r
 }\r
 \r
   return (Status);\r
 }\r
 \r