mirror of https://github.com/acidanthera/audk.git
Implement a filelength function for GCC.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1847 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
cbee1e7407
commit
fec7633848
|
@ -495,6 +495,14 @@ Returns:
|
|||
}
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
size_t _filelength(FILE *file)
|
||||
{
|
||||
struct stat stat_buf;
|
||||
fstat(fileno(file), &stat_buf);
|
||||
return stat_buf.st_size;
|
||||
}
|
||||
|
||||
#ifndef __CYGWIN__
|
||||
char *strlwr(char *s)
|
||||
{
|
||||
|
|
|
@ -124,9 +124,13 @@ PrintGuidToBuffer (
|
|||
#define ASSERT(x) assert(x)
|
||||
|
||||
#ifdef __GNUC__
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#define stricmp strcasecmp
|
||||
#define _stricmp strcasecmp
|
||||
#define strnicmp strncasecmp
|
||||
#define strcmpi strcasecmp
|
||||
size_t _filelength(FILE *file);
|
||||
#ifndef __CYGWIN__
|
||||
char *strlwr(char *s);
|
||||
#endif
|
||||
|
|
|
@ -1617,15 +1617,7 @@ Returns:
|
|||
//
|
||||
// Get the file size
|
||||
//
|
||||
#ifdef __GNUC__
|
||||
{
|
||||
struct stat stat_buf;
|
||||
fstat(fileno(NewFile), &stat_buf);
|
||||
FileSize = stat_buf.st_size;
|
||||
}
|
||||
#else
|
||||
FileSize = _filelength (fileno (NewFile));
|
||||
#endif
|
||||
|
||||
//
|
||||
// Read the file into a buffer
|
||||
|
|
Loading…
Reference in New Issue