mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-27 15:44:04 +02:00
BaseTools/GenFw: Fix VS2010/VS2012 build failure
https://bugzilla.tianocore.org/show_bug.cgi?id=417 The commit makes the following refinements in GenFw source codes to avoid VS2010/VS2012 build failure: 1. Replaces the uses of 'bool' with 'BOOLEAN' for accordance, and remove the header file dependency for '<stdbool.h>'. 2. Refines coding style for function 'GetSymName' to declare local variables at the beginning of the function block. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hao Wu <hao.a.wu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
parent
e1e7e0fb37
commit
7be7b25d11
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Elf32 Convert solution
|
Elf32 Convert solution
|
||||||
|
|
||||||
Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2017, 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
|
||||||
@ -21,7 +21,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#include <io.h>
|
#include <io.h>
|
||||||
#endif
|
#endif
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -304,23 +303,27 @@ GetSymName (
|
|||||||
Elf_Sym *Sym
|
Elf_Sym *Sym
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
Elf_Shdr *StrtabShdr;
|
||||||
|
UINT8 *StrtabContents;
|
||||||
|
BOOLEAN foundEnd;
|
||||||
|
UINT32 i;
|
||||||
|
|
||||||
if (Sym->st_name == 0) {
|
if (Sym->st_name == 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Elf_Shdr *StrtabShdr = FindStrtabShdr();
|
StrtabShdr = FindStrtabShdr();
|
||||||
if (StrtabShdr == NULL) {
|
if (StrtabShdr == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(Sym->st_name < StrtabShdr->sh_size);
|
assert(Sym->st_name < StrtabShdr->sh_size);
|
||||||
|
|
||||||
UINT8* StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;
|
StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;
|
||||||
|
|
||||||
bool foundEnd = false;
|
foundEnd = FALSE;
|
||||||
UINT32 i;
|
|
||||||
for (i = Sym->st_name; (i < StrtabShdr->sh_size) && !foundEnd; i++) {
|
for (i = Sym->st_name; (i < StrtabShdr->sh_size) && !foundEnd; i++) {
|
||||||
foundEnd = StrtabContents[i] == 0;
|
foundEnd = (BOOLEAN)(StrtabContents[i] == 0);
|
||||||
}
|
}
|
||||||
assert(foundEnd);
|
assert(foundEnd);
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/** @file
|
/** @file
|
||||||
Elf64 convert solution
|
Elf64 convert solution
|
||||||
|
|
||||||
Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>
|
Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>
|
||||||
Portions copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>
|
Portions copyright (c) 2013-2014, 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
|
||||||
@ -21,7 +21,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|||||||
#include <io.h>
|
#include <io.h>
|
||||||
#endif
|
#endif
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -296,23 +295,27 @@ GetSymName (
|
|||||||
Elf_Sym *Sym
|
Elf_Sym *Sym
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
Elf_Shdr *StrtabShdr;
|
||||||
|
UINT8 *StrtabContents;
|
||||||
|
BOOLEAN foundEnd;
|
||||||
|
UINT32 i;
|
||||||
|
|
||||||
if (Sym->st_name == 0) {
|
if (Sym->st_name == 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Elf_Shdr *StrtabShdr = FindStrtabShdr();
|
StrtabShdr = FindStrtabShdr();
|
||||||
if (StrtabShdr == NULL) {
|
if (StrtabShdr == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(Sym->st_name < StrtabShdr->sh_size);
|
assert(Sym->st_name < StrtabShdr->sh_size);
|
||||||
|
|
||||||
UINT8* StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;
|
StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;
|
||||||
|
|
||||||
bool foundEnd = false;
|
foundEnd = FALSE;
|
||||||
UINT32 i;
|
|
||||||
for (i= Sym->st_name; (i < StrtabShdr->sh_size) && !foundEnd; i++) {
|
for (i= Sym->st_name; (i < StrtabShdr->sh_size) && !foundEnd; i++) {
|
||||||
foundEnd = StrtabContents[i] == 0;
|
foundEnd = (BOOLEAN)(StrtabContents[i] == 0);
|
||||||
}
|
}
|
||||||
assert(foundEnd);
|
assert(foundEnd);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user