[Box Backup-commit] COMMIT r1115 - box/trunk/lib/win32
boxbackup-dev at fluffy.co.uk
boxbackup-dev at fluffy.co.uk
Fri Oct 27 20:11:17 BST 2006
Author: chris
Date: 2006-10-27 20:11:16 +0100 (Fri, 27 Oct 2006)
New Revision: 1115
Modified:
box/trunk/lib/win32/emu.h
Log:
Reorganise typedefs for clarity.
Modified: box/trunk/lib/win32/emu.h
===================================================================
--- box/trunk/lib/win32/emu.h 2006-10-27 19:09:40 UTC (rev 1114)
+++ box/trunk/lib/win32/emu.h 2006-10-27 19:11:16 UTC (rev 1115)
@@ -3,8 +3,49 @@
#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>
#include <sys/stat.h>
@@ -19,6 +60,8 @@
#include <string>
+// emulated functions
+
#define gmtime_r( _clock, _result ) \
( *(_result) = *gmtime( (_clock) ), \
(_result) )
@@ -50,8 +93,8 @@
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 @@
#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 @@
#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,11 +438,7 @@
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);
int emu_fstat(HANDLE file, struct stat * st);
More information about the Boxbackup-commit
mailing list