+ do_spout(f);
+ else
+ f->bptr = f->bstop; /* XXX: Skip the rest of the reading buffer ==> it breaks the position of the FE cursor */
+ DBG("FB: flushed");
+}
+
+static void do_seek(struct fastbuf *f, ucw_off_t pos, int whence)
+{
+ bflush(f);
+ DBG("FB: seeking to pos=%lld whence=%d %p %p %p %p", (long long)pos, whence, f->buffer, f->bstop, f->bptr, f->bufend);
+ if (!f->seek || !f->seek(f, pos, whence))
+ bthrow(f, "seek", "Stream not seekable");
+ DBG("FB: seeked %p %p %p %p", f->buffer, f->bstop, f->bptr, f->bufend);
+ ASSERT(f->buffer <= f->bstop && f->bstop <= f->bptr && f->bptr <= f->bufend);
+ if (whence == SEEK_SET)
+ ASSERT(pos == btell(f));
+ else
+ ASSERT(btell(f) >= 0);