]> git.proxmox.com Git - mirror_edk2.git/blobdiff - MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c
MdePkg: Fix Xcode 9 Beta treating 32-bit left shift as undefined
[mirror_edk2.git] / MdePkg / Library / BaseUefiDecompressLib / BaseUefiDecompressLib.c
index 15c3325cd4eb2f3cd39a2d6acc3fa258039180c3..e818543d925530ee9a9f66245c423c15b22bc2a6 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   UEFI Decompress Library implementation refer to UEFI specification.\r
 \r
-  Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.<BR>\r
   Portions copyright (c) 2008 - 2009, Apple Inc. 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
@@ -40,14 +40,14 @@ FillBuf (
   //\r
   // Left shift NumOfBits of bits in advance\r
   //\r
-  Sd->mBitBuf = (UINT32) (Sd->mBitBuf << NumOfBits);\r
+  Sd->mBitBuf = (UINT32) LShiftU64 (((UINT64)Sd->mBitBuf), NumOfBits);\r
 \r
   //\r
   // Copy data needed in bytes into mSbuBitBuf\r
   //\r
   while (NumOfBits > Sd->mBitCount) {\r
-\r
-    Sd->mBitBuf |= (UINT32) (Sd->mSubBitBuf << (NumOfBits = (UINT16) (NumOfBits - Sd->mBitCount)));\r
+    NumOfBits = (UINT16) (NumOfBits - Sd->mBitCount);\r
+    Sd->mBitBuf |= (UINT32) LShiftU64 (((UINT64)Sd->mSubBitBuf), NumOfBits);\r
 \r
     if (Sd->mCompSize > 0) {\r
       //\r
@@ -68,7 +68,7 @@ FillBuf (
   }\r
 \r
   //\r
-  // Caculate additional bit count read to update mBitCount\r
+  // Calculate additional bit count read to update mBitCount\r
   //\r
   Sd->mBitCount = (UINT16) (Sd->mBitCount - NumOfBits);\r
   \r
@@ -308,7 +308,7 @@ DecodeP (
 /**\r
   Reads code lengths for the Extra Set or the Position Set.\r
 \r
-  Read in the Extra Set or Pointion Set Length Arrary, then\r
+  Read in the Extra Set or Position Set Length Array, then\r
   generate the Huffman code mapping for them.\r
 \r
   @param  Sd      The global scratch data.\r
@@ -333,6 +333,7 @@ ReadPTLen (
   UINT16  Index;\r
   UINT32  Mask;\r
 \r
+  ASSERT (nn <= NPT);\r
   //\r
   // Read Extra Set Code Length Array size \r
   //\r
@@ -507,7 +508,7 @@ DecodeC (
     Sd->mBlockSize    = (UINT16) GetBits (Sd, 16);\r
 \r
     //\r
-    // Read in the Extra Set Code Length Arrary,\r
+    // Read in the Extra Set Code Length Array,\r
     // Generate the Huffman code mapping table for Extra Set.\r
     //\r
     Sd->mBadTableFlag = ReadPTLen (Sd, NT, TBIT, 3);\r
@@ -516,13 +517,13 @@ DecodeC (
     }\r
 \r
     //\r
-    // Read in and decode the Char&Len Set Code Length Arrary,\r
+    // Read in and decode the Char&Len Set Code Length Array,\r
     // Generate the Huffman code mapping table for Char&Len Set.\r
     //\r
     ReadCLen (Sd);\r
 \r
     //\r
-    // Read in the Position Set Code Length Arrary, \r
+    // Read in the Position Set Code Length Array,\r
     // Generate the Huffman code mapping table for the Position Set.\r
     //\r
     Sd->mBadTableFlag = ReadPTLen (Sd, MAXNP, Sd->mPBit, (UINT16) (-1));\r
@@ -776,7 +777,7 @@ UefiDecompress (
   Sd->mSrcBase  = (UINT8 *)Src;\r
   Sd->mDstBase  = Dst;\r
   //\r
-  // CompSize and OrigSize are caculated in bytes\r
+  // CompSize and OrigSize are calculated in bytes\r
   //\r
   Sd->mCompSize = CompSize;\r
   Sd->mOrigSize = OrigSize;\r