]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiDpLib/DpUtilities.c
ShellPkg: Code refine. Add error handling code to check pointer and remove redundant...
[mirror_edk2.git] / ShellPkg / Library / UefiDpLib / DpUtilities.c
index 57c81288da875d7406e2ebf2f8d0812863be611f..ef204ffef156eb2ac0abe437a950459ebe95e3e9 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Utility functions used by the Dp application.\r
 \r
-  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.\r
+  Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.\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
@@ -23,6 +23,7 @@
 #include <Library/PcdLib.h>\r
 #include <Library/UefiLib.h>\r
 #include <Library/DevicePathLib.h>\r
+#include <Library/HandleParsingLib.h>\r
 \r
 #include <Pi/PiFirmwareFile.h>\r
 #include <Library/DxeServicesLib.h>\r
@@ -143,7 +144,7 @@ GetShortPdbFileName (
   ZeroMem (UnicodeBuffer, DXE_PERFORMANCE_STRING_LENGTH * sizeof (CHAR16));\r
 \r
   if (PdbFileName == NULL) {\r
-    StrCpy (UnicodeBuffer, L" ");\r
+    StrnCpy (UnicodeBuffer, L" ", 1);\r
   } else {\r
     StartIndex = 0;\r
     for (EndIndex = 0; PdbFileName[EndIndex] != 0; EndIndex++)\r
@@ -252,7 +253,7 @@ GetNameFromHandle (
     //\r
     // Get the current platform language setting\r
     //\r
-    GetEfiGlobalVariable2 (L"PlatformLang", (VOID**)&PlatformLanguage, NULL);\r
+    PlatformLanguage = GetBestLanguageForDriver(ComponentName2->SupportedLanguages, NULL, FALSE);\r
     Status = ComponentName2->GetDriverName (\r
                                ComponentName2,\r
                                PlatformLanguage != NULL ? PlatformLanguage : "en-US",\r
@@ -333,7 +334,7 @@ GetNameFromHandle (
   //\r
   StringPtr = HiiGetString (gDpHiiHandle, STRING_TOKEN (STR_DP_ERROR_NAME), NULL);\r
   ASSERT (StringPtr != NULL);\r
-  StrCpy (mGaugeString, StringPtr);\r
+  StrnCpy (mGaugeString, StringPtr, DP_GAUGE_STRING_LENGTH);\r
   FreePool (StringPtr);\r
 }\r
 \r