From 475129d6b181a9b17ec08bca70a1ac03e42e3b2b Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Tue, 26 Jan 2021 19:44:56 +0000 Subject: [PATCH] Fix MuPDF-gl chapter/page handling. Internally, fz_locations are numbered from 0. Externally we number from 1. Adjust when parsing. --- platform/gl/gl-main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c index 8ded96d63..523e0d1d9 100644 --- a/platform/gl/gl-main.c +++ b/platform/gl/gl-main.c @@ -1472,16 +1472,16 @@ parse_location(const char *anchor, fz_location *loc) s = anchor; while (*s >= '0' && *s <= '9') s++; - loc->chapter = fz_atoi(anchor); + loc->chapter = fz_atoi(anchor)-1; if (*s != ':') return 0; p = ++s; while (*s >= '0' && *s <= '9') s++; if (s == p) - loc->page = 1; + loc->page = 0; else - loc->page = atoi(p); + loc->page = fz_atoi(p)-1; return 1; } -- 2.38.5