static void file_seek(fz_context *ctx, void *opaque, fz_off_t off, int whence) { FILE *file = opaque; int n = fz_fseek(file, off, whence); if (n < 0) fz_throw(ctx, FZ_ERROR_GENERIC, "cannot fseek: %s", strerror(errno)); }
static void seek_file(fz_context *ctx, fz_stream *stm, fz_off_t offset, int whence) { fz_file_stream *state = stm->state; fz_off_t n = fz_fseek(state->file, offset, whence); if (n < 0) fz_throw(ctx, FZ_ERROR_GENERIC, "cannot seek: %s", strerror(errno)); stm->pos = fz_ftell(state->file); stm->rp = state->buffer; stm->wp = state->buffer; }