]> mj.ucw.cz Git - libucw.git/blobdiff - lib/fastbuf.c
As usually, stuff in lib/* is LGPL'ed.
[libucw.git] / lib / fastbuf.c
index 8df905487ed42ff9bd371aaa222b8625a3fc21c7..013c1b0848d3453672c38828c24bc91a4a8d09c4 100644 (file)
@@ -2,6 +2,9 @@
  *     Sherlock Library -- Fast Buffered I/O
  *
  *     (c) 1997--2000 Martin Mares <mj@ucw.cz>
+ *
+ *     This software may be freely distributed and used according to the terms
+ *     of the GNU Lesser General Public License.
  */
 
 #include "lib/lib.h"
@@ -80,7 +83,7 @@ int bpeekc_slow(struct fastbuf *f)
   return *f->bptr;
 }
 
-void bputc_slow(struct fastbuf *f, byte c)
+void bputc_slow(struct fastbuf *f, uns c)
 {
   if (f->bptr >= f->bufend)
     f->spout(f);
@@ -143,7 +146,7 @@ u64 bget5_slow(struct fastbuf *f)
   return ((u64) h << 32) | l;
 }
 
-void bputw_slow(struct fastbuf *f, word w)
+void bputw_slow(struct fastbuf *f, uns w)
 {
 #ifdef CPU_BIG_ENDIAN
   bputc_slow(f, w >> 8);
@@ -285,7 +288,7 @@ bgets0(struct fastbuf *f, byte *b, uns l)
 }
 
 int
-bdirect_read(struct fastbuf *f, byte **buf)
+bdirect_read_prepare(struct fastbuf *f, byte **buf)
 {
   int len;
 
@@ -293,10 +296,15 @@ bdirect_read(struct fastbuf *f, byte **buf)
     return EOF;
   *buf = f->bptr;
   len = f->bstop - f->bptr;
-  f->bptr += len;
   return len;
 }
 
+void
+bdirect_read_commit(struct fastbuf *f, byte *pos)
+{
+  f->bptr = pos;
+}
+
 int
 bdirect_write_prepare(struct fastbuf *f, byte **buf)
 {