OSDN Git Service

This patch adds mingw32 cross-compilation support to HandBrake trunk to
[handbrake-jp/handbrake-jp-git.git] / contrib / libmp4v2 / P01-mingw-msvcrt-lower.patch
1 diff -Naur libmp4v2.orig/libplatform/io/File_win32.cpp libmp4v2/libplatform/io/File_win32.cpp
2 --- libmp4v2.orig/libplatform/io/File_win32.cpp 2008-11-16 02:50:26.000000000 -0500
3 +++ libmp4v2/libplatform/io/File_win32.cpp      2009-03-13 02:00:09.000000000 -0400
4 @@ -8,7 +8,8 @@
5  bool
6  StdioFile::getPosition( Size& pos_ )
7  {
8 -    pos_ = _ftelli64( _handle );
9 +    fflush( _handle ); // must flush because we're using _fileno routines
10 +    pos_ = _telli64( _fileno( _handle ));
11      return pos_ == -1;
12  }
13  
14 @@ -17,6 +18,7 @@
15  bool
16  StdioFile::getSize( Size& size_ )
17  {
18 +    fflush( _handle ); // must flush because we're using _fileno routines
19      LARGE_INTEGER n;
20      if( !GetFileSizeEx( (HANDLE)_get_osfhandle( _fileno( _handle )), &n ))
21          return true;
22 @@ -29,7 +31,8 @@
23  bool
24  StdioFile::setPosition( Size pos_ )
25  {
26 -    return _fseeki64( _handle, pos_, SEEK_SET ) != 0;
27 +    fflush( _handle ); // must flush because we're using _fileno routines
28 +    return _lseeki64( _fileno( _handle ), pos_, SEEK_SET ) == -1;
29  }
30  
31  ///////////////////////////////////////////////////////////////////////////////