From: Owen Shepherd Date: Thu, 16 Aug 2012 12:11:16 +0000 (+0100) Subject: win32: Fix _PDCLIB_seek. Todo soon: change this API. It is far too tricky and involve... X-Git-Url: https://pd.if.org/git/?p=pdclib;a=commitdiff_plain;h=b51005d0cdc8e592a7064a12f42a41b5d843fd94 win32: Fix _PDCLIB_seek. Todo soon: change this API. It is far too tricky and involves too much reaching into the stream objects. --- 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; }