public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/tex:master commit in: 2019/patches/
@ 2019-06-03 20:31 Mikle Kolyada
  0 siblings, 0 replies; 11+ messages in thread
From: Mikle Kolyada @ 2019-06-03 20:31 UTC (permalink / raw
  To: gentoo-commits

commit:     227f8894b929c8811a9629052ceb4af2e1b35f44
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Mon Jun  3 20:30:51 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Mon Jun  3 20:30:51 2019 +0000
URL:        https://gitweb.gentoo.org/proj/tex.git/commit/?id=227f8894

remove few more scripts

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 ...1-tl-core-2019-unbandle-installed_scripts.patch | 39 ++++++++++++++--------
 1 file changed, 25 insertions(+), 14 deletions(-)

diff --git a/2019/patches/0001-tl-core-2019-unbandle-installed_scripts.patch b/2019/patches/0001-tl-core-2019-unbandle-installed_scripts.patch
index 467c161..7b55866 100644
--- a/2019/patches/0001-tl-core-2019-unbandle-installed_scripts.patch
+++ b/2019/patches/0001-tl-core-2019-unbandle-installed_scripts.patch
@@ -1,19 +1,19 @@
-From 54d5123633e09da0b98708cb7d327481e6b35ecd Mon Sep 17 00:00:00 2001
+From 8a5265e35deddd0f6abce60eeec583ed8ed73f68 Mon Sep 17 00:00:00 2001
 From: Mikle Kolyada <zlogene@gentoo.org>
 Date: Sun, 2 Jun 2019 12:44:19 +0300
 Subject: [PATCH] tl-core-2019: unbandle installed_scripts
 
 Signed-off-by: Mikle Kolyada <zlogene@gentoo.org>
 ---
- texk/texlive/linked_scripts/Makefile.in | 94 ++-----------------------
- texk/texlive/tl_scripts/Makefile.in     | 10 ---
- 2 files changed, 4 insertions(+), 100 deletions(-)
+ texk/texlive/linked_scripts/Makefile.in | 110 +-----------------------
+ texk/texlive/tl_scripts/Makefile.in     |  10 ---
+ 2 files changed, 4 insertions(+), 116 deletions(-)
 
 diff --git a/texk/texlive/linked_scripts/Makefile.in b/texk/texlive/linked_scripts/Makefile.in
-index 6e8781db..2d163636 100644
+index 6e8781db..a197dd7d 100644
 --- a/texk/texlive/linked_scripts/Makefile.in
 +++ b/texk/texlive/linked_scripts/Makefile.in
-@@ -268,16 +268,13 @@ EXTRA_DIST = scripts.lst context/stubs/unix/ctxtools \
+@@ -268,144 +268,58 @@ EXTRA_DIST = scripts.lst context/stubs/unix/ctxtools \
  texmf_scriptsdir = $(datarootdir)/texmf-dist/scripts
  texmf_shell_scripts = \
  	adhocfilelist/adhocfilelist.sh \
@@ -28,10 +28,18 @@ index 6e8781db..2d163636 100644
  	ltxfileinfo/ltxfileinfo \
 -	lua2dox/lua2dox_filter \
  	pdfbook2/pdfbook2 \
- 	pdfjam/pdf180 \
- 	pdfjam/pdf270 \
-@@ -293,64 +290,27 @@ texmf_shell_scripts = \
- 	pdfjam/pdfpun \
+-	pdfjam/pdf180 \
+-	pdfjam/pdf270 \
+-	pdfjam/pdf90 \
+-	pdfjam/pdfbook \
+-	pdfjam/pdfflip \
+-	pdfjam/pdfjam \
+-	pdfjam/pdfjam-pocketmod \
+-	pdfjam/pdfjam-slides3up \
+-	pdfjam/pdfjam-slides6up \
+-	pdfjam/pdfjoin \
+-	pdfjam/pdfnup \
+-	pdfjam/pdfpun \
  	pdftex-quiet/pdftex-quiet \
  	pdfxup/pdfxup \
 -	pst-pdf/ps4pdf \
@@ -86,7 +94,7 @@ index 6e8781db..2d163636 100644
 -	fontools/ot2kpx \
  	fragmaster/fragmaster.pl \
 -	getmap/getmapdl.lua \
- 	glossaries/makeglossaries \
+-	glossaries/makeglossaries \
  	glossaries/makeglossaries-lite.lua \
 -	jfmutil/jfmutil.pl \
 -	kotex-utils/jamo-normalize.pl \
@@ -96,7 +104,10 @@ index 6e8781db..2d163636 100644
  	latex-git-log/latex-git-log \
  	latex-papersize/latex-papersize.py \
  	latex2man/latex2man \
-@@ -361,51 +321,21 @@ texmf_other_scripts = \
+ 	latex2nemeth/latex2nemeth \
+-	latexdiff/latexdiff-vc.pl \
+-	latexdiff/latexdiff.pl \
+-	latexdiff/latexrevise.pl \
  	latexindent/latexindent.pl \
  	latexmk/latexmk.pl \
  	latexpand/latexpand \
@@ -148,7 +159,7 @@ index 6e8781db..2d163636 100644
  	tex4ebook/tex4ebook \
  	texcount/texcount.pl \
  	texdef/texdef.pl \
-@@ -416,31 +346,16 @@ texmf_other_scripts = \
+@@ -416,31 +330,16 @@ texmf_other_scripts = \
  	texlive/fmtutil-sys.sh \
  	texlive/fmtutil-user.sh \
  	texlive/fmtutil.pl \
@@ -183,7 +194,7 @@ index 6e8781db..2d163636 100644
  
  nobase_dist_texmf_scripts_SCRIPTS = \
  	$(texmf_shell_scripts) \
-@@ -450,7 +365,6 @@ nobase_dist_texmf_scripts_SCRIPTS = \
+@@ -450,7 +349,6 @@ nobase_dist_texmf_scripts_SCRIPTS = \
  bin_links = \
  	cluttex:clxelatex \
  	cluttex:cllualatex \


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/tex:master commit in: 2019/patches/
@ 2019-06-04 13:56 Mikle Kolyada
  0 siblings, 0 replies; 11+ messages in thread
From: Mikle Kolyada @ 2019-06-04 13:56 UTC (permalink / raw
  To: gentoo-commits

commit:     1c25bd4ea629730cdddba887193b709411a6c484
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  4 13:54:53 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Tue Jun  4 13:54:53 2019 +0000
URL:        https://gitweb.gentoo.org/proj/tex.git/commit/?id=1c25bd4e

unbundle latexmk.pl

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 .../0001-tl-core-2019-unbandle-installed_scripts.patch   | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/2019/patches/0001-tl-core-2019-unbandle-installed_scripts.patch b/2019/patches/0001-tl-core-2019-unbandle-installed_scripts.patch
index 7b55866..77fa9e7 100644
--- a/2019/patches/0001-tl-core-2019-unbandle-installed_scripts.patch
+++ b/2019/patches/0001-tl-core-2019-unbandle-installed_scripts.patch
@@ -1,19 +1,19 @@
-From 8a5265e35deddd0f6abce60eeec583ed8ed73f68 Mon Sep 17 00:00:00 2001
+From 07f37bc7bde505dd81b4fe35f7a74e8280b3f9ce Mon Sep 17 00:00:00 2001
 From: Mikle Kolyada <zlogene@gentoo.org>
 Date: Sun, 2 Jun 2019 12:44:19 +0300
 Subject: [PATCH] tl-core-2019: unbandle installed_scripts
 
 Signed-off-by: Mikle Kolyada <zlogene@gentoo.org>
 ---
- texk/texlive/linked_scripts/Makefile.in | 110 +-----------------------
+ texk/texlive/linked_scripts/Makefile.in | 111 +-----------------------
  texk/texlive/tl_scripts/Makefile.in     |  10 ---
- 2 files changed, 4 insertions(+), 116 deletions(-)
+ 2 files changed, 4 insertions(+), 117 deletions(-)
 
 diff --git a/texk/texlive/linked_scripts/Makefile.in b/texk/texlive/linked_scripts/Makefile.in
-index 6e8781db..a197dd7d 100644
+index 6e8781db..2dd60a49 100644
 --- a/texk/texlive/linked_scripts/Makefile.in
 +++ b/texk/texlive/linked_scripts/Makefile.in
-@@ -268,144 +268,58 @@ EXTRA_DIST = scripts.lst context/stubs/unix/ctxtools \
+@@ -268,144 +268,57 @@ EXTRA_DIST = scripts.lst context/stubs/unix/ctxtools \
  texmf_scriptsdir = $(datarootdir)/texmf-dist/scripts
  texmf_shell_scripts = \
  	adhocfilelist/adhocfilelist.sh \
@@ -109,7 +109,7 @@ index 6e8781db..a197dd7d 100644
 -	latexdiff/latexdiff.pl \
 -	latexdiff/latexrevise.pl \
  	latexindent/latexindent.pl \
- 	latexmk/latexmk.pl \
+-	latexmk/latexmk.pl \
  	latexpand/latexpand \
 -	lilyglyphs/lily-glyph-commands.py \
 -	lilyglyphs/lily-image-commands.py \
@@ -159,7 +159,7 @@ index 6e8781db..a197dd7d 100644
  	tex4ebook/tex4ebook \
  	texcount/texcount.pl \
  	texdef/texdef.pl \
-@@ -416,31 +330,16 @@ texmf_other_scripts = \
+@@ -416,31 +329,16 @@ texmf_other_scripts = \
  	texlive/fmtutil-sys.sh \
  	texlive/fmtutil-user.sh \
  	texlive/fmtutil.pl \
@@ -194,7 +194,7 @@ index 6e8781db..a197dd7d 100644
  
  nobase_dist_texmf_scripts_SCRIPTS = \
  	$(texmf_shell_scripts) \
-@@ -450,7 +349,6 @@ nobase_dist_texmf_scripts_SCRIPTS = \
+@@ -450,7 +348,6 @@ nobase_dist_texmf_scripts_SCRIPTS = \
  bin_links = \
  	cluttex:clxelatex \
  	cluttex:cllualatex \


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/tex:master commit in: 2019/patches/
@ 2019-06-09 14:58 Mikle Kolyada
  0 siblings, 0 replies; 11+ messages in thread
From: Mikle Kolyada @ 2019-06-09 14:58 UTC (permalink / raw
  To: gentoo-commits

commit:     c1fb57ae3845e9405ee67f52e9bed31834030473
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Sun Jun  9 14:53:14 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Sun Jun  9 14:54:42 2019 +0000
URL:        https://gitweb.gentoo.org/proj/tex.git/commit/?id=c1fb57ae

linked_scripts: unlink tlmgr

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 .../0001-tl-core-2019-unbandle-installed_scripts.patch     | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/2019/patches/0001-tl-core-2019-unbandle-installed_scripts.patch b/2019/patches/0001-tl-core-2019-unbandle-installed_scripts.patch
index 77fa9e7..3f3b0fa 100644
--- a/2019/patches/0001-tl-core-2019-unbandle-installed_scripts.patch
+++ b/2019/patches/0001-tl-core-2019-unbandle-installed_scripts.patch
@@ -1,16 +1,16 @@
-From 07f37bc7bde505dd81b4fe35f7a74e8280b3f9ce Mon Sep 17 00:00:00 2001
+From 9224254101ba6b7cbb7ff71b9444ed5ae06fdb5a Mon Sep 17 00:00:00 2001
 From: Mikle Kolyada <zlogene@gentoo.org>
 Date: Sun, 2 Jun 2019 12:44:19 +0300
 Subject: [PATCH] tl-core-2019: unbandle installed_scripts
 
 Signed-off-by: Mikle Kolyada <zlogene@gentoo.org>
 ---
- texk/texlive/linked_scripts/Makefile.in | 111 +-----------------------
+ texk/texlive/linked_scripts/Makefile.in | 112 +-----------------------
  texk/texlive/tl_scripts/Makefile.in     |  10 ---
- 2 files changed, 4 insertions(+), 117 deletions(-)
+ 2 files changed, 4 insertions(+), 118 deletions(-)
 
 diff --git a/texk/texlive/linked_scripts/Makefile.in b/texk/texlive/linked_scripts/Makefile.in
-index 6e8781db..2dd60a49 100644
+index 6e8781db..8ca5cbfe 100644
 --- a/texk/texlive/linked_scripts/Makefile.in
 +++ b/texk/texlive/linked_scripts/Makefile.in
 @@ -268,144 +268,57 @@ EXTRA_DIST = scripts.lst context/stubs/unix/ctxtools \
@@ -159,12 +159,12 @@ index 6e8781db..2dd60a49 100644
  	tex4ebook/tex4ebook \
  	texcount/texcount.pl \
  	texdef/texdef.pl \
-@@ -416,31 +329,16 @@ texmf_other_scripts = \
+@@ -416,31 +329,15 @@ texmf_other_scripts = \
  	texlive/fmtutil-sys.sh \
  	texlive/fmtutil-user.sh \
  	texlive/fmtutil.pl \
 -	texlive/rungs.tlu \
- 	texlive/tlmgr.pl \
+-	texlive/tlmgr.pl \
  	texlive/updmap-sys.sh \
  	texlive/updmap-user.sh \
  	texlive/updmap.pl \
@@ -194,7 +194,7 @@ index 6e8781db..2dd60a49 100644
  
  nobase_dist_texmf_scripts_SCRIPTS = \
  	$(texmf_shell_scripts) \
-@@ -450,7 +348,6 @@ nobase_dist_texmf_scripts_SCRIPTS = \
+@@ -450,7 +347,6 @@ nobase_dist_texmf_scripts_SCRIPTS = \
  bin_links = \
  	cluttex:clxelatex \
  	cluttex:cllualatex \


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/tex:master commit in: 2019/patches/
@ 2019-12-27 10:28 Mikle Kolyada
  0 siblings, 0 replies; 11+ messages in thread
From: Mikle Kolyada @ 2019-12-27 10:28 UTC (permalink / raw
  To: gentoo-commits

commit:     b738509ade17c7df1a176c9bce9b5d7f66bc4e52
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Fri Dec 27 10:27:41 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Fri Dec 27 10:27:41 2019 +0000
URL:        https://gitweb.gentoo.org/proj/tex.git/commit/?id=b738509a

Add poppler-0.83 compat patch

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 2019/patches/texlive-core-2019-poppler083.patch | 804 ++++++++++++++++++++++++
 1 file changed, 804 insertions(+)

diff --git a/2019/patches/texlive-core-2019-poppler083.patch b/2019/patches/texlive-core-2019-poppler083.patch
new file mode 100644
index 0000000..42eee72
--- /dev/null
+++ b/2019/patches/texlive-core-2019-poppler083.patch
@@ -0,0 +1,804 @@
+From a2eb2d4c664c37d694a92f75ad5571d3f2e800bc Mon Sep 17 00:00:00 2001
+From: Mikle Kolyada <zlogene@gentoo.org>
+Date: Fri, 27 Dec 2019 12:09:32 +0300
+Subject: [PATCH] poppler-0.83 compat
+
+Signed-off-by: Mikle Kolyada <zlogene@gentoo.org>
+---
+ pdftoepdf.cc | 306 ++++++++++++++++++++++++++-------------------------
+ pdftosrc.cc  |  76 ++++++-------
+ 2 files changed, 191 insertions(+), 191 deletions(-)
+
+diff --git a/texk/web2c/pdftexdir/pdftoepdf.cc b/texk/web2c/pdftexdir/pdftoepdf.cc
+index 4db0c90..291c39e 100644
+--- a/texk/web2c/pdftexdir/pdftoepdf.cc
++++ b/texk/web2c/pdftexdir/pdftoepdf.cc
+@@ -1,5 +1,5 @@
+ /*
+-Copyright 1996-2016 Han The Thanh, <thanh@pdftex.org>
++Copyright 1996-2017 Han The Thanh, <thanh@pdftex.org>
+ 
+ This file is part of pdfTeX.
+ 
+@@ -17,6 +17,15 @@ You should have received a copy of the GNU General Public License along
+ with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+ 
++/*
++This is based on the patch texlive-poppler-0.59.patch <2017-09-19> at
++https://git.archlinux.org/svntogit/packages.git/plain/texlive-bin/trunk
++by Arch Linux. A little modifications are made to avoid a crash for
++some kind of pdf images, such as figure_missing.pdf in gnuplot.
++The poppler should be 0.75.0 or newer versions.
++POPPLER_VERSION should be defined.
++*/
++
+ /* Do this early in order to avoid a conflict between
+    MINGW32 <rpcndr.h> defining 'boolean' as 'unsigned char' and
+    <kpathsea/types.h> defining Pascal's boolean as 'int'.
+@@ -39,10 +48,7 @@ with this program.  If not, see <http://www.gnu.org/licenses/>.
+ #include <goo/gfile.h>
+ #define GString GooString
+ #else
+-#include <aconf.h>
+-#include <GString.h>
+-#include <gmem.h>
+-#include <gfile.h>
++#error POPPLER_VERSION should be defined.
+ #endif
+ #include <assert.h>
+ 
+@@ -84,31 +90,6 @@ extern integer zround(double);
+ #define MASK_SUPPRESS_PTEX_PAGENUMBER 0x04
+ #define MASK_SUPPRESS_PTEX_INFODICT   0x08
+ 
+-// PdfObject encapsulates the xpdf Object type,
+-// and properly frees its resources on destruction.
+-// Use obj-> to access members of the Object,
+-// and &obj to get a pointer to the object.
+-// It is no longer necessary to call Object::free explicitely.
+-
+-class PdfObject {
+-  public:
+-    PdfObject() {               // nothing
+-    } ~PdfObject() {
+-        iObject.free();
+-    }
+-    Object *operator->() {
+-        return &iObject;
+-    }
+-    Object *operator&() {
+-        return &iObject;
+-    }
+-  private:                     // no copying or assigning
+-    PdfObject(const PdfObject &);
+-    void operator=(const PdfObject &);
+-  public:
+-    Object iObject;
+-};
+-
+ // When copying the Resources of the selected page, all objects are copied
+ // recusively top-down. Indirect objects however are not fetched during
+ // copying, but get a new object number from pdfTeX and then will be
+@@ -139,7 +120,7 @@ struct UsedEncoding {
+ 
+ static InObj *inObjList;
+ static UsedEncoding *encodingList;
+-static GBool isInit = gFalse;
++static bool isInit = false;
+ 
+ // --------------------------------------------------------------------
+ // Maintain list of open embedded PDF files
+@@ -212,18 +193,6 @@ static void delete_document(PdfDocument * pdf_doc)
+     delete pdf_doc;
+ }
+ 
+-// Replacement for
+-//      Object *initDict(Dict *dict1){ initObj(objDict); dict = dict1; return this; }
+-
+-static void initDictFromDict(PdfObject & obj, Dict * dict)
+-{
+-    obj->initDict(xref);
+-    for (int i = 0, l = dict->getLength(); i < l; i++) {
+-        Object obj1;
+-        obj->dictAdd(copyString(dict->getKey(i)), dict->getValNF(i, &obj1));
+-    }
+-}
+-
+ // --------------------------------------------------------------------
+ 
+ static int addEncoding(GfxFont * gfont)
+@@ -320,10 +289,10 @@ static void copyName(char *s)
+ 
+ static void copyDictEntry(Object * obj, int i)
+ {
+-    PdfObject obj1;
+-    copyName(obj->dictGetKey(i));
++    Object obj1;
++    copyName((char *)obj->dictGetKey(i));
+     pdf_puts(" ");
+-    obj->dictGetValNF(i, &obj1);
++    obj1 = obj->dictGetValNF(i).copy();
+     copyObject(&obj1);
+     pdf_puts("\n");
+ }
+@@ -348,7 +317,7 @@ static void copyFontDict(Object * obj, InObj * r)
+     pdf_puts("<<\n");
+     assert(r->type == objFont); // FontDescriptor is in fd_tree
+     for (i = 0, l = obj->dictGetLength(); i < l; ++i) {
+-        key = obj->dictGetKey(i);
++        key = (char *)obj->dictGetKey(i);
+         if (strncmp("FontDescriptor", key, strlen("FontDescriptor")) == 0
+             || strncmp("BaseFont", key, strlen("BaseFont")) == 0
+             || strncmp("Encoding", key, strlen("Encoding")) == 0)
+@@ -376,17 +345,17 @@ static void copyStream(Stream * str)
+ static void copyProcSet(Object * obj)
+ {
+     int i, l;
+-    PdfObject procset;
++    Object procset;
+     if (!obj->isArray())
+         pdftex_fail("PDF inclusion: invalid ProcSet array type <%s>",
+                     obj->getTypeName());
+     pdf_puts("/ProcSet [ ");
+     for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
+-        obj->arrayGetNF(i, &procset);
+-        if (!procset->isName())
++        procset = obj->arrayGetNF(i).copy();
++        if (!procset.isName())
+             pdftex_fail("PDF inclusion: invalid ProcSet entry type <%s>",
+-                        procset->getTypeName());
+-        copyName(procset->getName());
++                        procset.getTypeName());
++        copyName((char *)procset.getName());
+         pdf_puts(" ");
+     }
+     pdf_puts("]\n");
+@@ -394,10 +363,29 @@ static void copyProcSet(Object * obj)
+ 
+ #define REPLACE_TYPE1C true
+ 
++static bool embeddableFont(Object * fontdesc)
++{
++    Object fontfile, ffsubtype;
++
++    if (!fontdesc->isDict())
++        return false;
++    fontfile = fontdesc->dictLookup("FontFile");
++    if (fontfile.isStream())
++        return true;
++    if (REPLACE_TYPE1C) {
++        fontfile = fontdesc->dictLookup("FontFile3");
++        if (!fontfile.isStream())
++            return false;
++        ffsubtype = fontfile.streamGetDict()->lookup("Subtype");
++        return ffsubtype.isName() && !strcmp(ffsubtype.getName(), "Type1C");
++    }
++    return false;
++}
++
+ static void copyFont(char *tag, Object * fontRef)
+ {
+-    PdfObject fontdict, subtype, basefont, fontdescRef, fontdesc, charset,
+-        fontfile, ffsubtype, stemV;
++    Object fontdict, subtype, basefont, fontdescRef, fontdesc, charset,
++        stemV;
+     GfxFont *gfont;
+     fd_entry *fd;
+     fm_entry *fontmap;
+@@ -413,33 +401,39 @@ static void copyFont(char *tag, Object * fontRef)
+     }
+     // Only handle included Type1 (and Type1C) fonts; anything else will be copied.
+     // Type1C fonts are replaced by Type1 fonts, if REPLACE_TYPE1C is true.
+-    if (!fixedinclusioncopyfont && fontRef->fetch(xref, &fontdict)->isDict()
+-        && fontdict->dictLookup("Subtype", &subtype)->isName()
+-        && !strcmp(subtype->getName(), "Type1")
+-        && fontdict->dictLookup("BaseFont", &basefont)->isName()
+-        && fontdict->dictLookupNF("FontDescriptor", &fontdescRef)->isRef()
+-        && fontdescRef->fetch(xref, &fontdesc)->isDict()
+-        && (fontdesc->dictLookup("FontFile", &fontfile)->isStream()
+-            || (REPLACE_TYPE1C
+-                && fontdesc->dictLookup("FontFile3", &fontfile)->isStream()
+-                && fontfile->streamGetDict()->lookup("Subtype",
+-                                                     &ffsubtype)->isName()
+-                && !strcmp(ffsubtype->getName(), "Type1C")))
+-        && (fontmap = lookup_fontmap(basefont->getName())) != NULL) {
++    fontdict = fontRef->fetch(xref);
++    fontdesc = Object(objNull);
++    if (fontdict.isDict()) {
++        subtype = fontdict.dictLookup("Subtype");
++        basefont = fontdict.dictLookup("BaseFont");
++        fontdescRef = fontdict.dictLookupNF("FontDescriptor").copy();
++        if (fontdescRef.isRef()) {
++            fontdesc = fontdescRef.fetch(xref);
++        }
++    }
++    if (!fixedinclusioncopyfont && fontdict.isDict()
++        && subtype.isName()
++        && !strcmp(subtype.getName(), "Type1")
++        && basefont.isName()
++        && fontdescRef.isRef()
++        && fontdesc.isDict()
++        && embeddableFont(&fontdesc)
++        && (fontmap = lookup_fontmap((char *)basefont.getName())) != NULL) {
+         // round /StemV value, since the PDF input is a float
+         // (see Font Descriptors in PDF reference), but we only store an
+         // integer, since we don't want to change the struct.
+-        fontdesc->dictLookup("StemV", &stemV);
+-        fd = epdf_create_fontdescriptor(fontmap, zround(stemV->getNum()));
+-        if (fontdesc->dictLookup("CharSet", &charset) &&
+-            charset->isString() && is_subsetable(fontmap))
+-            epdf_mark_glyphs(fd, charset->getString()->getCString());
++        stemV = fontdesc.dictLookup("StemV");
++        fd = epdf_create_fontdescriptor(fontmap, zround(stemV.getNum()));
++        charset = fontdesc.dictLookup("CharSet");
++        if (!charset.isNull() &&
++            charset.isString() && is_subsetable(fontmap))
++            epdf_mark_glyphs(fd, (char *)charset.getString()->c_str());
+         else
+             embed_whole_font(fd);
+-        addFontDesc(fontdescRef->getRef(), fd);
++        addFontDesc(fontdescRef.getRef(), fd);
+         copyName(tag);
+         gfont = GfxFont::makeFont(xref, tag, fontRef->getRef(),
+-                                  fontdict->getDict());
++                                  fontdict.getDict());
+         pdf_printf(" %d 0 R ", addFont(fontRef->getRef(), fd,
+                                        addEncoding(gfont)));
+     } else {
+@@ -451,24 +445,24 @@ static void copyFont(char *tag, Object * fontRef)
+ 
+ static void copyFontResources(Object * obj)
+ {
+-    PdfObject fontRef;
++    Object fontRef;
+     int i, l;
+     if (!obj->isDict())
+         pdftex_fail("PDF inclusion: invalid font resources dict type <%s>",
+                     obj->getTypeName());
+     pdf_puts("/Font << ");
+     for (i = 0, l = obj->dictGetLength(); i < l; ++i) {
+-        obj->dictGetValNF(i, &fontRef);
+-        if (fontRef->isRef())
+-            copyFont(obj->dictGetKey(i), &fontRef);
+-        else if (fontRef->isDict()) {   // some programs generate pdf with embedded font object
+-            copyName(obj->dictGetKey(i));
++        fontRef = obj->dictGetValNF(i).copy();
++        if (fontRef.isRef())
++            copyFont((char *)obj->dictGetKey(i), &fontRef);
++        else if (fontRef.isDict()) {   // some programs generate pdf with embedded font object
++            copyName((char *)obj->dictGetKey(i));
+             pdf_puts(" ");
+             copyObject(&fontRef);
+         }
+         else
+             pdftex_fail("PDF inclusion: invalid font in reference type <%s>",
+-                        fontRef->getTypeName());
++                        fontRef.getTypeName());
+     }
+     pdf_puts(">>\n");
+ }
+@@ -557,7 +551,7 @@ static char *convertNumToPDF(double n)
+ 
+ static void copyObject(Object * obj)
+ {
+-    PdfObject obj1;
++    Object obj1;
+     int i, l, c;
+     Ref ref;
+     char *p;
+@@ -571,8 +565,8 @@ static void copyObject(Object * obj)
+     } else if (obj->isNum()) {
+         pdf_printf("%s", convertNumToPDF(obj->getNum()));
+     } else if (obj->isString()) {
+-        s = obj->getString();
+-        p = s->getCString();
++        s = (GooString *)obj->getString();
++        p = (char *)s->c_str();
+         l = s->getLength();
+         if (strlen(p) == (unsigned int) l) {
+             pdf_puts("(");
+@@ -595,14 +589,14 @@ static void copyObject(Object * obj)
+             pdf_puts(">");
+         }
+     } else if (obj->isName()) {
+-        copyName(obj->getName());
++        copyName((char *)obj->getName());
+     } else if (obj->isNull()) {
+         pdf_puts("null");
+     } else if (obj->isArray()) {
+         pdf_puts("[");
+         for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
+-            obj->arrayGetNF(i, &obj1);
+-            if (!obj1->isName())
++            obj1 = obj->arrayGetNF(i).copy();
++            if (!obj1.isName())
+                 pdf_puts(" ");
+             copyObject(&obj1);
+         }
+@@ -612,9 +606,8 @@ static void copyObject(Object * obj)
+         copyDict(obj);
+         pdf_puts(">>");
+     } else if (obj->isStream()) {
+-        initDictFromDict(obj1, obj->streamGetDict());
+         pdf_puts("<<\n");
+-        copyDict(&obj1);
++        copyDict(obj->getStream()->getDictObject());
+         pdf_puts(">>\n");
+         pdf_puts("stream\n");
+         copyStream(obj->getStream()->getUndecodedStream());
+@@ -638,9 +631,8 @@ static void writeRefs()
+     InObj *r;
+     for (r = inObjList; r != 0; r = r->next) {
+         if (!r->written) {
+-            Object obj1;
+             r->written = 1;
+-            xref->fetch(r->ref.num, r->ref.gen, &obj1);
++            Object obj1 = xref->fetch(r->ref.num, r->ref.gen);
+             if (r->type == objFont) {
+                 assert(!obj1.isStream());
+                 pdfbeginobj(r->num, 2);         // \pdfobjcompresslevel = 2 is for this
+@@ -656,7 +648,6 @@ static void writeRefs()
+                 pdf_puts("\n");
+                 pdfendobj();
+             }
+-            obj1.free();
+         }
+     }
+ }
+@@ -673,7 +664,7 @@ static void writeEncodings()
+                     ("PDF inclusion: CID fonts are not supported"
+                      " (try to disable font replacement to fix this)");
+             }
+-            if ((s = ((Gfx8BitFont *) r->font)->getCharName(i)) != 0)
++            if ((s = (char *)((Gfx8BitFont *) r->font)->getCharName(i)) != 0)
+                 glyphNames[i] = s;
+             else
+                 glyphNames[i] = notdef;
+@@ -685,14 +676,14 @@ static void writeEncodings()
+ #ifdef POPPLER_VERSION
+         r->font->decRefCnt();
+ #else
+-        delete r->font;
++#error POPPLER_VERSION should be defined.
+ #endif
+         delete r;
+     }
+ }
+ 
+ // get the pagebox according to the pagebox_spec
+-static PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
++static const PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
+ {
+     if (pagebox_spec == pdfboxspecmedia)
+         return page->getMediaBox();
+@@ -724,17 +715,21 @@ read_pdf_info(char *image_name, char *page_name, int page_num,
+ {
+     PdfDocument *pdf_doc;
+     Page *page;
+-    PDFRectangle *pagebox;
++    const PDFRectangle *pagebox;
+ #ifdef POPPLER_VERSION
+     int pdf_major_version_found, pdf_minor_version_found;
+ #else
+-    float pdf_version_found, pdf_version_wanted;
++#error POPPLER_VERSION should be defined.
+ #endif
+     // initialize
+     if (!isInit) {
+-        globalParams = new GlobalParams();
+-        globalParams->setErrQuiet(gFalse);
+-        isInit = gTrue;
++#if POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 83
++	globalParams.reset(new GlobalParams());
++#else
++        globalParams = std::make_unique<GlobalParams>();
++#endif
++        globalParams->setErrQuiet(false);
++        isInit = true;
+     }
+     // open PDF file
+     pdf_doc = find_add_document(image_name);
+@@ -760,19 +755,7 @@ read_pdf_info(char *image_name, char *page_name, int page_num,
+         }
+     }
+ #else
+-    pdf_version_found = pdf_doc->doc->getPDFVersion();
+-    pdf_version_wanted = 1 + (minor_pdf_version_wanted * 0.1);
+-    if (pdf_version_found > pdf_version_wanted + 0.01) {
+-        char msg[] =
+-            "PDF inclusion: found PDF version <%.1f>, but at most version <%.1f> allowed";
+-        if (pdf_inclusion_errorlevel > 0) {
+-            pdftex_fail(msg, pdf_version_found, pdf_version_wanted);
+-        } else if (pdf_inclusion_errorlevel < 0) {
+-            ; /* do nothing */
+-        } else { /* = 0, give warning */
+-            pdftex_warn(msg, pdf_version_found, pdf_version_wanted);
+-        }
+-    }
++#error POPPLER_VERSION should be defined.
+ #endif
+     epdf_num_pages = pdf_doc->doc->getCatalog()->getNumPages();
+     if (page_name) {
+@@ -782,7 +765,7 @@ read_pdf_info(char *image_name, char *page_name, int page_num,
+         if (link == 0 || !link->isOk())
+             pdftex_fail("PDF inclusion: invalid destination <%s>", page_name);
+         Ref ref = link->getPageRef();
+-        page_num = pdf_doc->doc->getCatalog()->findPage(ref.num, ref.gen);
++        page_num = pdf_doc->doc->getCatalog()->findPage(ref);
+         if (page_num == 0)
+             pdftex_fail("PDF inclusion: destination is not a page <%s>",
+                         page_name);
+@@ -839,8 +822,8 @@ void write_epdf(void)
+     Page *page;
+     Ref *pageRef;
+     Dict *pageDict;
+-    PdfObject contents, obj1, obj2, pageObj, dictObj;
+-    PdfObject groupDict;
++    Object contents, obj1, obj2, pageObj, dictObj;
++    Object groupDict;
+     bool writeSepGroup = false;
+     Object info;
+     char *key;
+@@ -867,10 +850,10 @@ void write_epdf(void)
+     encodingList = 0;
+     page = pdf_doc->doc->getCatalog()->getPage(epdf_selected_page);
+     pageRef = pdf_doc->doc->getCatalog()->getPageRef(epdf_selected_page);
+-    xref->fetch(pageRef->num, pageRef->gen, &pageObj);
+-    pageDict = pageObj->getDict();
++    pageObj = xref->fetch(pageRef->num, pageRef->gen);
++    pageDict = pageObj.getDict();
+     rotate = page->getRotate();
+-    PDFRectangle *pagebox;
++    const PDFRectangle *pagebox;
+     // write the Page header
+     pdf_puts("/Type /XObject\n");
+     pdf_puts("/Subtype /Form\n");
+@@ -886,7 +869,7 @@ void write_epdf(void)
+         pdf_printf("/%s.PageNumber %i\n", pdfkeyprefix, (int) epdf_selected_page);
+     }
+     if ((suppress_ptex_info & MASK_SUPPRESS_PTEX_INFODICT) == 0) {
+-        pdf_doc->doc->getDocInfoNF(&info);
++        info = pdf_doc->doc->getDocInfoNF().copy();
+         if (info.isRef()) {
+             // the info dict must be indirect (PDF Ref p. 61)
+             pdf_printf("/%s.InfoDict ", pdfkeyprefix);
+@@ -942,14 +925,14 @@ void write_epdf(void)
+     pdf_puts(stripzeros(s));
+ 
+     // Metadata validity check (as a stream it must be indirect)
+-    pageDict->lookupNF("Metadata", &dictObj);
+-    if (!dictObj->isNull() && !dictObj->isRef())
++    dictObj = pageDict->lookupNF("Metadata").copy();
++    if (!dictObj.isNull() && !dictObj.isRef())
+         pdftex_warn("PDF inclusion: /Metadata must be indirect object");
+ 
+     // copy selected items in Page dictionary except Resources & Group
+     for (i = 0; pageDictKeys[i] != NULL; i++) {
+-        pageDict->lookupNF(pageDictKeys[i], &dictObj);
+-        if (!dictObj->isNull()) {
++        dictObj = pageDict->lookupNF(pageDictKeys[i]).copy();
++        if (!dictObj.isNull()) {
+             pdf_newline();
+             pdf_printf("/%s ", pageDictKeys[i]);
+             copyObject(&dictObj); // preserves indirection
+@@ -957,8 +940,8 @@ void write_epdf(void)
+     } 
+ 
+     // handle page group
+-    pageDict->lookupNF("Group", &dictObj);
+-    if (!dictObj->isNull()) {
++    dictObj = pageDict->lookupNF("Group").copy();
++    if (!dictObj.isNull()) {
+         if (pdfpagegroupval == 0) { 
+             // another pdf with page group was included earlier on the
+             // same page; copy the Group entry as is.  See manual for
+@@ -972,11 +955,36 @@ void write_epdf(void)
+             copyObject(&dictObj);
+         } else {
+             // write Group dict as a separate object, since the Page dict also refers to it
+-            pageDict->lookup("Group", &dictObj);
+-            if (!dictObj->isDict())
++            dictObj = pageDict->lookup("Group");
++            if (!dictObj.isDict())
+                 pdftex_fail("PDF inclusion: /Group dict missing");
+             writeSepGroup = true;
+-            initDictFromDict(groupDict, page->getGroup());
++/*
++This part is only a single line
++            groupDict = Object(page->getGroup());
++in the original patch. In this case, however, pdftex crashes at
++"delete pdf_doc->doc" in "delete_document()" for inclusion of some
++kind of pdf images, for example, figure_missing.pdf in gnuplot.
++A change
++            groupDict = Object(page->getGroup()).copy();
++does not improve the situation.
++The changes below seem to work fine. 
++*/
++// begin modification
++            groupDict = pageDict->lookup("Group");
++            const Dict& dic1 = page->getGroup();
++            const Dict& dic2 = groupDict.getDict();
++            // replace dic2 in groupDict with dic1
++            l = dic2.getLength();
++            for (i = 0; i < l; i++) {
++                groupDict.dictRemove(dic2.getKey(i));
++            }
++            l = dic1.getLength();
++            for (i = 0; i < l; i++) {
++                groupDict.dictAdd((const char *)copyString(dic1.getKey(i)),
++                                  dic1.getValNF(i).copy());
++            }
++// end modification
+             pdf_printf("/Group %ld 0 R\n", (long)pdfpagegroupval);
+         }
+     }
+@@ -989,28 +997,28 @@ void write_epdf(void)
+         pdftex_warn
+             ("PDF inclusion: /Resources missing. 'This practice is not recommended' (PDF Ref)");
+     } else {
+-        initDictFromDict(obj1, page->getResourceDict());
++        Object *obj1 = page->getResourceDictObject();
+         if (!obj1->isDict())
+             pdftex_fail("PDF inclusion: invalid resources dict type <%s>",
+                         obj1->getTypeName());
+         pdf_newline();
+         pdf_puts("/Resources <<\n");
+         for (i = 0, l = obj1->dictGetLength(); i < l; ++i) {
+-            obj1->dictGetVal(i, &obj2);
+-            key = obj1->dictGetKey(i);
++            obj2 = obj1->dictGetVal(i);
++            key = (char *)obj1->dictGetKey(i);
+             if (strcmp("Font", key) == 0)
+                 copyFontResources(&obj2);
+             else if (strcmp("ProcSet", key) == 0)
+                 copyProcSet(&obj2);
+             else
+-                copyOtherResources(&obj2, key);
++                copyOtherResources(&obj2, (char *)key);
+         }
+         pdf_puts(">>\n");
+     }
+ 
+     // write the page contents
+-    page->getContents(&contents);
+-    if (contents->isStream()) {
++    contents = page->getContents();
++    if (contents.isStream()) {
+ 
+         // Variant A: get stream and recompress under control
+         // of \pdfcompresslevel
+@@ -1021,36 +1029,35 @@ void write_epdf(void)
+ 
+         // Variant B: copy stream without recompressing
+         //
+-        contents->streamGetDict()->lookup("F", &obj1);
+-        if (!obj1->isNull()) {
++        obj1 = contents.streamGetDict()->lookup("F");
++        if (!obj1.isNull()) {
+             pdftex_fail("PDF inclusion: Unsupported external stream");
+         }
+-        contents->streamGetDict()->lookup("Length", &obj1);
+-        assert(!obj1->isNull());
++        obj1 = contents.streamGetDict()->lookup("Length");
++        assert(!obj1.isNull());
+         pdf_puts("/Length ");
+         copyObject(&obj1);
+         pdf_puts("\n");
+-        contents->streamGetDict()->lookup("Filter", &obj1);
+-        if (!obj1->isNull()) {
++        obj1 = contents.streamGetDict()->lookup("Filter");
++        if (!obj1.isNull()) {
+             pdf_puts("/Filter ");
+             copyObject(&obj1);
+             pdf_puts("\n");
+-            contents->streamGetDict()->lookup("DecodeParms", &obj1);
+-            if (!obj1->isNull()) {
++            obj1 = contents.streamGetDict()->lookup("DecodeParms");
++            if (!obj1.isNull()) {
+                 pdf_puts("/DecodeParms ");
+                 copyObject(&obj1);
+                 pdf_puts("\n");
+             }
+         }
+         pdf_puts(">>\nstream\n");
+-        copyStream(contents->getStream()->getUndecodedStream());
++        copyStream(contents.getStream()->getUndecodedStream());
+         pdfendstream();
+-    } else if (contents->isArray()) {
++    } else if (contents.isArray()) {
+         pdfbeginstream();
+-        for (i = 0, l = contents->arrayGetLength(); i < l; ++i) {
+-            Object contentsobj;
+-            copyStream((contents->arrayGet(i, &contentsobj))->getStream());
+-            contentsobj.free();
++        for (i = 0, l = contents.arrayGetLength(); i < l; ++i) {
++            Object contentsobj = contents.arrayGet(i);
++            copyStream(contentsobj.getStream());
+             if (i < l - 1)
+                 pdf_newline();  // add a newline after each stream except the last
+         }
+@@ -1105,6 +1112,5 @@ void epdf_check_mem()
+             delete_document(p);
+         }
+         // see above for globalParams
+-        delete globalParams;
+     }
+ }
+diff --git a/texk/web2c/pdftexdir/pdftosrc.cc b/texk/web2c/pdftexdir/pdftosrc.cc
+index 67be229..b6700fd 100644
+--- a/texk/web2c/pdftexdir/pdftosrc.cc
++++ b/texk/web2c/pdftexdir/pdftosrc.cc
+@@ -16,6 +16,14 @@ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License along
+ with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
++
++/*
++This is based on the patch texlive-poppler-0.59.patch <2017-09-19> at
++https://git.archlinux.org/svntogit/packages.git/plain/texlive-bin/trunk
++by Arch Linux. The poppler should be 0.72.0 or newer versions.
++POPPLER_VERSION should be defined.
++*/
++
+ #include <w2c/config.h>
+ 
+ #include <stdlib.h>
+@@ -32,16 +40,12 @@ with this program.  If not, see <http://www.gnu.org/licenses/>.
+ #include <goo/gmem.h>
+ #include <goo/gfile.h>
+ #else
+-#include <aconf.h>
+-#include <GString.h>
+-#include <gmem.h>
+-#include <gfile.h>
++#error POPPLER_VERSION should be defined.
+ #endif
+ #include <assert.h>
+ 
+ #include "Object.h"
+ #include "Stream.h"
+-#include "Lexer.h"
+ #include "Parser.h"
+ #include "Array.h"
+ #include "Dict.h"
+@@ -74,7 +78,11 @@ int main(int argc, char *argv[])
+         exit(1);
+     }
+     fileName = new GString(argv[1]);
+-    globalParams = new GlobalParams();
++#if POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 83
++    globalParams.reset(new GlobalParams());
++#else
++    globalParams = std::make_unique<GlobalParams>();
++#endif
+     doc = new PDFDoc(fileName);
+     if (!doc->isOk()) {
+         fprintf(stderr, "Invalid PDF file\n");
+@@ -86,36 +94,34 @@ int main(int argc, char *argv[])
+             objgen = atoi(argv[3]);
+     }
+     xref = doc->getXRef();
+-    catalogDict.initNull();
+-    xref->getCatalog(&catalogDict);
++    catalogDict = xref->getCatalog();
+     if (!catalogDict.isDict("Catalog")) {
+         fprintf(stderr, "No Catalog found\n");
+         exit(1);
+     }
+-    srcStream.initNull();
++    srcStream = Object(objNull);
+     if (objnum == 0) {
+-        catalogDict.dictLookup("SourceObject", &srcStream);
+-        static char const_SourceFile[] = "SourceFile";
+-        if (!srcStream.isStream(const_SourceFile)) {
++        srcStream = catalogDict.dictLookup("SourceObject");
++        static const char *const_SourceFile = "SourceFile";
++        if (!srcStream.isDict(const_SourceFile)) {
+             fprintf(stderr, "No SourceObject found\n");
+             exit(1);
+         }
+-        srcName.initNull();
+-        srcStream.getStream()->getDict()->lookup("SourceName", &srcName);
++        srcName = srcStream.getStream()->getDict()->lookup("SourceName");
+         if (!srcName.isString()) {
+             fprintf(stderr, "No SourceName found\n");
+             exit(1);
+         }
+-        outname = srcName.getString()->getCString();
++        outname = (char *)srcName.getString()->c_str();
+         // We cannot free srcName, as objname shares its string.
+         // srcName.free();
+     } else if (objnum > 0) {
+-        xref->fetch(objnum, objgen, &srcStream);
++        srcStream = xref->fetch(objnum, objgen);
+         if (!srcStream.isStream()) {
+             fprintf(stderr, "Not a Stream object\n");
+             exit(1);
+         }
+-        sprintf(buf, "%s", fileName->getCString());
++        sprintf(buf, "%s", fileName->c_str());
+         if ((p = strrchr(buf, '.')) == 0)
+             p = strchr(buf, 0);
+         if (objgen == 0)
+@@ -125,7 +131,7 @@ int main(int argc, char *argv[])
+         outname = buf;
+     } else {                    // objnum < 0 means we are extracting the XRef table
+         extract_xref_table = true;
+-        sprintf(buf, "%s", fileName->getCString());
++        sprintf(buf, "%s", fileName->c_str());
+         if ((p = strrchr(buf, '.')) == 0)
+             p = strchr(buf, 0);
+         sprintf(p, ".xref");
+@@ -153,41 +159,32 @@ int main(int argc, char *argv[])
+                         (e->type == xrefEntryFree ? "f" : "n"));
+             else {              // e->offset is the object number of the object stream
+                 Stream *str;
+-                Lexer *lexer;
+                 Parser *parser;
+                 Object objStr, obj1, obj2;
+                 int nObjects, first, n;
+                 int localOffset = 0;
+-                Guint firstOffset;
++                unsigned int firstOffset;
+ 
+-                assert(xref->fetch(e->offset, 0, &objStr)->isStream());
+-                nObjects = objStr.streamGetDict()->lookup("N", &obj1)->getInt();
+-                obj1.free();
+-                first = objStr.streamGetDict()->lookup("First", &obj1)->getInt();
+-                obj1.free();
++                objStr = xref->fetch(e->offset, 0);
++                assert(objStr.isStream());
++                obj1 = objStr.streamGetDict()->lookup("N");
++                nObjects = obj1.getInt();
++                obj1 = objStr.streamGetDict()->lookup("First");
++                first = obj1.getInt();
+                 firstOffset = objStr.getStream()->getBaseStream()->getStart() + first;
+ 
+                 // parse the header: object numbers and offsets
+                 objStr.streamReset();
+-                obj1.initNull();
+-                str = new EmbedStream(objStr.getStream(), &obj1, gTrue, first);
+-                lexer = new Lexer(xref, str);
+-                parser = new Parser(xref, lexer, gFalse);
++                str = new EmbedStream(objStr.getStream(), Object(objNull), true, first);
++                parser = new Parser(xref, str, false);
+                 for (n = 0; n < nObjects; ++n) {
+-                    parser->getObj(&obj1);
+-                    parser->getObj(&obj2);
++                    obj1 = parser->getObj();
++                    obj2 = parser->getObj();
+                     if (n == e->gen)
+                         localOffset = obj2.getInt();
+-                    obj1.free();
+-                    obj2.free();
+                 }
+-#if defined(POPPLER_VERSION) || defined(XPDF304)
+                 while (str->getChar() != EOF) ;
+-#else /* xpdf 4.00 */
+-                lexer->skipToEOF();
+-#endif
+                 delete parser;
+-                objStr.free();
+ 
+                 fprintf(outfile, "%.10lu 00000 n\n",
+                         (long unsigned)(firstOffset + localOffset));
+@@ -198,7 +195,6 @@ int main(int argc, char *argv[])
+         s->reset();
+         while ((c = s->getChar()) != EOF)
+             fputc(c, outfile);
+-        srcStream.free();
+     }
+     if (objnum == 0)
+         fprintf(stderr, "Source file extracted to %s\n", outname);
+@@ -207,7 +203,5 @@ int main(int argc, char *argv[])
+     else
+         fprintf(stderr, "Cross-reference table extracted to %s\n", outname);
+     fclose(outfile);
+-    catalogDict.free();
+     delete doc;
+-    delete globalParams;
+ }
+-- 
+2.24.1
+


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/tex:master commit in: 2019/patches/
@ 2019-12-30 17:47 Mikle Kolyada
  0 siblings, 0 replies; 11+ messages in thread
From: Mikle Kolyada @ 2019-12-30 17:47 UTC (permalink / raw
  To: gentoo-commits

commit:     7ce651d660c5f233678269178ef23f8fd58a962c
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Mon Dec 30 17:46:51 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Mon Dec 30 17:46:51 2019 +0000
URL:        https://gitweb.gentoo.org/proj/tex.git/commit/?id=7ce651d6

Add poppler-0.84 compat patch

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 2019/patches/texlive-core-2019-poppler0.84.patch | 27 ++++++++++++++++++++++++
 1 file changed, 27 insertions(+)

diff --git a/2019/patches/texlive-core-2019-poppler0.84.patch b/2019/patches/texlive-core-2019-poppler0.84.patch
new file mode 100644
index 0000000..d92288f
--- /dev/null
+++ b/2019/patches/texlive-core-2019-poppler0.84.patch
@@ -0,0 +1,27 @@
+From f00f5c8bac586a07dbfd3d517f0f213e22ca2435 Mon Sep 17 00:00:00 2001
+From: Mikle Kolyada <zlogene@gentoo.org>
+Date: Mon, 30 Dec 2019 19:45:59 +0300
+Subject: [PATCH] poppler-0.84 compat
+
+Upstream report: https://tug.org/pipermail/tex-k/2019-December/003096.html
+
+Signed-off-by: Mikle Kolyada <zlogene@gentoo.org>
+---
+ utils.c | 1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/utils.c b/utils.c
+index c93a878..6f866e7 100644
+--- a/texk/web2c/pdftexdir/utils.c
++++ b/texk/web2c/pdftexdir/utils.c
+@@ -33,7 +33,6 @@ with this program.  If not, see <http://www.gnu.org/licenses/>.
+ #include "ptexlib.h"
+ #include <png.h>
+ #ifdef POPPLER_VERSION
+-#include <poppler-config.h>
+ #define xpdfVersion POPPLER_VERSION
+ #define xpdfString "poppler"
+ #else
+-- 
+2.24.1
+


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/tex:master commit in: 2019/patches/
@ 2019-12-31  7:37 Mikle Kolyada
  0 siblings, 0 replies; 11+ messages in thread
From: Mikle Kolyada @ 2019-12-31  7:37 UTC (permalink / raw
  To: gentoo-commits

commit:     3c874341c6466e87a73e484eae267b9d505ad808
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 31 07:37:29 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Tue Dec 31 07:37:29 2019 +0000
URL:        https://gitweb.gentoo.org/proj/tex.git/commit/?id=3c874341

remove incomplete poppler-0.84 patch

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 2019/patches/texlive-core-2019-poppler0.84.patch | 27 ------------------------
 1 file changed, 27 deletions(-)

diff --git a/2019/patches/texlive-core-2019-poppler0.84.patch b/2019/patches/texlive-core-2019-poppler0.84.patch
deleted file mode 100644
index d92288f..0000000
--- a/2019/patches/texlive-core-2019-poppler0.84.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From f00f5c8bac586a07dbfd3d517f0f213e22ca2435 Mon Sep 17 00:00:00 2001
-From: Mikle Kolyada <zlogene@gentoo.org>
-Date: Mon, 30 Dec 2019 19:45:59 +0300
-Subject: [PATCH] poppler-0.84 compat
-
-Upstream report: https://tug.org/pipermail/tex-k/2019-December/003096.html
-
-Signed-off-by: Mikle Kolyada <zlogene@gentoo.org>
----
- utils.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/utils.c b/utils.c
-index c93a878..6f866e7 100644
---- a/texk/web2c/pdftexdir/utils.c
-+++ b/texk/web2c/pdftexdir/utils.c
-@@ -33,7 +33,6 @@ with this program.  If not, see <http://www.gnu.org/licenses/>.
- #include "ptexlib.h"
- #include <png.h>
- #ifdef POPPLER_VERSION
--#include <poppler-config.h>
- #define xpdfVersion POPPLER_VERSION
- #define xpdfString "poppler"
- #else
--- 
-2.24.1
-


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/tex:master commit in: 2019/patches/
@ 2019-12-31  8:34 Mikle Kolyada
  0 siblings, 0 replies; 11+ messages in thread
From: Mikle Kolyada @ 2019-12-31  8:34 UTC (permalink / raw
  To: gentoo-commits

commit:     e13ed5af2a56bd24e7dd8d0732095f1f40586da7
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Tue Dec 31 08:34:06 2019 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Tue Dec 31 08:34:06 2019 +0000
URL:        https://gitweb.gentoo.org/proj/tex.git/commit/?id=e13ed5af

redo poppler-0.84 compat patch

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 2019/patches/texlive-core-2019-poppler084.patch | 43 +++++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/2019/patches/texlive-core-2019-poppler084.patch b/2019/patches/texlive-core-2019-poppler084.patch
new file mode 100644
index 0000000..02dc9e2
--- /dev/null
+++ b/2019/patches/texlive-core-2019-poppler084.patch
@@ -0,0 +1,43 @@
+From cf05aae9685e5c6a46b4313e7bfce49edc6f51f9 Mon Sep 17 00:00:00 2001
+From: Mikle Kolyada <zlogene@gentoo.org>
+Date: Tue, 31 Dec 2019 11:29:30 +0300
+Subject: [PATCH] poppler-0.84 compat
+
+Upstream report: https://tug.org/pipermail/tex-k/2019-December/003096.html
+
+Signed-off-by: Mikle Kolyada <zlogene@gentoo.org>
+---
+ texk/web2c/pdftexdir/utils.c    | 1 -
+ texk/web2c/xetexdir/XeTeX_ext.c | 3 +++
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/texk/web2c/pdftexdir/utils.c b/texk/web2c/pdftexdir/utils.c
+index c93a8781..6f866e76 100644
+--- a/texk/web2c/pdftexdir/utils.c
++++ b/texk/web2c/pdftexdir/utils.c
+@@ -33,7 +33,6 @@ with this program.  If not, see <http://www.gnu.org/licenses/>.
+ #include "ptexlib.h"
+ #include <png.h>
+ #ifdef POPPLER_VERSION
+-#include <poppler-config.h>
+ #define xpdfVersion POPPLER_VERSION
+ #define xpdfString "poppler"
+ #else
+diff --git a/texk/web2c/xetexdir/XeTeX_ext.c b/texk/web2c/xetexdir/XeTeX_ext.c
+index 4968ee41..0aee4ee3 100644
+--- a/texk/web2c/xetexdir/XeTeX_ext.c
++++ b/texk/web2c/xetexdir/XeTeX_ext.c
+@@ -38,7 +38,10 @@ authorization from the copyright holders.
+ 
+ #include <w2c/config.h>
+ 
++#ifndef POPPLER_VERSION
+ #include <poppler-config.h>
++#endif
++
+ #include <png.h>
+ #include <zlib.h>
+ #include <graphite2/Font.h>
+-- 
+2.24.1
+


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/tex:master commit in: 2019/patches/
@ 2020-02-10  9:29 Mikle Kolyada
  0 siblings, 0 replies; 11+ messages in thread
From: Mikle Kolyada @ 2020-02-10  9:29 UTC (permalink / raw
  To: gentoo-commits

commit:     44885ef09c55d9d3f546e5ab549bf15c647c2806
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Mon Feb 10 09:29:22 2020 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Mon Feb 10 09:29:22 2020 +0000
URL:        https://gitweb.gentoo.org/proj/tex.git/commit/?id=44885ef0

add gcc-10 compat patch

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 2019/patches/texlive-core-2019-no-fcommon.patch | 338 ++++++++++++++++++++++++
 1 file changed, 338 insertions(+)

diff --git a/2019/patches/texlive-core-2019-no-fcommon.patch b/2019/patches/texlive-core-2019-no-fcommon.patch
new file mode 100644
index 0000000..54e5feb
--- /dev/null
+++ b/2019/patches/texlive-core-2019-no-fcommon.patch
@@ -0,0 +1,338 @@
+--- a/texk/web2c/luatexdir/font/luatexfont.h
++++ b/texk/web2c/luatexdir/font/luatexfont.h
+@@ -128,8 +128,8 @@
+ void replace_packet_fonts(internal_font_number f, int *old_fontid, int *new_fontid, int count);
+ int *packet_local_fonts(internal_font_number f, int *num);
+ 
+-int packet_cur_s;               /* current |do_vf_packet()| recursion level */
+-int packet_stack_ptr;           /* pointer into |packet_stack| */
++extern int packet_cur_s;               /* current |do_vf_packet()| recursion level */
++extern int packet_stack_ptr;           /* pointer into |packet_stack| */
+ vf_struct *new_vfstruct(void);
+ 
+ /* writecff.c */
+--- a/texk/web2c/luatexdir/font/vfpacket.c
++++ b/texk/web2c/luatexdir/font/vfpacket.c
+@@ -29,6 +29,9 @@
+ 
+ */
+ 
++int packet_cur_s;
++int packet_stack_ptr;
++
+ #define packet_number(fw) {    \
+     fw = *(vfp++);             \
+     fw = fw * 256 + *(vfp++);  \
+--- a/texk/web2c/luatexdir/image/writeimg.h
++++ b/texk/web2c/luatexdir/image/writeimg.h
+@@ -26,7 +26,7 @@
+ #  include "pdf/pdfpage.h"
+ 
+ typedef image_dict *idict_entry;
+-idict_entry *idict_array;
++extern idict_entry *idict_array;
+ 
+ void new_img_pdfstream_struct(image_dict *);
+ image *new_image(void);
+--- a/texk/web2c/luatexdir/pdf/pdftables.c
++++ b/texk/web2c/luatexdir/pdf/pdftables.c
+@@ -31,7 +31,6 @@
+ int pdf_last_link;
+ int pdf_last_obj;
+ int pdf_retval;
+-int pdf_cur_form;
+ 
+ /*tex
+ 
+--- a/texk/web2c/luatexdir/pdf/pdftables.h
++++ b/texk/web2c/luatexdir/pdf/pdftables.h
+@@ -21,7 +21,7 @@
+ #ifndef PDFTABLES_H
+ #  define PDFTABLES_H
+ 
+-const char *pdf_obj_typenames[PDF_OBJ_TYPE_MAX + 1];
++extern const char *pdf_obj_typenames[PDF_OBJ_TYPE_MAX + 1];
+ 
+ typedef enum {
+     union_type_int,
+--- a/texk/web2c/luatexdir/tex/textoken.c
++++ b/texk/web2c/luatexdir/tex/textoken.c
+@@ -76,7 +76,7 @@
+ 
+ /*tex how much memory is in use */
+ 
+-int var_used, dyn_used;
++int dyn_used;
+ 
+ /*tex head of the list of available one-word nodes */
+ 
+--- a/texk/web2c/mplibdir/mp.w
++++ b/texk/web2c/mplibdir/mp.w
+@@ -2958,12 +2958,15 @@
+ }
+ 
+ @ @<Internal library declarations@>=
+-int mp_snprintf_res ;
++extern int mp_snprintf_res ;
+ /* Some compilers (i.e. gcc 8.2.0 ) complained with the old */
+ /* #define mp_snprintf (void)snprintf                       */
+ /* about truncation. For the moment we store the result.    */
+ #  define mp_snprintf mp_snprintf_res=snprintf
+ 
++@ @c
++int mp_snprintf_res ;
++
+ @* Dynamic memory allocation.
+ 
+ The \MP\ system does nearly all of its own memory allocation, so that it
+--- a/utils/autosp/autosp-src/autosp.c
++++ b/utils/autosp/autosp-src/autosp.c
+@@ -82,6 +82,16 @@
+ 
+ # include "autosp.h"
+ 
++bool debug;
++bool dottedbeamnotes;
++
++char infilename[SHORT_LEN];
++char *infilename_n;
++char outfilename[SHORT_LEN];
++char *outfilename_n;
++char logfilename[SHORT_LEN];
++char *logfilename_n;
++FILE *infile, *outfile, *logfile;
+ 
+ PRIVATE void
+ usage ()
+--- a/utils/autosp/autosp-src/autosp.h
++++ b/utils/autosp/autosp-src/autosp.h
+@@ -25,16 +25,16 @@
+ 
+ # define SHORT_LEN 256
+ 
+-bool debug;
+-bool dottedbeamnotes;          /* dotted beam notes ignored?        */
++extern bool debug;
++extern bool dottedbeamnotes;          /* dotted beam notes ignored?        */
+ 
+-char infilename[SHORT_LEN];
+-char *infilename_n;
+-char outfilename[SHORT_LEN];
+-char *outfilename_n;
+-char logfilename[SHORT_LEN];
+-char *logfilename_n;
+-FILE *infile, *outfile, *logfile;
++extern char infilename[SHORT_LEN];
++extern char *infilename_n;
++extern char outfilename[SHORT_LEN];
++extern char *outfilename_n;
++extern char logfilename[SHORT_LEN];
++extern char *logfilename_n;
++extern FILE *infile, *outfile, *logfile;
+ 
+ 
+ void process_score ();
+--- a/utils/autosp/autosp-src/process_command.c
++++ b/utils/autosp/autosp-src/process_command.c
+@@ -1,5 +1,43 @@
+ # include "process_command.h"
+ 
++char terminator[MAX_STAFFS];
++
++char *notes[MAX_STAFFS];
++char *current[MAX_STAFFS];
++
++int spacings[MAX_STAFFS];
++
++int vspacing[MAX_STAFFS];
++bool vspacing_active[MAX_STAFFS];
++
++bool nonvirtual_notes;
++
++int cspacing[MAX_STAFFS];
++char collective[MAX_STAFFS][SHORT_LEN];
++bool first_collective[MAX_STAFFS];
++
++char deferred_bar[SHORT_LEN];
++
++int beaming[MAX_STAFFS];
++int new_beaming;
++int semiauto_beam_notes[MAX_STAFFS];
++
++int beamingi;  
++char *currenti;
++int cspacingi;
++int vspacingi;
++char collectivei[SHORT_LEN];
++bool first_collectivei;
++
++int xtuplet[MAX_STAFFS];
++
++bool appoggiatura;
++
++char outstrings[MAX_STAFFS][LINE_LEN];  
++
++char *n_outstrings[MAX_STAFFS];
++
++int global_skip;  
+ 
+ void process_xtuplet (void);
+ 
+--- a/utils/autosp/autosp-src/process_command.h
++++ b/utils/autosp/autosp-src/process_command.h
+@@ -8,47 +8,47 @@
+ # define NOTEsp  "\\vnotes9.52\\elemskip"
+ # define APPOGG_NOTES "\\vnotes1.45\\elemskip"
+ 
+-char terminator[MAX_STAFFS];    /* one of '&' "|', '$'                */
++extern char terminator[MAX_STAFFS];    /* one of '&' "|', '$'                */
+ 
+-char *notes[MAX_STAFFS];        /* note segment for ith staff         */
+-char *current[MAX_STAFFS];
++extern char *notes[MAX_STAFFS];        /* note segment for ith staff         */
++extern char *current[MAX_STAFFS];
+ 
+-int spacings[MAX_STAFFS];       /* spacing for ith staff              */
++extern int spacings[MAX_STAFFS];       /* spacing for ith staff              */
+ 
+-int vspacing[MAX_STAFFS];       /* virtual-note (skip) spacing        */
+-bool vspacing_active[MAX_STAFFS]; /* virtual-note spacing active?       */
++extern int vspacing[MAX_STAFFS];       /* virtual-note (skip) spacing        */
++extern bool vspacing_active[MAX_STAFFS]; /* virtual-note spacing active?       */
+                       /* used to preclude unnecessary pre-accidental skips    */
+ 
+-bool nonvirtual_notes;          /* used to preclude output of *only* virtual notes */
++extern bool nonvirtual_notes;          /* used to preclude output of *only* virtual notes */
+ 
+-int cspacing[MAX_STAFFS];       /* nominal collective-note spacing    */
+-char collective[MAX_STAFFS][SHORT_LEN];
++extern int cspacing[MAX_STAFFS];       /* nominal collective-note spacing    */
++extern char collective[MAX_STAFFS][SHORT_LEN];
+                                     /* prefixes for collective note sequences */
+-bool first_collective[MAX_STAFFS];
++extern bool first_collective[MAX_STAFFS];
+ 
+-char deferred_bar[SHORT_LEN];   /* deferred \bar (or \endpiece etc.)  */
++extern char deferred_bar[SHORT_LEN];   /* deferred \bar (or \endpiece etc.)  */
+ 
+-int beaming[MAX_STAFFS];        /* spacing for beamed notes           */
+-int new_beaming;
+-int semiauto_beam_notes[MAX_STAFFS]; /* semi-automatic beam notes     */
++extern int beaming[MAX_STAFFS];        /* spacing for beamed notes           */
++extern int new_beaming;
++extern int semiauto_beam_notes[MAX_STAFFS]; /* semi-automatic beam notes     */
+ 
+ /* save-restore state for a staff; used in process_xtuplet */
+-int beamingi;  
+-char *currenti;
+-int cspacingi;
+-int vspacingi;
+-char collectivei[SHORT_LEN];
+-bool first_collectivei;
++extern int beamingi;  
++extern char *currenti;
++extern int cspacingi;
++extern int vspacingi;
++extern char collectivei[SHORT_LEN];
++extern bool first_collectivei;
+ 
+-int xtuplet[MAX_STAFFS];        /* x for xtuplet in staff i          */
++extern int xtuplet[MAX_STAFFS];        /* x for xtuplet in staff i          */
+ 
+-bool appoggiatura;
++extern bool appoggiatura;
+ 
+-char outstrings[MAX_STAFFS][LINE_LEN];  
++extern char outstrings[MAX_STAFFS][LINE_LEN];  
+                                      /* accumulate commands to be output    */
+-char *n_outstrings[MAX_STAFFS];
++extern char *n_outstrings[MAX_STAFFS];
+ 
+-int global_skip;  
++extern int global_skip;  
+    /* = 1, 2, 3, or 4 for (non-standard) commands \QQsk \HQsk \TQsk \Qsk    */
+    /* = 5 for five commas and double-flat accidental spacing                */
+    /* = 6 for six commas                                                    */
+--- a/utils/autosp/autosp-src/process_score.c
++++ b/utils/autosp/autosp-src/process_score.c
+@@ -1,5 +1,21 @@
+ # include "process_score.h"
+ 
++int staffs[MAX_STAFFS];
++bool active[MAX_STAFFS];
++bool bar_rest[MAX_STAFFS];
++int spacing;
++int restbars;
++char global_skip_str[7][16];   
++int ninstr;
++int nstaffs;
++int nastaffs;
++int old_spacing;
++bool Changeclefs;
++char TransformNotes2[SHORT_LEN];
++bool TransformNotesDefined;
++
++char line[LINE_LEN];
++
+ void process_line ()
+ {
+   char  *ln; 
+--- a/utils/autosp/autosp-src/process_score.h
++++ b/utils/autosp/autosp-src/process_score.h
+@@ -6,21 +6,21 @@
+ # define SP(note) (SMALL_NOTE/note)  
+ /* note = { 256 | 128 | 64 | 32 | 16 | 8 | 4 | 2 | 1 }  */
+ # define MAX_SPACING 2*SP(1)
+-int staffs[MAX_STAFFS]; /* number of staffs for ith instrument*/
+-bool active[MAX_STAFFS];        /* is staff i active?                 */
+-bool bar_rest[MAX_STAFFS];
+-int spacing;                    /* spacing for current notes          */
+-int restbars;
+-char global_skip_str[7][16];   
+-int ninstr;                 /* number of instruments              */
+-int nstaffs;                /* number of staffs                   */
+-int nastaffs;               /* number of active staffs;           */
+-int old_spacing;
+-bool Changeclefs;               /* output \Changeclefs after \def\atnextbar */
+-char TransformNotes2[SHORT_LEN];      /* 2nd argument of \TransformNotes    */
+-bool TransformNotesDefined;
++extern int staffs[MAX_STAFFS]; /* number of staffs for ith instrument*/
++extern bool active[MAX_STAFFS];        /* is staff i active?                 */
++extern bool bar_rest[MAX_STAFFS];
++extern int spacing;                    /* spacing for current notes          */
++extern int restbars;
++extern char global_skip_str[7][16];   
++extern int ninstr;                 /* number of instruments              */
++extern int nstaffs;                /* number of staffs                   */
++extern int nastaffs;               /* number of active staffs;           */
++extern int old_spacing;
++extern bool Changeclefs;               /* output \Changeclefs after \def\atnextbar */
++extern char TransformNotes2[SHORT_LEN];      /* 2nd argument of \TransformNotes    */
++extern bool TransformNotesDefined;
+ 
+-char line[LINE_LEN];            /* line of input                      */
++extern char line[LINE_LEN];            /* line of input                      */
+ 
+ void process_line ();
+ 
+--- a/utils/autosp/autosp-src/utils.c
++++ b/utils/autosp/autosp-src/utils.c
+@@ -24,6 +24,8 @@
+ 
+ # include "utils.h"
+ 
++int lineno;
++
+ void
+ warning (const char msg[])    /* output warning message msg to stderr                 */
+ {
+--- a/utils/autosp/autosp-src/utils.h
++++ b/utils/autosp/autosp-src/utils.h
+@@ -61,6 +61,6 @@
+ extern bool prefix (const char *cs, const char *ct); /* is string cs[] a prefix of ct[]?  */
+ extern bool suffix (const char *cs, const char *ct); /* is string cs[] a suffix of ct[]?  */
+ 
+-int lineno;
++extern int lineno;
+ extern void error (const char msg[]);	/* abort with stderr message msg */
+ extern void warning (const char msg[]); /* output warning message msg to stderr  */


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/tex:master commit in: 2019/patches/
@ 2020-03-06 14:05 Mikle Kolyada
  0 siblings, 0 replies; 11+ messages in thread
From: Mikle Kolyada @ 2020-03-06 14:05 UTC (permalink / raw
  To: gentoo-commits

commit:     fe370d3fcd032cda6c0a0de31d094add85699fff
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Fri Mar  6 14:05:12 2020 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Fri Mar  6 14:05:12 2020 +0000
URL:        https://gitweb.gentoo.org/proj/tex.git/commit/?id=fe370d3f

Add poppler-0.86 compat patch

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 2019/patches/texlive-core-2019-poppler086.patch | 820 ++++++++++++++++++++++++
 1 file changed, 820 insertions(+)

diff --git a/2019/patches/texlive-core-2019-poppler086.patch b/2019/patches/texlive-core-2019-poppler086.patch
new file mode 100644
index 0000000..4ab4f95
--- /dev/null
+++ b/2019/patches/texlive-core-2019-poppler086.patch
@@ -0,0 +1,820 @@
+From 1203f6d9d51d6bedf11e36509f3a56638b1c816e Mon Sep 17 00:00:00 2001
+From: Mikle Kolyada <zlogene@gentoo.org>
+Date: Fri, 6 Mar 2020 13:31:24 +0000
+Subject: [PATCH] poppler-0.86 compat
+
+Signed-off-by: Mikle Kolyada <zlogene@gentoo.org>
+---
+ pdftoepdf.cc | 308 ++++++++++++++++++++++++++-------------------------
+ pdftosrc.cc  |  76 ++++++-------
+ utils.c      |   1 -
+ 3 files changed, 192 insertions(+), 193 deletions(-)
+
+diff --git a/pdftoepdf.cc b/pdftoepdf.cc
+index 4db0c90..d13293e 100644
+--- a/texk/web2c/pdftexdir/pdftoepdf.cc
++++ b/texk/web2c/pdftexdir/pdftoepdf.cc
+@@ -1,5 +1,5 @@
+ /*
+-Copyright 1996-2016 Han The Thanh, <thanh@pdftex.org>
++Copyright 1996-2017 Han The Thanh, <thanh@pdftex.org>
+ 
+ This file is part of pdfTeX.
+ 
+@@ -17,6 +17,15 @@ You should have received a copy of the GNU General Public License along
+ with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+ 
++/*
++This is based on the patch texlive-poppler-0.59.patch <2017-09-19> at
++https://git.archlinux.org/svntogit/packages.git/plain/texlive-bin/trunk
++by Arch Linux. A little modifications are made to avoid a crash for
++some kind of pdf images, such as figure_missing.pdf in gnuplot.
++The poppler should be 0.75.0 or newer versions.
++POPPLER_VERSION should be defined.
++*/
++
+ /* Do this early in order to avoid a conflict between
+    MINGW32 <rpcndr.h> defining 'boolean' as 'unsigned char' and
+    <kpathsea/types.h> defining Pascal's boolean as 'int'.
+@@ -39,10 +48,7 @@ with this program.  If not, see <http://www.gnu.org/licenses/>.
+ #include <goo/gfile.h>
+ #define GString GooString
+ #else
+-#include <aconf.h>
+-#include <GString.h>
+-#include <gmem.h>
+-#include <gfile.h>
++#error POPPLER_VERSION should be defined.
+ #endif
+ #include <assert.h>
+ 
+@@ -84,31 +90,6 @@ extern integer zround(double);
+ #define MASK_SUPPRESS_PTEX_PAGENUMBER 0x04
+ #define MASK_SUPPRESS_PTEX_INFODICT   0x08
+ 
+-// PdfObject encapsulates the xpdf Object type,
+-// and properly frees its resources on destruction.
+-// Use obj-> to access members of the Object,
+-// and &obj to get a pointer to the object.
+-// It is no longer necessary to call Object::free explicitely.
+-
+-class PdfObject {
+-  public:
+-    PdfObject() {               // nothing
+-    } ~PdfObject() {
+-        iObject.free();
+-    }
+-    Object *operator->() {
+-        return &iObject;
+-    }
+-    Object *operator&() {
+-        return &iObject;
+-    }
+-  private:                     // no copying or assigning
+-    PdfObject(const PdfObject &);
+-    void operator=(const PdfObject &);
+-  public:
+-    Object iObject;
+-};
+-
+ // When copying the Resources of the selected page, all objects are copied
+ // recusively top-down. Indirect objects however are not fetched during
+ // copying, but get a new object number from pdfTeX and then will be
+@@ -139,7 +120,7 @@ struct UsedEncoding {
+ 
+ static InObj *inObjList;
+ static UsedEncoding *encodingList;
+-static GBool isInit = gFalse;
++static bool isInit = false;
+ 
+ // --------------------------------------------------------------------
+ // Maintain list of open embedded PDF files
+@@ -212,18 +193,6 @@ static void delete_document(PdfDocument * pdf_doc)
+     delete pdf_doc;
+ }
+ 
+-// Replacement for
+-//      Object *initDict(Dict *dict1){ initObj(objDict); dict = dict1; return this; }
+-
+-static void initDictFromDict(PdfObject & obj, Dict * dict)
+-{
+-    obj->initDict(xref);
+-    for (int i = 0, l = dict->getLength(); i < l; i++) {
+-        Object obj1;
+-        obj->dictAdd(copyString(dict->getKey(i)), dict->getValNF(i, &obj1));
+-    }
+-}
+-
+ // --------------------------------------------------------------------
+ 
+ static int addEncoding(GfxFont * gfont)
+@@ -320,10 +289,10 @@ static void copyName(char *s)
+ 
+ static void copyDictEntry(Object * obj, int i)
+ {
+-    PdfObject obj1;
+-    copyName(obj->dictGetKey(i));
++    Object obj1;
++    copyName((char *)obj->dictGetKey(i));
+     pdf_puts(" ");
+-    obj->dictGetValNF(i, &obj1);
++    obj1 = obj->dictGetValNF(i).copy();
+     copyObject(&obj1);
+     pdf_puts("\n");
+ }
+@@ -348,7 +317,7 @@ static void copyFontDict(Object * obj, InObj * r)
+     pdf_puts("<<\n");
+     assert(r->type == objFont); // FontDescriptor is in fd_tree
+     for (i = 0, l = obj->dictGetLength(); i < l; ++i) {
+-        key = obj->dictGetKey(i);
++        key = (char *)obj->dictGetKey(i);
+         if (strncmp("FontDescriptor", key, strlen("FontDescriptor")) == 0
+             || strncmp("BaseFont", key, strlen("BaseFont")) == 0
+             || strncmp("Encoding", key, strlen("Encoding")) == 0)
+@@ -376,17 +345,17 @@ static void copyStream(Stream * str)
+ static void copyProcSet(Object * obj)
+ {
+     int i, l;
+-    PdfObject procset;
++    Object procset;
+     if (!obj->isArray())
+         pdftex_fail("PDF inclusion: invalid ProcSet array type <%s>",
+                     obj->getTypeName());
+     pdf_puts("/ProcSet [ ");
+     for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
+-        obj->arrayGetNF(i, &procset);
+-        if (!procset->isName())
++        procset = obj->arrayGetNF(i).copy();
++        if (!procset.isName())
+             pdftex_fail("PDF inclusion: invalid ProcSet entry type <%s>",
+-                        procset->getTypeName());
+-        copyName(procset->getName());
++                        procset.getTypeName());
++        copyName((char *)procset.getName());
+         pdf_puts(" ");
+     }
+     pdf_puts("]\n");
+@@ -394,10 +363,29 @@ static void copyProcSet(Object * obj)
+ 
+ #define REPLACE_TYPE1C true
+ 
++static bool embeddableFont(Object * fontdesc)
++{
++    Object fontfile, ffsubtype;
++
++    if (!fontdesc->isDict())
++        return false;
++    fontfile = fontdesc->dictLookup("FontFile");
++    if (fontfile.isStream())
++        return true;
++    if (REPLACE_TYPE1C) {
++        fontfile = fontdesc->dictLookup("FontFile3");
++        if (!fontfile.isStream())
++            return false;
++        ffsubtype = fontfile.streamGetDict()->lookup("Subtype");
++        return ffsubtype.isName() && !strcmp(ffsubtype.getName(), "Type1C");
++    }
++    return false;
++}
++
+ static void copyFont(char *tag, Object * fontRef)
+ {
+-    PdfObject fontdict, subtype, basefont, fontdescRef, fontdesc, charset,
+-        fontfile, ffsubtype, stemV;
++    Object fontdict, subtype, basefont, fontdescRef, fontdesc, charset,
++        stemV;
+     GfxFont *gfont;
+     fd_entry *fd;
+     fm_entry *fontmap;
+@@ -413,33 +401,39 @@ static void copyFont(char *tag, Object * fontRef)
+     }
+     // Only handle included Type1 (and Type1C) fonts; anything else will be copied.
+     // Type1C fonts are replaced by Type1 fonts, if REPLACE_TYPE1C is true.
+-    if (!fixedinclusioncopyfont && fontRef->fetch(xref, &fontdict)->isDict()
+-        && fontdict->dictLookup("Subtype", &subtype)->isName()
+-        && !strcmp(subtype->getName(), "Type1")
+-        && fontdict->dictLookup("BaseFont", &basefont)->isName()
+-        && fontdict->dictLookupNF("FontDescriptor", &fontdescRef)->isRef()
+-        && fontdescRef->fetch(xref, &fontdesc)->isDict()
+-        && (fontdesc->dictLookup("FontFile", &fontfile)->isStream()
+-            || (REPLACE_TYPE1C
+-                && fontdesc->dictLookup("FontFile3", &fontfile)->isStream()
+-                && fontfile->streamGetDict()->lookup("Subtype",
+-                                                     &ffsubtype)->isName()
+-                && !strcmp(ffsubtype->getName(), "Type1C")))
+-        && (fontmap = lookup_fontmap(basefont->getName())) != NULL) {
++    fontdict = fontRef->fetch(xref);
++    fontdesc = Object(objNull);
++    if (fontdict.isDict()) {
++        subtype = fontdict.dictLookup("Subtype");
++        basefont = fontdict.dictLookup("BaseFont");
++        fontdescRef = fontdict.dictLookupNF("FontDescriptor").copy();
++        if (fontdescRef.isRef()) {
++            fontdesc = fontdescRef.fetch(xref);
++        }
++    }
++    if (!fixedinclusioncopyfont && fontdict.isDict()
++        && subtype.isName()
++        && !strcmp(subtype.getName(), "Type1")
++        && basefont.isName()
++        && fontdescRef.isRef()
++        && fontdesc.isDict()
++        && embeddableFont(&fontdesc)
++        && (fontmap = lookup_fontmap((char *)basefont.getName())) != NULL) {
+         // round /StemV value, since the PDF input is a float
+         // (see Font Descriptors in PDF reference), but we only store an
+         // integer, since we don't want to change the struct.
+-        fontdesc->dictLookup("StemV", &stemV);
+-        fd = epdf_create_fontdescriptor(fontmap, zround(stemV->getNum()));
+-        if (fontdesc->dictLookup("CharSet", &charset) &&
+-            charset->isString() && is_subsetable(fontmap))
+-            epdf_mark_glyphs(fd, charset->getString()->getCString());
++        stemV = fontdesc.dictLookup("StemV");
++        fd = epdf_create_fontdescriptor(fontmap, zround(stemV.getNum()));
++        charset = fontdesc.dictLookup("CharSet");
++        if (!charset.isNull() &&
++            charset.isString() && is_subsetable(fontmap))
++            epdf_mark_glyphs(fd, (char *)charset.getString()->c_str());
+         else
+             embed_whole_font(fd);
+-        addFontDesc(fontdescRef->getRef(), fd);
++        addFontDesc(fontdescRef.getRef(), fd);
+         copyName(tag);
+         gfont = GfxFont::makeFont(xref, tag, fontRef->getRef(),
+-                                  fontdict->getDict());
++                                  fontdict.getDict());
+         pdf_printf(" %d 0 R ", addFont(fontRef->getRef(), fd,
+                                        addEncoding(gfont)));
+     } else {
+@@ -451,24 +445,24 @@ static void copyFont(char *tag, Object * fontRef)
+ 
+ static void copyFontResources(Object * obj)
+ {
+-    PdfObject fontRef;
++    Object fontRef;
+     int i, l;
+     if (!obj->isDict())
+         pdftex_fail("PDF inclusion: invalid font resources dict type <%s>",
+                     obj->getTypeName());
+     pdf_puts("/Font << ");
+     for (i = 0, l = obj->dictGetLength(); i < l; ++i) {
+-        obj->dictGetValNF(i, &fontRef);
+-        if (fontRef->isRef())
+-            copyFont(obj->dictGetKey(i), &fontRef);
+-        else if (fontRef->isDict()) {   // some programs generate pdf with embedded font object
+-            copyName(obj->dictGetKey(i));
++        fontRef = obj->dictGetValNF(i).copy();
++        if (fontRef.isRef())
++            copyFont((char *)obj->dictGetKey(i), &fontRef);
++        else if (fontRef.isDict()) {   // some programs generate pdf with embedded font object
++            copyName((char *)obj->dictGetKey(i));
+             pdf_puts(" ");
+             copyObject(&fontRef);
+         }
+         else
+             pdftex_fail("PDF inclusion: invalid font in reference type <%s>",
+-                        fontRef->getTypeName());
++                        fontRef.getTypeName());
+     }
+     pdf_puts(">>\n");
+ }
+@@ -557,7 +551,7 @@ static char *convertNumToPDF(double n)
+ 
+ static void copyObject(Object * obj)
+ {
+-    PdfObject obj1;
++    Object obj1;
+     int i, l, c;
+     Ref ref;
+     char *p;
+@@ -571,8 +565,8 @@ static void copyObject(Object * obj)
+     } else if (obj->isNum()) {
+         pdf_printf("%s", convertNumToPDF(obj->getNum()));
+     } else if (obj->isString()) {
+-        s = obj->getString();
+-        p = s->getCString();
++        s = (GooString *)obj->getString();
++        p = (char *)s->c_str();
+         l = s->getLength();
+         if (strlen(p) == (unsigned int) l) {
+             pdf_puts("(");
+@@ -595,14 +589,14 @@ static void copyObject(Object * obj)
+             pdf_puts(">");
+         }
+     } else if (obj->isName()) {
+-        copyName(obj->getName());
++        copyName((char *)obj->getName());
+     } else if (obj->isNull()) {
+         pdf_puts("null");
+     } else if (obj->isArray()) {
+         pdf_puts("[");
+         for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
+-            obj->arrayGetNF(i, &obj1);
+-            if (!obj1->isName())
++            obj1 = obj->arrayGetNF(i).copy();
++            if (!obj1.isName())
+                 pdf_puts(" ");
+             copyObject(&obj1);
+         }
+@@ -612,9 +606,8 @@ static void copyObject(Object * obj)
+         copyDict(obj);
+         pdf_puts(">>");
+     } else if (obj->isStream()) {
+-        initDictFromDict(obj1, obj->streamGetDict());
+         pdf_puts("<<\n");
+-        copyDict(&obj1);
++        copyDict(obj->getStream()->getDictObject());
+         pdf_puts(">>\n");
+         pdf_puts("stream\n");
+         copyStream(obj->getStream()->getUndecodedStream());
+@@ -638,9 +631,8 @@ static void writeRefs()
+     InObj *r;
+     for (r = inObjList; r != 0; r = r->next) {
+         if (!r->written) {
+-            Object obj1;
+             r->written = 1;
+-            xref->fetch(r->ref.num, r->ref.gen, &obj1);
++            Object obj1 = xref->fetch(r->ref.num, r->ref.gen);
+             if (r->type == objFont) {
+                 assert(!obj1.isStream());
+                 pdfbeginobj(r->num, 2);         // \pdfobjcompresslevel = 2 is for this
+@@ -656,7 +648,6 @@ static void writeRefs()
+                 pdf_puts("\n");
+                 pdfendobj();
+             }
+-            obj1.free();
+         }
+     }
+ }
+@@ -673,7 +664,7 @@ static void writeEncodings()
+                     ("PDF inclusion: CID fonts are not supported"
+                      " (try to disable font replacement to fix this)");
+             }
+-            if ((s = ((Gfx8BitFont *) r->font)->getCharName(i)) != 0)
++            if ((s = (char *)((Gfx8BitFont *) r->font)->getCharName(i)) != 0)
+                 glyphNames[i] = s;
+             else
+                 glyphNames[i] = notdef;
+@@ -685,14 +676,14 @@ static void writeEncodings()
+ #ifdef POPPLER_VERSION
+         r->font->decRefCnt();
+ #else
+-        delete r->font;
++#error POPPLER_VERSION should be defined.
+ #endif
+         delete r;
+     }
+ }
+ 
+ // get the pagebox according to the pagebox_spec
+-static PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
++static const PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
+ {
+     if (pagebox_spec == pdfboxspecmedia)
+         return page->getMediaBox();
+@@ -724,17 +715,21 @@ read_pdf_info(char *image_name, char *page_name, int page_num,
+ {
+     PdfDocument *pdf_doc;
+     Page *page;
+-    PDFRectangle *pagebox;
++    const PDFRectangle *pagebox;
+ #ifdef POPPLER_VERSION
+     int pdf_major_version_found, pdf_minor_version_found;
+ #else
+-    float pdf_version_found, pdf_version_wanted;
++#error POPPLER_VERSION should be defined.
+ #endif
+     // initialize
+     if (!isInit) {
+-        globalParams = new GlobalParams();
+-        globalParams->setErrQuiet(gFalse);
+-        isInit = gTrue;
++#if POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 83
++	globalParams.reset(new GlobalParams());
++#else
++        globalParams = std::make_unique<GlobalParams>();
++#endif
++        globalParams->setErrQuiet(false);
++        isInit = true;
+     }
+     // open PDF file
+     pdf_doc = find_add_document(image_name);
+@@ -760,29 +755,17 @@ read_pdf_info(char *image_name, char *page_name, int page_num,
+         }
+     }
+ #else
+-    pdf_version_found = pdf_doc->doc->getPDFVersion();
+-    pdf_version_wanted = 1 + (minor_pdf_version_wanted * 0.1);
+-    if (pdf_version_found > pdf_version_wanted + 0.01) {
+-        char msg[] =
+-            "PDF inclusion: found PDF version <%.1f>, but at most version <%.1f> allowed";
+-        if (pdf_inclusion_errorlevel > 0) {
+-            pdftex_fail(msg, pdf_version_found, pdf_version_wanted);
+-        } else if (pdf_inclusion_errorlevel < 0) {
+-            ; /* do nothing */
+-        } else { /* = 0, give warning */
+-            pdftex_warn(msg, pdf_version_found, pdf_version_wanted);
+-        }
+-    }
++#error POPPLER_VERSION should be defined.
+ #endif
+     epdf_num_pages = pdf_doc->doc->getCatalog()->getNumPages();
+     if (page_name) {
+         // get page by name
+         GString name(page_name);
+-        LinkDest *link = pdf_doc->doc->findDest(&name);
++        LinkDest *link = pdf_doc->doc->findDest(&name).get();
+         if (link == 0 || !link->isOk())
+             pdftex_fail("PDF inclusion: invalid destination <%s>", page_name);
+         Ref ref = link->getPageRef();
+-        page_num = pdf_doc->doc->getCatalog()->findPage(ref.num, ref.gen);
++        page_num = pdf_doc->doc->getCatalog()->findPage(ref);
+         if (page_num == 0)
+             pdftex_fail("PDF inclusion: destination is not a page <%s>",
+                         page_name);
+@@ -839,8 +822,8 @@ void write_epdf(void)
+     Page *page;
+     Ref *pageRef;
+     Dict *pageDict;
+-    PdfObject contents, obj1, obj2, pageObj, dictObj;
+-    PdfObject groupDict;
++    Object contents, obj1, obj2, pageObj, dictObj;
++    Object groupDict;
+     bool writeSepGroup = false;
+     Object info;
+     char *key;
+@@ -867,10 +850,10 @@ void write_epdf(void)
+     encodingList = 0;
+     page = pdf_doc->doc->getCatalog()->getPage(epdf_selected_page);
+     pageRef = pdf_doc->doc->getCatalog()->getPageRef(epdf_selected_page);
+-    xref->fetch(pageRef->num, pageRef->gen, &pageObj);
+-    pageDict = pageObj->getDict();
++    pageObj = xref->fetch(pageRef->num, pageRef->gen);
++    pageDict = pageObj.getDict();
+     rotate = page->getRotate();
+-    PDFRectangle *pagebox;
++    const PDFRectangle *pagebox;
+     // write the Page header
+     pdf_puts("/Type /XObject\n");
+     pdf_puts("/Subtype /Form\n");
+@@ -886,7 +869,7 @@ void write_epdf(void)
+         pdf_printf("/%s.PageNumber %i\n", pdfkeyprefix, (int) epdf_selected_page);
+     }
+     if ((suppress_ptex_info & MASK_SUPPRESS_PTEX_INFODICT) == 0) {
+-        pdf_doc->doc->getDocInfoNF(&info);
++        info = pdf_doc->doc->getDocInfoNF().copy();
+         if (info.isRef()) {
+             // the info dict must be indirect (PDF Ref p. 61)
+             pdf_printf("/%s.InfoDict ", pdfkeyprefix);
+@@ -942,14 +925,14 @@ void write_epdf(void)
+     pdf_puts(stripzeros(s));
+ 
+     // Metadata validity check (as a stream it must be indirect)
+-    pageDict->lookupNF("Metadata", &dictObj);
+-    if (!dictObj->isNull() && !dictObj->isRef())
++    dictObj = pageDict->lookupNF("Metadata").copy();
++    if (!dictObj.isNull() && !dictObj.isRef())
+         pdftex_warn("PDF inclusion: /Metadata must be indirect object");
+ 
+     // copy selected items in Page dictionary except Resources & Group
+     for (i = 0; pageDictKeys[i] != NULL; i++) {
+-        pageDict->lookupNF(pageDictKeys[i], &dictObj);
+-        if (!dictObj->isNull()) {
++        dictObj = pageDict->lookupNF(pageDictKeys[i]).copy();
++        if (!dictObj.isNull()) {
+             pdf_newline();
+             pdf_printf("/%s ", pageDictKeys[i]);
+             copyObject(&dictObj); // preserves indirection
+@@ -957,8 +940,8 @@ void write_epdf(void)
+     } 
+ 
+     // handle page group
+-    pageDict->lookupNF("Group", &dictObj);
+-    if (!dictObj->isNull()) {
++    dictObj = pageDict->lookupNF("Group").copy();
++    if (!dictObj.isNull()) {
+         if (pdfpagegroupval == 0) { 
+             // another pdf with page group was included earlier on the
+             // same page; copy the Group entry as is.  See manual for
+@@ -972,11 +955,36 @@ void write_epdf(void)
+             copyObject(&dictObj);
+         } else {
+             // write Group dict as a separate object, since the Page dict also refers to it
+-            pageDict->lookup("Group", &dictObj);
+-            if (!dictObj->isDict())
++            dictObj = pageDict->lookup("Group");
++            if (!dictObj.isDict())
+                 pdftex_fail("PDF inclusion: /Group dict missing");
+             writeSepGroup = true;
+-            initDictFromDict(groupDict, page->getGroup());
++/*
++This part is only a single line
++            groupDict = Object(page->getGroup());
++in the original patch. In this case, however, pdftex crashes at
++"delete pdf_doc->doc" in "delete_document()" for inclusion of some
++kind of pdf images, for example, figure_missing.pdf in gnuplot.
++A change
++            groupDict = Object(page->getGroup()).copy();
++does not improve the situation.
++The changes below seem to work fine. 
++*/
++// begin modification
++            groupDict = pageDict->lookup("Group");
++            const Dict& dic1 = page->getGroup();
++            const Dict& dic2 = groupDict.getDict();
++            // replace dic2 in groupDict with dic1
++            l = dic2.getLength();
++            for (i = 0; i < l; i++) {
++                groupDict.dictRemove(dic2.getKey(i));
++            }
++            l = dic1.getLength();
++            for (i = 0; i < l; i++) {
++                groupDict.dictAdd((const char *)copyString(dic1.getKey(i)),
++                                  dic1.getValNF(i).copy());
++            }
++// end modification
+             pdf_printf("/Group %ld 0 R\n", (long)pdfpagegroupval);
+         }
+     }
+@@ -989,28 +997,28 @@ void write_epdf(void)
+         pdftex_warn
+             ("PDF inclusion: /Resources missing. 'This practice is not recommended' (PDF Ref)");
+     } else {
+-        initDictFromDict(obj1, page->getResourceDict());
++        Object *obj1 = page->getResourceDictObject();
+         if (!obj1->isDict())
+             pdftex_fail("PDF inclusion: invalid resources dict type <%s>",
+                         obj1->getTypeName());
+         pdf_newline();
+         pdf_puts("/Resources <<\n");
+         for (i = 0, l = obj1->dictGetLength(); i < l; ++i) {
+-            obj1->dictGetVal(i, &obj2);
+-            key = obj1->dictGetKey(i);
++            obj2 = obj1->dictGetVal(i);
++            key = (char *)obj1->dictGetKey(i);
+             if (strcmp("Font", key) == 0)
+                 copyFontResources(&obj2);
+             else if (strcmp("ProcSet", key) == 0)
+                 copyProcSet(&obj2);
+             else
+-                copyOtherResources(&obj2, key);
++                copyOtherResources(&obj2, (char *)key);
+         }
+         pdf_puts(">>\n");
+     }
+ 
+     // write the page contents
+-    page->getContents(&contents);
+-    if (contents->isStream()) {
++    contents = page->getContents();
++    if (contents.isStream()) {
+ 
+         // Variant A: get stream and recompress under control
+         // of \pdfcompresslevel
+@@ -1021,36 +1029,35 @@ void write_epdf(void)
+ 
+         // Variant B: copy stream without recompressing
+         //
+-        contents->streamGetDict()->lookup("F", &obj1);
+-        if (!obj1->isNull()) {
++        obj1 = contents.streamGetDict()->lookup("F");
++        if (!obj1.isNull()) {
+             pdftex_fail("PDF inclusion: Unsupported external stream");
+         }
+-        contents->streamGetDict()->lookup("Length", &obj1);
+-        assert(!obj1->isNull());
++        obj1 = contents.streamGetDict()->lookup("Length");
++        assert(!obj1.isNull());
+         pdf_puts("/Length ");
+         copyObject(&obj1);
+         pdf_puts("\n");
+-        contents->streamGetDict()->lookup("Filter", &obj1);
+-        if (!obj1->isNull()) {
++        obj1 = contents.streamGetDict()->lookup("Filter");
++        if (!obj1.isNull()) {
+             pdf_puts("/Filter ");
+             copyObject(&obj1);
+             pdf_puts("\n");
+-            contents->streamGetDict()->lookup("DecodeParms", &obj1);
+-            if (!obj1->isNull()) {
++            obj1 = contents.streamGetDict()->lookup("DecodeParms");
++            if (!obj1.isNull()) {
+                 pdf_puts("/DecodeParms ");
+                 copyObject(&obj1);
+                 pdf_puts("\n");
+             }
+         }
+         pdf_puts(">>\nstream\n");
+-        copyStream(contents->getStream()->getUndecodedStream());
++        copyStream(contents.getStream()->getUndecodedStream());
+         pdfendstream();
+-    } else if (contents->isArray()) {
++    } else if (contents.isArray()) {
+         pdfbeginstream();
+-        for (i = 0, l = contents->arrayGetLength(); i < l; ++i) {
+-            Object contentsobj;
+-            copyStream((contents->arrayGet(i, &contentsobj))->getStream());
+-            contentsobj.free();
++        for (i = 0, l = contents.arrayGetLength(); i < l; ++i) {
++            Object contentsobj = contents.arrayGet(i);
++            copyStream(contentsobj.getStream());
+             if (i < l - 1)
+                 pdf_newline();  // add a newline after each stream except the last
+         }
+@@ -1105,6 +1112,5 @@ void epdf_check_mem()
+             delete_document(p);
+         }
+         // see above for globalParams
+-        delete globalParams;
+     }
+ }
+diff --git a/pdftosrc.cc b/pdftosrc.cc
+index 67be229..b6700fd 100644
+--- a/texk/web2c/pdftexdir/pdftosrc.cc
++++ b/texk/web2c/pdftexdir/pdftosrc.cc
+@@ -16,6 +16,14 @@ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License along
+ with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
++
++/*
++This is based on the patch texlive-poppler-0.59.patch <2017-09-19> at
++https://git.archlinux.org/svntogit/packages.git/plain/texlive-bin/trunk
++by Arch Linux. The poppler should be 0.72.0 or newer versions.
++POPPLER_VERSION should be defined.
++*/
++
+ #include <w2c/config.h>
+ 
+ #include <stdlib.h>
+@@ -32,16 +40,12 @@ with this program.  If not, see <http://www.gnu.org/licenses/>.
+ #include <goo/gmem.h>
+ #include <goo/gfile.h>
+ #else
+-#include <aconf.h>
+-#include <GString.h>
+-#include <gmem.h>
+-#include <gfile.h>
++#error POPPLER_VERSION should be defined.
+ #endif
+ #include <assert.h>
+ 
+ #include "Object.h"
+ #include "Stream.h"
+-#include "Lexer.h"
+ #include "Parser.h"
+ #include "Array.h"
+ #include "Dict.h"
+@@ -74,7 +78,11 @@ int main(int argc, char *argv[])
+         exit(1);
+     }
+     fileName = new GString(argv[1]);
+-    globalParams = new GlobalParams();
++#if POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 83
++    globalParams.reset(new GlobalParams());
++#else
++    globalParams = std::make_unique<GlobalParams>();
++#endif
+     doc = new PDFDoc(fileName);
+     if (!doc->isOk()) {
+         fprintf(stderr, "Invalid PDF file\n");
+@@ -86,36 +94,34 @@ int main(int argc, char *argv[])
+             objgen = atoi(argv[3]);
+     }
+     xref = doc->getXRef();
+-    catalogDict.initNull();
+-    xref->getCatalog(&catalogDict);
++    catalogDict = xref->getCatalog();
+     if (!catalogDict.isDict("Catalog")) {
+         fprintf(stderr, "No Catalog found\n");
+         exit(1);
+     }
+-    srcStream.initNull();
++    srcStream = Object(objNull);
+     if (objnum == 0) {
+-        catalogDict.dictLookup("SourceObject", &srcStream);
+-        static char const_SourceFile[] = "SourceFile";
+-        if (!srcStream.isStream(const_SourceFile)) {
++        srcStream = catalogDict.dictLookup("SourceObject");
++        static const char *const_SourceFile = "SourceFile";
++        if (!srcStream.isDict(const_SourceFile)) {
+             fprintf(stderr, "No SourceObject found\n");
+             exit(1);
+         }
+-        srcName.initNull();
+-        srcStream.getStream()->getDict()->lookup("SourceName", &srcName);
++        srcName = srcStream.getStream()->getDict()->lookup("SourceName");
+         if (!srcName.isString()) {
+             fprintf(stderr, "No SourceName found\n");
+             exit(1);
+         }
+-        outname = srcName.getString()->getCString();
++        outname = (char *)srcName.getString()->c_str();
+         // We cannot free srcName, as objname shares its string.
+         // srcName.free();
+     } else if (objnum > 0) {
+-        xref->fetch(objnum, objgen, &srcStream);
++        srcStream = xref->fetch(objnum, objgen);
+         if (!srcStream.isStream()) {
+             fprintf(stderr, "Not a Stream object\n");
+             exit(1);
+         }
+-        sprintf(buf, "%s", fileName->getCString());
++        sprintf(buf, "%s", fileName->c_str());
+         if ((p = strrchr(buf, '.')) == 0)
+             p = strchr(buf, 0);
+         if (objgen == 0)
+@@ -125,7 +131,7 @@ int main(int argc, char *argv[])
+         outname = buf;
+     } else {                    // objnum < 0 means we are extracting the XRef table
+         extract_xref_table = true;
+-        sprintf(buf, "%s", fileName->getCString());
++        sprintf(buf, "%s", fileName->c_str());
+         if ((p = strrchr(buf, '.')) == 0)
+             p = strchr(buf, 0);
+         sprintf(p, ".xref");
+@@ -153,41 +159,32 @@ int main(int argc, char *argv[])
+                         (e->type == xrefEntryFree ? "f" : "n"));
+             else {              // e->offset is the object number of the object stream
+                 Stream *str;
+-                Lexer *lexer;
+                 Parser *parser;
+                 Object objStr, obj1, obj2;
+                 int nObjects, first, n;
+                 int localOffset = 0;
+-                Guint firstOffset;
++                unsigned int firstOffset;
+ 
+-                assert(xref->fetch(e->offset, 0, &objStr)->isStream());
+-                nObjects = objStr.streamGetDict()->lookup("N", &obj1)->getInt();
+-                obj1.free();
+-                first = objStr.streamGetDict()->lookup("First", &obj1)->getInt();
+-                obj1.free();
++                objStr = xref->fetch(e->offset, 0);
++                assert(objStr.isStream());
++                obj1 = objStr.streamGetDict()->lookup("N");
++                nObjects = obj1.getInt();
++                obj1 = objStr.streamGetDict()->lookup("First");
++                first = obj1.getInt();
+                 firstOffset = objStr.getStream()->getBaseStream()->getStart() + first;
+ 
+                 // parse the header: object numbers and offsets
+                 objStr.streamReset();
+-                obj1.initNull();
+-                str = new EmbedStream(objStr.getStream(), &obj1, gTrue, first);
+-                lexer = new Lexer(xref, str);
+-                parser = new Parser(xref, lexer, gFalse);
++                str = new EmbedStream(objStr.getStream(), Object(objNull), true, first);
++                parser = new Parser(xref, str, false);
+                 for (n = 0; n < nObjects; ++n) {
+-                    parser->getObj(&obj1);
+-                    parser->getObj(&obj2);
++                    obj1 = parser->getObj();
++                    obj2 = parser->getObj();
+                     if (n == e->gen)
+                         localOffset = obj2.getInt();
+-                    obj1.free();
+-                    obj2.free();
+                 }
+-#if defined(POPPLER_VERSION) || defined(XPDF304)
+                 while (str->getChar() != EOF) ;
+-#else /* xpdf 4.00 */
+-                lexer->skipToEOF();
+-#endif
+                 delete parser;
+-                objStr.free();
+ 
+                 fprintf(outfile, "%.10lu 00000 n\n",
+                         (long unsigned)(firstOffset + localOffset));
+@@ -198,7 +195,6 @@ int main(int argc, char *argv[])
+         s->reset();
+         while ((c = s->getChar()) != EOF)
+             fputc(c, outfile);
+-        srcStream.free();
+     }
+     if (objnum == 0)
+         fprintf(stderr, "Source file extracted to %s\n", outname);
+@@ -207,7 +203,5 @@ int main(int argc, char *argv[])
+     else
+         fprintf(stderr, "Cross-reference table extracted to %s\n", outname);
+     fclose(outfile);
+-    catalogDict.free();
+     delete doc;
+-    delete globalParams;
+ }
+diff --git a/utils.c b/utils.c
+index c93a878..6f866e7 100644
+--- a/texk/web2c/pdftexdir/utils.c
++++ b/texk/web2c/pdftexdir/utils.c
+@@ -33,7 +33,6 @@ with this program.  If not, see <http://www.gnu.org/licenses/>.
+ #include "ptexlib.h"
+ #include <png.h>
+ #ifdef POPPLER_VERSION
+-#include <poppler-config.h>
+ #define xpdfVersion POPPLER_VERSION
+ #define xpdfString "poppler"
+ #else
+-- 
+2.24.1
+


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/tex:master commit in: 2019/patches/
@ 2020-03-08 10:11 Mikle Kolyada
  0 siblings, 0 replies; 11+ messages in thread
From: Mikle Kolyada @ 2020-03-08 10:11 UTC (permalink / raw
  To: gentoo-commits

commit:     64fd416a0b3452d063025f7f65063eef17d8120c
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Sun Mar  8 10:10:18 2020 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Sun Mar  8 10:10:18 2020 +0000
URL:        https://gitweb.gentoo.org/proj/tex.git/commit/?id=64fd416a

fix poppler-0.86 compat with XeTeX

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 2019/patches/texlive-core-2019-poppler086.patch | 40 +++++++++++++++++--------
 1 file changed, 28 insertions(+), 12 deletions(-)

diff --git a/2019/patches/texlive-core-2019-poppler086.patch b/2019/patches/texlive-core-2019-poppler086.patch
index 4ab4f95..8109222 100644
--- a/2019/patches/texlive-core-2019-poppler086.patch
+++ b/2019/patches/texlive-core-2019-poppler086.patch
@@ -1,17 +1,18 @@
-From 1203f6d9d51d6bedf11e36509f3a56638b1c816e Mon Sep 17 00:00:00 2001
+From 15e3bef2a1ec72007706705a31d9bd4c8eae53b1 Mon Sep 17 00:00:00 2001
 From: Mikle Kolyada <zlogene@gentoo.org>
-Date: Fri, 6 Mar 2020 13:31:24 +0000
+Date: Sun, 8 Mar 2020 10:05:15 +0000
 Subject: [PATCH] poppler-0.86 compat
 
 Signed-off-by: Mikle Kolyada <zlogene@gentoo.org>
 ---
- pdftoepdf.cc | 308 ++++++++++++++++++++++++++-------------------------
- pdftosrc.cc  |  76 ++++++-------
- utils.c      |   1 -
- 3 files changed, 192 insertions(+), 193 deletions(-)
+ texk/web2c/pdftexdir/pdftoepdf.cc | 308 +++++++++++++++---------------
+ texk/web2c/pdftexdir/pdftosrc.cc  |  76 ++++----
+ texk/web2c/pdftexdir/utils.c      |   1 -
+ texk/web2c/xetexdir/XeTeX_ext.c   |   3 +
+ 4 files changed, 195 insertions(+), 193 deletions(-)
 
-diff --git a/pdftoepdf.cc b/pdftoepdf.cc
-index 4db0c90..d13293e 100644
+diff --git a/texk/web2c/pdftexdir/pdftoepdf.cc b/texk/web2c/pdftexdir/pdftoepdf.cc
+index 4db0c90a..d13293e9 100644
 --- a/texk/web2c/pdftexdir/pdftoepdf.cc
 +++ b/texk/web2c/pdftexdir/pdftoepdf.cc
 @@ -1,5 +1,5 @@
@@ -629,8 +630,8 @@ index 4db0c90..d13293e 100644
 -        delete globalParams;
      }
  }
-diff --git a/pdftosrc.cc b/pdftosrc.cc
-index 67be229..b6700fd 100644
+diff --git a/texk/web2c/pdftexdir/pdftosrc.cc b/texk/web2c/pdftexdir/pdftosrc.cc
+index 67be229e..b6700fd6 100644
 --- a/texk/web2c/pdftexdir/pdftosrc.cc
 +++ b/texk/web2c/pdftexdir/pdftosrc.cc
 @@ -16,6 +16,14 @@ GNU General Public License for more details.
@@ -803,8 +804,8 @@ index 67be229..b6700fd 100644
      delete doc;
 -    delete globalParams;
  }
-diff --git a/utils.c b/utils.c
-index c93a878..6f866e7 100644
+diff --git a/texk/web2c/pdftexdir/utils.c b/texk/web2c/pdftexdir/utils.c
+index c93a8781..6f866e76 100644
 --- a/texk/web2c/pdftexdir/utils.c
 +++ b/texk/web2c/pdftexdir/utils.c
 @@ -33,7 +33,6 @@ with this program.  If not, see <http://www.gnu.org/licenses/>.
@@ -815,6 +816,21 @@ index c93a878..6f866e7 100644
  #define xpdfVersion POPPLER_VERSION
  #define xpdfString "poppler"
  #else
+diff --git a/texk/web2c/xetexdir/XeTeX_ext.c b/texk/web2c/xetexdir/XeTeX_ext.c
+index 4968ee41..0aee4ee3 100644
+--- a/texk/web2c/xetexdir/XeTeX_ext.c
++++ b/texk/web2c/xetexdir/XeTeX_ext.c
+@@ -38,7 +38,10 @@ authorization from the copyright holders.
+ 
+ #include <w2c/config.h>
+ 
++#ifndef POPPLER_VERSION
+ #include <poppler-config.h>
++#endif
++
+ #include <png.h>
+ #include <zlib.h>
+ #include <graphite2/Font.h>
 -- 
 2.24.1
 


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-commits] proj/tex:master commit in: 2019/patches/
@ 2020-04-06  9:09 Mikle Kolyada
  0 siblings, 0 replies; 11+ messages in thread
From: Mikle Kolyada @ 2020-04-06  9:09 UTC (permalink / raw
  To: gentoo-commits

commit:     0738009b101c89c313bbdd4cdd40484955b1f7db
Author:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
AuthorDate: Mon Apr  6 07:41:04 2020 +0000
Commit:     Mikle Kolyada <zlogene <AT> gentoo <DOT> org>
CommitDate: Mon Apr  6 07:41:04 2020 +0000
URL:        https://gitweb.gentoo.org/proj/tex.git/commit/?id=0738009b

Add poppler-0.87 compat patch

Signed-off-by: Mikle Kolyada <zlogene <AT> gentoo.org>

 2019/patches/texlive-core-2019-poppler087.patch | 836 ++++++++++++++++++++++++
 1 file changed, 836 insertions(+)

diff --git a/2019/patches/texlive-core-2019-poppler087.patch b/2019/patches/texlive-core-2019-poppler087.patch
new file mode 100644
index 0000000..8109222
--- /dev/null
+++ b/2019/patches/texlive-core-2019-poppler087.patch
@@ -0,0 +1,836 @@
+From 15e3bef2a1ec72007706705a31d9bd4c8eae53b1 Mon Sep 17 00:00:00 2001
+From: Mikle Kolyada <zlogene@gentoo.org>
+Date: Sun, 8 Mar 2020 10:05:15 +0000
+Subject: [PATCH] poppler-0.86 compat
+
+Signed-off-by: Mikle Kolyada <zlogene@gentoo.org>
+---
+ texk/web2c/pdftexdir/pdftoepdf.cc | 308 +++++++++++++++---------------
+ texk/web2c/pdftexdir/pdftosrc.cc  |  76 ++++----
+ texk/web2c/pdftexdir/utils.c      |   1 -
+ texk/web2c/xetexdir/XeTeX_ext.c   |   3 +
+ 4 files changed, 195 insertions(+), 193 deletions(-)
+
+diff --git a/texk/web2c/pdftexdir/pdftoepdf.cc b/texk/web2c/pdftexdir/pdftoepdf.cc
+index 4db0c90a..d13293e9 100644
+--- a/texk/web2c/pdftexdir/pdftoepdf.cc
++++ b/texk/web2c/pdftexdir/pdftoepdf.cc
+@@ -1,5 +1,5 @@
+ /*
+-Copyright 1996-2016 Han The Thanh, <thanh@pdftex.org>
++Copyright 1996-2017 Han The Thanh, <thanh@pdftex.org>
+ 
+ This file is part of pdfTeX.
+ 
+@@ -17,6 +17,15 @@ You should have received a copy of the GNU General Public License along
+ with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+ 
++/*
++This is based on the patch texlive-poppler-0.59.patch <2017-09-19> at
++https://git.archlinux.org/svntogit/packages.git/plain/texlive-bin/trunk
++by Arch Linux. A little modifications are made to avoid a crash for
++some kind of pdf images, such as figure_missing.pdf in gnuplot.
++The poppler should be 0.75.0 or newer versions.
++POPPLER_VERSION should be defined.
++*/
++
+ /* Do this early in order to avoid a conflict between
+    MINGW32 <rpcndr.h> defining 'boolean' as 'unsigned char' and
+    <kpathsea/types.h> defining Pascal's boolean as 'int'.
+@@ -39,10 +48,7 @@ with this program.  If not, see <http://www.gnu.org/licenses/>.
+ #include <goo/gfile.h>
+ #define GString GooString
+ #else
+-#include <aconf.h>
+-#include <GString.h>
+-#include <gmem.h>
+-#include <gfile.h>
++#error POPPLER_VERSION should be defined.
+ #endif
+ #include <assert.h>
+ 
+@@ -84,31 +90,6 @@ extern integer zround(double);
+ #define MASK_SUPPRESS_PTEX_PAGENUMBER 0x04
+ #define MASK_SUPPRESS_PTEX_INFODICT   0x08
+ 
+-// PdfObject encapsulates the xpdf Object type,
+-// and properly frees its resources on destruction.
+-// Use obj-> to access members of the Object,
+-// and &obj to get a pointer to the object.
+-// It is no longer necessary to call Object::free explicitely.
+-
+-class PdfObject {
+-  public:
+-    PdfObject() {               // nothing
+-    } ~PdfObject() {
+-        iObject.free();
+-    }
+-    Object *operator->() {
+-        return &iObject;
+-    }
+-    Object *operator&() {
+-        return &iObject;
+-    }
+-  private:                     // no copying or assigning
+-    PdfObject(const PdfObject &);
+-    void operator=(const PdfObject &);
+-  public:
+-    Object iObject;
+-};
+-
+ // When copying the Resources of the selected page, all objects are copied
+ // recusively top-down. Indirect objects however are not fetched during
+ // copying, but get a new object number from pdfTeX and then will be
+@@ -139,7 +120,7 @@ struct UsedEncoding {
+ 
+ static InObj *inObjList;
+ static UsedEncoding *encodingList;
+-static GBool isInit = gFalse;
++static bool isInit = false;
+ 
+ // --------------------------------------------------------------------
+ // Maintain list of open embedded PDF files
+@@ -212,18 +193,6 @@ static void delete_document(PdfDocument * pdf_doc)
+     delete pdf_doc;
+ }
+ 
+-// Replacement for
+-//      Object *initDict(Dict *dict1){ initObj(objDict); dict = dict1; return this; }
+-
+-static void initDictFromDict(PdfObject & obj, Dict * dict)
+-{
+-    obj->initDict(xref);
+-    for (int i = 0, l = dict->getLength(); i < l; i++) {
+-        Object obj1;
+-        obj->dictAdd(copyString(dict->getKey(i)), dict->getValNF(i, &obj1));
+-    }
+-}
+-
+ // --------------------------------------------------------------------
+ 
+ static int addEncoding(GfxFont * gfont)
+@@ -320,10 +289,10 @@ static void copyName(char *s)
+ 
+ static void copyDictEntry(Object * obj, int i)
+ {
+-    PdfObject obj1;
+-    copyName(obj->dictGetKey(i));
++    Object obj1;
++    copyName((char *)obj->dictGetKey(i));
+     pdf_puts(" ");
+-    obj->dictGetValNF(i, &obj1);
++    obj1 = obj->dictGetValNF(i).copy();
+     copyObject(&obj1);
+     pdf_puts("\n");
+ }
+@@ -348,7 +317,7 @@ static void copyFontDict(Object * obj, InObj * r)
+     pdf_puts("<<\n");
+     assert(r->type == objFont); // FontDescriptor is in fd_tree
+     for (i = 0, l = obj->dictGetLength(); i < l; ++i) {
+-        key = obj->dictGetKey(i);
++        key = (char *)obj->dictGetKey(i);
+         if (strncmp("FontDescriptor", key, strlen("FontDescriptor")) == 0
+             || strncmp("BaseFont", key, strlen("BaseFont")) == 0
+             || strncmp("Encoding", key, strlen("Encoding")) == 0)
+@@ -376,17 +345,17 @@ static void copyStream(Stream * str)
+ static void copyProcSet(Object * obj)
+ {
+     int i, l;
+-    PdfObject procset;
++    Object procset;
+     if (!obj->isArray())
+         pdftex_fail("PDF inclusion: invalid ProcSet array type <%s>",
+                     obj->getTypeName());
+     pdf_puts("/ProcSet [ ");
+     for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
+-        obj->arrayGetNF(i, &procset);
+-        if (!procset->isName())
++        procset = obj->arrayGetNF(i).copy();
++        if (!procset.isName())
+             pdftex_fail("PDF inclusion: invalid ProcSet entry type <%s>",
+-                        procset->getTypeName());
+-        copyName(procset->getName());
++                        procset.getTypeName());
++        copyName((char *)procset.getName());
+         pdf_puts(" ");
+     }
+     pdf_puts("]\n");
+@@ -394,10 +363,29 @@ static void copyProcSet(Object * obj)
+ 
+ #define REPLACE_TYPE1C true
+ 
++static bool embeddableFont(Object * fontdesc)
++{
++    Object fontfile, ffsubtype;
++
++    if (!fontdesc->isDict())
++        return false;
++    fontfile = fontdesc->dictLookup("FontFile");
++    if (fontfile.isStream())
++        return true;
++    if (REPLACE_TYPE1C) {
++        fontfile = fontdesc->dictLookup("FontFile3");
++        if (!fontfile.isStream())
++            return false;
++        ffsubtype = fontfile.streamGetDict()->lookup("Subtype");
++        return ffsubtype.isName() && !strcmp(ffsubtype.getName(), "Type1C");
++    }
++    return false;
++}
++
+ static void copyFont(char *tag, Object * fontRef)
+ {
+-    PdfObject fontdict, subtype, basefont, fontdescRef, fontdesc, charset,
+-        fontfile, ffsubtype, stemV;
++    Object fontdict, subtype, basefont, fontdescRef, fontdesc, charset,
++        stemV;
+     GfxFont *gfont;
+     fd_entry *fd;
+     fm_entry *fontmap;
+@@ -413,33 +401,39 @@ static void copyFont(char *tag, Object * fontRef)
+     }
+     // Only handle included Type1 (and Type1C) fonts; anything else will be copied.
+     // Type1C fonts are replaced by Type1 fonts, if REPLACE_TYPE1C is true.
+-    if (!fixedinclusioncopyfont && fontRef->fetch(xref, &fontdict)->isDict()
+-        && fontdict->dictLookup("Subtype", &subtype)->isName()
+-        && !strcmp(subtype->getName(), "Type1")
+-        && fontdict->dictLookup("BaseFont", &basefont)->isName()
+-        && fontdict->dictLookupNF("FontDescriptor", &fontdescRef)->isRef()
+-        && fontdescRef->fetch(xref, &fontdesc)->isDict()
+-        && (fontdesc->dictLookup("FontFile", &fontfile)->isStream()
+-            || (REPLACE_TYPE1C
+-                && fontdesc->dictLookup("FontFile3", &fontfile)->isStream()
+-                && fontfile->streamGetDict()->lookup("Subtype",
+-                                                     &ffsubtype)->isName()
+-                && !strcmp(ffsubtype->getName(), "Type1C")))
+-        && (fontmap = lookup_fontmap(basefont->getName())) != NULL) {
++    fontdict = fontRef->fetch(xref);
++    fontdesc = Object(objNull);
++    if (fontdict.isDict()) {
++        subtype = fontdict.dictLookup("Subtype");
++        basefont = fontdict.dictLookup("BaseFont");
++        fontdescRef = fontdict.dictLookupNF("FontDescriptor").copy();
++        if (fontdescRef.isRef()) {
++            fontdesc = fontdescRef.fetch(xref);
++        }
++    }
++    if (!fixedinclusioncopyfont && fontdict.isDict()
++        && subtype.isName()
++        && !strcmp(subtype.getName(), "Type1")
++        && basefont.isName()
++        && fontdescRef.isRef()
++        && fontdesc.isDict()
++        && embeddableFont(&fontdesc)
++        && (fontmap = lookup_fontmap((char *)basefont.getName())) != NULL) {
+         // round /StemV value, since the PDF input is a float
+         // (see Font Descriptors in PDF reference), but we only store an
+         // integer, since we don't want to change the struct.
+-        fontdesc->dictLookup("StemV", &stemV);
+-        fd = epdf_create_fontdescriptor(fontmap, zround(stemV->getNum()));
+-        if (fontdesc->dictLookup("CharSet", &charset) &&
+-            charset->isString() && is_subsetable(fontmap))
+-            epdf_mark_glyphs(fd, charset->getString()->getCString());
++        stemV = fontdesc.dictLookup("StemV");
++        fd = epdf_create_fontdescriptor(fontmap, zround(stemV.getNum()));
++        charset = fontdesc.dictLookup("CharSet");
++        if (!charset.isNull() &&
++            charset.isString() && is_subsetable(fontmap))
++            epdf_mark_glyphs(fd, (char *)charset.getString()->c_str());
+         else
+             embed_whole_font(fd);
+-        addFontDesc(fontdescRef->getRef(), fd);
++        addFontDesc(fontdescRef.getRef(), fd);
+         copyName(tag);
+         gfont = GfxFont::makeFont(xref, tag, fontRef->getRef(),
+-                                  fontdict->getDict());
++                                  fontdict.getDict());
+         pdf_printf(" %d 0 R ", addFont(fontRef->getRef(), fd,
+                                        addEncoding(gfont)));
+     } else {
+@@ -451,24 +445,24 @@ static void copyFont(char *tag, Object * fontRef)
+ 
+ static void copyFontResources(Object * obj)
+ {
+-    PdfObject fontRef;
++    Object fontRef;
+     int i, l;
+     if (!obj->isDict())
+         pdftex_fail("PDF inclusion: invalid font resources dict type <%s>",
+                     obj->getTypeName());
+     pdf_puts("/Font << ");
+     for (i = 0, l = obj->dictGetLength(); i < l; ++i) {
+-        obj->dictGetValNF(i, &fontRef);
+-        if (fontRef->isRef())
+-            copyFont(obj->dictGetKey(i), &fontRef);
+-        else if (fontRef->isDict()) {   // some programs generate pdf with embedded font object
+-            copyName(obj->dictGetKey(i));
++        fontRef = obj->dictGetValNF(i).copy();
++        if (fontRef.isRef())
++            copyFont((char *)obj->dictGetKey(i), &fontRef);
++        else if (fontRef.isDict()) {   // some programs generate pdf with embedded font object
++            copyName((char *)obj->dictGetKey(i));
+             pdf_puts(" ");
+             copyObject(&fontRef);
+         }
+         else
+             pdftex_fail("PDF inclusion: invalid font in reference type <%s>",
+-                        fontRef->getTypeName());
++                        fontRef.getTypeName());
+     }
+     pdf_puts(">>\n");
+ }
+@@ -557,7 +551,7 @@ static char *convertNumToPDF(double n)
+ 
+ static void copyObject(Object * obj)
+ {
+-    PdfObject obj1;
++    Object obj1;
+     int i, l, c;
+     Ref ref;
+     char *p;
+@@ -571,8 +565,8 @@ static void copyObject(Object * obj)
+     } else if (obj->isNum()) {
+         pdf_printf("%s", convertNumToPDF(obj->getNum()));
+     } else if (obj->isString()) {
+-        s = obj->getString();
+-        p = s->getCString();
++        s = (GooString *)obj->getString();
++        p = (char *)s->c_str();
+         l = s->getLength();
+         if (strlen(p) == (unsigned int) l) {
+             pdf_puts("(");
+@@ -595,14 +589,14 @@ static void copyObject(Object * obj)
+             pdf_puts(">");
+         }
+     } else if (obj->isName()) {
+-        copyName(obj->getName());
++        copyName((char *)obj->getName());
+     } else if (obj->isNull()) {
+         pdf_puts("null");
+     } else if (obj->isArray()) {
+         pdf_puts("[");
+         for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
+-            obj->arrayGetNF(i, &obj1);
+-            if (!obj1->isName())
++            obj1 = obj->arrayGetNF(i).copy();
++            if (!obj1.isName())
+                 pdf_puts(" ");
+             copyObject(&obj1);
+         }
+@@ -612,9 +606,8 @@ static void copyObject(Object * obj)
+         copyDict(obj);
+         pdf_puts(">>");
+     } else if (obj->isStream()) {
+-        initDictFromDict(obj1, obj->streamGetDict());
+         pdf_puts("<<\n");
+-        copyDict(&obj1);
++        copyDict(obj->getStream()->getDictObject());
+         pdf_puts(">>\n");
+         pdf_puts("stream\n");
+         copyStream(obj->getStream()->getUndecodedStream());
+@@ -638,9 +631,8 @@ static void writeRefs()
+     InObj *r;
+     for (r = inObjList; r != 0; r = r->next) {
+         if (!r->written) {
+-            Object obj1;
+             r->written = 1;
+-            xref->fetch(r->ref.num, r->ref.gen, &obj1);
++            Object obj1 = xref->fetch(r->ref.num, r->ref.gen);
+             if (r->type == objFont) {
+                 assert(!obj1.isStream());
+                 pdfbeginobj(r->num, 2);         // \pdfobjcompresslevel = 2 is for this
+@@ -656,7 +648,6 @@ static void writeRefs()
+                 pdf_puts("\n");
+                 pdfendobj();
+             }
+-            obj1.free();
+         }
+     }
+ }
+@@ -673,7 +664,7 @@ static void writeEncodings()
+                     ("PDF inclusion: CID fonts are not supported"
+                      " (try to disable font replacement to fix this)");
+             }
+-            if ((s = ((Gfx8BitFont *) r->font)->getCharName(i)) != 0)
++            if ((s = (char *)((Gfx8BitFont *) r->font)->getCharName(i)) != 0)
+                 glyphNames[i] = s;
+             else
+                 glyphNames[i] = notdef;
+@@ -685,14 +676,14 @@ static void writeEncodings()
+ #ifdef POPPLER_VERSION
+         r->font->decRefCnt();
+ #else
+-        delete r->font;
++#error POPPLER_VERSION should be defined.
+ #endif
+         delete r;
+     }
+ }
+ 
+ // get the pagebox according to the pagebox_spec
+-static PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
++static const PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
+ {
+     if (pagebox_spec == pdfboxspecmedia)
+         return page->getMediaBox();
+@@ -724,17 +715,21 @@ read_pdf_info(char *image_name, char *page_name, int page_num,
+ {
+     PdfDocument *pdf_doc;
+     Page *page;
+-    PDFRectangle *pagebox;
++    const PDFRectangle *pagebox;
+ #ifdef POPPLER_VERSION
+     int pdf_major_version_found, pdf_minor_version_found;
+ #else
+-    float pdf_version_found, pdf_version_wanted;
++#error POPPLER_VERSION should be defined.
+ #endif
+     // initialize
+     if (!isInit) {
+-        globalParams = new GlobalParams();
+-        globalParams->setErrQuiet(gFalse);
+-        isInit = gTrue;
++#if POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 83
++	globalParams.reset(new GlobalParams());
++#else
++        globalParams = std::make_unique<GlobalParams>();
++#endif
++        globalParams->setErrQuiet(false);
++        isInit = true;
+     }
+     // open PDF file
+     pdf_doc = find_add_document(image_name);
+@@ -760,29 +755,17 @@ read_pdf_info(char *image_name, char *page_name, int page_num,
+         }
+     }
+ #else
+-    pdf_version_found = pdf_doc->doc->getPDFVersion();
+-    pdf_version_wanted = 1 + (minor_pdf_version_wanted * 0.1);
+-    if (pdf_version_found > pdf_version_wanted + 0.01) {
+-        char msg[] =
+-            "PDF inclusion: found PDF version <%.1f>, but at most version <%.1f> allowed";
+-        if (pdf_inclusion_errorlevel > 0) {
+-            pdftex_fail(msg, pdf_version_found, pdf_version_wanted);
+-        } else if (pdf_inclusion_errorlevel < 0) {
+-            ; /* do nothing */
+-        } else { /* = 0, give warning */
+-            pdftex_warn(msg, pdf_version_found, pdf_version_wanted);
+-        }
+-    }
++#error POPPLER_VERSION should be defined.
+ #endif
+     epdf_num_pages = pdf_doc->doc->getCatalog()->getNumPages();
+     if (page_name) {
+         // get page by name
+         GString name(page_name);
+-        LinkDest *link = pdf_doc->doc->findDest(&name);
++        LinkDest *link = pdf_doc->doc->findDest(&name).get();
+         if (link == 0 || !link->isOk())
+             pdftex_fail("PDF inclusion: invalid destination <%s>", page_name);
+         Ref ref = link->getPageRef();
+-        page_num = pdf_doc->doc->getCatalog()->findPage(ref.num, ref.gen);
++        page_num = pdf_doc->doc->getCatalog()->findPage(ref);
+         if (page_num == 0)
+             pdftex_fail("PDF inclusion: destination is not a page <%s>",
+                         page_name);
+@@ -839,8 +822,8 @@ void write_epdf(void)
+     Page *page;
+     Ref *pageRef;
+     Dict *pageDict;
+-    PdfObject contents, obj1, obj2, pageObj, dictObj;
+-    PdfObject groupDict;
++    Object contents, obj1, obj2, pageObj, dictObj;
++    Object groupDict;
+     bool writeSepGroup = false;
+     Object info;
+     char *key;
+@@ -867,10 +850,10 @@ void write_epdf(void)
+     encodingList = 0;
+     page = pdf_doc->doc->getCatalog()->getPage(epdf_selected_page);
+     pageRef = pdf_doc->doc->getCatalog()->getPageRef(epdf_selected_page);
+-    xref->fetch(pageRef->num, pageRef->gen, &pageObj);
+-    pageDict = pageObj->getDict();
++    pageObj = xref->fetch(pageRef->num, pageRef->gen);
++    pageDict = pageObj.getDict();
+     rotate = page->getRotate();
+-    PDFRectangle *pagebox;
++    const PDFRectangle *pagebox;
+     // write the Page header
+     pdf_puts("/Type /XObject\n");
+     pdf_puts("/Subtype /Form\n");
+@@ -886,7 +869,7 @@ void write_epdf(void)
+         pdf_printf("/%s.PageNumber %i\n", pdfkeyprefix, (int) epdf_selected_page);
+     }
+     if ((suppress_ptex_info & MASK_SUPPRESS_PTEX_INFODICT) == 0) {
+-        pdf_doc->doc->getDocInfoNF(&info);
++        info = pdf_doc->doc->getDocInfoNF().copy();
+         if (info.isRef()) {
+             // the info dict must be indirect (PDF Ref p. 61)
+             pdf_printf("/%s.InfoDict ", pdfkeyprefix);
+@@ -942,14 +925,14 @@ void write_epdf(void)
+     pdf_puts(stripzeros(s));
+ 
+     // Metadata validity check (as a stream it must be indirect)
+-    pageDict->lookupNF("Metadata", &dictObj);
+-    if (!dictObj->isNull() && !dictObj->isRef())
++    dictObj = pageDict->lookupNF("Metadata").copy();
++    if (!dictObj.isNull() && !dictObj.isRef())
+         pdftex_warn("PDF inclusion: /Metadata must be indirect object");
+ 
+     // copy selected items in Page dictionary except Resources & Group
+     for (i = 0; pageDictKeys[i] != NULL; i++) {
+-        pageDict->lookupNF(pageDictKeys[i], &dictObj);
+-        if (!dictObj->isNull()) {
++        dictObj = pageDict->lookupNF(pageDictKeys[i]).copy();
++        if (!dictObj.isNull()) {
+             pdf_newline();
+             pdf_printf("/%s ", pageDictKeys[i]);
+             copyObject(&dictObj); // preserves indirection
+@@ -957,8 +940,8 @@ void write_epdf(void)
+     } 
+ 
+     // handle page group
+-    pageDict->lookupNF("Group", &dictObj);
+-    if (!dictObj->isNull()) {
++    dictObj = pageDict->lookupNF("Group").copy();
++    if (!dictObj.isNull()) {
+         if (pdfpagegroupval == 0) { 
+             // another pdf with page group was included earlier on the
+             // same page; copy the Group entry as is.  See manual for
+@@ -972,11 +955,36 @@ void write_epdf(void)
+             copyObject(&dictObj);
+         } else {
+             // write Group dict as a separate object, since the Page dict also refers to it
+-            pageDict->lookup("Group", &dictObj);
+-            if (!dictObj->isDict())
++            dictObj = pageDict->lookup("Group");
++            if (!dictObj.isDict())
+                 pdftex_fail("PDF inclusion: /Group dict missing");
+             writeSepGroup = true;
+-            initDictFromDict(groupDict, page->getGroup());
++/*
++This part is only a single line
++            groupDict = Object(page->getGroup());
++in the original patch. In this case, however, pdftex crashes at
++"delete pdf_doc->doc" in "delete_document()" for inclusion of some
++kind of pdf images, for example, figure_missing.pdf in gnuplot.
++A change
++            groupDict = Object(page->getGroup()).copy();
++does not improve the situation.
++The changes below seem to work fine. 
++*/
++// begin modification
++            groupDict = pageDict->lookup("Group");
++            const Dict& dic1 = page->getGroup();
++            const Dict& dic2 = groupDict.getDict();
++            // replace dic2 in groupDict with dic1
++            l = dic2.getLength();
++            for (i = 0; i < l; i++) {
++                groupDict.dictRemove(dic2.getKey(i));
++            }
++            l = dic1.getLength();
++            for (i = 0; i < l; i++) {
++                groupDict.dictAdd((const char *)copyString(dic1.getKey(i)),
++                                  dic1.getValNF(i).copy());
++            }
++// end modification
+             pdf_printf("/Group %ld 0 R\n", (long)pdfpagegroupval);
+         }
+     }
+@@ -989,28 +997,28 @@ void write_epdf(void)
+         pdftex_warn
+             ("PDF inclusion: /Resources missing. 'This practice is not recommended' (PDF Ref)");
+     } else {
+-        initDictFromDict(obj1, page->getResourceDict());
++        Object *obj1 = page->getResourceDictObject();
+         if (!obj1->isDict())
+             pdftex_fail("PDF inclusion: invalid resources dict type <%s>",
+                         obj1->getTypeName());
+         pdf_newline();
+         pdf_puts("/Resources <<\n");
+         for (i = 0, l = obj1->dictGetLength(); i < l; ++i) {
+-            obj1->dictGetVal(i, &obj2);
+-            key = obj1->dictGetKey(i);
++            obj2 = obj1->dictGetVal(i);
++            key = (char *)obj1->dictGetKey(i);
+             if (strcmp("Font", key) == 0)
+                 copyFontResources(&obj2);
+             else if (strcmp("ProcSet", key) == 0)
+                 copyProcSet(&obj2);
+             else
+-                copyOtherResources(&obj2, key);
++                copyOtherResources(&obj2, (char *)key);
+         }
+         pdf_puts(">>\n");
+     }
+ 
+     // write the page contents
+-    page->getContents(&contents);
+-    if (contents->isStream()) {
++    contents = page->getContents();
++    if (contents.isStream()) {
+ 
+         // Variant A: get stream and recompress under control
+         // of \pdfcompresslevel
+@@ -1021,36 +1029,35 @@ void write_epdf(void)
+ 
+         // Variant B: copy stream without recompressing
+         //
+-        contents->streamGetDict()->lookup("F", &obj1);
+-        if (!obj1->isNull()) {
++        obj1 = contents.streamGetDict()->lookup("F");
++        if (!obj1.isNull()) {
+             pdftex_fail("PDF inclusion: Unsupported external stream");
+         }
+-        contents->streamGetDict()->lookup("Length", &obj1);
+-        assert(!obj1->isNull());
++        obj1 = contents.streamGetDict()->lookup("Length");
++        assert(!obj1.isNull());
+         pdf_puts("/Length ");
+         copyObject(&obj1);
+         pdf_puts("\n");
+-        contents->streamGetDict()->lookup("Filter", &obj1);
+-        if (!obj1->isNull()) {
++        obj1 = contents.streamGetDict()->lookup("Filter");
++        if (!obj1.isNull()) {
+             pdf_puts("/Filter ");
+             copyObject(&obj1);
+             pdf_puts("\n");
+-            contents->streamGetDict()->lookup("DecodeParms", &obj1);
+-            if (!obj1->isNull()) {
++            obj1 = contents.streamGetDict()->lookup("DecodeParms");
++            if (!obj1.isNull()) {
+                 pdf_puts("/DecodeParms ");
+                 copyObject(&obj1);
+                 pdf_puts("\n");
+             }
+         }
+         pdf_puts(">>\nstream\n");
+-        copyStream(contents->getStream()->getUndecodedStream());
++        copyStream(contents.getStream()->getUndecodedStream());
+         pdfendstream();
+-    } else if (contents->isArray()) {
++    } else if (contents.isArray()) {
+         pdfbeginstream();
+-        for (i = 0, l = contents->arrayGetLength(); i < l; ++i) {
+-            Object contentsobj;
+-            copyStream((contents->arrayGet(i, &contentsobj))->getStream());
+-            contentsobj.free();
++        for (i = 0, l = contents.arrayGetLength(); i < l; ++i) {
++            Object contentsobj = contents.arrayGet(i);
++            copyStream(contentsobj.getStream());
+             if (i < l - 1)
+                 pdf_newline();  // add a newline after each stream except the last
+         }
+@@ -1105,6 +1112,5 @@ void epdf_check_mem()
+             delete_document(p);
+         }
+         // see above for globalParams
+-        delete globalParams;
+     }
+ }
+diff --git a/texk/web2c/pdftexdir/pdftosrc.cc b/texk/web2c/pdftexdir/pdftosrc.cc
+index 67be229e..b6700fd6 100644
+--- a/texk/web2c/pdftexdir/pdftosrc.cc
++++ b/texk/web2c/pdftexdir/pdftosrc.cc
+@@ -16,6 +16,14 @@ GNU General Public License for more details.
+ You should have received a copy of the GNU General Public License along
+ with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
++
++/*
++This is based on the patch texlive-poppler-0.59.patch <2017-09-19> at
++https://git.archlinux.org/svntogit/packages.git/plain/texlive-bin/trunk
++by Arch Linux. The poppler should be 0.72.0 or newer versions.
++POPPLER_VERSION should be defined.
++*/
++
+ #include <w2c/config.h>
+ 
+ #include <stdlib.h>
+@@ -32,16 +40,12 @@ with this program.  If not, see <http://www.gnu.org/licenses/>.
+ #include <goo/gmem.h>
+ #include <goo/gfile.h>
+ #else
+-#include <aconf.h>
+-#include <GString.h>
+-#include <gmem.h>
+-#include <gfile.h>
++#error POPPLER_VERSION should be defined.
+ #endif
+ #include <assert.h>
+ 
+ #include "Object.h"
+ #include "Stream.h"
+-#include "Lexer.h"
+ #include "Parser.h"
+ #include "Array.h"
+ #include "Dict.h"
+@@ -74,7 +78,11 @@ int main(int argc, char *argv[])
+         exit(1);
+     }
+     fileName = new GString(argv[1]);
+-    globalParams = new GlobalParams();
++#if POPPLER_MAJOR_VERSION >= 1 || POPPLER_MINOR_VERSION >= 83
++    globalParams.reset(new GlobalParams());
++#else
++    globalParams = std::make_unique<GlobalParams>();
++#endif
+     doc = new PDFDoc(fileName);
+     if (!doc->isOk()) {
+         fprintf(stderr, "Invalid PDF file\n");
+@@ -86,36 +94,34 @@ int main(int argc, char *argv[])
+             objgen = atoi(argv[3]);
+     }
+     xref = doc->getXRef();
+-    catalogDict.initNull();
+-    xref->getCatalog(&catalogDict);
++    catalogDict = xref->getCatalog();
+     if (!catalogDict.isDict("Catalog")) {
+         fprintf(stderr, "No Catalog found\n");
+         exit(1);
+     }
+-    srcStream.initNull();
++    srcStream = Object(objNull);
+     if (objnum == 0) {
+-        catalogDict.dictLookup("SourceObject", &srcStream);
+-        static char const_SourceFile[] = "SourceFile";
+-        if (!srcStream.isStream(const_SourceFile)) {
++        srcStream = catalogDict.dictLookup("SourceObject");
++        static const char *const_SourceFile = "SourceFile";
++        if (!srcStream.isDict(const_SourceFile)) {
+             fprintf(stderr, "No SourceObject found\n");
+             exit(1);
+         }
+-        srcName.initNull();
+-        srcStream.getStream()->getDict()->lookup("SourceName", &srcName);
++        srcName = srcStream.getStream()->getDict()->lookup("SourceName");
+         if (!srcName.isString()) {
+             fprintf(stderr, "No SourceName found\n");
+             exit(1);
+         }
+-        outname = srcName.getString()->getCString();
++        outname = (char *)srcName.getString()->c_str();
+         // We cannot free srcName, as objname shares its string.
+         // srcName.free();
+     } else if (objnum > 0) {
+-        xref->fetch(objnum, objgen, &srcStream);
++        srcStream = xref->fetch(objnum, objgen);
+         if (!srcStream.isStream()) {
+             fprintf(stderr, "Not a Stream object\n");
+             exit(1);
+         }
+-        sprintf(buf, "%s", fileName->getCString());
++        sprintf(buf, "%s", fileName->c_str());
+         if ((p = strrchr(buf, '.')) == 0)
+             p = strchr(buf, 0);
+         if (objgen == 0)
+@@ -125,7 +131,7 @@ int main(int argc, char *argv[])
+         outname = buf;
+     } else {                    // objnum < 0 means we are extracting the XRef table
+         extract_xref_table = true;
+-        sprintf(buf, "%s", fileName->getCString());
++        sprintf(buf, "%s", fileName->c_str());
+         if ((p = strrchr(buf, '.')) == 0)
+             p = strchr(buf, 0);
+         sprintf(p, ".xref");
+@@ -153,41 +159,32 @@ int main(int argc, char *argv[])
+                         (e->type == xrefEntryFree ? "f" : "n"));
+             else {              // e->offset is the object number of the object stream
+                 Stream *str;
+-                Lexer *lexer;
+                 Parser *parser;
+                 Object objStr, obj1, obj2;
+                 int nObjects, first, n;
+                 int localOffset = 0;
+-                Guint firstOffset;
++                unsigned int firstOffset;
+ 
+-                assert(xref->fetch(e->offset, 0, &objStr)->isStream());
+-                nObjects = objStr.streamGetDict()->lookup("N", &obj1)->getInt();
+-                obj1.free();
+-                first = objStr.streamGetDict()->lookup("First", &obj1)->getInt();
+-                obj1.free();
++                objStr = xref->fetch(e->offset, 0);
++                assert(objStr.isStream());
++                obj1 = objStr.streamGetDict()->lookup("N");
++                nObjects = obj1.getInt();
++                obj1 = objStr.streamGetDict()->lookup("First");
++                first = obj1.getInt();
+                 firstOffset = objStr.getStream()->getBaseStream()->getStart() + first;
+ 
+                 // parse the header: object numbers and offsets
+                 objStr.streamReset();
+-                obj1.initNull();
+-                str = new EmbedStream(objStr.getStream(), &obj1, gTrue, first);
+-                lexer = new Lexer(xref, str);
+-                parser = new Parser(xref, lexer, gFalse);
++                str = new EmbedStream(objStr.getStream(), Object(objNull), true, first);
++                parser = new Parser(xref, str, false);
+                 for (n = 0; n < nObjects; ++n) {
+-                    parser->getObj(&obj1);
+-                    parser->getObj(&obj2);
++                    obj1 = parser->getObj();
++                    obj2 = parser->getObj();
+                     if (n == e->gen)
+                         localOffset = obj2.getInt();
+-                    obj1.free();
+-                    obj2.free();
+                 }
+-#if defined(POPPLER_VERSION) || defined(XPDF304)
+                 while (str->getChar() != EOF) ;
+-#else /* xpdf 4.00 */
+-                lexer->skipToEOF();
+-#endif
+                 delete parser;
+-                objStr.free();
+ 
+                 fprintf(outfile, "%.10lu 00000 n\n",
+                         (long unsigned)(firstOffset + localOffset));
+@@ -198,7 +195,6 @@ int main(int argc, char *argv[])
+         s->reset();
+         while ((c = s->getChar()) != EOF)
+             fputc(c, outfile);
+-        srcStream.free();
+     }
+     if (objnum == 0)
+         fprintf(stderr, "Source file extracted to %s\n", outname);
+@@ -207,7 +203,5 @@ int main(int argc, char *argv[])
+     else
+         fprintf(stderr, "Cross-reference table extracted to %s\n", outname);
+     fclose(outfile);
+-    catalogDict.free();
+     delete doc;
+-    delete globalParams;
+ }
+diff --git a/texk/web2c/pdftexdir/utils.c b/texk/web2c/pdftexdir/utils.c
+index c93a8781..6f866e76 100644
+--- a/texk/web2c/pdftexdir/utils.c
++++ b/texk/web2c/pdftexdir/utils.c
+@@ -33,7 +33,6 @@ with this program.  If not, see <http://www.gnu.org/licenses/>.
+ #include "ptexlib.h"
+ #include <png.h>
+ #ifdef POPPLER_VERSION
+-#include <poppler-config.h>
+ #define xpdfVersion POPPLER_VERSION
+ #define xpdfString "poppler"
+ #else
+diff --git a/texk/web2c/xetexdir/XeTeX_ext.c b/texk/web2c/xetexdir/XeTeX_ext.c
+index 4968ee41..0aee4ee3 100644
+--- a/texk/web2c/xetexdir/XeTeX_ext.c
++++ b/texk/web2c/xetexdir/XeTeX_ext.c
+@@ -38,7 +38,10 @@ authorization from the copyright holders.
+ 
+ #include <w2c/config.h>
+ 
++#ifndef POPPLER_VERSION
+ #include <poppler-config.h>
++#endif
++
+ #include <png.h>
+ #include <zlib.h>
+ #include <graphite2/Font.h>
+-- 
+2.24.1
+


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-04-06  9:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-09 14:58 [gentoo-commits] proj/tex:master commit in: 2019/patches/ Mikle Kolyada
  -- strict thread matches above, loose matches on Subject: below --
2020-04-06  9:09 Mikle Kolyada
2020-03-08 10:11 Mikle Kolyada
2020-03-06 14:05 Mikle Kolyada
2020-02-10  9:29 Mikle Kolyada
2019-12-31  8:34 Mikle Kolyada
2019-12-31  7:37 Mikle Kolyada
2019-12-30 17:47 Mikle Kolyada
2019-12-27 10:28 Mikle Kolyada
2019-06-04 13:56 Mikle Kolyada
2019-06-03 20:31 Mikle Kolyada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox