From 64af8f342eff7c5a01af4cf7b6f6459597e49582 Mon Sep 17 00:00:00 2001 From: Andris Zeila Date: Tue, 8 Apr 2014 12:49:23 +0000 Subject: ...G...... [ZBX-7856] added workaround for Windows _wstat64() not working with symlinks [merge ^/branches/2.2 -c r44213] --- include/zbxtypes.h | 86 ++++++++++++++++++++++-------------------------------- 1 file changed, 35 insertions(+), 51 deletions(-) (limited to 'include/zbxtypes.h') diff --git a/include/zbxtypes.h b/include/zbxtypes.h index fa300cb9508..77f9933aae7 100644 --- a/include/zbxtypes.h +++ b/include/zbxtypes.h @@ -27,55 +27,41 @@ #if defined(_WINDOWS) -#ifdef _UNICODE # define zbx_stat(path, buf) __zbx_stat(path, buf) # define zbx_open(pathname, flags) __zbx_open(pathname, flags | O_BINARY) -#else -# define zbx_stat(path, buf) _stat64(path, buf) -# define zbx_open(pathname, flags) open(pathname, flags | O_BINARY) -#endif -#ifdef UNICODE # include -# define zbx_wsnprintf StringCchPrintf -# define zbx_strlen wcslen -# define zbx_strchr wcschr -# define zbx_strstr wcsstr -# define zbx_fullpath _wfullpath -#else -# define zbx_wsnprintf zbx_snprintf -# define zbx_strlen strlen -# define zbx_strchr strchr -# define zbx_strstr strstr -# define zbx_fullpath _fullpath -#endif +# define zbx_wsnprintf StringCchPrintf +# define zbx_strlen wcslen +# define zbx_strchr wcschr +# define zbx_strstr wcsstr +# define zbx_fullpath _wfullpath -#ifndef __UINT64_C -# define __UINT64_C(x) x -#endif +# ifndef __UINT64_C +# define __UINT64_C(x) x +# endif -# define zbx_uint64_t unsigned __int64 -# define ZBX_FS_UI64 "%I64u" -# define ZBX_FS_UO64 "%I64o" -# define ZBX_FS_UX64 "%I64x" +# define zbx_uint64_t unsigned __int64 +# define ZBX_FS_UI64 "%I64u" +# define ZBX_FS_UO64 "%I64o" +# define ZBX_FS_UX64 "%I64x" -# define stat _stat64 # define snprintf _snprintf # define alloca _alloca -#ifndef uint32_t -# define uint32_t __int32 -#endif +# ifndef uint32_t +# define uint32_t __int32 +# endif -#ifndef PATH_SEPARATOR -# define PATH_SEPARATOR '\\' -#endif +# ifndef PATH_SEPARATOR +# define PATH_SEPARATOR '\\' +# endif # define strcasecmp lstrcmpiA typedef __int64 zbx_offset_t; -#define zbx_lseek(fd, offset, whence) _lseeki64(fd, (zbx_offset_t)(offset), whence) +# define zbx_lseek(fd, offset, whence) _lseeki64(fd, (zbx_offset_t)(offset), whence) #else /* _WINDOWS */ @@ -84,37 +70,35 @@ typedef __int64 zbx_offset_t; # ifndef __UINT64_C # ifdef UINT64_C -# define __UINT64_C(c) (UINT64_C(c)) +# define __UINT64_C(c) (UINT64_C(c)) # else -# define __UINT64_C(c) (c ## ULL) +# define __UINT64_C(c) (c ## ULL) # endif # endif -# define zbx_uint64_t uint64_t +# define zbx_uint64_t uint64_t # if __WORDSIZE == 64 -# define ZBX_FS_UI64 "%lu" -# define ZBX_FS_UO64 "%lo" -# define ZBX_FS_UX64 "%lx" -# define ZBX_OFFSET 10000000000000000UL +# define ZBX_FS_UI64 "%lu" +# define ZBX_FS_UO64 "%lo" +# define ZBX_FS_UX64 "%lx" # else # ifdef HAVE_LONG_LONG_QU -# define ZBX_FS_UI64 "%qu" -# define ZBX_FS_UO64 "%qo" -# define ZBX_FS_UX64 "%qx" +# define ZBX_FS_UI64 "%qu" +# define ZBX_FS_UO64 "%qo" +# define ZBX_FS_UX64 "%qx" # else -# define ZBX_FS_UI64 "%llu" -# define ZBX_FS_UO64 "%llo" -# define ZBX_FS_UX64 "%llx" +# define ZBX_FS_UI64 "%llu" +# define ZBX_FS_UO64 "%llo" +# define ZBX_FS_UX64 "%llx" # endif -# define ZBX_OFFSET 10000000000000000ULL # endif -#ifndef PATH_SEPARATOR -# define PATH_SEPARATOR '/' -#endif +# ifndef PATH_SEPARATOR +# define PATH_SEPARATOR '/' +# endif typedef off_t zbx_offset_t; -#define zbx_lseek(fd, offset, whence) lseek(fd, (zbx_offset_t)(offset), whence) +# define zbx_lseek(fd, offset, whence) lseek(fd, (zbx_offset_t)(offset), whence) #endif /* _WINDOWS */ -- cgit v1.2.3