Fix the Linux build to accomodate with the new Win32 features.

This commit is contained in:
Sam Hocevar 2010-09-22 22:18:07 +00:00 committed by sam
parent 6ac571b003
commit c60b52ccb3
4 changed files with 21 additions and 5 deletions

View File

@ -14,7 +14,7 @@ LIBZZUF = \
libzzuf/sys.c libzzuf/sys.h \ libzzuf/sys.c libzzuf/sys.h \
libzzuf/network.c libzzuf/network.h \ libzzuf/network.c libzzuf/network.h \
libzzuf/lib-fd.c libzzuf/lib-mem.c libzzuf/lib-signal.c \ libzzuf/lib-fd.c libzzuf/lib-mem.c libzzuf/lib-signal.c \
libzzuf/lib-stream.c libzzuf/lib-load.h libzzuf/lib-stream.c libzzuf/lib-win32.c libzzuf/lib-load.h
COMMON = \ COMMON = \
common/common.h \ common/common.h \

View File

@ -18,7 +18,7 @@
#define STR(x) #x #define STR(x) #x
#define ORIG(x) x##_orig #define ORIG(x) x##_orig
#ifdef HAVE_DLFCN_H #if defined HAVE_DLFCN_H
# include <dlfcn.h> # include <dlfcn.h>
# define NEW(x) x # define NEW(x) x
# define LOADSYM(x) \ # define LOADSYM(x) \
@ -34,7 +34,7 @@
if(!ORIG(x)) \ if(!ORIG(x)) \
abort(); \ abort(); \
} while(0) } while(0)
#else #elif defined _WIN32
# define NEW(x) x##_new # define NEW(x) x##_new
# define LOADSYM(x) \ # define LOADSYM(x) \
do { \ do { \
@ -56,4 +56,7 @@ zzuf_table_t;
extern zzuf_table_t table_stream[], extern zzuf_table_t table_stream[],
table_win32[]; table_win32[];
#else
# error no function diversion system for this platform
#endif #endif

View File

@ -1147,6 +1147,7 @@ int NEW(__uflow)(FILE *fp)
#endif #endif
/* Win32 function table */ /* Win32 function table */
#if defined _WIN32
zzuf_table_t table_stream[] = zzuf_table_t table_stream[] =
{ {
DIVERT(fopen), DIVERT(fopen),
@ -1154,3 +1155,5 @@ zzuf_table_t table_stream[] =
DIVERT(fclose), DIVERT(fclose),
DIVERT_END DIVERT_END
}; };
#endif

View File

@ -16,12 +16,18 @@
#include "config.h" #include "config.h"
#if defined HAVE_WINDOWS_H #if defined HAVE_STDINT_H
# include <windows.h> # include <stdint.h>
#elif defined HAVE_INTTYPES_H
# include <inttypes.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
#if defined HAVE_WINDOWS_H
# include <windows.h>
#endif
#include "common.h" #include "common.h"
#include "libzzuf.h" #include "libzzuf.h"
#include "lib-load.h" #include "lib-load.h"
@ -37,6 +43,7 @@ static HANDLE (*ORIG(CreateFileA))(LPCTSTR lpFileName, DWORD dwDesiredAccess,
HANDLE hTemplateFile); HANDLE hTemplateFile);
#endif #endif
#if defined HAVE_CREATEFILE
HANDLE NEW(CreateFileA)(LPCTSTR lpFileName, DWORD dwDesiredAccess, HANDLE NEW(CreateFileA)(LPCTSTR lpFileName, DWORD dwDesiredAccess,
DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes,
DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
@ -47,8 +54,10 @@ HANDLE NEW(CreateFileA)(LPCTSTR lpFileName, DWORD dwDesiredAccess,
lpSecurityAttributes, dwCreationDisposition, lpSecurityAttributes, dwCreationDisposition,
dwFlagsAndAttributes, hTemplateFile); dwFlagsAndAttributes, hTemplateFile);
} }
#endif
/* Win32 function table */ /* Win32 function table */
#if defined _WIN32
zzuf_table_t table_win32[] = zzuf_table_t table_win32[] =
{ {
#if defined HAVE_CREATEFILE #if defined HAVE_CREATEFILE
@ -56,4 +65,5 @@ zzuf_table_t table_win32[] =
#endif #endif
DIVERT_END DIVERT_END
}; };
#endif