]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Implement a filelength function for GCC.
authorbbahnsen <bbahnsen@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 26 Oct 2006 18:14:11 +0000 (18:14 +0000)
committerbbahnsen <bbahnsen@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 26 Oct 2006 18:14:11 +0000 (18:14 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1847 6f19259b-4bc3-4df7-8a09-765794883524

Tools/CCode/Source/Common/CommonLib.c
Tools/CCode/Source/Common/CommonLib.h
Tools/CCode/Source/GenFvImage/GenFvImageLib.c

index 4d1663a55a27ed603545ab129ca1bfd51fc4a8f9..618abd89bb7c53400406fa391751a41047aa231b 100644 (file)
@@ -495,6 +495,14 @@ Returns:
 }\r
 \r
 #ifdef __GNUC__\r
 }\r
 \r
 #ifdef __GNUC__\r
+\r
+size_t _filelength(FILE *file)\r
+{\r
+  struct stat stat_buf;\r
+  fstat(fileno(file), &stat_buf);\r
+  return stat_buf.st_size;\r
+}\r
+\r
 #ifndef __CYGWIN__\r
 char *strlwr(char *s)\r
 {\r
 #ifndef __CYGWIN__\r
 char *strlwr(char *s)\r
 {\r
index 46f0cbace5645a9771ac4f818658c7975332cb8a..f6c29ef8a8727d99b23416123763642fb2aa919d 100644 (file)
@@ -124,9 +124,13 @@ PrintGuidToBuffer (
 #define ASSERT(x) assert(x)\r
 \r
 #ifdef __GNUC__\r
 #define ASSERT(x) assert(x)\r
 \r
 #ifdef __GNUC__\r
+#include <stdio.h>\r
+#include <sys/stat.h>\r
 #define stricmp strcasecmp\r
 #define stricmp strcasecmp\r
+#define _stricmp strcasecmp\r
 #define strnicmp strncasecmp\r
 #define strcmpi strcasecmp\r
 #define strnicmp strncasecmp\r
 #define strcmpi strcasecmp\r
+size_t _filelength(FILE *file);\r
 #ifndef __CYGWIN__\r
 char *strlwr(char *s);\r
 #endif\r
 #ifndef __CYGWIN__\r
 char *strlwr(char *s);\r
 #endif\r
index 888656ad5c9f586aa814dfac6b17d7542b41c77a..eb36663b8dc411f93bb05ac96fe3fce65bfad4b4 100644 (file)
@@ -1617,15 +1617,7 @@ Returns:
   //\r
   // Get the file size\r
   //\r
   //\r
   // Get the file size\r
   //\r
-#ifdef __GNUC__\r
-  {\r
-    struct stat stat_buf;\r
-    fstat(fileno(NewFile), &stat_buf);\r
-    FileSize = stat_buf.st_size;\r
-  }\r
-#else\r
   FileSize = _filelength (fileno (NewFile));\r
   FileSize = _filelength (fileno (NewFile));\r
-#endif\r
 \r
   //\r
   // Read the file into a buffer\r
 \r
   //\r
   // Read the file into a buffer\r