diff options
author | Liliana Marie Prikler <liliana.prikler@gmail.com> | 2024-03-09 07:46:25 +0100 |
---|---|---|
committer | Liliana Marie Prikler <liliana.prikler@gmail.com> | 2024-03-09 07:46:25 +0100 |
commit | 058532bdd8953feefbd84fd7514822886c7f1a7e (patch) | |
tree | dd29b23b04df1e30a03b93d53a339f6fcd817285 /gnu/packages/patches | |
parent | 19fc252ab7e86ad1443a8d16f68467c61bf23179 (diff) | |
parent | 1bc05c6f6d56ad9e0e31d7f1cc75545a65e3d0f3 (diff) |
Merge branch 'master' into emacs-team
Diffstat (limited to 'gnu/packages/patches')
-rw-r--r-- | gnu/packages/patches/hubbub-maybe-uninitialized.patch | 40 | ||||
-rw-r--r-- | gnu/packages/patches/libcss-check-format.patch | 13 | ||||
-rw-r--r-- | gnu/packages/patches/libtommath-fix-linkage.patch | 55 | ||||
-rw-r--r-- | gnu/packages/patches/libtommath-integer-overflow.patch | 140 | ||||
-rw-r--r-- | gnu/packages/patches/netsurf-message-timestamp.patch | 4 | ||||
-rw-r--r-- | gnu/packages/patches/podman-program-lookup.patch | 120 | ||||
-rw-r--r-- | gnu/packages/patches/scribus-1.5.8-poppler-22.03.0.patch | 52 | ||||
-rw-r--r-- | gnu/packages/patches/scribus-1.5.8-poppler-22.04.0.patch | 291 | ||||
-rw-r--r-- | gnu/packages/patches/scribus-1.5.8-poppler-22.09.0.patch | 20 | ||||
-rw-r--r-- | gnu/packages/patches/scribus-1.5.8-poppler-22.2.0-1.patch | 129 | ||||
-rw-r--r-- | gnu/packages/patches/scribus-1.5.8-poppler-22.2.0-2.patch | 28 | ||||
-rw-r--r-- | gnu/packages/patches/sioyek-fix-build.patch | 82 |
12 files changed, 217 insertions, 757 deletions
diff --git a/gnu/packages/patches/hubbub-maybe-uninitialized.patch b/gnu/packages/patches/hubbub-maybe-uninitialized.patch deleted file mode 100644 index 6f289a770ef..00000000000 --- a/gnu/packages/patches/hubbub-maybe-uninitialized.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 69d81a8a4d4c223aad67cde0fdf64d64351b9802 Mon Sep 17 00:00:00 2001 -From: Andy Tai <atai@atai.org> -Date: Sat, 27 May 2023 00:01:34 -0700 -Subject: [PATCH] prevent -Werror=maybe-uninitialized build failure with gcc 11 - when building tests tokeniser2 and tokeniser3 - ---- - test/tokeniser2.c | 2 +- - test/tokeniser3.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/test/tokeniser2.c b/test/tokeniser2.c -index c8ab9c0..4caae38 100644 ---- a/test/tokeniser2.c -+++ b/test/tokeniser2.c -@@ -438,7 +438,7 @@ hubbub_error token_handler(const hubbub_token *token, void *pw) - /* Expected token only contained part of the data - * Calculate how much is left, then try again with - * the next expected token */ -- hubbub_token t; -+ hubbub_token t = { 0 }; - - t.type = HUBBUB_TOKEN_CHARACTER; - t.data.character.ptr += len; -diff --git a/test/tokeniser3.c b/test/tokeniser3.c -index e33d018..b3be901 100644 ---- a/test/tokeniser3.c -+++ b/test/tokeniser3.c -@@ -447,7 +447,7 @@ hubbub_error token_handler(const hubbub_token *token, void *pw) - /* Expected token only contained part of the data - * Calculate how much is left, then try again with - * the next expected token */ -- hubbub_token t; -+ hubbub_token t = { 0 }; - - t.type = HUBBUB_TOKEN_CHARACTER; - t.data.character.ptr += len; --- -2.40.1 - diff --git a/gnu/packages/patches/libcss-check-format.patch b/gnu/packages/patches/libcss-check-format.patch new file mode 100644 index 00000000000..b297ac1c929 --- /dev/null +++ b/gnu/packages/patches/libcss-check-format.patch @@ -0,0 +1,13 @@ +Submitted upstream at https://bugs.netsurf-browser.org/mantis/view.php?id=2870 + +--- libcss-0.9.2/test/dump.h.orig ++++ libcss-0.9.2/test/dump.h +@@ -131,7 +131,7 @@ void dump_rule_media(css_rule_media *s, char **buf, size_t *buflen) + char *ptr = *buf; + css_rule *rule; + +- ptr += sprintf(ptr, "| @media %s%03lx", ++ ptr += sprintf(ptr, "| @media %s%03" PRIx64, + s->media->negate_type ? "not " : "", + s->media->type); + diff --git a/gnu/packages/patches/libtommath-fix-linkage.patch b/gnu/packages/patches/libtommath-fix-linkage.patch deleted file mode 100644 index 1a9d46eb7c2..00000000000 --- a/gnu/packages/patches/libtommath-fix-linkage.patch +++ /dev/null @@ -1,55 +0,0 @@ -https://github.com/libtom/libtommath/commit/93dea3a4162527346cd8856bfda6f17ffe98ab04.patch - -From 93dea3a4162527346cd8856bfda6f17ffe98ab04 Mon Sep 17 00:00:00 2001 -From: Steffen Jaeckel <s@jaeckel.eu> -Date: Thu, 31 Jan 2019 14:12:03 +0100 -Subject: [PATCH] makefile.shared: fix compilation and linkage - ---- - makefile.shared | 15 ++++++++------- - 1 file changed, 8 insertions(+), 7 deletions(-) - -diff --git a/makefile.shared b/makefile.shared -index 3955f830..870b18d1 100644 ---- a/makefile.shared -+++ b/makefile.shared -@@ -18,6 +18,7 @@ ifndef LIBTOOL - endif - endif - LTCOMPILE = $(LIBTOOL) --mode=compile --tag=CC $(CC) -+LTLINK = $(LIBTOOL) --mode=link --tag=CC $(CC) - - LCOV_ARGS=--directory .libs --directory . - -@@ -59,7 +60,7 @@ objs: $(OBJECTS) - LOBJECTS = $(OBJECTS:.o=.lo) - - $(LIBNAME): $(OBJECTS) -- $(LIBTOOL) --mode=link --tag=CC $(CC) $(LDFLAGS) $(LOBJECTS) -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION_SO) $(LIBTOOLFLAGS) -+ $(LTLINK) $(LDFLAGS) $(LOBJECTS) -o $(LIBNAME) -rpath $(LIBPATH) -version-info $(VERSION_SO) $(LIBTOOLFLAGS) - - install: $(LIBNAME) - install -d $(DESTDIR)$(LIBPATH) -@@ -76,16 +77,16 @@ uninstall: - rm $(DESTDIR)$(LIBPATH)/pkgconfig/libtommath.pc - - test: $(LIBNAME) demo/demo.o -- $(CC) $(CFLAGS) -c demo/demo.c -o demo/demo.o -- $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o test demo/demo.o $(LIBNAME) -+ $(LTCOMPILE) $(CFLAGS) -c demo/demo.c -o demo/demo.o -+ $(LTLINK) $(LDFLAGS) -o test demo/demo.o $(LIBNAME) - - test_standalone: $(LIBNAME) demo/demo.o -- $(CC) $(CFLAGS) -c demo/demo.c -o demo/demo.o -- $(LIBTOOL) --mode=link $(CC) $(LDFLAGS) -o test demo/demo.o $(LIBNAME) -+ $(LTCOMPILE) $(CFLAGS) -c demo/demo.c -o demo/demo.o -+ $(LTLINK) $(LDFLAGS) -o test demo/demo.o $(LIBNAME) - - .PHONY: mtest - mtest: -- cd mtest ; $(CC) $(CFLAGS) $(LDFLAGS) mtest.c -o mtest -+ cd mtest ; $(CC) $(CFLAGS) -O0 mtest.c $(LDFLAGS) -o mtest - - timing: $(LIBNAME) demo/timing.c -- $(LIBTOOL) --mode=link $(CC) $(CFLAGS) $(LDFLAGS) -DTIMER demo/timing.c $(LIBNAME) -o timing -+ $(LTLINK) $(CFLAGS) $(LDFLAGS) -DTIMER demo/timing.c $(LIBNAME) -o timing diff --git a/gnu/packages/patches/libtommath-integer-overflow.patch b/gnu/packages/patches/libtommath-integer-overflow.patch deleted file mode 100644 index 5241726775d..00000000000 --- a/gnu/packages/patches/libtommath-integer-overflow.patch +++ /dev/null @@ -1,140 +0,0 @@ -This patch is from upstream: -https://github.com/libtom/libtommath/pull/546 - -From beba892bc0d4e4ded4d667ab1d2a94f4d75109a9 Mon Sep 17 00:00:00 2001 -From: czurnieden <czurnieden@gmx.de> -Date: Tue, 9 May 2023 17:17:12 +0200 -Subject: [PATCH] Fix possible integer overflow - ---- - bn_mp_2expt.c | 4 ++++ - bn_mp_grow.c | 4 ++++ - bn_mp_init_size.c | 5 +++++ - bn_mp_mul_2d.c | 4 ++++ - bn_s_mp_mul_digs.c | 4 ++++ - bn_s_mp_mul_digs_fast.c | 4 ++++ - bn_s_mp_mul_high_digs.c | 4 ++++ - bn_s_mp_mul_high_digs_fast.c | 4 ++++ - 8 files changed, 33 insertions(+) - -diff --git a/bn_mp_2expt.c b/bn_mp_2expt.c -index 0ae3df1bf..23de0c3c5 100644 ---- a/bn_mp_2expt.c -+++ b/bn_mp_2expt.c -@@ -12,6 +12,10 @@ mp_err mp_2expt(mp_int *a, int b) - { - mp_err err; - -+ if (b < 0) { -+ return MP_VAL; -+ } -+ - /* zero a as per default */ - mp_zero(a); - -diff --git a/bn_mp_grow.c b/bn_mp_grow.c -index 9e904c547..2b1682651 100644 ---- a/bn_mp_grow.c -+++ b/bn_mp_grow.c -@@ -9,6 +9,10 @@ mp_err mp_grow(mp_int *a, int size) - int i; - mp_digit *tmp; - -+ if (size < 0) { -+ return MP_VAL; -+ } -+ - /* if the alloc size is smaller alloc more ram */ - if (a->alloc < size) { - /* reallocate the array a->dp -diff --git a/bn_mp_init_size.c b/bn_mp_init_size.c -index d62268721..99573833f 100644 ---- a/bn_mp_init_size.c -+++ b/bn_mp_init_size.c -@@ -6,6 +6,11 @@ - /* init an mp_init for a given size */ - mp_err mp_init_size(mp_int *a, int size) - { -+ -+ if (size < 0) { -+ return MP_VAL; -+ } -+ - size = MP_MAX(MP_MIN_PREC, size); - - /* alloc mem */ -diff --git a/bn_mp_mul_2d.c b/bn_mp_mul_2d.c -index 87354de20..bfeaf2eb2 100644 ---- a/bn_mp_mul_2d.c -+++ b/bn_mp_mul_2d.c -@@ -9,6 +9,10 @@ mp_err mp_mul_2d(const mp_int *a, int b, mp_int *c) - mp_digit d; - mp_err err; - -+ if (b < 0) { -+ return MP_VAL; -+ } -+ - /* copy */ - if (a != c) { - if ((err = mp_copy(a, c)) != MP_OKAY) { -diff --git a/bn_s_mp_mul_digs.c b/bn_s_mp_mul_digs.c -index 64509d4cb..3682b4980 100644 ---- a/bn_s_mp_mul_digs.c -+++ b/bn_s_mp_mul_digs.c -@@ -16,6 +16,10 @@ mp_err s_mp_mul_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) - mp_word r; - mp_digit tmpx, *tmpt, *tmpy; - -+ if (digs < 0) { -+ return MP_VAL; -+ } -+ - /* can we use the fast multiplier? */ - if ((digs < MP_WARRAY) && - (MP_MIN(a->used, b->used) < MP_MAXFAST)) { -diff --git a/bn_s_mp_mul_digs_fast.c b/bn_s_mp_mul_digs_fast.c -index b2a287b02..3c4176a87 100644 ---- a/bn_s_mp_mul_digs_fast.c -+++ b/bn_s_mp_mul_digs_fast.c -@@ -26,6 +26,10 @@ mp_err s_mp_mul_digs_fast(const mp_int *a, const mp_int *b, mp_int *c, int digs) - mp_digit W[MP_WARRAY]; - mp_word _W; - -+ if (digs < 0) { -+ return MP_VAL; -+ } -+ - /* grow the destination as required */ - if (c->alloc < digs) { - if ((err = mp_grow(c, digs)) != MP_OKAY) { -diff --git a/bn_s_mp_mul_high_digs.c b/bn_s_mp_mul_high_digs.c -index 2bb2a5098..c9dd355f8 100644 ---- a/bn_s_mp_mul_high_digs.c -+++ b/bn_s_mp_mul_high_digs.c -@@ -15,6 +15,10 @@ mp_err s_mp_mul_high_digs(const mp_int *a, const mp_int *b, mp_int *c, int digs) - mp_word r; - mp_digit tmpx, *tmpt, *tmpy; - -+ if (digs < 0) { -+ return MP_VAL; -+ } -+ - /* can we use the fast multiplier? */ - if (MP_HAS(S_MP_MUL_HIGH_DIGS_FAST) - && ((a->used + b->used + 1) < MP_WARRAY) -diff --git a/bn_s_mp_mul_high_digs_fast.c b/bn_s_mp_mul_high_digs_fast.c -index a2c4fb692..4ce7f590c 100644 ---- a/bn_s_mp_mul_high_digs_fast.c -+++ b/bn_s_mp_mul_high_digs_fast.c -@@ -19,6 +19,10 @@ mp_err s_mp_mul_high_digs_fast(const mp_int *a, const mp_int *b, mp_int *c, int - mp_digit W[MP_WARRAY]; - mp_word _W; - -+ if (digs < 0) { -+ return MP_VAL; -+ } -+ - /* grow the destination as required */ - pa = a->used + b->used; - if (c->alloc < pa) { diff --git a/gnu/packages/patches/netsurf-message-timestamp.patch b/gnu/packages/patches/netsurf-message-timestamp.patch index 8df9dbf8f7c..03bfdfde3fd 100644 --- a/gnu/packages/patches/netsurf-message-timestamp.patch +++ b/gnu/packages/patches/netsurf-message-timestamp.patch @@ -1,5 +1,5 @@ ---- netsurf-3.8/utils/split-messages.pl.orig 1969-12-31 18:00:00.000000000 -0600 -+++ netsurf-3.8/utils/split-messages.pl 2018-08-30 00:18:58.158367530 -0500 +--- netsurf-3.11/tools/split-messages.pl.orig ++++ netsurf-3.11/tools/split-messages.pl @@ -238,7 +238,7 @@ if( $opt{gzip} ) diff --git a/gnu/packages/patches/podman-program-lookup.patch b/gnu/packages/patches/podman-program-lookup.patch new file mode 100644 index 00000000000..27a94212859 --- /dev/null +++ b/gnu/packages/patches/podman-program-lookup.patch @@ -0,0 +1,120 @@ +From 914aed3e04f71453fbdc30f4287e13ca3ce63a36 Mon Sep 17 00:00:00 2001 +From: Tomas Volf <~@wolfsden.cz> +Date: Wed, 14 Feb 2024 20:02:03 +0100 +Subject: [PATCH] Modify search for binaries to fit Guix model + +Podman basically looked into the $PATH and into its libexec. That does not fit +Guix's model very well, to an additional option to specify additional +directories during compilation was added. + +* pkg/rootless/rootless_linux.go +(tryMappingTool): Also check /run/setuid-programs. +* vendor/github.com/containers/common/pkg/config/config.go +(extraGuixDir): New function. +(FindHelperBinary): Use it. +* vendor/github.com/containers/storage/pkg/unshare/unshare_linux.go +(guixLookupSetuidPath): New function. +(Start): Use it. +--- + pkg/rootless/rootless_linux.go | 3 +++ + .../containers/common/pkg/config/config.go | 23 +++++++++++++++++++ + .../storage/pkg/unshare/unshare_linux.go | 14 +++++++++-- + 3 files changed, 38 insertions(+), 2 deletions(-) + +diff --git a/pkg/rootless/rootless_linux.go b/pkg/rootless/rootless_linux.go +index d303c8b..0191d90 100644 +--- a/pkg/rootless/rootless_linux.go ++++ b/pkg/rootless/rootless_linux.go +@@ -102,6 +102,9 @@ func tryMappingTool(uid bool, pid int, hostID int, mappings []idtools.IDMap) err + idtype = "setgid" + } + path, err := exec.LookPath(tool) ++ if err != nil { ++ path, err = exec.LookPath("/run/setuid-programs/" + tool) ++ } + if err != nil { + return fmt.Errorf("command required for rootless mode with multiple IDs: %w", err) + } +diff --git a/vendor/github.com/containers/common/pkg/config/config.go b/vendor/github.com/containers/common/pkg/config/config.go +index 75b917f..ed2f131 100644 +--- a/vendor/github.com/containers/common/pkg/config/config.go ++++ b/vendor/github.com/containers/common/pkg/config/config.go +@@ -1102,6 +1102,24 @@ func findBindir() string { + return bindirCached + } + ++func extraGuixDir(bin_name string) string { ++ if (bin_name == "slirp4netns") { ++ return "@SLIRP4NETNS_DIR@"; ++ } else if (bin_name == "pasta") { ++ return "@PASST_DIR@"; ++ } else if (strings.HasPrefix(bin_name, "qemu-")) { ++ return "@QEMU_DIR@"; ++ } else if (bin_name == "gvproxy") { ++ return "@GVPROXY_DIR@"; ++ } else if (bin_name == "netavark") { ++ return "@NETAVARK_DIR@"; ++ } else if (bin_name == "aardvark-dns") { ++ return "@AARDVARK_DNS_DIR@"; ++ } else { ++ return ""; ++ } ++} ++ + // FindHelperBinary will search the given binary name in the configured directories. + // If searchPATH is set to true it will also search in $PATH. + func (c *Config) FindHelperBinary(name string, searchPATH bool) (string, error) { +@@ -1109,6 +1127,11 @@ func (c *Config) FindHelperBinary(name string, searchPATH bool) (string, error) + bindirPath := "" + bindirSearched := false + ++ if dir := extraGuixDir(name); dir != "" { ++ /* If there is a Guix dir, skip the PATH search. */ ++ dirList = append([]string{dir}, dirList...) ++ } ++ + // If set, search this directory first. This is used in testing. + if dir, found := os.LookupEnv("CONTAINERS_HELPER_BINARY_DIR"); found { + dirList = append([]string{dir}, dirList...) +diff --git a/vendor/github.com/containers/storage/pkg/unshare/unshare_linux.go b/vendor/github.com/containers/storage/pkg/unshare/unshare_linux.go +index a8dc1ba..0b0d755 100644 +--- a/vendor/github.com/containers/storage/pkg/unshare/unshare_linux.go ++++ b/vendor/github.com/containers/storage/pkg/unshare/unshare_linux.go +@@ -26,6 +26,16 @@ import ( + "github.com/syndtr/gocapability/capability" + ) + ++func guixLookupSetuidPath(prog string) (string, error) { ++ path, err := exec.LookPath(prog) ++ if err != nil { ++ path, err = exec.LookPath("/run/setuid-programs/" + prog) ++ } ++ return path, err ++} ++ ++ ++ + // Cmd wraps an exec.Cmd created by the reexec package in unshare(), and + // handles setting ID maps and other related settings by triggering + // initialization code in the child. +@@ -237,7 +247,7 @@ func (c *Cmd) Start() error { + gidmapSet := false + // Set the GID map. + if c.UseNewgidmap { +- path, err := exec.LookPath("newgidmap") ++ path, err := guixLookupSetuidPath("newgidmap") + if err != nil { + return fmt.Errorf("finding newgidmap: %w", err) + } +@@ -297,7 +307,7 @@ func (c *Cmd) Start() error { + uidmapSet := false + // Set the UID map. + if c.UseNewuidmap { +- path, err := exec.LookPath("newuidmap") ++ path, err := guixLookupSetuidPath("newuidmap") + if err != nil { + return fmt.Errorf("finding newuidmap: %w", err) + } +-- +2.41.0 + diff --git a/gnu/packages/patches/scribus-1.5.8-poppler-22.03.0.patch b/gnu/packages/patches/scribus-1.5.8-poppler-22.03.0.patch deleted file mode 100644 index f7a0c03fdd9..00000000000 --- a/gnu/packages/patches/scribus-1.5.8-poppler-22.03.0.patch +++ /dev/null @@ -1,52 +0,0 @@ -From f19410ac3b27e33dd62105746784e61e85b90a1d Mon Sep 17 00:00:00 2001 -From: Jean Ghali <jghali@libertysurf.fr> -Date: Wed, 2 Mar 2022 22:22:53 +0000 -Subject: [PATCH] #16764: Build break with poppler 22.03.0 - -git-svn-id: svn://scribus.net/trunk/Scribus@24982 11d20701-8431-0410-a711-e3c959e3b870 ---- - scribus/plugins/import/pdf/importpdf.cpp | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -diff --git a/scribus/plugins/import/pdf/importpdf.cpp b/scribus/plugins/import/pdf/importpdf.cpp -index 154e58a3f0..392dcd9e64 100644 ---- a/scribus/plugins/import/pdf/importpdf.cpp -+++ b/scribus/plugins/import/pdf/importpdf.cpp -@@ -89,7 +89,11 @@ QImage PdfPlug::readThumbnail(const QString& fName) - #endif
- globalParams->setErrQuiet(gTrue);
-
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
-+ PDFDoc pdfDoc{ std::make_unique<GooString>(fname) };
-+#else
- PDFDoc pdfDoc{fname, nullptr, nullptr, nullptr};
-+#endif
- if (!pdfDoc.isOk() || pdfDoc.getErrorCode() == errEncrypted)
- return QImage();
-
-@@ -342,7 +346,11 @@ bool PdfPlug::convert(const QString& fn) - globalParams->setErrQuiet(gTrue);
- // globalParams->setPrintCommands(gTrue);
- QList<OptionalContentGroup*> ocgGroups;
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
-+ auto pdfDoc = std::make_unique<PDFDoc>(std::make_unique<GooString>(fname));
-+#else
- auto pdfDoc = std::unique_ptr<PDFDoc>(new PDFDoc(fname, nullptr, nullptr, nullptr));
-+#endif
- if (pdfDoc)
- {
- if (pdfDoc->getErrorCode() == errEncrypted)
-@@ -361,8 +369,13 @@ bool PdfPlug::convert(const QString& fn) - #else
- auto fname = new GooString(QFile::encodeName(fn).data());
- #endif
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 3, 0)
-+ std::optional<GooString> userPW(std::in_place, text.toLocal8Bit().data());
-+ pdfDoc.reset(new PDFDoc(std::make_unique<GooString>(fname), userPW, userPW, nullptr));
-+#else
- auto userPW = new GooString(text.toLocal8Bit().data());
- pdfDoc.reset(new PDFDoc(fname, userPW, userPW, nullptr));
-+#endif
- qApp->changeOverrideCursor(QCursor(Qt::WaitCursor));
- }
- if ((!pdfDoc) || (pdfDoc->getErrorCode() != errNone))
diff --git a/gnu/packages/patches/scribus-1.5.8-poppler-22.04.0.patch b/gnu/packages/patches/scribus-1.5.8-poppler-22.04.0.patch deleted file mode 100644 index 290484e7e87..00000000000 --- a/gnu/packages/patches/scribus-1.5.8-poppler-22.04.0.patch +++ /dev/null @@ -1,291 +0,0 @@ -https://bugs.gentoo.org/843287 -https://github.com/scribusproject/scribus/commit/f2237b8f0b5cf7690e864a22ef7a63a6d769fa36.patch - -From f2237b8f0b5cf7690e864a22ef7a63a6d769fa36 Mon Sep 17 00:00:00 2001 -From: Jean Ghali <jghali@libertysurf.fr> -Date: Fri, 1 Apr 2022 23:52:32 +0000 -Subject: [PATCH] Fix build with poppler 22.04.0 - -git-svn-id: svn://scribus.net/trunk/Scribus@25074 11d20701-8431-0410-a711-e3c959e3b870 ---- - scribus/plugins/import/pdf/slaoutput.cpp | 123 ++++++++++++++--------- - 1 file changed, 78 insertions(+), 45 deletions(-) - -diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp -index e20a81f99e..5626fe3477 100644 ---- a/scribus/plugins/import/pdf/slaoutput.cpp -+++ b/scribus/plugins/import/pdf/slaoutput.cpp -@@ -174,8 +174,13 @@ void AnoOutputDev::drawString(GfxState *state, POPPLER_CONST GooString *s) - int shade = 100;
- currColorText = getColor(state->getFillColorSpace(), state->getFillColor(), &shade);
- fontSize = state->getFontSize();
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
-+ if (state->getFont() && state->getFont()->getName())
-+ fontName = new GooString(state->getFont()->getName().value());
-+#else
- if (state->getFont())
- fontName = state->getFont()->getName()->copy();
-+#endif
- itemText = s->copy();
- }
-
-@@ -357,7 +362,12 @@ std::unique_ptr<LinkAction> SlaOutputDev::SC_getAdditionalAction(const char *key - GBool SlaOutputDev::annotations_callback(Annot *annota, void *user_data)
- {
- SlaOutputDev *dev = (SlaOutputDev*)user_data;
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
-+ const PDFRectangle& annotRect = annota->getRect();;
-+ const PDFRectangle* box = &annotRect;
-+#else
- PDFRectangle *box = annota->getRect();
-+#endif
- double xCoor = dev->m_doc->currentPage()->xOffset() + box->x1 - dev->cropOffsetX;
- double yCoor = dev->m_doc->currentPage()->yOffset() + dev->m_doc->currentPage()->height() - box->y2 + dev->cropOffsetY;
- double width = box->x2 - box->x1;
-@@ -684,7 +694,12 @@ bool SlaOutputDev::handleWidgetAnnot(Annot* annota, double xCoor, double yCoor, - if (apa || !achar)
- {
- AnoOutputDev *annotOutDev = new AnoOutputDev(m_doc, m_importedColors);
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
-+ const PDFRectangle& annotaRect = annota->getRect();
-+ Gfx* gfx = new Gfx(pdfDoc, annotOutDev, pdfDoc->getPage(m_actPage)->getResourceDict(), &annotaRect, nullptr);
-+#else
- Gfx *gfx = new Gfx(pdfDoc, annotOutDev, pdfDoc->getPage(m_actPage)->getResourceDict(), annota->getRect(), nullptr);
-+#endif
- ano->draw(gfx, false);
- if (!bgFound)
- m_currColorFill = annotOutDev->currColorFill;
-@@ -2916,22 +2931,27 @@ void SlaOutputDev::markPoint(POPPLER_CONST char *name, Dict *properties) -
- void SlaOutputDev::updateFont(GfxState *state)
- {
-- GfxFont *gfxFont;
--#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
-+ std::optional<GfxFontLoc> fontLoc;
-+ std::string fileName;
-+ std::unique_ptr<FoFiTrueType> ff;
-+ std::optional<std::vector<unsigned char>> tmpBuf;
-+#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
- std::optional<GfxFontLoc> fontLoc;
- const GooString * fileName = nullptr;
- std::unique_ptr<FoFiTrueType> ff;
-+ char* tmpBuf = nullptr;
- #else
- GfxFontLoc * fontLoc = nullptr;
- GooString * fileName = nullptr;
- FoFiTrueType * ff = nullptr;
-+ char* tmpBuf = nullptr;
- #endif
- GfxFontType fontType;
- SlaOutFontFileID *id;
- SplashFontFile *fontFile;
- SplashFontSrc *fontsrc = nullptr;
- Object refObj, strObj;
-- char *tmpBuf = nullptr;
- int tmpBufLen = 0;
- int *codeToGID = nullptr;
- const double *textMat = nullptr;
-@@ -2943,7 +2963,11 @@ void SlaOutputDev::updateFont(GfxState *state) -
- m_font = nullptr;
-
-- gfxFont = state->getFont();
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
-+ GfxFont* gfxFont = state->getFont().get();
-+#else
-+ GfxFont* gfxFont = state->getFont();
-+#endif
- if (!gfxFont)
- goto err1;
-
-@@ -2968,15 +2992,23 @@ void SlaOutputDev::updateFont(GfxState *state) - if (fontLoc->locType == gfxFontLocEmbedded)
- {
- // if there is an embedded font, read it to memory
-- tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
-+ tmpBuf = gfxFont->readEmbFontFile((xref) ? xref : pdfDoc->getXRef());
- if (! tmpBuf)
- goto err2;
-+#else
-+ tmpBuf = gfxFont->readEmbFontFile(xref, &tmpBufLen);
-+ if (!tmpBuf)
-+ goto err2;
-+#endif
-
- // external font
- }
- else
- { // gfxFontLocExternal
--#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
-+ fileName = fontLoc->path;
-+#elif POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
- fileName = fontLoc->pathAsGooString();
- #else
- fileName = fontLoc->path;
-@@ -2985,52 +3017,54 @@ void SlaOutputDev::updateFont(GfxState *state) - }
-
- fontsrc = new SplashFontSrc;
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
-+ if (!fileName.empty())
-+ fontsrc->setFile(fileName);
-+ else
-+ fontsrc->setBuf(std::move(tmpBuf.value()));
-+#else
- if (fileName)
- fontsrc->setFile(fileName, gFalse);
- else
- fontsrc->setBuf(tmpBuf, tmpBufLen, gTrue);
-+#endif
-
- // load the font file
- switch (fontType) {
- case fontType1:
-- if (!(fontFile = m_fontEngine->loadType1Font(
-- id,
-- fontsrc,
-- (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
-+ if (!(fontFile = m_fontEngine->loadType1Font(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
- {
-- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
-- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
-+ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
- goto err2;
- }
- break;
- case fontType1C:
-- if (!(fontFile = m_fontEngine->loadType1CFont(
-- id,
-- fontsrc,
-- (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
-+ if (!(fontFile = m_fontEngine->loadType1CFont(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
- {
-- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
-- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
-+ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
- goto err2;
- }
- break;
- case fontType1COT:
-- if (!(fontFile = m_fontEngine->loadOpenTypeT1CFont(
-- id,
-- fontsrc,
-- (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
-+ if (!(fontFile = m_fontEngine->loadOpenTypeT1CFont(id, fontsrc, (const char **)((Gfx8BitFont *) gfxFont)->getEncoding())))
- {
-- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
-- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
-+ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
- goto err2;
- }
- break;
- case fontTrueType:
- case fontTrueTypeOT:
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
-+ if (!fileName.empty())
-+ ff = FoFiTrueType::load(fileName.c_str());
-+ else
-+ ff = FoFiTrueType::make(fontsrc->buf.data(), fontsrc->buf.size());
-+#else
- if (fileName)
- ff = FoFiTrueType::load(fileName->getCString());
- else
- ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
-+#endif
- if (ff)
- {
- #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
-@@ -3047,24 +3081,17 @@ void SlaOutputDev::updateFont(GfxState *state) - codeToGID = nullptr;
- n = 0;
- }
-- if (!(fontFile = m_fontEngine->loadTrueTypeFont(
-- id,
-- fontsrc,
-- codeToGID, n)))
-+ if (!(fontFile = m_fontEngine->loadTrueTypeFont(id, fontsrc, codeToGID, n)))
- {
-- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
-- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
-+ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
- goto err2;
- }
- break;
- case fontCIDType0:
- case fontCIDType0C:
-- if (!(fontFile = m_fontEngine->loadCIDFont(
-- id,
-- fontsrc)))
-+ if (!(fontFile = m_fontEngine->loadCIDFont(id, fontsrc)))
- {
-- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
-- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
-+ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
- goto err2;
- }
- break;
-@@ -3080,10 +3107,7 @@ void SlaOutputDev::updateFont(GfxState *state) - codeToGID = nullptr;
- n = 0;
- }
-- if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(
-- id,
-- fontsrc,
-- codeToGID, n)))
-+ if (!(fontFile = m_fontEngine->loadOpenTypeCFFFont(id, fontsrc, codeToGID, n)))
- {
- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
-@@ -3105,10 +3129,17 @@ void SlaOutputDev::updateFont(GfxState *state) - }
- else
- {
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
-+ if (!fileName.empty())
-+ ff = FoFiTrueType::load(fileName.c_str());
-+ else
-+ ff = FoFiTrueType::make(fontsrc->buf.data(), fontsrc->buf.size());
-+#else
- if (fileName)
- ff = FoFiTrueType::load(fileName->getCString());
- else
- ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
-+#endif
- if (! ff)
- goto err2;
- #if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
-@@ -3119,13 +3150,9 @@ void SlaOutputDev::updateFont(GfxState *state) - delete ff;
- #endif
- }
-- if (!(fontFile = m_fontEngine->loadTrueTypeFont(
-- id,
-- fontsrc,
-- codeToGID, n, faceIndex)))
-+ if (!(fontFile = m_fontEngine->loadTrueTypeFont(id, fontsrc, codeToGID, n, faceIndex)))
- {
-- error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
-- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
-+ error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
- goto err2;
- }
- break;
-@@ -3269,9 +3296,15 @@ void SlaOutputDev::drawChar(GfxState* state, double x, double y, double dx, doub - GBool SlaOutputDev::beginType3Char(GfxState *state, double x, double y, double dx, double dy, CharCode code, POPPLER_CONST_082 Unicode *u, int uLen)
- {
- // qDebug() << "beginType3Char";
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 4, 0)
- GfxFont *gfxFont;
-+ if (!(gfxFont = state->getFont().get()))
-+ return gTrue;
-+#else
-+ GfxFont* gfxFont;
- if (!(gfxFont = state->getFont()))
- return gTrue;
-+#endif
- if (gfxFont->getType() != fontType3)
- return gTrue;
- F3Entry f3e;
diff --git a/gnu/packages/patches/scribus-1.5.8-poppler-22.09.0.patch b/gnu/packages/patches/scribus-1.5.8-poppler-22.09.0.patch deleted file mode 100644 index 106a6f5162b..00000000000 --- a/gnu/packages/patches/scribus-1.5.8-poppler-22.09.0.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/scribus/plugins/import/pdf/slaoutput.cpp -+++ b/scribus/plugins/import/pdf/slaoutput.cpp -@@ -3741,9 +3741,16 @@ void SlaOutputDev::getPenState(GfxState *state) - break;
- }
- double lw = state->getLineWidth();
-- double *dashPattern;
- int dashLength;
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 9, 0)
-+ const double *dashPattern;
-+ const std::vector<double> &dash = state->getLineDash(&DashOffset);
-+ dashPattern = dash.data();
-+ dashLength = dash.size();
-+#else
-+ double *dashPattern;
- state->getLineDash(&dashPattern, &dashLength, &DashOffset);
-+#endif
- QVector<double> pattern(dashLength);
- for (int i = 0; i < dashLength; ++i)
- {
diff --git a/gnu/packages/patches/scribus-1.5.8-poppler-22.2.0-1.patch b/gnu/packages/patches/scribus-1.5.8-poppler-22.2.0-1.patch deleted file mode 100644 index 4e0f607c6a0..00000000000 --- a/gnu/packages/patches/scribus-1.5.8-poppler-22.2.0-1.patch +++ /dev/null @@ -1,129 +0,0 @@ -From 85c0dff3422fa3c26fbc2e8d8561f597ec24bd92 Mon Sep 17 00:00:00 2001 -From: Jean Ghali <jghali@libertysurf.fr> -Date: Wed, 2 Feb 2022 23:12:52 +0000 -Subject: [PATCH] #16734: Build break with poppler 22.2.0 - -git-svn-id: svn://scribus.net/trunk/Scribus@24884 11d20701-8431-0410-a711-e3c959e3b870 ---- - scribus/plugins/import/pdf/slaoutput.cpp | 47 +++++++++++++++++++----- - 1 file changed, 37 insertions(+), 10 deletions(-) - -diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp -index 5894bf2ad6..3650c96f52 100644 ---- a/scribus/plugins/import/pdf/slaoutput.cpp -+++ b/scribus/plugins/import/pdf/slaoutput.cpp -@@ -7,6 +7,11 @@ for which a new license (GPL+exception) is in place. -
- #include "slaoutput.h"
-
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
-+#include <memory>
-+#include <optional>
-+#endif
-+
- #include <poppler/GlobalParams.h>
- #include <poppler/poppler-config.h>
- #include <poppler/FileSpec.h>
-@@ -3027,18 +3032,24 @@ void SlaOutputDev::markPoint(POPPLER_CONST char *name, Dict *properties) - void SlaOutputDev::updateFont(GfxState *state)
- {
- GfxFont *gfxFont;
-- GfxFontLoc *fontLoc;
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
-+ std::optional<GfxFontLoc> fontLoc;
-+ const GooString * fileName = nullptr;
-+ std::unique_ptr<FoFiTrueType> ff;
-+#else
-+ GfxFontLoc * fontLoc = nullptr;
-+ GooString * fileName = nullptr;
-+ FoFiTrueType * ff = nullptr;
-+#endif
- GfxFontType fontType;
- SlaOutFontFileID *id;
- SplashFontFile *fontFile;
- SplashFontSrc *fontsrc = nullptr;
-- FoFiTrueType *ff;
- Object refObj, strObj;
-- GooString *fileName;
-- char *tmpBuf;
-+ char *tmpBuf = nullptr;
- int tmpBufLen = 0;
-- int *codeToGID;
-- const double *textMat;
-+ int *codeToGID = nullptr;
-+ const double *textMat = nullptr;
- double m11, m12, m21, m22, fontSize;
- SplashCoord mat[4];
- int n = 0;
-@@ -3046,9 +3057,6 @@ void SlaOutputDev::updateFont(GfxState *state) - SplashCoord matrix[6];
-
- m_font = nullptr;
-- fileName = nullptr;
-- tmpBuf = nullptr;
-- fontLoc = nullptr;
-
- gfxFont = state->getFont();
- if (!gfxFont)
-@@ -3083,7 +3091,11 @@ void SlaOutputDev::updateFont(GfxState *state) - }
- else
- { // gfxFontLocExternal
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
-+ fileName = fontLoc->pathAsGooString();
-+#else
- fileName = fontLoc->path;
-+#endif
- fontType = fontLoc->fontType;
- }
-
-@@ -3136,9 +3148,14 @@ void SlaOutputDev::updateFont(GfxState *state) - ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
- if (ff)
- {
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
-+ codeToGID = ((Gfx8BitFont*) gfxFont)->getCodeToGIDMap(ff.get());
-+ ff.reset();
-+#else
- codeToGID = ((Gfx8BitFont *)gfxFont)->getCodeToGIDMap(ff);
-- n = 256;
- delete ff;
-+#endif
-+ n = 256;
- }
- else
- {
-@@ -3209,8 +3226,13 @@ void SlaOutputDev::updateFont(GfxState *state) - ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
- if (! ff)
- goto err2;
-+#if POPPLER_ENCODED_VERSION >= POPPLER_VERSION_ENCODE(22, 2, 0)
-+ codeToGID = ((GfxCIDFont*) gfxFont)->getCodeToGIDMap(ff.get(), &n);
-+ ff.reset();
-+#else
- codeToGID = ((GfxCIDFont *)gfxFont)->getCodeToGIDMap(ff, &n);
- delete ff;
-+#endif
- }
- if (!(fontFile = m_fontEngine->loadTrueTypeFont(
- id,
-@@ -3247,14 +3269,19 @@ void SlaOutputDev::updateFont(GfxState *state) - mat[3] = -m22;
- m_font = m_fontEngine->getFont(fontFile, mat, matrix);
-
-+#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(22, 2, 0)
- delete fontLoc;
-+#endif
- if (fontsrc && !fontsrc->isFile)
- fontsrc->unref();
- return;
-
- err2:
- delete id;
-+#if POPPLER_ENCODED_VERSION < POPPLER_VERSION_ENCODE(22, 2, 0)
- delete fontLoc;
-+#endif
-+
- err1:
- if (fontsrc && !fontsrc->isFile)
- fontsrc->unref();
diff --git a/gnu/packages/patches/scribus-1.5.8-poppler-22.2.0-2.patch b/gnu/packages/patches/scribus-1.5.8-poppler-22.2.0-2.patch deleted file mode 100644 index 73beac2d70d..00000000000 --- a/gnu/packages/patches/scribus-1.5.8-poppler-22.2.0-2.patch +++ /dev/null @@ -1,28 +0,0 @@ -From f75c1613db67f4067643d0218a2db3235e42ec9f Mon Sep 17 00:00:00 2001 -From: Jean Ghali <jghali@libertysurf.fr> -Date: Thu, 3 Feb 2022 19:46:13 +0000 -Subject: [PATCH] Small update vs latest code in poppler - -git-svn-id: svn://scribus.net/trunk/Scribus@24885 11d20701-8431-0410-a711-e3c959e3b870 ---- - scribus/plugins/import/pdf/slaoutput.cpp | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/scribus/plugins/import/pdf/slaoutput.cpp b/scribus/plugins/import/pdf/slaoutput.cpp -index 3650c96f52..a6f4e00fa9 100644 ---- a/scribus/plugins/import/pdf/slaoutput.cpp -+++ b/scribus/plugins/import/pdf/slaoutput.cpp -@@ -3072,10 +3072,10 @@ void SlaOutputDev::updateFont(GfxState *state) - delete id;
- else
- {
-- if (!(fontLoc = gfxFont->locateFont(xref, nullptr)))
-+ fontLoc = gfxFont->locateFont((xref) ? xref : pdfDoc->getXRef(), nullptr);
-+ if (!fontLoc)
- {
-- error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'",
-- gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
-+ error(errSyntaxError, -1, "Couldn't find a font for '{0:s}'", gfxFont->getName() ? gfxFont->getName()->getCString() : "(unnamed)");
- goto err2;
- }
-
diff --git a/gnu/packages/patches/sioyek-fix-build.patch b/gnu/packages/patches/sioyek-fix-build.patch new file mode 100644 index 00000000000..521b361f2a0 --- /dev/null +++ b/gnu/packages/patches/sioyek-fix-build.patch @@ -0,0 +1,82 @@ +Patch fetched from https://git.alpinelinux.org/aports/tree/community/sioyek/mupdf-0.23.0.patch + +From 86e913eccf19b97a16f25d9b6cdf0f50232f1226 Mon Sep 17 00:00:00 2001 +From: ptrcnull <git@ptrcnull.me> +Date: Fri, 25 Aug 2023 22:44:26 +0200 +Subject: community/sioyek: fix build with mupdf-0.23.0 + +--- + +diff --git a/pdf_viewer/document_view.cpp b/pdf_viewer/document_view.cpp +index f48d05e..0bc3855 100644 +--- a/pdf_viewer/document_view.cpp ++++ b/pdf_viewer/document_view.cpp +@@ -1121,7 +1121,7 @@ std::vector<DocumentPos> DocumentView::find_line_definitions() { + + std::optional<PdfLink> pdf_link = current_document->get_link_in_page_rect(get_center_page_number(), line_rects[line_index]); + if (pdf_link.has_value()) { +- auto parsed_uri = parse_uri(mupdf_context, pdf_link.value().uri); ++ auto parsed_uri = parse_uri(mupdf_context, current_document->doc, pdf_link.value().uri); + result.push_back({ parsed_uri.page - 1, parsed_uri.x, parsed_uri.y }); + return result; + } +diff --git a/pdf_viewer/main_widget.cpp b/pdf_viewer/main_widget.cpp +index 19b568b..335a93f 100644 +--- a/pdf_viewer/main_widget.cpp ++++ b/pdf_viewer/main_widget.cpp +@@ -170,7 +170,7 @@ void MainWidget::set_overview_position(int page, float offset) { + + void MainWidget::set_overview_link(PdfLink link) { + +- auto [page, offset_x, offset_y] = parse_uri(mupdf_context, link.uri); ++ auto [page, offset_x, offset_y] = parse_uri(mupdf_context, doc()->doc, link.uri); + if (page >= 1) { + set_overview_position(page - 1, offset_y); + } +@@ -3178,7 +3178,7 @@ void MainWidget::handle_pending_text_command(std::wstring text) { + open_web_url(utf8_decode(selected_link->uri)); + } + else{ +- auto [page, offset_x, offset_y] = parse_uri(mupdf_context, selected_link->uri); ++ auto [page, offset_x, offset_y] = parse_uri(mupdf_context, doc()->doc, selected_link->uri); + long_jump_to_destination(page-1, offset_y); + } + } +@@ -3863,7 +3863,7 @@ void MainWidget::handle_link_click(const PdfLink& link) { + return; + } + +- auto [page, offset_x, offset_y] = parse_uri(mupdf_context, link.uri); ++ auto [page, offset_x, offset_y] = parse_uri(mupdf_context, doc()->doc, link.uri); + + // convert one indexed page to zero indexed page + page--; +diff --git a/pdf_viewer/utils.cpp b/pdf_viewer/utils.cpp +index 22d4265..3150e66 100644 +--- a/pdf_viewer/utils.cpp ++++ b/pdf_viewer/utils.cpp +@@ -116,8 +116,9 @@ bool rects_intersect(fz_rect rect1, fz_rect rect2) { + return range_intersects(rect1.x0, rect1.x1, rect2.x0, rect2.x1) && range_intersects(rect1.y0, rect1.y1, rect2.y0, rect2.y1); + } + +-ParsedUri parse_uri(fz_context* mupdf_context, std::string uri) { +- fz_link_dest dest = pdf_parse_link_uri(mupdf_context, uri.c_str()); ++ParsedUri parse_uri(fz_context* mupdf_context, fz_document* fz_doc, std::string uri) { ++ pdf_document* doc = pdf_document_from_fz_document(mupdf_context, fz_doc); ++ fz_link_dest dest = pdf_resolve_link_dest(mupdf_context, doc, uri.c_str()); + return { dest.loc.page + 1, dest.x, dest.y }; + } + +diff --git a/pdf_viewer/utils.h b/pdf_viewer/utils.h +index 2a12211..643b030 100644 +--- a/pdf_viewer/utils.h ++++ b/pdf_viewer/utils.h +@@ -55,7 +55,7 @@ void get_flat_toc(const std::vector<TocNode*>& roots, std::vector<std::wstring>& + int mod(int a, int b); + bool range_intersects(float range1_start, float range1_end, float range2_start, float range2_end); + bool rects_intersect(fz_rect rect1, fz_rect rect2); +-ParsedUri parse_uri(fz_context* mupdf_context, std::string uri); ++ParsedUri parse_uri(fz_context* mupdf_context, fz_document* fz_doc, std::string uri); + char get_symbol(int key, bool is_shift_pressed, const std::vector<char>&special_symbols); + + template<typename T> |