]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools/GenFw: Fix VS2010/VS2012 build failure
authorHao Wu <hao.a.wu@intel.com>
Mon, 6 Mar 2017 01:56:02 +0000 (09:56 +0800)
committerHao Wu <hao.a.wu@intel.com>
Tue, 7 Mar 2017 00:43:26 +0000 (08:43 +0800)
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>
BaseTools/Source/C/GenFw/Elf32Convert.c
BaseTools/Source/C/GenFw/Elf64Convert.c

index f420bc89da44e1d943a45c5fd8d15ca9bd98181b..f7b084dc9b8497df4405d370abd2aabbf9e07cd9 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Elf32 Convert solution\r
 \r
-Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2017, 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
@@ -21,7 +21,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <io.h>\r
 #endif\r
 #include <assert.h>\r
-#include <stdbool.h>\r
 #include <stdio.h>\r
 #include <stdlib.h>\r
 #include <string.h>\r
@@ -304,23 +303,27 @@ GetSymName (
   Elf_Sym *Sym\r
   )\r
 {\r
+  Elf_Shdr *StrtabShdr;\r
+  UINT8    *StrtabContents;\r
+  BOOLEAN  foundEnd;\r
+  UINT32   i;\r
+\r
   if (Sym->st_name == 0) {\r
     return NULL;\r
   }\r
 \r
-  Elf_Shdr *StrtabShdr = FindStrtabShdr();\r
+  StrtabShdr = FindStrtabShdr();\r
   if (StrtabShdr == NULL) {\r
     return NULL;\r
   }\r
 \r
   assert(Sym->st_name < StrtabShdr->sh_size);\r
 \r
-  UINT8* StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;\r
+  StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;\r
 \r
-  bool foundEnd = false;\r
-  UINT32 i;\r
+  foundEnd = FALSE;\r
   for (i = Sym->st_name; (i < StrtabShdr->sh_size) && !foundEnd; i++) {\r
-    foundEnd = StrtabContents[i] == 0;\r
+    foundEnd = (BOOLEAN)(StrtabContents[i] == 0);\r
   }\r
   assert(foundEnd);\r
 \r
index acf021667eab494ccf2def0d2a811a6198e25e07..7eed7b92d30f0462477a573ee7b4402118f811f1 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
 Elf64 convert solution\r
 \r
-Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.<BR>\r
 Portions copyright (c) 2013-2014, ARM Ltd. All rights reserved.<BR>\r
 \r
 This program and the accompanying materials are licensed and made available\r
@@ -21,7 +21,6 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include <io.h>\r
 #endif\r
 #include <assert.h>\r
-#include <stdbool.h>\r
 #include <stdio.h>\r
 #include <stdlib.h>\r
 #include <string.h>\r
@@ -296,23 +295,27 @@ GetSymName (
   Elf_Sym *Sym\r
   )\r
 {\r
+  Elf_Shdr *StrtabShdr;\r
+  UINT8    *StrtabContents;\r
+  BOOLEAN  foundEnd;\r
+  UINT32   i;\r
+\r
   if (Sym->st_name == 0) {\r
     return NULL;\r
   }\r
 \r
-  Elf_Shdr *StrtabShdr = FindStrtabShdr();\r
+  StrtabShdr = FindStrtabShdr();\r
   if (StrtabShdr == NULL) {\r
     return NULL;\r
   }\r
 \r
   assert(Sym->st_name < StrtabShdr->sh_size);\r
 \r
-  UINT8* StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;\r
+  StrtabContents = (UINT8*)mEhdr + StrtabShdr->sh_offset;\r
 \r
-  bool foundEnd = false;\r
-  UINT32 i;\r
+  foundEnd = FALSE;\r
   for (i= Sym->st_name; (i < StrtabShdr->sh_size) && !foundEnd; i++) {\r
-    foundEnd = StrtabContents[i] == 0;\r
+    foundEnd = (BOOLEAN)(StrtabContents[i] == 0);\r
   }\r
   assert(foundEnd);\r
 \r