From 20d8d6b04cc16c1d0829402152566b2e1212d516 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 3 Jun 2004 21:55:30 +0000 Subject: [PATCH] Fixes for compilation on Windows. --- Makefile.mingw | 4 ++-- src/common/mm_io.cpp | 13 ++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/Makefile.mingw b/Makefile.mingw index e5d71d4dd..83f34ba56 100644 --- a/Makefile.mingw +++ b/Makefile.mingw @@ -110,8 +110,8 @@ config.h: configure.in # avilib-0.6.10 # -libavi_SOURCES = $(wildcard avilib-0.6.10/*.c) -libavi_OBJECTS := $(patsubst %.c,%.o,$(libavi_SOURCES)) +libavi_SOURCES = $(wildcard avilib-0.6.10/*.c) $(wildcard avilib-0.6.10/*.cpp) +libavi_OBJECTS := $(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(libavi_SOURCES))) avilib-0.6.10/libavi.a: $(libavi_OBJECTS) rm -f $@ diff --git a/src/common/mm_io.cpp b/src/common/mm_io.cpp index bd541a0e5..6fde54845 100644 --- a/src/common/mm_io.cpp +++ b/src/common/mm_io.cpp @@ -266,7 +266,18 @@ bool mm_io_c::eof() { int mm_io_c::truncate(int64_t pos) { - _chsize((HANDLE)file, pos); + bool result; + + save_pos(); + if (setFilePointer2(pos)) { + result = SetEndOfFile((HANDLE)file); + restore_pos(); + if (result) + return 0; + return -1; + } + restore_pos(); + return -1; } #endif