]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellLevel2CommandsLib/Map.c
Use a compare operator for Non-Boolean comparison in 'map.c'.
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel2CommandsLib / Map.c
index 590dbf79e34f2bb3451a3a659178e752268c740a..4763cfccca535a38ce026fff184071d7d4bf84bf 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Main file for map shell level 2 command.\r
 \r
-  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2014, 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
@@ -345,6 +345,7 @@ MappingListHasType(
     FreePool(NewSpecific);\r
   }\r
   if (  Consist\r
+    && Specific == NULL\r
     && (SearchList(MapList, L"HD*",  NULL, TRUE, TRUE, L";")\r
       ||SearchList(MapList, L"CD*",  NULL, TRUE, TRUE, L";")\r
       ||SearchList(MapList, L"F*",   NULL, TRUE, TRUE, L";")\r
@@ -353,6 +354,7 @@ MappingListHasType(
   }\r
 \r
   if (  Normal\r
+    && Specific == NULL\r
     && (SearchList(MapList, L"FS",  NULL, FALSE, TRUE, L";")\r
       ||SearchList(MapList, L"BLK", NULL, FALSE, TRUE, L";"))){\r
     return (TRUE);\r
@@ -416,7 +418,11 @@ PerformSingleMappingDisplay(
     return EFI_NOT_FOUND;\r
   }\r
 \r
-  if (Normal) {\r
+  if (Normal || !Consist) {\r
+    //\r
+    // need the Normal here since people can use both on command line.  otherwise unused.\r
+    //\r
+\r
     //\r
     // Allocate a name\r
     //\r
@@ -434,7 +440,7 @@ PerformSingleMappingDisplay(
     if (TempSpot != NULL) {\r
       *TempSpot = CHAR_NULL;\r
     }\r
-  } else if (Consist) {\r
+  } else {\r
     CurrentName = NULL;\r
 \r
     //\r
@@ -468,6 +474,9 @@ PerformSingleMappingDisplay(
       }\r
     } else {\r
       Alias = StrnCatGrow(&Alias, 0, MapList, 0);\r
+      if (Alias == NULL) {\r
+        return EFI_OUT_OF_RESOURCES;\r
+      }\r
       TempSpot = StrStr(Alias, CurrentName);\r
       if (TempSpot != NULL) {\r
         TempSpot2 = StrStr(TempSpot, L";");\r
@@ -482,12 +491,10 @@ PerformSingleMappingDisplay(
         Alias[StrLen(Alias)-1] = CHAR_NULL;\r
       }\r
     }\r
-  } else {\r
-    CurrentName = NULL;\r
   }\r
   DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);\r
+  TempLen = StrLen(CurrentName);\r
   if (!SFO) {\r
-    TempLen = StrLen(CurrentName);\r
     ShellPrintHiiEx (\r
       -1,\r
       -1,\r
@@ -521,7 +528,6 @@ PerformSingleMappingDisplay(
       SHELL_FREE_NON_NULL(MediaType);\r
     }\r
   } else {\r
-    TempLen = StrLen(CurrentName);\r
     ShellPrintHiiEx (\r
       -1,\r
       -1,\r