X-Git-Url: https://pd.if.org/git/?p=pdclib;a=blobdiff_plain;f=functions%2Fstdio%2F_PDCLIB_fillbuffer.c;h=7cfbe9355351eb469f5e06a721493a610607105a;hp=dfdfe262510d858043e23bfb3a30505271bbb2f0;hb=abc15df6b9fae3374d24c7cf5c3ab94c605b2a6d;hpb=c5d49235e09fbd58416f10dec2799e61cf3431c8 diff --git a/functions/stdio/_PDCLIB_fillbuffer.c b/functions/stdio/_PDCLIB_fillbuffer.c index dfdfe26..7cfbe93 100644 --- a/functions/stdio/_PDCLIB_fillbuffer.c +++ b/functions/stdio/_PDCLIB_fillbuffer.c @@ -1,45 +1,46 @@ -/* _PDCLIB_fillbuffer( struct _PDCLIB_file_t * stream ) - - This file is part of the Public Domain C Library (PDCLib). - Permission is granted to use, modify, and / or redistribute at will. -*/ - -#include - -#ifndef REGTEST -#include <_PDCLIB_glue.h> - -int _PDCLIB_fillbuffer( struct _PDCLIB_file_t * stream ) -{ - size_t bytesRead; - bool ok = stream->ops->read( stream->handle, stream->buffer, stream->bufsize, - &bytesRead); - - if( ok ) { - if( bytesRead == 0 ) { - stream->status |= _PDCLIB_EOFFLAG; - return EOF; - } - stream->pos.offset += bytesRead; - stream->bufend = bytesRead; - stream->bufidx = 0; - return 0; - } else { - stream->status |= _PDCLIB_ERRORFLAG; - return EOF; - } -} - -#endif - -#ifdef TEST -#include <_PDCLIB_test.h> - -int main( void ) -{ - /* Testing covered by ftell.c */ - return TEST_RESULTS; -} - -#endif - +/* _PDCLIB_fillbuffer( FILE * stream ) + + This file is part of the Public Domain C Library (PDCLib). + Permission is granted to use, modify, and / or redistribute at will. +*/ + +#include + +#ifndef REGTEST +#include "_PDCLIB_glue.h" +#include "_PDCLIB_io.h" + +int _PDCLIB_fillbuffer( FILE * stream ) +{ + size_t bytesRead; + bool ok = stream->ops->read( stream->handle, stream->buffer, stream->bufsize, + &bytesRead); + + if( ok ) { + if( bytesRead == 0 ) { + stream->status |= _PDCLIB_EOFFLAG; + return EOF; + } + stream->pos.offset += bytesRead; + stream->bufend = bytesRead; + stream->bufidx = 0; + return 0; + } else { + stream->status |= _PDCLIB_ERRORFLAG; + return EOF; + } +} + +#endif + +#ifdef TEST +#include "_PDCLIB_test.h" + +int main( void ) +{ + /* Testing covered by ftell.c */ + return TEST_RESULTS; +} + +#endif +