security/nss/lib/dbm/include/winfile.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     2 /* ---------------------------------------------------------------------------
     3     Stuff to fake unix file I/O on windows boxes
     4     ------------------------------------------------------------------------*/
     6 #ifndef WINFILE_H
     7 #define WINFILE_H
     9 #ifdef _WINDOWS
    10 /* hacked out of <dirent.h> on an SGI */
    11 #if defined(XP_WIN32) || defined(_WIN32)
    12 /* 32-bit stuff here */
    13 #include <windows.h>
    14 #include <stdlib.h>
    15 #ifdef __MINGW32__
    16 #include <sys/types.h>
    17 #include <sys/stat.h>
    18 #else
    19 #include <sys\types.h>
    20 #include <sys\stat.h>
    21 #endif
    23 typedef struct DIR_Struct {
    24     void            * directoryPtr;
    25     WIN32_FIND_DATA   data;
    26 } DIR;
    28 #define _ST_FSTYPSZ 16
    30 #if !defined(__BORLANDC__) && !defined(__GNUC__)
    31  typedef unsigned long mode_t;
    32  typedef          long uid_t;
    33  typedef          long gid_t;
    34  typedef          long off_t;
    35  typedef unsigned long nlink_t;
    36 #endif 
    38 typedef struct timestruc {
    39     time_t  tv_sec;         /* seconds */
    40     long    tv_nsec;        /* and nanoseconds */
    41 } timestruc_t;
    44 struct dirent {                                 /* data from readdir() */
    45         ino_t           d_ino;                  /* inode number of entry */
    46         off_t           d_off;                  /* offset of disk direntory entry */
    47         unsigned short  d_reclen;               /* length of this record */
    48         char            d_name[_MAX_FNAME];     /* name of file */
    49 };
    51 #if !defined(__BORLANDC__) && !defined (__GNUC__)
    52 #define S_ISDIR(s)  ((s) & _S_IFDIR)
    53 #endif
    55 #else /* _WIN32 */
    56 /* 16-bit windows stuff */
    58 #include <sys\types.h>
    59 #include <sys\stat.h>
    60 #include <dos.h>
    64 /*	Getting cocky to support multiple file systems */
    65 typedef struct	dirStruct_tag	{
    66 	struct _find_t	file_data;
    67 	char			c_checkdrive;
    68 } dirStruct;
    70 typedef struct DIR_Struct {
    71     void            * directoryPtr;
    72     dirStruct         data;
    73 } DIR;
    75 #define _ST_FSTYPSZ 16
    76 typedef unsigned long mode_t;
    77 typedef          long uid_t;
    78 typedef          long gid_t;
    79 typedef          long off_t;
    80 typedef unsigned long nlink_t;
    82 typedef struct timestruc {
    83     time_t  tv_sec;         /* seconds */
    84     long    tv_nsec;        /* and nanoseconds */
    85 } timestruc_t;
    87 struct dirent {                             /* data from readdir() */
    88         ino_t           d_ino;              /* inode number of entry */
    89         off_t           d_off;              /* offset of disk direntory entry */
    90         unsigned short  d_reclen;           /* length of this record */
    91 #ifdef XP_WIN32
    92         char            d_name[_MAX_FNAME]; /* name of file */
    93 #else
    94         char            d_name[20]; /* name of file */
    95 #endif
    96 };
    98 #define S_ISDIR(s)  ((s) & _S_IFDIR)
   100 #endif /* 16-bit windows */
   102 #define CONST const
   104 #endif /* _WINDOWS */
   106 #endif /* WINFILE_H */

mercurial