]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Update BaseTools to pass VS2015 compiler
authorYonghong Zhu <yonghong.zhu@intel.com>
Fri, 29 Jan 2016 04:54:37 +0000 (04:54 +0000)
committeryzhu52 <yzhu52@Edk2>
Fri, 29 Jan 2016 04:54:37 +0000 (04:54 +0000)
Fix some errors to pass VS2015 compiler.
1. warning C4456: declaration of xxx hides previous local declaration
2. warning C4005: 'UINT8_MAX': macro redefinition

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19768 6f19259b-4bc3-4df7-8a09-765794883524

BaseTools/Source/C/GenFw/Elf32Convert.c
BaseTools/Source/C/GenVtf/GenVtf.c
BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaDec.c
BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
BaseTools/Source/C/VfrCompile/VfrSyntax.g

index eede64576940a57be3d69c643e0f85fa4f8e0372..9bf58555c076c88a8cef657a7d2a4f98e4c37aac 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Elf32 Convert solution\r
 \r
-Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
 Portions copyright (c) 2013, ARM Ltd. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials are licensed and made available\r
@@ -815,7 +815,7 @@ WriteRelocations32 (
 \r
         FoundRelocations = TRUE;\r
         for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) {\r
-          Elf_Rel  *Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx);\r
+          Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx);\r
 \r
           if (mEhdr->e_machine == EM_386) { \r
             switch (ELF_R_TYPE(Rel->r_info)) {\r
index 6f66ddc84292cdd3273d1f98969a7195557154a9..9a3f5081a70ce92b30549e60cd34194205ee01ce 100644 (file)
@@ -2,7 +2,7 @@
 This file contains functions required to generate a boot strap file (BSF) also \r
 known as the Volume Top File (VTF)\r
 \r
-Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>\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
 distribution.  The full text of the license may be found at\r
@@ -2652,20 +2652,20 @@ Returns:
     SymFileName = VTF_SYM_FILE;\r
   } else {\r
     INTN OutFileNameLen = strlen(OutFileName1);\r
-    INTN Index;\r
+    INTN NewIndex;\r
 \r
-    for (Index = OutFileNameLen; Index > 0; --Index) {\r
-      if (OutFileName1[Index] == '/' || OutFileName1[Index] == '\\') {\r
+    for (NewIndex = OutFileNameLen; NewIndex > 0; --NewIndex) {\r
+      if (OutFileName1[NewIndex] == '/' || OutFileName1[NewIndex] == '\\') {\r
         break;\r
       }\r
     }\r
-    if (Index == 0) {\r
+    if (NewIndex == 0) {\r
       SymFileName = VTF_SYM_FILE;\r
     } else {\r
-      INTN SymFileNameLen = Index + 1 + strlen(VTF_SYM_FILE);\r
+      INTN SymFileNameLen = NewIndex + 1 + strlen(VTF_SYM_FILE);\r
       SymFileName = malloc(SymFileNameLen + 1);\r
-      memcpy(SymFileName, OutFileName1, Index + 1);\r
-      memcpy(SymFileName + Index + 1, VTF_SYM_FILE, strlen(VTF_SYM_FILE));\r
+      memcpy(SymFileName, OutFileName1, NewIndex + 1);\r
+      memcpy(SymFileName + NewIndex + 1, VTF_SYM_FILE, strlen(VTF_SYM_FILE));\r
       SymFileName[SymFileNameLen] = '\0';\r
     }\r
     if (DebugMode) {\r
index eb5250174b18ef1e0bc33b3954ae6926dea13627..87bea866e4a1324b0c1586784023f98089988182 100644 (file)
@@ -266,7 +266,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
         prob = probs + RepLenCoder;\r
       }\r
       {\r
-        unsigned limit, offset;\r
+        unsigned offset;\r
         CLzmaProb *probLen = prob + LenChoice;\r
         IF_BIT_0(probLen)\r
         {\r
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
index d74fec8815c1f4e5726777d4e31192eb5a549b40..55a9a23ff2d7e0c834402ed75207711d6e04b2eb 100644 (file)
@@ -1,7 +1,7 @@
 /*++ @file\r
 Vfr Syntax\r
 \r
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 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
@@ -23,6 +23,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 >>\r
 \r
 <<\r
+#ifdef UINT8_MAX\r
+#undef UINT8_MAX\r
+#endif\r
 #include "stdio.h"\r
 #include "PBlackBox.h"\r
 #include "DLexerBase.h"\r