Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
michael@0 | 1 | |
michael@0 | 2 | /* --------------------------------------------------------------------------- |
michael@0 | 3 | Stuff to fake unix file I/O on windows boxes |
michael@0 | 4 | ------------------------------------------------------------------------*/ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef WINFILE_H |
michael@0 | 7 | #define WINFILE_H |
michael@0 | 8 | |
michael@0 | 9 | #ifdef _WINDOWS |
michael@0 | 10 | /* hacked out of <dirent.h> on an SGI */ |
michael@0 | 11 | #if defined(XP_WIN32) || defined(_WIN32) |
michael@0 | 12 | /* 32-bit stuff here */ |
michael@0 | 13 | #include <windows.h> |
michael@0 | 14 | #include <stdlib.h> |
michael@0 | 15 | #ifdef __MINGW32__ |
michael@0 | 16 | #include <sys/types.h> |
michael@0 | 17 | #include <sys/stat.h> |
michael@0 | 18 | #else |
michael@0 | 19 | #include <sys\types.h> |
michael@0 | 20 | #include <sys\stat.h> |
michael@0 | 21 | #endif |
michael@0 | 22 | |
michael@0 | 23 | typedef struct DIR_Struct { |
michael@0 | 24 | void * directoryPtr; |
michael@0 | 25 | WIN32_FIND_DATA data; |
michael@0 | 26 | } DIR; |
michael@0 | 27 | |
michael@0 | 28 | #define _ST_FSTYPSZ 16 |
michael@0 | 29 | |
michael@0 | 30 | #if !defined(__BORLANDC__) && !defined(__GNUC__) |
michael@0 | 31 | typedef unsigned long mode_t; |
michael@0 | 32 | typedef long uid_t; |
michael@0 | 33 | typedef long gid_t; |
michael@0 | 34 | typedef long off_t; |
michael@0 | 35 | typedef unsigned long nlink_t; |
michael@0 | 36 | #endif |
michael@0 | 37 | |
michael@0 | 38 | typedef struct timestruc { |
michael@0 | 39 | time_t tv_sec; /* seconds */ |
michael@0 | 40 | long tv_nsec; /* and nanoseconds */ |
michael@0 | 41 | } timestruc_t; |
michael@0 | 42 | |
michael@0 | 43 | |
michael@0 | 44 | struct dirent { /* data from readdir() */ |
michael@0 | 45 | ino_t d_ino; /* inode number of entry */ |
michael@0 | 46 | off_t d_off; /* offset of disk direntory entry */ |
michael@0 | 47 | unsigned short d_reclen; /* length of this record */ |
michael@0 | 48 | char d_name[_MAX_FNAME]; /* name of file */ |
michael@0 | 49 | }; |
michael@0 | 50 | |
michael@0 | 51 | #if !defined(__BORLANDC__) && !defined (__GNUC__) |
michael@0 | 52 | #define S_ISDIR(s) ((s) & _S_IFDIR) |
michael@0 | 53 | #endif |
michael@0 | 54 | |
michael@0 | 55 | #else /* _WIN32 */ |
michael@0 | 56 | /* 16-bit windows stuff */ |
michael@0 | 57 | |
michael@0 | 58 | #include <sys\types.h> |
michael@0 | 59 | #include <sys\stat.h> |
michael@0 | 60 | #include <dos.h> |
michael@0 | 61 | |
michael@0 | 62 | |
michael@0 | 63 | |
michael@0 | 64 | /* Getting cocky to support multiple file systems */ |
michael@0 | 65 | typedef struct dirStruct_tag { |
michael@0 | 66 | struct _find_t file_data; |
michael@0 | 67 | char c_checkdrive; |
michael@0 | 68 | } dirStruct; |
michael@0 | 69 | |
michael@0 | 70 | typedef struct DIR_Struct { |
michael@0 | 71 | void * directoryPtr; |
michael@0 | 72 | dirStruct data; |
michael@0 | 73 | } DIR; |
michael@0 | 74 | |
michael@0 | 75 | #define _ST_FSTYPSZ 16 |
michael@0 | 76 | typedef unsigned long mode_t; |
michael@0 | 77 | typedef long uid_t; |
michael@0 | 78 | typedef long gid_t; |
michael@0 | 79 | typedef long off_t; |
michael@0 | 80 | typedef unsigned long nlink_t; |
michael@0 | 81 | |
michael@0 | 82 | typedef struct timestruc { |
michael@0 | 83 | time_t tv_sec; /* seconds */ |
michael@0 | 84 | long tv_nsec; /* and nanoseconds */ |
michael@0 | 85 | } timestruc_t; |
michael@0 | 86 | |
michael@0 | 87 | struct dirent { /* data from readdir() */ |
michael@0 | 88 | ino_t d_ino; /* inode number of entry */ |
michael@0 | 89 | off_t d_off; /* offset of disk direntory entry */ |
michael@0 | 90 | unsigned short d_reclen; /* length of this record */ |
michael@0 | 91 | #ifdef XP_WIN32 |
michael@0 | 92 | char d_name[_MAX_FNAME]; /* name of file */ |
michael@0 | 93 | #else |
michael@0 | 94 | char d_name[20]; /* name of file */ |
michael@0 | 95 | #endif |
michael@0 | 96 | }; |
michael@0 | 97 | |
michael@0 | 98 | #define S_ISDIR(s) ((s) & _S_IFDIR) |
michael@0 | 99 | |
michael@0 | 100 | #endif /* 16-bit windows */ |
michael@0 | 101 | |
michael@0 | 102 | #define CONST const |
michael@0 | 103 | |
michael@0 | 104 | #endif /* _WINDOWS */ |
michael@0 | 105 | |
michael@0 | 106 | #endif /* WINFILE_H */ |