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