]> mj.ucw.cz Git - libucw.git/blobdiff - ucw/fb-buffer.c
Fixed note about res_alloc() with no resource pool active
[libucw.git] / ucw / fb-buffer.c
index e0350f374f30fb99745cbeda3fd2cf899b9c304b..c91dbaf4ddd425fbb5214be9c2d6094f2f0272ab 100644 (file)
@@ -7,8 +7,8 @@
  *     of the GNU Lesser General Public License.
  */
 
-#include "ucw/lib.h"
-#include "ucw/fastbuf.h"
+#include <ucw/lib.h>
+#include <ucw/fastbuf.h>
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -29,10 +29,9 @@ fbbuf_seek(struct fastbuf *f, ucw_off_t pos, int whence)
   if (whence == SEEK_END)
     pos += len;
   if (pos < 0 || pos > len)
-    bthrow(f, "fb.seek", "Seek out of range");
-  f->bptr = f->buffer + pos;
-  f->bstop = f->buffer;
-  f->pos = 0;
+    bthrow(f, "seek", "Seek out of range");
+  f->bstop = f->bptr = f->buffer + pos;
+  f->pos = pos;
   return 1;
 }
 
@@ -54,7 +53,7 @@ fbbuf_init_read(struct fastbuf *f, byte *buf, uns size, uns can_overwrite)
 static void
 fbbuf_spout(struct fastbuf *f)
 {
-  bthrow(f, "fb.write", "fbbuf: buffer overflow on write");
+  bthrow(f, "write", "fbbuf: buffer overflow on write");
 }
 
 void
@@ -66,7 +65,6 @@ fbbuf_init_write(struct fastbuf *f, byte *buf, uns size)
     .bptr = buf,
     .bufend = buf + size,
     .name = "fbbuf-write",
-    .pos = size,
     .spout = fbbuf_spout,
   };
 }