From 2261a3f11a0f3951e774e339d0b532436445abc6 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 27 Mar 2011 15:50:54 +0000 Subject: Add inline definition of ftruncate to fix MSVC compile. --- lib/win32/emu.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'lib/win32') diff --git a/lib/win32/emu.h b/lib/win32/emu.h index 1b071f7e..d5ac7e1e 100644 --- a/lib/win32/emu.h +++ b/lib/win32/emu.h @@ -435,6 +435,16 @@ std::string GetErrorMessage(DWORD errorCode); // relatively recent C runtime lib int console_read(char* pBuffer, size_t BufferSize); +// Defined thus by MinGW, but missing from MSVC +// [http://curl.haxx.se/mail/lib-2004-11/0260.html] +#ifndef HAVE_FTRUNCATE + int ftruncate(int, off_t); + inline int ftruncate(int __fd, off_t __length) + { + return _chsize(__fd, __length); + } +#endif + #ifdef _MSC_VER /* disable certain compiler warnings to be able to actually see the show-stopper ones */ #pragma warning(disable:4101) // unreferenced local variable -- cgit v1.2.3