diff --git a/BaseTools/Source/C/GenFw/Elf32Convert.c b/BaseTools/Source/C/GenFw/Elf32Convert.c
index f420bc89da..f7b084dc9b 100644
--- a/BaseTools/Source/C/GenFw/Elf32Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf32Convert.c
@@ -1,7 +1,7 @@
/** @file
Elf32 Convert solution
-Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
Portions copyright (c) 2013, ARM Ltd. All rights reserved.
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
#endif
#include
-#include
#include
#include
#include
@@ -304,23 +303,27 @@ GetSymName (
Elf_Sym *Sym
)
{
+ Elf_Shdr *StrtabShdr;
+ UINT8 *StrtabContents;
+ BOOLEAN foundEnd;
+ UINT32 i;
+
if (Sym->st_name == 0) {
return NULL;
}
- Elf_Shdr *StrtabShdr = FindStrtabShdr();
+ StrtabShdr = FindStrtabShdr();
if (StrtabShdr == NULL) {
return NULL;
}
assert(Sym->st_name < StrtabShdr->sh_size);
- UINT8* StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;
+ StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;
- bool foundEnd = false;
- UINT32 i;
+ foundEnd = FALSE;
for (i = Sym->st_name; (i < StrtabShdr->sh_size) && !foundEnd; i++) {
- foundEnd = StrtabContents[i] == 0;
+ foundEnd = (BOOLEAN)(StrtabContents[i] == 0);
}
assert(foundEnd);
diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c b/BaseTools/Source/C/GenFw/Elf64Convert.c
index acf021667e..7eed7b92d3 100644
--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -1,7 +1,7 @@
/** @file
Elf64 convert solution
-Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
Portions copyright (c) 2013-2014, ARM Ltd. All rights reserved.
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
#endif
#include
-#include
#include
#include
#include
@@ -296,23 +295,27 @@ GetSymName (
Elf_Sym *Sym
)
{
+ Elf_Shdr *StrtabShdr;
+ UINT8 *StrtabContents;
+ BOOLEAN foundEnd;
+ UINT32 i;
+
if (Sym->st_name == 0) {
return NULL;
}
- Elf_Shdr *StrtabShdr = FindStrtabShdr();
+ StrtabShdr = FindStrtabShdr();
if (StrtabShdr == NULL) {
return NULL;
}
assert(Sym->st_name < StrtabShdr->sh_size);
- UINT8* StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;
+ StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;
- bool foundEnd = false;
- UINT32 i;
+ foundEnd = FALSE;
for (i= Sym->st_name; (i < StrtabShdr->sh_size) && !foundEnd; i++) {
- foundEnd = StrtabContents[i] == 0;
+ foundEnd = (BOOLEAN)(StrtabContents[i] == 0);
}
assert(foundEnd);