From afe333259dade3fc921c38d255c74c93cf0af9c6 Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Fri, 23 Aug 2002 08:26:26 +0000 Subject: [PATCH] Allow SEEK_END. (I plan to rewrite seek in fbmem streams, the current version is awfully slow.) --- lib/fb-mem.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/fb-mem.c b/lib/fb-mem.c index 07e4efbc..41d0a691 100644 --- a/lib/fb-mem.c +++ b/lib/fb-mem.c @@ -90,6 +90,17 @@ fbmem_seek(struct fastbuf *f, sh_off_t pos, int whence) struct msblock *b; unsigned int p = 0; + /* FIXME: Milan's quick hack to allow SEEK_END */ + if (whence == SEEK_END) + { + for (b=m->first; b; b=b->next) + p += b->size; + pos += p; + p=0; + whence = SEEK_SET; + } + /* EOQH */ + if (whence != SEEK_SET) die("fbmem_seek: only SEEK_SET supported"); for (b=m->first; b; b=b->next) -- 2.39.2