X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=lib%2Ffastbuf.c;h=8df905487ed42ff9bd371aaa222b8625a3fc21c7;hb=23552983305e667eeb772406d1745ab7b865855e;hp=00fa51bcccd902538514cbbb069598008094b06f;hpb=8d7ea15cf2d519e6f6cae540bdaeeee7fbc82acc;p=libucw.git diff --git a/lib/fastbuf.c b/lib/fastbuf.c index 00fa51bc..8df90548 100644 --- a/lib/fastbuf.c +++ b/lib/fastbuf.c @@ -87,13 +87,19 @@ void bputc_slow(struct fastbuf *f, byte c) *f->bptr++ = c; } -word bgetw_slow(struct fastbuf *f) +int bgetw_slow(struct fastbuf *f) { - word w = bgetc_slow(f); + int w1, w2; + w1 = bgetc_slow(f); + if (w1 < 0) + return w1; + w2 = bgetc_slow(f); + if (w2 < 0) + return w2; #ifdef CPU_BIG_ENDIAN - return (w << 8) | bgetc_slow(f); + return (w1 << 8) | w2; #else - return w | (bgetc_slow(f) << 8); + return w1 | (w2 << 8); #endif }