diff options
author | Chris Wilson <chris+github@qwirx.com> | 2006-09-02 11:32:38 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2006-09-02 11:32:38 +0000 |
commit | 364ec72789db5a33c5ff35f0774a29348304d868 (patch) | |
tree | 992b347f21dc934896dc84bcc285206cb3552cd4 /lib | |
parent | 300d1fc0c31b6122d2e897acd5cee93a05eef61c (diff) |
(refs #3)
Reorganise typedefs for clarity
Diffstat (limited to 'lib')
-rw-r--r-- | lib/win32/emu.h | 68 |
1 files changed, 46 insertions, 22 deletions
diff --git a/lib/win32/emu.h b/lib/win32/emu.h index ce0c884f..5d67264a 100644 --- a/lib/win32/emu.h +++ b/lib/win32/emu.h @@ -3,7 +3,48 @@ #if ! defined EMU_INCLUDE && defined WIN32 #define EMU_INCLUDE -#define _INO_T_DEFINED +// basic types, may be required by other headers since we +// don't include sys/types.h + +#ifdef __MINGW32__ + #include <stdint.h> + typedef uint32_t u_int32_t; +#else // MSVC + typedef __int64 int64_t; + typedef __int32 int32_t; + typedef __int16 int16_t; + typedef __int8 int8_t; + + typedef unsigned __int64 u_int64_t; + typedef unsigned __int32 u_int32_t; + + typedef unsigned __int64 uint64_t; + typedef unsigned __int32 uint32_t; + typedef unsigned __int16 uint16_t; + typedef unsigned __int8 uint8_t; +#endif + +// emulated types, present on MinGW but not MSVC or vice versa + +#ifdef _MSC_VER + typedef unsigned int mode_t; + typedef unsigned int pid_t; + + // must define _INO_T_DEFINED before including <sys/types.h> + // to replace it with our own. + typedef u_int64_t _ino_t; + #define _INO_T_DEFINED +#endif + +// set up to include the necessary parts of Windows headers + +#define WIN32_LEAN_AND_MEAN + +#ifndef __MSVCRT_VERSION__ +#define __MSVCRT_VERSION__ 0x0601 +#endif + +// Windows headers #include <winsock2.h> #include <fcntl.h> @@ -19,6 +60,8 @@ #include <string> +// emulated functions + #define gmtime_r( _clock, _result ) \ ( *(_result) = *gmtime( (_clock) ), \ (_result) ) @@ -50,8 +93,8 @@ inline int geteuid(void) struct passwd { char *pw_name; char *pw_passwd; - uid_t pw_uid; - gid_t pw_gid; + int pw_uid; + int pw_gid; time_t pw_change; char *pw_class; char *pw_gecos; @@ -252,17 +295,6 @@ struct itimerval #define tv_nsec tv_usec #ifndef __MINGW32__ - typedef unsigned __int64 u_int64_t; - typedef unsigned __int64 uint64_t; - typedef __int64 int64_t; - typedef unsigned __int32 uint32_t; - typedef unsigned __int32 u_int32_t; - typedef __int32 int32_t; - typedef unsigned __int16 uint16_t; - typedef __int16 int16_t; - typedef unsigned __int8 uint8_t; - typedef __int8 int8_t; - typedef int socklen_t; #endif @@ -283,10 +315,6 @@ struct itimerval #define vsnprintf _vsnprintf -#ifndef __MINGW32__ -typedef unsigned int mode_t; -#endif - int emu_mkdir(const char* pPathName); inline int mkdir(const char *pPathName, mode_t mode) @@ -410,10 +438,6 @@ struct stat { time_t st_mtime; time_t st_ctime; }; - -#ifndef __MINGW32__ -typedef u_int64_t _ino_t; -#endif #endif int emu_stat(const char * name, struct stat * st); |