summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
Diffstat (limited to 'filter')
-rw-r--r--filter/filec.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/filter/filec.c b/filter/filec.c
index 4388b48a..05813185 100644
--- a/filter/filec.c
+++ b/filter/filec.c
@@ -282,6 +282,25 @@ fz_seek(fz_file *f, int ofs, int whence)
whence = 0;
}
+ if (f->fd == -1)
+ {
+ if (whence == 0)
+ {
+ if (f->mode == FZ_READ)
+ f->out->rp = CLAMP(f->out->bp + ofs, f->out->bp, f->in->ep);
+ else
+ f->in->wp = CLAMP(f->in->bp + ofs, f->in->bp, f->in->ep);
+ }
+ else
+ {
+ if (f->mode == FZ_READ)
+ f->out->rp = CLAMP(f->out->ep + ofs, f->out->bp, f->in->ep);
+ else
+ f->in->wp = CLAMP(f->in->ep + ofs, f->in->bp, f->in->ep);
+ }
+ return fz_tell(f);
+ }
+
t = lseek(f->fd, ofs, whence);
if (t == -1)
{
@@ -307,6 +326,14 @@ fz_tell(fz_file *f)
return f->filter->count - (f->out->wp - f->out->rp);
}
+ if (f->fd == -1)
+ {
+ if (f->mode == FZ_READ)
+ return f->out->rp - f->out->bp;
+ else
+ return f->in->wp - f->in->bp;
+ }
+
t = lseek(f->fd, 0, 1);
if (t == -1)
{