]> pd.if.org Git - pdclib/commitdiff
win32: Fix _PDCLIB_seek. Todo soon: change this API. It is far too tricky and involve...
authorOwen Shepherd <owen.shepherd@e43.eu>
Thu, 16 Aug 2012 12:11:16 +0000 (13:11 +0100)
committerOwen Shepherd <owen.shepherd@e43.eu>
Thu, 16 Aug 2012 12:11:16 +0000 (13:11 +0100)
platform/win32/functions/_PDCLIB/_PDCLIB_seek.c

index 3add6591c535962fc775a9a311759bcb0b64f8de..e23cd3cbaf5af4ac71910663085487ca0f9d0fa7 100644 (file)
 #include <_PDCLIB_glue.h>
 #include <windows.h>
 
+_Static_assert(SEEK_SET == FILE_BEGIN, "SEEK_SET is incorrect");
+_Static_assert(SEEK_CUR == FILE_CURRENT, "SEEK_CUR is incorrect");
+_Static_assert(SEEK_END == FILE_END, "SEEK_END is incorrect");
+
 extern void _PDCLIB_w32errno( void );
 _PDCLIB_int64_t _PDCLIB_seek( struct _PDCLIB_file_t * stream, _PDCLIB_int64_t offset, int whence )
 {
@@ -22,6 +26,10 @@ _PDCLIB_int64_t _PDCLIB_seek( struct _PDCLIB_file_t * stream, _PDCLIB_int64_t of
         _PDCLIB_w32errno();
         return EOF;
     }
+
+    stream->ungetidx = 0;
+    stream->bufidx = 0;
+    stream->bufend = 0;
     stream->pos.offset = liOffset.QuadPart;
     return liOffset.QuadPart;
 }