BaseTools: Update BaseTools to pass VS2015 compiler

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
This commit is contained in:
Yonghong Zhu 2016-01-29 04:54:37 +00:00 committed by yzhu52
parent e459de7800
commit 5aec6991e7
5 changed files with 29 additions and 31 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
Elf32 Convert solution Elf32 Convert solution
Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR> Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
Portions copyright (c) 2013, ARM Ltd. All rights reserved.<BR> Portions copyright (c) 2013, ARM Ltd. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available This program and the accompanying materials are licensed and made available
@ -815,7 +815,7 @@ WriteRelocations32 (
FoundRelocations = TRUE; FoundRelocations = TRUE;
for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) { for (RelIdx = 0; RelIdx < RelShdr->sh_size; RelIdx += RelShdr->sh_entsize) {
Elf_Rel *Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx); Rel = (Elf_Rel *)((UINT8*)mEhdr + RelShdr->sh_offset + RelIdx);
if (mEhdr->e_machine == EM_386) { if (mEhdr->e_machine == EM_386) {
switch (ELF_R_TYPE(Rel->r_info)) { switch (ELF_R_TYPE(Rel->r_info)) {

View File

@ -2,7 +2,7 @@
This file contains functions required to generate a boot strap file (BSF) also This file contains functions required to generate a boot strap file (BSF) also
known as the Volume Top File (VTF) known as the Volume Top File (VTF)
Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR> Copyright (c) 1999 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials are licensed and made available This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at distribution. The full text of the license may be found at
@ -2652,20 +2652,20 @@ Returns:
SymFileName = VTF_SYM_FILE; SymFileName = VTF_SYM_FILE;
} else { } else {
INTN OutFileNameLen = strlen(OutFileName1); INTN OutFileNameLen = strlen(OutFileName1);
INTN Index; INTN NewIndex;
for (Index = OutFileNameLen; Index > 0; --Index) { for (NewIndex = OutFileNameLen; NewIndex > 0; --NewIndex) {
if (OutFileName1[Index] == '/' || OutFileName1[Index] == '\\') { if (OutFileName1[NewIndex] == '/' || OutFileName1[NewIndex] == '\\') {
break; break;
} }
} }
if (Index == 0) { if (NewIndex == 0) {
SymFileName = VTF_SYM_FILE; SymFileName = VTF_SYM_FILE;
} else { } else {
INTN SymFileNameLen = Index + 1 + strlen(VTF_SYM_FILE); INTN SymFileNameLen = NewIndex + 1 + strlen(VTF_SYM_FILE);
SymFileName = malloc(SymFileNameLen + 1); SymFileName = malloc(SymFileNameLen + 1);
memcpy(SymFileName, OutFileName1, Index + 1); memcpy(SymFileName, OutFileName1, NewIndex + 1);
memcpy(SymFileName + Index + 1, VTF_SYM_FILE, strlen(VTF_SYM_FILE)); memcpy(SymFileName + NewIndex + 1, VTF_SYM_FILE, strlen(VTF_SYM_FILE));
SymFileName[SymFileNameLen] = '\0'; SymFileName[SymFileNameLen] = '\0';
} }
if (DebugMode) { if (DebugMode) {

View File

@ -266,7 +266,7 @@ static int MY_FAST_CALL LzmaDec_DecodeReal(CLzmaDec *p, SizeT limit, const Byte
prob = probs + RepLenCoder; prob = probs + RepLenCoder;
} }
{ {
unsigned limit, offset; unsigned offset;
CLzmaProb *probLen = prob + LenChoice; CLzmaProb *probLen = prob + LenChoice;
IF_BIT_0(probLen) IF_BIT_0(probLen)
{ {

View File

@ -3,7 +3,7 @@
LzmaEnc.c -- LZMA Encoder LzmaEnc.c -- LZMA Encoder
2009-02-02 : Igor Pavlov : Public domain 2009-02-02 : Igor Pavlov : Public domain
Copyright (c) 2011, Intel Corporation. All rights reserved.<BR> Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -132,9 +132,9 @@ void LzmaEnc_FastPosInit(Byte *g_FastPos)
} }
} }
#define BSR2_RET(pos, res) { UInt32 i = 6 + ((kNumLogBits - 1) & \ #define BSR2_RET(pos, res) { UInt32 ij = 6 + ((kNumLogBits - 1) & \
(0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \ (0 - (((((UInt32)1 << (kNumLogBits + 6)) - 1) - pos) >> 31))); \
res = p->g_FastPos[pos >> i] + (i * 2); } res = p->g_FastPos[pos >> ij] + (ij * 2); }
/* /*
#define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \ #define BSR2_RET(pos, res) { res = (pos < (1 << (kNumLogBits + 6))) ? \
p->g_FastPos[pos >> 6] + 12 : \ p->g_FastPos[pos >> 6] + 12 : \
@ -1148,20 +1148,18 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
#ifdef SHOW_STAT2 #ifdef SHOW_STAT2
if (position >= 0) if (position >= 0)
{ {
unsigned i; unsigned ii;
printf("\n pos = %4X", position); printf("\n pos = %4X", position);
for (i = cur; i <= lenEnd; i++) for (ii = cur; ii <= lenEnd; ii++)
printf("\nprice[%4X] = %d", position - cur + i, p->opt[i].price); printf("\nprice[%4X] = %d", position - cur + ii, p->opt[ii].price);
} }
#endif #endif
for (;;) for (;;)
{ {
UInt32 numAvailFull, newLen, numPairs, posPrev, state, posState, startLen; UInt32 numAvailFull, newLen, posPrev, state, startLen;
UInt32 curPrice, curAnd1Price, matchPrice, repMatchPrice; UInt32 curPrice, curAnd1Price;
Bool nextIsChar; Bool nextIsChar;
Byte curByte, matchByte;
const Byte *data;
COptimal *curOpt; COptimal *curOpt;
COptimal *nextOpt; COptimal *nextOpt;
@ -1224,7 +1222,6 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
prevOpt = &p->opt[posPrev]; prevOpt = &p->opt[posPrev];
if (pos < LZMA_NUM_REPS) if (pos < LZMA_NUM_REPS)
{ {
UInt32 i;
reps[0] = prevOpt->backs[pos]; reps[0] = prevOpt->backs[pos];
for (i = 1; i <= pos; i++) for (i = 1; i <= pos; i++)
reps[i] = prevOpt->backs[i - 1]; reps[i] = prevOpt->backs[i - 1];
@ -1233,7 +1230,6 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
} }
else else
{ {
UInt32 i;
reps[0] = (pos - LZMA_NUM_REPS); reps[0] = (pos - LZMA_NUM_REPS);
for (i = 1; i < LZMA_NUM_REPS; i++) for (i = 1; i < LZMA_NUM_REPS; i++)
reps[i] = prevOpt->backs[i - 1]; reps[i] = prevOpt->backs[i - 1];
@ -1319,12 +1315,11 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
GET_PRICE_1(p->isRep[state2]); GET_PRICE_1(p->isRep[state2]);
/* for (; lenTest2 >= 2; lenTest2--) */ /* for (; lenTest2 >= 2; lenTest2--) */
{ {
UInt32 curAndLenPrice;
COptimal *opt; COptimal *opt;
UInt32 offset = cur + 1 + lenTest2; UInt32 offset = cur + 1 + lenTest2;
while (lenEnd < offset) while (lenEnd < offset)
p->opt[++lenEnd].price = kInfinityPrice; p->opt[++lenEnd].price = kInfinityPrice;
curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); UInt32 curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
opt = &p->opt[offset]; opt = &p->opt[offset];
if (curAndLenPrice < opt->price) if (curAndLenPrice < opt->price)
{ {
@ -1430,7 +1425,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
} }
if (newLen >= startLen) if (newLen >= startLen)
{ {
UInt32 normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]); normalMatchPrice = matchPrice + GET_PRICE_0(p->isRep[state]);
UInt32 offs, curBack, posSlot; UInt32 offs, curBack, posSlot;
UInt32 lenTest; UInt32 lenTest;
while (lenEnd < cur + newLen) while (lenEnd < cur + newLen)
@ -1443,7 +1438,8 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
GetPosSlot2(curBack, posSlot); GetPosSlot2(curBack, posSlot);
for (lenTest = /*2*/ startLen; ; lenTest++) for (lenTest = /*2*/ startLen; ; lenTest++)
{ {
UInt32 curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN]; UInt32 curAndLenPrice;
curAndLenPrice = normalMatchPrice + p->lenEnc.prices[posState][lenTest - LZMA_MATCH_LEN_MIN];
UInt32 lenToPosState = GetLenToPosState(lenTest); UInt32 lenToPosState = GetLenToPosState(lenTest);
COptimal *opt; COptimal *opt;
if (curBack < kNumFullDistances) if (curBack < kNumFullDistances)
@ -1488,8 +1484,7 @@ static UInt32 GetOptimum(CLzmaEnc *p, UInt32 position, UInt32 *backRes)
/* for (; lenTest2 >= 2; lenTest2--) */ /* for (; lenTest2 >= 2; lenTest2--) */
{ {
UInt32 offset = cur + lenTest + 1 + lenTest2; UInt32 offset = cur + lenTest + 1 + lenTest2;
UInt32 curAndLenPrice;
COptimal *opt;
while (lenEnd < offset) while (lenEnd < offset)
p->opt[++lenEnd].price = kInfinityPrice; p->opt[++lenEnd].price = kInfinityPrice;
curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext); curAndLenPrice = nextRepMatchPrice + GetRepPrice(p, 0, lenTest2, state2, posStateNext);
@ -1697,7 +1692,7 @@ static void FillDistancesPrices(CLzmaEnc *p)
{ {
UInt32 *distancesPrices = p->distancesPrices[lenToPosState]; UInt32 *distancesPrices = p->distancesPrices[lenToPosState];
UInt32 i;
for (i = 0; i < kStartPosModelIndex; i++) for (i = 0; i < kStartPosModelIndex; i++)
distancesPrices[i] = posSlotPrices[i]; distancesPrices[i] = posSlotPrices[i];
for (; i < kNumFullDistances; i++) for (; i < kNumFullDistances; i++)

View File

@ -1,7 +1,7 @@
/*++ @file /*++ @file
Vfr Syntax Vfr Syntax
Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR> Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at which accompanies this distribution. The full text of the license may be found at
@ -23,6 +23,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>> >>
<< <<
#ifdef UINT8_MAX
#undef UINT8_MAX
#endif
#include "stdio.h" #include "stdio.h"
#include "PBlackBox.h" #include "PBlackBox.h"
#include "DLexerBase.h" #include "DLexerBase.h"