X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=inline;f=lib%2Ffastbuf.c;h=dcb8d20dc0fe305b1229b2418ee89390bb4ae0ad;hb=d5e8872563f6fde8299db971ffb6494c2438c590;hp=79229d4e1d372bf981a92cd4c5adea28b3802b7c;hpb=d894fe2e0d3bc2d3d9d3a2b84d372fb2ea2b5ca0;p=libucw.git diff --git a/lib/fastbuf.c b/lib/fastbuf.c index 79229d4e..dcb8d20d 100644 --- a/lib/fastbuf.c +++ b/lib/fastbuf.c @@ -1,7 +1,7 @@ /* * UCW Library -- Fast Buffered I/O * - * (c) 1997--2006 Martin Mares + * (c) 1997--2007 Martin Mares * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. @@ -10,6 +10,7 @@ #include "lib/lib.h" #include "lib/fastbuf.h" +#include #include void bclose(struct fastbuf *f) @@ -66,7 +67,7 @@ int bgetc_slow(struct fastbuf *f) if (f->bptr < f->bstop) return *f->bptr++; if (!f->refill(f)) - return EOF; + return -1; return *f->bptr++; } @@ -75,7 +76,7 @@ int bpeekc_slow(struct fastbuf *f) if (f->bptr < f->bstop) return *f->bptr; if (!f->refill(f)) - return EOF; + return -1; return *f->bptr; } @@ -195,7 +196,7 @@ bfilesize(struct fastbuf *f) return 0; sh_off_t pos = btell(f); bflush(f); - if (!f->seek(f, pos, SEEK_END)) + if (!f->seek(f, 0, SEEK_END)) return -1; sh_off_t len = btell(f); bsetpos(f, pos);