X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;ds=sidebyside;f=ucw%2Ffb-buffer.c;h=c69234725e0d26901e780fca0d63ec394369b3af;hb=a6368763d08042207963c941b1c52b5fafcb0cb3;hp=846ff8f9814b94aece359f873959562549073545;hpb=ba1c173f544383aa6553a75dee6e6858d8f243a4;p=libucw.git diff --git a/ucw/fb-buffer.c b/ucw/fb-buffer.c index 846ff8f9..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 @@ -30,14 +30,13 @@ fbbuf_seek(struct fastbuf *f, ucw_off_t pos, int whence) pos += len; if (pos < 0 || pos > len) bthrow(f, "seek", "Seek out of range"); - f->bptr = f->buffer + pos; - f->bstop = f->buffer; - f->pos = 0; + 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, @@ -58,7 +57,7 @@ fbbuf_spout(struct fastbuf *f) } 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, }; }