diff options
author | Tor Andersson <tor@ghostscript.com> | 2004-12-08 15:06:07 +0100 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2004-12-08 15:06:07 +0100 |
commit | 5537c50d225b8521a043859f9de4057d271cac97 (patch) | |
tree | a3bf8962f522f3e398dcd99eb3452e913127bbce /filter | |
parent | 576f0af8fbeb49f6e813d06379ed8b0db07ea271 (diff) | |
download | mupdf-5537c50d225b8521a043859f9de4057d271cac97.tar.xz |
seek/tell for openbuffer. path clip cloned too early.
Diffstat (limited to 'filter')
-rw-r--r-- | filter/filec.c | 27 |
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) { |