]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
BaseTools: Update BaseTools to pass VS2015 compiler
[mirror_edk2.git] / BaseTools / Source / C / LzmaCompress / Sdk / C / LzmaEnc.c
index 95c3c9ff5fc7c187623602a87d8eec8d6db3c2ab..9b2dd16ffa4888dd662e0505ef0f71a3d49bf269 100644 (file)
@@ -3,7 +3,7 @@
     LzmaEnc.c -- LZMA Encoder\r
     2009-02-02 : Igor Pavlov : Public domain\r
 \r
-  Copyright (c) 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2011 - 2016, 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
@@ -132,9 +132,9 @@ void LzmaEnc_FastPosInit(Byte *g_FastPos)
   }\r
 }\r
 \r
-#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \\r
+#define BSR2_RET(pos, res) { UInt32 ij = 6 + ((kNumLogBits - 1) & \\r
   (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \\r
-  res = p->g_FastPos[pos >> i] + (i * 2); }\r
+  res = p->g_FastPos[pos >> ij] + (ij * 2); }\r
 /*\r
 #define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \\r
   p->g_FastPos[pos >> 6] + 12 : \\r
@@ -1148,20 +1148,18 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
     #ifdef SHOW_STAT2\r
     if (position >= 0)\r
     {\r
-      unsigned i;\r
+      unsigned ii;\r
       printf("\n pos = %4X", position);\r
-      for (i = cur; i <= lenEnd; i++)\r
-      printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price);\r
+      for (ii = cur; ii <= lenEnd; ii++)\r
+      printf("\nprice[%4X] = %d", position - cur + ii, p->opt[ii].price);\r
     }\r
     #endif\r
 \r
   for (;;)\r
   {\r
-    UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen;\r
-    UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice;\r
+    UInt32 numAvailFull, newLen, posPrev, state, startLen;\r
+    UInt32 curPrice, curAnd1Price;\r
     Bool nextIsChar;\r
-    Byte curByte, matchByte;\r
-    const Byte *data;\r
     COptimal *curOpt;\r
     COptimal *nextOpt;\r
 \r
@@ -1224,7 +1222,6 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
       prevOpt = &p->opt[posPrev];\r
       if (pos < LZMA_NUM_REPS)\r
       {\r
-        UInt32 i;\r
         reps[0] = prevOpt->backs[pos];\r
         for (i = 1; i <= pos; i++)\r
           reps[i] = prevOpt->backs[i - 1];\r
@@ -1233,7 +1230,6 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
       }\r
       else\r
       {\r
-        UInt32 i;\r
         reps[0] = (pos - LZMA_NUM_REPS);\r
         for (i = 1; i < LZMA_NUM_REPS; i++)\r
           reps[i] = prevOpt->backs[i - 1];\r
@@ -1319,12 +1315,11 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
             GET_PRICE_1(p->isRep[state2]);\r
         /* for (; lenTest2 >= 2; lenTest2--) */\r
         {\r
-          UInt32 curAndLenPrice;\r
           COptimal *opt;\r
           UInt32 offset = cur + 1 + lenTest2;\r
           while (lenEnd < offset)\r
             p->opt[++lenEnd].price = kInfinityPrice;\r
-          curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);\r
+          UInt32 curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);\r
           opt = &p->opt[offset];\r
           if (curAndLenPrice < opt->price)\r
           {\r
@@ -1430,7 +1425,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
     }\r
     if (newLen >= startLen)\r
     {\r
-      UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]);\r
+      normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]);\r
       UInt32 offs, curBack, posSlot;\r
       UInt32 lenTest;\r
       while (lenEnd < cur + newLen)\r
@@ -1443,7 +1438,8 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
       GetPosSlot2(curBack, posSlot);\r
       for (lenTest = /*2*/ startLen; ; lenTest++)\r
       {\r
-        UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN];\r
+        UInt32 curAndLenPrice;\r
+        curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN];\r
         UInt32 lenToPosState = GetLenToPosState(lenTest);\r
         COptimal *opt;\r
         if (curBack < kNumFullDistances)\r
@@ -1488,8 +1484,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
             /* for (; lenTest2 >= 2; lenTest2--) */\r
             {\r
               UInt32 offset = cur + lenTest + 1 + lenTest2;\r
-              UInt32 curAndLenPrice;\r
-              COptimal *opt;\r
+\r
               while (lenEnd < offset)\r
                 p->opt[++lenEnd].price = kInfinityPrice;\r
               curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);\r
@@ -1697,7 +1692,7 @@ static void FillDistancesPrices(CLzmaEnc *p)
 \r
     {\r
       UInt32 *distancesPrices = p->distancesPrices[lenToPosState];\r
-      UInt32 i;\r
+\r
       for (i = 0; i < kStartPosModelIndex; i++)\r
         distancesPrices[i] = posSlotPrices[i];\r
       for (; i < kNumFullDistances; i++)\r