mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 02:25:34 +00:00
Bug 456625 - WinMobile / WinCE has no fstat. r=blassey
This commit is contained in:
parent
fb771b56d7
commit
bc640076a2
@ -177,7 +177,9 @@ typedef INT_PTR intptr_t;
|
||||
#define _S_IFREG 0100000 /* stat, is a normal file */
|
||||
#define _S_IREAD 0000400 /* stat, can read */
|
||||
#define _S_IWRITE 0000200 /* stat, can write */
|
||||
#define _S_IEXEC 0000100
|
||||
#define _S_IEXEC 0000100
|
||||
|
||||
#define S_IFREG 0x8000
|
||||
|
||||
struct stat
|
||||
{
|
||||
@ -306,18 +308,18 @@ typedef struct MAT2 {
|
||||
|
||||
|
||||
struct color{
|
||||
unsigned char Red;
|
||||
unsigned char Green;
|
||||
unsigned char Blue;
|
||||
double Alpha;
|
||||
unsigned char Red;
|
||||
unsigned char Green;
|
||||
unsigned char Blue;
|
||||
double Alpha;
|
||||
};
|
||||
|
||||
#ifndef SEE_MASK_FLAG_DDEWAIT
|
||||
#define SEE_MASK_FLAG_DDEWAIT 0
|
||||
#define SEE_MASK_FLAG_DDEWAIT 0
|
||||
#endif
|
||||
|
||||
#ifndef SEE_MASK_INVOKEIDLIST
|
||||
#define SEE_MASK_INVOKEIDLIST 0
|
||||
#define SEE_MASK_INVOKEIDLIST 0
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -61,7 +61,6 @@
|
||||
#define _isatty isatty
|
||||
#undef fileno
|
||||
#define fileno (int)_fileno
|
||||
#define fstat (int)_fstat
|
||||
#define _mbctolower tolower
|
||||
#define _mbsicmp mbsicmp
|
||||
#define _mbsdec mbsdec
|
||||
@ -217,6 +216,7 @@ extern "C" {
|
||||
MOZCE_SHUNT_API int unlink(const char *pathname);
|
||||
MOZCE_SHUNT_API int lseek(int fildes, int offset, int whence);
|
||||
|
||||
MOZCE_SHUNT_API int fstat(FILE* handle, struct stat* buff);
|
||||
|
||||
// From stdlib.cpp
|
||||
MOZCE_SHUNT_API void splitpath(const char* inPath, char* outDrive, char* outDir, char* outFname, char* outExt);
|
||||
|
@ -47,6 +47,32 @@ extern "C" {
|
||||
}
|
||||
#endif
|
||||
|
||||
MOZCE_SHUNT_API int fstat(FILE* handle, struct stat* buff)
|
||||
{
|
||||
WINCE_LOG_API_CALL("fstat called\n");
|
||||
|
||||
int position = ftell(handle);
|
||||
if (position < 0)
|
||||
return -1;
|
||||
|
||||
if (fseek(handle, 0, SEEK_END) < 0)
|
||||
return -1;
|
||||
|
||||
buff->st_size = ftell(handle);
|
||||
|
||||
if (fseek(handle, position, SEEK_SET) < 0)
|
||||
return -1;
|
||||
|
||||
if (buff->st_size < 0)
|
||||
return -1;
|
||||
|
||||
buff->st_mode = _S_IFREG | _S_IREAD | _S_IWRITE | _S_IEXEC;
|
||||
/* can't get time from a file handle on wince */
|
||||
buff->st_ctime = 0;
|
||||
buff->st_atime = 0;
|
||||
buff->st_mtime = 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
MOZCE_SHUNT_API int stat(const char* inPath, struct stat* outStats)
|
||||
{
|
||||
@ -71,7 +97,6 @@ MOZCE_SHUNT_API int stat(const char* inPath, struct stat* outStats)
|
||||
|
||||
if (readHandle != INVALID_HANDLE_VALUE && readHandle != NULL)
|
||||
{
|
||||
|
||||
retval = 0;
|
||||
outStats->st_size = findData.nFileSizeLow;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user