From b51005d0cdc8e592a7064a12f42a41b5d843fd94 Mon Sep 17 00:00:00 2001 From: Owen Shepherd Date: Thu, 16 Aug 2012 13:11:16 +0100 Subject: [PATCH] win32: Fix _PDCLIB_seek. Todo soon: change this API. It is far too tricky and involves too much reaching into the stream objects. --- platform/win32/functions/_PDCLIB/_PDCLIB_seek.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/platform/win32/functions/_PDCLIB/_PDCLIB_seek.c b/platform/win32/functions/_PDCLIB/_PDCLIB_seek.c index 3add659..e23cd3c 100644 --- a/platform/win32/functions/_PDCLIB/_PDCLIB_seek.c +++ b/platform/win32/functions/_PDCLIB/_PDCLIB_seek.c @@ -12,6 +12,10 @@ #include <_PDCLIB_glue.h> #include +_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; } -- 2.40.0