From 9579d09533d4f94c38bb4755c6df90552483b7b6 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 14 Jun 2010 13:36:32 -0400 Subject: [PATCH] Windows: fix definition of lstat() macro The lstat() macro definition has to take into account the version of the compiler and the size of time_t. Change-Id: Id7ad8c3956bba9832cc028db628cfabe58a1d8d9 Reviewed-on: http://gerrit.openafs.org/2158 Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/config/param.amd64_w2k.h | 11 ++++++++++- src/config/param.i386_nt40.h | 4 ++++ src/config/param.i386_w2k.h | 10 +++++++++- src/config/param.i64_w2k.h | 10 +++++++++- 4 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/config/param.amd64_w2k.h b/src/config/param.amd64_w2k.h index e0aa08be3..55225b98d 100644 --- a/src/config/param.amd64_w2k.h +++ b/src/config/param.amd64_w2k.h @@ -41,7 +41,16 @@ typedef __int64 ssize_t; /* map lstat calls to _stat, until an AFS-aware lstat wrapper * can be written */ -#define lstat(a, b) _stat((a), (b)) + +#if (_MSC_VER < 1400) +#define lstat(a, b) _stat((a), (struct _stat *)(b)) +#else +#ifdef _USE_32BIT_TIME_T +#define lstat(a, b) _stat((a), (struct _stat32 *)(b)) +#else +#define lstat(a, b) _stat((a), (struct _stat64i32 *)(b)) +#endif +#endif #if 0 #define memset(A, 0, S) memset((void*)(A), 0, (size_t)(S)) diff --git a/src/config/param.i386_nt40.h b/src/config/param.i386_nt40.h index dde475012..418c5c761 100644 --- a/src/config/param.i386_nt40.h +++ b/src/config/param.i386_nt40.h @@ -39,6 +39,10 @@ typedef int ssize_t; /* these macros define Unix-style functions missing in VC++5.0/NT4.0 */ #define MAXPATHLEN _MAX_PATH +/* map lstat calls to _stat, until an AFS-aware lstat wrapper + * can be written */ +#define lstat(a, b) _stat((a), (struct _stat *)(b)) + #if 0 #define memset(A, 0, S) memset((void*)(A), 0, (size_t)(S)) #define memcpy(B, A, S) memcpy((void*)(B), (void*)(A), (size_t)(S)) diff --git a/src/config/param.i386_w2k.h b/src/config/param.i386_w2k.h index 151e2e644..7b200e024 100644 --- a/src/config/param.i386_w2k.h +++ b/src/config/param.i386_w2k.h @@ -41,7 +41,15 @@ typedef int ssize_t; /* map lstat calls to _stat, until an AFS-aware lstat wrapper * can be written */ -#define lstat(a, b) _stat((a), (b)) +#if (_MSC_VER < 1400) +#define lstat(a, b) _stat((a), (struct _stat *)(b)) +#else +#ifdef _USE_32BIT_TIME_T +#define lstat(a, b) _stat((a), (struct _stat32 *)(b)) +#else +#define lstat(a, b) _stat((a), (struct _stat64i32 *)(b)) +#endif +#endif #if 0 #define memset(A, 0, S) memset((void*)(A), 0, (size_t)(S)) diff --git a/src/config/param.i64_w2k.h b/src/config/param.i64_w2k.h index 3bfe9718e..a96d7a74a 100644 --- a/src/config/param.i64_w2k.h +++ b/src/config/param.i64_w2k.h @@ -40,7 +40,15 @@ typedef __int64 ssize_t; /* map lstat calls to _stat, until an AFS-aware lstat wrapper * can be written */ -#define lstat(a, b) _stat((a), (b)) +#if (_MSC_VER < 1400) +#define lstat(a, b) _stat((a), (struct _stat *)(b)) +#else +#ifdef _USE_32BIT_TIME_T +#define lstat(a, b) _stat((a), (struct _stat32 *)(b)) +#else +#define lstat(a, b) _stat((a), (struct _stat64i32 *)(b)) +#endif +#endif #if 0 #define memset(A, 0, S) memset((void*)(A), 0, (size_t)(S)) -- 2.39.5