]> git.proxmox.com Git - mirror_edk2.git/blobdiff - FatPkg/FatPei/FatLiteLib.c
FatPkg: Refine casting expression result to bigger size
[mirror_edk2.git] / FatPkg / FatPei / FatLiteLib.c
index b5191b6706f01dfe21dc5762e687e36bee6033c4..109789a54baa0e412e52913256dc8c92fb4c0d82 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   General purpose supporting routines for FAT recovery PEIM\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials are licensed and made available\r
 under the terms and conditions of the BSD License which accompanies this\r
@@ -87,7 +87,17 @@ FatReadBlock (
     // Status = BlockDev->ReadFunc\r
     //  (PrivateData->PeiServices, BlockDev->PhysicalDevNo, Lba, BufferSize, Buffer);\r
     //\r
-    Status = BlockDev->BlockIo->ReadBlocks (\r
+    if (BlockDev->BlockIo2 != NULL) {\r
+      Status = BlockDev->BlockIo2->ReadBlocks (\r
+                                    (EFI_PEI_SERVICES **) GetPeiServicesTablePointer (),\r
+                                    BlockDev->BlockIo2,\r
+                                    BlockDev->PhysicalDevNo,\r
+                                    Lba,\r
+                                    BufferSize,\r
+                                    Buffer\r
+                                    );\r
+    } else {\r
+      Status = BlockDev->BlockIo->ReadBlocks (\r
                                   (EFI_PEI_SERVICES **) GetPeiServicesTablePointer (),\r
                                   BlockDev->BlockIo,\r
                                   BlockDev->PhysicalDevNo,\r
@@ -95,6 +105,7 @@ FatReadBlock (
                                   BufferSize,\r
                                   Buffer\r
                                   );\r
+    }\r
 \r
   } else {\r
     Status = FatReadDisk (\r
@@ -317,15 +328,16 @@ EngFatToStr (
   // No DBCS issues, just expand and add null terminate to end of string\r
   //\r
   while (*Fat != 0 && FatSize != 0) {\r
+    if (*Fat == ' ') {\r
+      break;\r
+    }\r
     *String = *Fat;\r
     String += 1;\r
     Fat += 1;\r
     FatSize -= 1;\r
-    if (*Fat == ' ') {\r
-      *String = 0;\r
-      return ;\r
-    }\r
   }\r
+\r
+  *String = 0;\r
 }\r
 \r
 \r