Blame SOURCES/texlive-20200327-poppler-0.84.patch

0067d1
diff -up texlive-base-20200327/source/texk/web2c/pdftexdir/pdftoepdf.cc.poppler-0.84 texlive-base-20200327/source/texk/web2c/pdftexdir/pdftoepdf.cc
0067d1
--- texlive-base-20200327/source/texk/web2c/pdftexdir/pdftoepdf.cc.poppler-0.84	2020-04-20 14:38:05.301181578 -0400
0067d1
+++ texlive-base-20200327/source/texk/web2c/pdftexdir/pdftoepdf.cc	2020-04-20 14:38:05.314181306 -0400
0067d1
@@ -26,6 +26,15 @@ The poppler should be 0.59.0 or newer ve
0067d1
 POPPLER_VERSION should be defined.
0067d1
 */
0067d1
 
0067d1
+#ifdef POPPLER_VERSION
0067d1
+#include <poppler-config.h>
0067d1
+#define xpdfVersion POPPLER_VERSION
0067d1
+#define xpdfString "poppler"
0067d1
+#else
0067d1
+#include <xpdf/config.h>        /* just to get the xpdf version */
0067d1
+#define xpdfString "xpdf"
0067d1
+#endif
0067d1
+
0067d1
 /* Do this early in order to avoid a conflict between
0067d1
    MINGW32 <rpcndr.h> defining 'boolean' as 'unsigned char' and
0067d1
    <kpathsea/types.h> defining Pascal's boolean as 'int'.
0067d1
@@ -292,7 +301,7 @@ static void copyDictEntry(Object * obj,
0067d1
     Object obj1;
0067d1
     copyName(obj->dictGetKey(i));
0067d1
     pdf_puts(" ");
0067d1
-    obj1 = obj->dictGetValNF(i);
0067d1
+    obj1 = obj->dictGetValNF(i).copy();
0067d1
     copyObject(&obj1);
0067d1
     pdf_puts("\n");
0067d1
 }
0067d1
@@ -351,7 +360,7 @@ static void copyProcSet(Object * obj)
0067d1
                     obj->getTypeName());
0067d1
     pdf_puts("/ProcSet [ ");
0067d1
     for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
0067d1
-        procset = obj->arrayGetNF(i);
0067d1
+        procset = obj->arrayGetNF(i).copy();
0067d1
         if (!procset.isName())
0067d1
             pdftex_fail("PDF inclusion: invalid ProcSet entry type <%s>",
0067d1
                         procset.getTypeName());
0067d1
@@ -406,7 +415,7 @@ static void copyFont(const char *tag, Ob
0067d1
     if (fontdict.isDict()) {
0067d1
         subtype = fontdict.dictLookup("Subtype");
0067d1
         basefont = fontdict.dictLookup("BaseFont");
0067d1
-        fontdescRef = fontdict.dictLookupNF("FontDescriptor");
0067d1
+        fontdescRef = fontdict.dictLookupNF("FontDescriptor").copy();
0067d1
         if (fontdescRef.isRef()) {
0067d1
             fontdesc = fontdescRef.fetch(xref);
0067d1
         }
0067d1
@@ -452,7 +461,7 @@ static void copyFontResources(Object * o
0067d1
                     obj->getTypeName());
0067d1
     pdf_puts("/Font << ");
0067d1
     for (i = 0, l = obj->dictGetLength(); i < l; ++i) {
0067d1
-        fontRef = obj->dictGetValNF(i);
0067d1
+        fontRef = obj->dictGetValNF(i).copy();
0067d1
         if (fontRef.isRef())
0067d1
             copyFont(obj->dictGetKey(i), &fontRef);
0067d1
         else if (fontRef.isDict()) {   // some programs generate pdf with embedded font object
0067d1
@@ -595,7 +604,7 @@ static void copyObject(Object * obj)
0067d1
     } else if (obj->isArray()) {
0067d1
         pdf_puts("[");
0067d1
         for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
0067d1
-            obj1 = obj->arrayGetNF(i);
0067d1
+            obj1 = obj->arrayGetNF(i).copy();
0067d1
             if (!obj1.isName())
0067d1
                 pdf_puts(" ");
0067d1
             copyObject(&obj1);
0067d1
@@ -723,7 +732,7 @@ read_pdf_info(char *image_name, char *pa
0067d1
 #endif
0067d1
     // initialize
0067d1
     if (!isInit) {
0067d1
-        globalParams = new GlobalParams();
0067d1
+        globalParams = std::unique_ptr<GlobalParams>(new GlobalParams());
0067d1
         globalParams->setErrQuiet(false);
0067d1
         isInit = true;
0067d1
     }
0067d1
@@ -761,7 +770,7 @@ read_pdf_info(char *image_name, char *pa
0067d1
         if (link == 0 || !link->isOk())
0067d1
             pdftex_fail("PDF inclusion: invalid destination <%s>", page_name);
0067d1
         Ref ref = link->getPageRef();
0067d1
-        page_num = pdf_doc->doc->getCatalog()->findPage(ref.num, ref.gen);
0067d1
+        page_num = pdf_doc->doc->getCatalog()->findPage(ref);
0067d1
         if (page_num == 0)
0067d1
             pdftex_fail("PDF inclusion: destination is not a page <%s>",
0067d1
                         page_name);
0067d1
@@ -921,13 +930,13 @@ void write_epdf(void)
0067d1
     pdf_puts(stripzeros(s));
0067d1
 
0067d1
     // Metadata validity check (as a stream it must be indirect)
0067d1
-    dictObj = pageDict->lookupNF("Metadata");
0067d1
+    dictObj = pageDict->lookupNF("Metadata").copy();
0067d1
     if (!dictObj.isNull() && !dictObj.isRef())
0067d1
         pdftex_warn("PDF inclusion: /Metadata must be indirect object");
0067d1
 
0067d1
     // copy selected items in Page dictionary except Resources & Group
0067d1
     for (i = 0; pageDictKeys[i] != NULL; i++) {
0067d1
-        dictObj = pageDict->lookupNF(pageDictKeys[i]);
0067d1
+        dictObj = pageDict->lookupNF(pageDictKeys[i]).copy();
0067d1
         if (!dictObj.isNull()) {
0067d1
             pdf_newline();
0067d1
             pdf_printf("/%s ", pageDictKeys[i]);
0067d1
@@ -936,7 +945,7 @@ void write_epdf(void)
0067d1
     } 
0067d1
 
0067d1
     // handle page group
0067d1
-    dictObj = pageDict->lookupNF("Group");
0067d1
+    dictObj = pageDict->lookupNF("Group").copy();
0067d1
     if (!dictObj.isNull()) {
0067d1
         if (pdfpagegroupval == 0) { 
0067d1
             // another pdf with page group was included earlier on the
0067d1
@@ -978,7 +987,7 @@ The changes below seem to work fine.
0067d1
             l = dic1.getLength();
0067d1
             for (i = 0; i < l; i++) {
0067d1
                 groupDict.dictAdd(dic1.getKey(i),
0067d1
-                                  dic1.getValNF(i));
0067d1
+                                  dic1.getValNF(i).copy());
0067d1
             }
0067d1
 // end modification
0067d1
             pdf_printf("/Group %ld 0 R\n", (long)pdfpagegroupval);
0067d1
@@ -1108,6 +1117,6 @@ void epdf_check_mem()
0067d1
             delete_document(p);
0067d1
         }
0067d1
         // see above for globalParams
0067d1
-        delete globalParams;
0067d1
+        globalParams.reset();
0067d1
     }
0067d1
 }
0067d1
diff -up texlive-base-20200327/source/texk/web2c/pdftexdir/pdftosrc.cc.poppler-0.84 texlive-base-20200327/source/texk/web2c/pdftexdir/pdftosrc.cc
0067d1
--- texlive-base-20200327/source/texk/web2c/pdftexdir/pdftosrc.cc.poppler-0.84	2020-04-20 14:38:05.301181578 -0400
0067d1
+++ texlive-base-20200327/source/texk/web2c/pdftexdir/pdftosrc.cc	2020-04-20 14:38:05.314181306 -0400
0067d1
@@ -24,6 +24,15 @@ by Arch Linux. The poppler should be 0.5
0067d1
 POPPLER_VERSION should be defined.
0067d1
 */
