]> mj.ucw.cz Git - libucw.git/commitdiff
bdirect_read_prepare() now returns 0 instead of EOF.
authorMartin Mares <mj@ucw.cz>
Sun, 6 Oct 2002 15:45:45 +0000 (15:45 +0000)
committerMartin Mares <mj@ucw.cz>
Sun, 6 Oct 2002 15:45:45 +0000 (15:45 +0000)
lib/fastbuf.c
lib/fastbuf.h

index 115719422b8844875edefb015f61170297c0494a..b7be624b5645d5ac34e1e52ca83b1ce2a951be62 100644 (file)
@@ -290,7 +290,7 @@ bbcopy_slow(struct fastbuf *f, struct fastbuf *t, uns l)
       uns favail, tavail, n;
 
       favail = bdirect_read_prepare(f, &fptr);
-      if (favail == (uns)EOF)
+      if (!favail)
        die("bbcopy: source exhausted");
       tavail = bdirect_write_prepare(t, &tptr);
       n = MIN(l, favail);
index 5ee23d48c88c556e0e25bb7ab1c20d9a1880b48d..ebc69955fb7720e7ebc192651745d705ba8c5d10 100644 (file)
@@ -65,7 +65,7 @@ struct fastbuf {
   int (*config)(struct fastbuf *, uns, int);   /* Configure the stream */
 };
 
-/* FastIO on standard files */
+/* FastIO on standard files (specify buffer size 0 to enable mmaping) */
 
 struct fastbuf *bopen(byte *name, uns mode, uns buffer);
 struct fastbuf *bopen_tmp(uns buffer);
@@ -315,11 +315,11 @@ bbcopy(struct fastbuf *f, struct fastbuf *t, uns l)
 
 /* Direct I/O on buffers */
 
-static inline int
+static inline uns
 bdirect_read_prepare(struct fastbuf *f, byte **buf)
 {
   if (f->bptr == f->bstop && !f->refill(f))
-    return EOF;
+    return 0;
   *buf = f->bptr;
   return f->bstop - f->bptr;
 }
@@ -330,7 +330,7 @@ bdirect_read_commit(struct fastbuf *f, byte *pos)
   f->bptr = pos;
 }
 
-static inline int
+static inline uns
 bdirect_write_prepare(struct fastbuf *f, byte **buf)
 {
   if (f->bptr == f->bufend)