X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=ucw%2Ffb-buffer.c;h=c69234725e0d26901e780fca0d63ec394369b3af;hb=a6368763d08042207963c941b1c52b5fafcb0cb3;hp=e0350f374f30fb99745cbeda3fd2cf899b9c304b;hpb=f20ecabf44f24743a1383f2ae2148adb660aa8f5;p=libucw.git diff --git a/ucw/fb-buffer.c b/ucw/fb-buffer.c index e0350f37..c6923472 100644 --- a/ucw/fb-buffer.c +++ b/ucw/fb-buffer.c @@ -7,8 +7,8 @@ * of the GNU Lesser General Public License. */ -#include "ucw/lib.h" -#include "ucw/fastbuf.h" +#include +#include #include #include @@ -29,15 +29,14 @@ 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; } void -fbbuf_init_read(struct fastbuf *f, byte *buf, uns size, uns can_overwrite) +fbbuf_init_read(struct fastbuf *f, byte *buf, uint size, uint can_overwrite) { *f = (struct fastbuf) { .buffer = buf, @@ -54,11 +53,11 @@ 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 -fbbuf_init_write(struct fastbuf *f, byte *buf, uns size) +fbbuf_init_write(struct fastbuf *f, byte *buf, uint size) { *f = (struct fastbuf) { .buffer = buf, @@ -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, }; }