0067d1
 
0067d1
+#ifdef POPPLER_VERSION
0067d1
+#include <poppler-config.h>
0067d1
+#define xpdfVersion POPPLER_VERSION
0067d1
+#define xpdfString "poppler"
0067d1
+#else
0067d1
+#include <xpdf/config.h>        /* just to get the xpdf version */
0067d1
+#define xpdfString "xpdf"
0067d1
+#endif
0067d1
+
0067d1
 #include <w2c/config.h>
0067d1
 
0067d1
 #include <stdlib.h>
0067d1
@@ -79,7 +88,7 @@ int main(int argc, char *argv[])
0067d1
         exit(1);
0067d1
     }
0067d1
     fileName = new GString(argv[1]);
0067d1
-    globalParams = new GlobalParams();
0067d1
+    globalParams = std::unique_ptr<GlobalParams>(new GlobalParams());
0067d1
     doc = new PDFDoc(fileName);
0067d1
     if (!doc->isOk()) {
0067d1
         fprintf(stderr, "Invalid PDF file\n");
0067d1
@@ -100,7 +109,7 @@ int main(int argc, char *argv[])
0067d1
     if (objnum == 0) {
0067d1
         srcStream = catalogDict.dictLookup("SourceObject");
0067d1
         static char const_SourceFile[] = "SourceFile";
0067d1
-        if (!srcStream.isStream(const_SourceFile)) {
0067d1
+        if (!(srcStream.isStream() && srcStream.getDict()->is(const_SourceFile))) {
0067d1
             fprintf(stderr, "No SourceObject found\n");
0067d1
             exit(1);
0067d1
         }
0067d1
@@ -156,7 +165,6 @@ int main(int argc, char *argv[])
0067d1
                         (e->type == xrefEntryFree ? "f" : "n"));
0067d1
             else {              // e->offset is the object number of the object stream
0067d1
                 Stream *str;
0067d1
-                Lexer *lexer;
0067d1
                 Parser *parser;
0067d1
                 Object objStr, obj1, obj2;
0067d1
                 int nObjects, first, n;
0067d1
@@ -174,8 +182,7 @@ int main(int argc, char *argv[])
0067d1
                 // parse the header: object numbers and offsets
0067d1
                 objStr.streamReset();
0067d1
                 str = new EmbedStream(objStr.getStream(), Object(objNull), true, first);
0067d1
-                lexer = new Lexer(xref, str);
0067d1
-                parser = new Parser(xref, lexer, false);
0067d1
+                parser = new Parser(xref, str, false);
0067d1
                 for (n = 0; n < nObjects; ++n) {
0067d1
                     obj1 = parser->getObj();
0067d1
                     obj2 = parser->getObj();
0067d1
@@ -207,5 +214,5 @@ int main(int argc, char *argv[])
0067d1
         fprintf(stderr, "Cross-reference table extracted to %s\n", outname);
0067d1
     fclose(outfile);
0067d1
     delete doc;
0067d1
-    delete globalParams;
0067d1
+    globalParams.reset();
0067d1
 }
0067d1
diff -up texlive-base-20200327/source/texk/web2c/pdftexdir/utils.c.poppler-0.84 texlive-base-20200327/source/texk/web2c/pdftexdir/utils.c
0067d1
--- texlive-base-20200327/source/texk/web2c/pdftexdir/utils.c.poppler-0.84	2019-12-29 19:37:32.000000000 -0500
0067d1
+++ texlive-base-20200327/source/texk/web2c/pdftexdir/utils.c	2020-04-20 14:39:39.355214866 -0400
0067d1
@@ -32,14 +32,6 @@ with this program.  If not, see 
0067d1
 #include <zlib.h>
0067d1
 #include "ptexlib.h"
0067d1
 #include <png.h>
0067d1
-#ifdef POPPLER_VERSION
0067d1
-/* POPPLER_VERSION should be a proper version string */
0067d1
-#define xpdfVersion POPPLER_VERSION
0067d1
-#define xpdfString "poppler"
0067d1
-#else
0067d1
-#include <xpdf/config.h>        /* just to get the xpdf version */
0067d1
-#define xpdfString "xpdf"
0067d1
-#endif
0067d1
 
0067d1
 #define check_nprintf(size_get, size_want) \
0067d1
     if ((unsigned)(size_get) >= (unsigned)(size_want)) \
0067d1
@@ -977,12 +969,10 @@ void initversionstring(char **versions)
0067d1
 {
0067d1
     const_string fmt =
0067d1
                     "Compiled with libpng %s; using libpng %s\n"
0067d1
-                    "Compiled with zlib %s; using zlib %s\n"
0067d1
-                    "Compiled with %s version %s\n";
0067d1
+                    "Compiled with zlib %s; using zlib %s\n";
0067d1
     size_t len = strlen(fmt)
0067d1
                     + strlen(PNG_LIBPNG_VER_STRING) + strlen(png_libpng_ver)
0067d1
                     + strlen(ZLIB_VERSION) + strlen(zlib_version)
0067d1
-                    + strlen(xpdfString) + strlen(xpdfVersion)
0067d1
                     + 1;
0067d1
 
0067d1
     /* len will be more than enough, because of the placeholder chars in fmt
0067d1
@@ -990,7 +980,7 @@ void initversionstring(char **versions)
0067d1
     *versions = xmalloc(len);
0067d1
     sprintf(*versions, fmt,
0067d1
                     PNG_LIBPNG_VER_STRING, png_libpng_ver,
0067d1
-                    ZLIB_VERSION, zlib_version, xpdfString, xpdfVersion);
0067d1
+                    ZLIB_VERSION, zlib_version);
0067d1
 }
0067d1
 
0067d1
 
0067d1
diff -up texlive-base-20200327/source/texk/web2c/xetexdir/XeTeX_ext.c.poppler-0.84 texlive-base-20200327/source/texk/web2c/xetexdir/XeTeX_ext.c
0067d1
--- texlive-base-20200327/source/texk/web2c/xetexdir/XeTeX_ext.c.poppler-0.84	2019-12-30 16:00:39.000000000 -0500
0067d1
+++ texlive-base-20200327/source/texk/web2c/xetexdir/XeTeX_ext.c	2020-04-20 14:40:44.534851910 -0400
0067d1
@@ -38,10 +38,6 @@ authorization from the copyright holders
0067d1
 
0067d1
 #include <w2c/config.h>
0067d1
 
0067d1
-#ifndef POPPLER_VERSION
0067d1
-#include <poppler-config.h>
0067d1
-#endif
0067d1
-
0067d1
 #include <png.h>
0067d1
 #include <zlib.h>
0067d1
 #include <graphite2/Font.h>
0067d1
@@ -170,7 +166,6 @@ void initversionstring(char **versions)
0067d1
         "Compiled with Graphite2 version %d.%d.%d; using %d.%d.%d\n"
0067d1
         "Compiled with HarfBuzz version %s; using %s\n"
0067d1
         "Compiled with libpng version %s; using %s\n"
0067d1
-        "Compiled with poppler version %s\n"
0067d1
 #ifdef XETEX_MAC
0067d1
         "Using Mac OS X Core Text and Cocoa frameworks\n"
0067d1
 #else
0067d1
@@ -187,7 +182,6 @@ void initversionstring(char **versions)
0067d1
             + strlen(hb_version_string())
0067d1
             + strlen(PNG_LIBPNG_VER_STRING)
0067d1
             + strlen(png_libpng_ver)
0067d1
-            + strlen(POPPLER_VERSION)
0067d1
 #ifndef XETEX_MAC
0067d1
             + 6 * 3 /* for fontconfig version #s (won't really need 3 digits per field!) */
0067d1
 #endif
0067d1
@@ -217,7 +211,7 @@ void initversionstring(char **versions)
0067d1
         GR2_VERSION_MAJOR, GR2_VERSION_MINOR, GR2_VERSION_BUGFIX,
0067d1
         grMajor, grMinor, grBugfix,
0067d1
         HB_VERSION_STRING, hb_version_string(),
0067d1
-        PNG_LIBPNG_VER_STRING, png_libpng_ver, POPPLER_VERSION
0067d1
+        PNG_LIBPNG_VER_STRING, png_libpng_ver
0067d1
 #ifndef XETEX_MAC
0067d1
         ,
0067d1
         FC_VERSION / 10000, (FC_VERSION % 10000) / 100, FC_VERSION % 100,