From: Amos Jeffries Date: Wed, 8 Aug 2012 08:01:46 +0000 (+1200) Subject: Windows: MinGW provides truncate()/ftruncate() X-Git-Tag: sourceformat-review-1~131 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3bfe9ee782e190d70a17235923a69026c3da778a;p=thirdparty%2Fsquid.git Windows: MinGW provides truncate()/ftruncate() --- diff --git a/compat/mswin.cc b/compat/mswin.cc index 4cae8cfbf5..c50f7092b8 100644 --- a/compat/mswin.cc +++ b/compat/mswin.cc @@ -236,6 +236,7 @@ statfs(const char *path, struct statfs *sfs) return 0; } +#if !_SQUID_MINGW_ int WIN32_ftruncate(int fd, off_t size) { @@ -283,6 +284,7 @@ WIN32_truncate(const char *pathname, off_t length) return res; } +#endif /* !_SQUID_MINGW_ */ struct passwd * getpwnam(char *unused) { diff --git a/compat/os/mswin.h b/compat/os/mswin.h index 6561b41f94..ad685ea554 100644 --- a/compat/os/mswin.h +++ b/compat/os/mswin.h @@ -90,7 +90,12 @@ typedef unsigned long ino_t; #define fileno _fileno #define fstat _fstati64 #endif +#if !defined(_SQUID_MINGW_) // MinGW defines these properly +SQUIDCEXTERN int WIN32_ftruncate(int fd, off_t size); #define ftruncate WIN32_ftruncate +SQUIDCEXTERN int WIN32_truncate(const char *pathname, off_t length); +#define truncate WIN32_truncate +#endif #define getcwd _getcwd #define getpid _getpid #define getrusage WIN32_getrusage @@ -115,7 +120,6 @@ typedef unsigned long ino_t; #define strncasecmp _strnicmp #define tempnam _tempnam #endif -#define truncate WIN32_truncate #define umask _umask #define unlink _unlink #if defined(_MSC_VER) /* Microsoft C Compiler ONLY */ diff --git a/include/util.h b/include/util.h index 43cd026158..d97198bfb4 100644 --- a/include/util.h +++ b/include/util.h @@ -115,13 +115,11 @@ SQUIDCEXTERN unsigned int RoundTo(const unsigned int num, const unsigned int wha /* win32lib.c */ #if _SQUID_MSWIN_ SQUIDCEXTERN int chroot (const char *); -SQUIDCEXTERN int ftruncate(int, off_t); #if !HAVE_GETTIMEOFDAY SQUIDCEXTERN int gettimeofday(struct timeval * ,void *); #endif SQUIDCEXTERN int kill(pid_t, int); SQUIDCEXTERN int statfs(const char *, struct statfs *); -SQUIDCEXTERN int truncate(const char *, off_t); SQUIDCEXTERN struct passwd *getpwnam(char *); SQUIDCEXTERN struct group *getgrnam(char *); SQUIDCEXTERN uid_t geteuid(void);