From: Martin Mares Date: Fri, 23 Aug 2002 08:26:26 +0000 (+0000) Subject: Allow SEEK_END. (I plan to rewrite seek in fbmem streams, the current X-Git-Tag: holmes-import~1361 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=afe333259dade3fc921c38d255c74c93cf0af9c6;p=libucw.git Allow SEEK_END. (I plan to rewrite seek in fbmem streams, the current version is awfully slow.) --- 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)