File poppler-fix-0.79.patch of Package texlive.29025

--- ./texk/web2c/pdftexdir/pdftosrc.cc
+++ ./texk/web2c/pdftexdir/pdftosrc.cc
@@ -63,6 +63,7 @@
 #include "GlobalParams.h"
 #include "Error.h"
 
+typedef unsigned int    guint;
 static XRef *xref = 0;
 
 int main(int argc, char *argv[])
@@ -106,7 +107,7 @@ int main(int argc, char *argv[])
             fprintf(stderr, "No SourceName found\n");
             exit(1);
         }
-        outname = srcName.getString()->getCString();
+        outname = const_cast<char *>(srcName.getString()->c_str());
         // We cannot free srcName, as objname shares its string.
         // srcName.free();
     } else if (objnum > 0) {
@@ -115,7 +116,7 @@ int main(int argc, char *argv[])
             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 +126,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");
@@ -157,7 +158,7 @@ int main(int argc, char *argv[])
                 Object objStr, obj1, obj2;
                 int nObjects, first, n;
                 int localOffset = 0;
-                Guint firstOffset;
+                guint firstOffset;
 
#                 assert(xref->fetch(e->offset, 0, &objStr)->isStream());
#                 nObjects = objStr.streamGetDict()->lookup("N", &obj1)->getInt();
                 objStr = xref->fetch(e->offset, 0);
                 assert(objStr.isStream());
@@ -169,9 +170,8 @@ int main(int argc, char *argv[])
 
                 // parse the header: object numbers and offsets
                 objStr.streamReset();
-                str = new EmbedStream(objStr.getStream(), Object(objNull), gTrue, first);
+                str = new EmbedStream(objStr.getStream(), Object(objNull), true, first);
-                lexer = new Lexer(xref, str);
-                parser = new Parser(xref, lexer, gFalse);
+                parser = new Parser(xref, str, false);
                 for (n = 0; n < nObjects; ++n) {
                     obj1 = parser->getObj();
                     obj2 = parser->getObj();
--- ./texk/web2c/luatexdir/lua/lepdflib.cc.original	2019-10-29 09:47:18.394527120 +0000
+++ ./texk/web2c/luatexdir/lua/lepdflib.cc	2019-10-29 09:49:20.259775317 +0000
@@ -238,7 +238,7 @@
        if (uobj->pd != NULL && uobj->pd->pc != uobj->pc)
           pdfdoc_changed_error(L);
        uout = new_Attribute_userdata(L);
-       uout->d = new Attribute(n, nlen, (Object *)uobj->d);
+       uout->d = new Attribute(GooString(n, nlen), (Object *)uobj->d);
        uout->atype = ALLOC_LEPDF;
        uout->pc = uobj->pc;
        uout->pd = uobj->pd;
@@ -443,7 +443,27 @@
     uin = (udstruct *) luaL_checkudata(L, 1, M_##in);          \
     if (uin->pd != NULL && uin->pd->pc != uin->pc)             \
         pdfdoc_changed_error(L);                               \
-    o = ((in *) uin->d)->function();                           \
+    o = ((in *) uin->d)->function();                         \
+    if (o != NULL) {                                           \
+        uout = new_##out##_userdata(L);                        \
+        uout->d = o;                                           \
+        uout->pc = uin->pc;                                    \
+        uout->pd = uin->pd;                                    \
+    } else                                                     \
+        lua_pushnil(L);                                        \
+    return 1;                                                  \
+}
+
+#define m_poppler_get_poppler2(in, out, function)              \
+static int m_##in##_##function(lua_State * L)                  \
+{                                                              \
+    out *o;                                                    \
+    udstruct *uin, *uout;                                      \
+    uin = (udstruct *) luaL_checkudata(L, 1, M_##in);          \
+    if (uin->pd != NULL && uin->pd->pc != uin->pc)             \
+        pdfdoc_changed_error(L);                               \
+    o = new out;                                               \
+    *o = *((in *) uin->d)->function();                         \
     if (o != NULL) {                                           \
         uout = new_##out##_userdata(L);                        \
         uout->d = o;                                           \
@@ -516,14 +536,14 @@
 #define m_poppler_get_GOOSTRING(in, function)                  \
 static int m_##in##_##function(lua_State * L)                  \
 {                                                              \
-    GooString *gs;                                             \
+    const GooString *gs;                                       \
     udstruct *uin;                                             \
     uin = (udstruct *) luaL_checkudata(L, 1, M_##in);          \
     if (uin->pd != NULL && uin->pd->pc != uin->pc)             \
         pdfdoc_changed_error(L);                               \
     gs = ((in *) uin->d)->function();                          \
     if (gs != NULL)                                            \
-        lua_pushlstring(L, gs->getCString(), gs->getLength()); \
+        lua_pushlstring(L, gs->c_str(), gs->getLength());      \
     else                                                       \
         lua_pushnil(L);                                        \
     return 1;                                                  \
@@ -736,7 +756,7 @@
     if (i > 0 && i <= len) {
         uout = new_Object_userdata(L);
         uout->d = new Object();
-        *((Object *) uout->d) = ((Array *) uin->d)->getNF(i - 1);
+        *((Object *) uout->d) = ((Array *) uin->d)->getNF(i - 1).copy();
         uout->atype = ALLOC_LEPDF;
         uout->pc = uin->pc;
         uout->pd = uin->pd;
@@ -758,7 +778,7 @@
     if (i > 0 && i <= len) {
         gs = new GooString();
         if (((Array *) uin->d)->getString(i - 1, gs))
-            lua_pushlstring(L, gs->getCString(), gs->getLength());
+            lua_pushlstring(L, gs->c_str(), gs->getLength());
         else
             lua_pushnil(L);
         delete gs;
@@ -841,7 +861,7 @@
         pdfdoc_changed_error(L);
     num = luaL_checkint(L, 2);
     gen = luaL_checkint(L, 3);
-    i = ((Catalog *) uin->d)->findPage(num, gen);
+    i = ((Catalog *) uin->d)->findPage({num, gen});
     if (i > 0)
         lua_pushinteger(L, i);
     else
@@ -910,7 +930,7 @@
     if (i > 0 && i <= len) {
         gs = ((Catalog *) uin->d)->getJS(i - 1);
         if (gs != NULL)
-            lua_pushlstring(L, gs->getCString(), gs->getLength());
+            lua_pushlstring(L, gs->c_str(), gs->getLength());
         else
             lua_pushnil(L);
         delete gs;
@@ -979,7 +999,7 @@
         pdfdoc_changed_error(L);
     s = copyString(luaL_checkstring(L, 2));
     uobj = (udstruct *) luaL_checkudata(L, 3, M_Object);
-    ((Dict *) uin->d)->add(s, std::move(*((Object *) uobj->d)));
+    ((Dict *) uin->d)->add(const_cast<const char *>(s), std::move(*((Object *) uobj->d)));
     return 0;
 }
 
@@ -1037,7 +1057,7 @@
     s = luaL_checkstring(L, 2);
     uout = new_Object_userdata(L);
     uout->d = new Object();
-    *((Object *) uout->d) = ((Dict *) uin->d)->lookupNF(s);
+    *((Object *) uout->d) = ((Dict *) uin->d)->lookupNF(s).copy();
     uout->atype = ALLOC_LEPDF;
     uout->pc = uin->pc;
     uout->pd = uin->pd;
@@ -1110,7 +1130,7 @@
     if (i > 0 && i <= len) {
         uout = new_Object_userdata(L);
         uout->d = new Object();
-        *((Object *) uout->d) = ((Dict *) uin->d)->getValNF(i - 1);
+        *((Object *) uout->d) = ((Dict *) uin->d)->getValNF(i - 1).copy();
         uout->atype = ALLOC_LEPDF;
         uout->pc = uin->pc;
         uout->pd = uin->pd;
@@ -1225,7 +1245,7 @@
     uin = (udstruct *) luaL_checkudata(L, 1, M_GooString);
     if (uin->pd != NULL && uin->pd->pc != uin->pc)
         pdfdoc_changed_error(L);
-    lua_pushlstring(L, ((GooString *) uin->d)->getCString(),
+    lua_pushlstring(L, ((GooString *) uin->d)->c_str(),
                     ((GooString *) uin->d)->getLength());
     return 1;
 }
@@ -1374,9 +1394,9 @@
         pdfdoc_changed_error(L);
     luaL_checktype(L, 2, LUA_TBOOLEAN);
     if (lua_toboolean(L, 2) != 0)
-        *((Object *) uin->d) = Object(gTrue);
+        *((Object *) uin->d) = Object(true);
     else
-        *((Object *) uin->d) = Object(gFalse);
+        *((Object *) uin->d) = Object(false);
     return 0;
 }
 
@@ -1500,7 +1520,7 @@
         pdfdoc_changed_error(L);
     num = luaL_checkint(L, 2);
     gen = luaL_checkint(L, 3);
-    *((Object *) uin->d) = Object(num, gen);
+    *((Object *) uin->d) = Object({num, gen});
     return 0;
 }
 
@@ -1650,14 +1670,14 @@
 
 static int m_Object_getString(lua_State * L)
 {
-    GooString *gs;
+    const GooString *gs;
     udstruct *uin;
     uin = (udstruct *) luaL_checkudata(L, 1, M_Object);
     if (uin->pd != NULL && uin->pd->pc != uin->pc)
         pdfdoc_changed_error(L);
     if (((Object *) uin->d)->isString()) {
         gs = ((Object *) uin->d)->getString();
-        lua_pushlstring(L, gs->getCString(), gs->getLength());
+        lua_pushlstring(L, gs->c_str(), gs->getLength());
     } else
         lua_pushnil(L);
     return 1;
@@ -1854,7 +1874,7 @@
         if (i > 0 && i <= len) {
             uout = new_Object_userdata(L);
             uout->d = new Object();
-            *((Object *) uout->d) = ((Object *) uin->d)->arrayGetNF(i - 1);
+            *((Object *) uout->d) = ((Object *) uin->d)->arrayGetNF(i - 1).copy();
             uout->atype = ALLOC_LEPDF;
             uout->pc = uin->pc;
             uout->pd = uin->pd;
@@ -1894,7 +1914,7 @@
         pdfdoc_changed_error(L);
     if (!((Object *) uin->d)->isDict())
         luaL_error(L, "Object is not a Dict");
-    ((Object *) uin->d)->dictAdd(copyString(s), std::move(*((Object *) uobj->d)));
+    ((Object *) uin->d)->dictAdd(s, std::move(*((Object *) uobj->d)));
     return 0;
 }
 
@@ -1947,7 +1967,7 @@
     if (((Object *) uin->d)->isDict()) {
         uout = new_Object_userdata(L);
         uout->d = new Object();
-        *((Object *) uout->d) = ((Object *) uin->d)->dictLookupNF(s);
+        *((Object *) uout->d) = ((Object *) uin->d)->dictLookupNF(s).copy();
         uout->atype = ALLOC_LEPDF;
         uout->pc = uin->pc;
         uout->pd = uin->pd;
@@ -2012,7 +2032,7 @@
         if (i > 0 && i <= len) {
             uout = new_Object_userdata(L);
             uout->d = new Object();
-            *((Object *) uout->d) = ((Object *) uin->d)->dictGetValNF(i - 1);
+            *((Object *) uout->d) = ((Object *) uin->d)->dictGetValNF(i - 1).copy();
             uout->atype = ALLOC_LEPDF;
             uout->pc = uin->pc;
             uout->pd = uin->pd;
@@ -2222,16 +2242,16 @@
 
 m_poppler_get_BOOL(Page, isOk);
 m_poppler_get_INT(Page, getNum);
-m_poppler_get_poppler(Page, PDFRectangle, getMediaBox);
-m_poppler_get_poppler(Page, PDFRectangle, getCropBox);
+m_poppler_get_poppler2(Page, PDFRectangle, getMediaBox);
+m_poppler_get_poppler2(Page, PDFRectangle, getCropBox);
 m_poppler_get_BOOL(Page, isCropped);
 m_poppler_get_DOUBLE(Page, getMediaWidth);
 m_poppler_get_DOUBLE(Page, getMediaHeight);
 m_poppler_get_DOUBLE(Page, getCropWidth);
 m_poppler_get_DOUBLE(Page, getCropHeight);
-m_poppler_get_poppler(Page, PDFRectangle, getBleedBox);
-m_poppler_get_poppler(Page, PDFRectangle, getTrimBox);
-m_poppler_get_poppler(Page, PDFRectangle, getArtBox);
+m_poppler_get_poppler2(Page, PDFRectangle, getBleedBox);
+m_poppler_get_poppler2(Page, PDFRectangle, getTrimBox);
+m_poppler_get_poppler2(Page, PDFRectangle, getArtBox);
 m_poppler_get_INT(Page, getRotate);
 m_poppler_get_GOOSTRING(Page, getLastModified);
 m_poppler_get_poppler(Page, Dict, getBoxColorInfo);
@@ -2308,14 +2328,14 @@
 
 static int m_PDFDoc_getFileName(lua_State * L)
 {
-    GooString *gs;
+    const GooString *gs;
     udstruct *uin;
     uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
     if (uin->pd != NULL && uin->pd->pc != uin->pc)
         pdfdoc_changed_error(L);
     gs = ((PdfDocument *) uin->d)->doc->getFileName();
     if (gs != NULL)
-        lua_pushlstring(L, gs->getCString(), gs->getLength());
+        lua_pushlstring(L, gs->c_str(), gs->getLength());
     else
         lua_pushnil(L);
     return 1;
@@ -2396,7 +2416,7 @@
 
 static int m_PDFDoc_readMetadata(lua_State * L)
 {
-    GooString *gs;
+    const GooString *gs;
     udstruct *uin;
     uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
     if (uin->pd != NULL && uin->pd->pc != uin->pc)
@@ -2404,7 +2424,7 @@
     if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) {
         gs = ((PdfDocument *) uin->d)->doc->readMetadata();
         if (gs != NULL)
-            lua_pushlstring(L, gs->getCString(), gs->getLength());
+            lua_pushlstring(L, gs->c_str(), gs->getLength());
         else
             lua_pushnil(L);
     } else
@@ -2420,7 +2440,7 @@
     if (uin->pd != NULL && uin->pd->pc != uin->pc)
         pdfdoc_changed_error(L);
     if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) {
-        obj = ((PdfDocument *) uin->d)->doc->getStructTreeRoot();
+        obj = const_cast<StructTreeRoot *>(((PdfDocument *) uin->d)->doc->getStructTreeRoot());
         uout = new_StructTreeRoot_userdata(L);
         uout->d = obj;
         uout->pc = uin->pc;
@@ -2440,7 +2460,7 @@
     num = luaL_checkint(L, 2);
     gen = luaL_checkint(L, 3);
     if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) {
-        i = ((PdfDocument *) uin->d)->doc->findPage(num, gen);
+        i = ((PdfDocument *) uin->d)->doc->findPage({num, gen});
         if (i > 0)
             lua_pushinteger(L, i);
         else
@@ -2867,12 +2887,12 @@
 
 static int m_Attribute_setRevision(lua_State * L)
 {
-    Guint i;
+    unsigned int i;
     udstruct *uin;
     uin = (udstruct *) luaL_checkudata(L, 1, M_Attribute);
     if (uin->pd != NULL && uin->pd->pc != uin->pc)
         pdfdoc_changed_error(L);
-    i = (Guint) luaL_checkint(L, 2);
+    i = (unsigned int) luaL_checkint(L, 2);
     ((Attribute *) uin->d)->setRevision(i);
     return 0;
 }
@@ -2881,12 +2901,12 @@
 
 static int m_Attribute_setHidden(lua_State * L)
 {
-    GBool i;
+    bool i;
     udstruct *uin;
     uin = (udstruct *) luaL_checkudata(L, 1, M_Attribute);
     if (uin->pd != NULL && uin->pd->pc != uin->pc)
         pdfdoc_changed_error(L);
-    i = (GBool) lua_toboolean(L, 2);
+    i = (bool) lua_toboolean(L, 2);
     ((Attribute *) uin->d)->setHidden(i);
     return 0;
 }
@@ -3023,7 +3043,7 @@
 // Ref is false if the C++ functione return false
 static int m_StructElement_getPageRef(lua_State * L)
 {
-    GBool b;
+    bool b;
     Ref *r;
     udstruct *uin, *uout;
     uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement);
@@ -3057,28 +3077,28 @@
 
 static int m_StructElement_setRevision(lua_State * L)
 {
-    Guint i;
+    unsigned int i;
     udstruct *uin;
     uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement);
     if (uin->pd != NULL && uin->pd->pc != uin->pc)
         pdfdoc_changed_error(L);
-    i = (Guint) luaL_checkint(L, 2);
+    i = (unsigned int) luaL_checkint(L, 2);
     ((StructElement *) uin->d)->setRevision(i);
     return 0;
 }
 
 static int m_StructElement_getText(lua_State * L)
 {
-    GBool i;
+    bool i;
     GooString *gs;
     udstruct *uin;
     uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement);
     if (uin->pd != NULL && uin->pd->pc != uin->pc)
         pdfdoc_changed_error(L);
-    i = (GBool) lua_toboolean(L, 2);
+    i = (bool) lua_toboolean(L, 2);
     gs =  ((StructElement *) uin->d)->getText(i);
     if (gs != NULL)
-        lua_pushlstring(L, gs->getCString(), gs->getLength());
+        lua_pushlstring(L, gs->c_str(), gs->getLength());
     else
         lua_pushnil(L);
     return 1;
@@ -3164,7 +3184,7 @@
 {
     Attribute::Type t;
     Attribute::Owner o;
-    GBool g;
+    bool g;
     udstruct *uin, *uout;
     const Attribute *a;
     uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement);
@@ -3172,7 +3192,7 @@
         pdfdoc_changed_error(L);
     t = (Attribute::Type) luaL_checkint(L,1);
     o = (Attribute::Owner) luaL_checkint(L,2);
-    g = (GBool) lua_toboolean(L, 3);
+    g = (bool) lua_toboolean(L, 3);
     a = ((StructElement *) uin->d)->findAttribute(t,g,o);
 
     if (a!=NULL){
--- ./texk/web2c/pdftexdir/mapfile.c.original	2019-10-29 10:10:26.473799404 +0000
+++ ./texk/web2c/pdftexdir/mapfile.c	2019-10-29 10:11:24.606044181 +0000
@@ -652,7 +652,7 @@
  * used for Type1 font replacement when embedding of PDF files
  */
 
-fm_entry *lookup_fontmap(char *ps_name)
+fm_entry *lookup_fontmap(const char *ps_name)
 {
     fm_entry *fm, *fm2, tmp;
     char *a, *b, *c, *d, *e, *s;
@@ -661,7 +661,7 @@
     if (tfm_tree == NULL)
         fm_read_info();         /* only to read default map file */
     assert(ps_name != NULL);
-    s = ps_name;
+    s = (char *)ps_name;
     if (strlen(ps_name) > 7) {  /* check for subsetted name tag */
         for (i = 0; i < 6; i++, s++)
             if (*s < 'A' || *s > 'Z')
--- ./texk/web2c/pdftexdir/pdftoepdf.cc.original	2019-10-29 12:00:53.950400564 +0000
+++ ./texk/web2c/pdftexdir/pdftoepdf.cc	2019-10-29 12:13:10.076342383 +0000
@@ -124,7 +124,7 @@
 
 static InObj *inObjList;
 static UsedEncoding *encodingList;
-static GBool isInit = gFalse;
+static bool isInit = false;
 
 // --------------------------------------------------------------------
 // Maintain list of open embedded PDF files
@@ -279,15 +279,16 @@
 
 static void copyObject(Object *);
 
-static void copyName(char *s)
+static void copyName(const char *s)
 {
     pdf_puts("/");
-    for (; *s != 0; s++) {
-        if (isdigit(*s) || isupper(*s) || islower(*s) || *s == '_' ||
-            *s == '.' || *s == '-' || *s == '+')
-            pdfout(*s);
+    char *p = (char *)s;
+    for (; *p != 0; p++) {
+        if (isdigit(*p) || isupper(*p) || islower(*p) || *p == '_' ||
+            *p == '.' || *p == '-' || *p == '+')
+            pdfout(*p);
         else
-            pdf_printf("#%.2X", *s & 0xFF);
+            pdf_printf("#%.2X", *p & 0xFF);
     }
 }
 
@@ -296,7 +297,7 @@
     Object obj1;
     copyName(obj->dictGetKey(i));
     pdf_puts(" ");
-    obj1 = obj->dictGetValNF(i);
+    obj1 = obj->dictGetValNF(i).copy();
     copyObject(&obj1);
     pdf_puts("\n");
 }
@@ -314,7 +315,7 @@
 static void copyFontDict(Object * obj, InObj * r)
 {
     int i, l;
-    char *key;
+    const char *key;
     if (!obj->isDict())
         pdftex_fail("PDF inclusion: invalid dict type <%s>",
                     obj->getTypeName());
@@ -355,7 +356,7 @@
                     obj->getTypeName());
     pdf_puts("/ProcSet [ ");
     for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
-        procset = obj->arrayGetNF(i);
+        procset = obj->arrayGetNF(i).copy();
         if (!procset.isName())
             pdftex_fail("PDF inclusion: invalid ProcSet entry type <%s>",
                         procset.getTypeName());
@@ -410,7 +411,7 @@
     if (fontdict.isDict()) {
         subtype = fontdict.dictLookup("Subtype");
         basefont = fontdict.dictLookup("BaseFont");
-        fontdescRef = fontdict.dictLookupNF("FontDescriptor");
+        fontdescRef = fontdict.dictLookupNF("FontDescriptor").copy();
         if (fontdescRef.isRef()) {
             fontdesc = fontdescRef.fetch(xref);
         }
@@ -431,7 +432,7 @@
         charset = fontdesc.dictLookup("CharSet");
         if (!charset.isNull() &&
             charset.isString() && is_subsetable(fontmap))
-            epdf_mark_glyphs(fd, charset.getString()->getCString());
+            epdf_mark_glyphs(fd, (char *)charset.getString()->c_str());
         else
             embed_whole_font(fd);
         addFontDesc(fontdescRef.getRef(), fd);
@@ -456,9 +457,9 @@
                     obj->getTypeName());
     pdf_puts("/Font << ");
     for (i = 0, l = obj->dictGetLength(); i < l; ++i) {
-        fontRef = obj->dictGetValNF(i);
+        fontRef = obj->dictGetValNF(i).copy();
         if (fontRef.isRef())
-            copyFont(obj->dictGetKey(i), &fontRef);
+            copyFont((char *)obj->dictGetKey(i), &fontRef);
         else if (fontRef.isDict()) {   // some programs generate pdf with embedded font object
             copyName(obj->dictGetKey(i));
             pdf_puts(" ");
@@ -471,7 +472,7 @@
     pdf_puts(">>\n");
 }
 
-static void copyOtherResources(Object * obj, char *key)
+static void copyOtherResources(Object * obj, const char *key)
 {
     // copies all other resources (write_epdf handles Fonts and ProcSets),
 
@@ -559,7 +560,7 @@
     int i, l, c;
     Ref ref;
     char *p;
-    GString *s;
+    const GString *s;
     if (obj->isBool()) {
         pdf_printf("%s", obj->getBool()? "true" : "false");
     } else if (obj->isInt()) {
@@ -570,7 +571,7 @@
         pdf_printf("%s", convertNumToPDF(obj->getNum()));
     } else if (obj->isString()) {
         s = obj->getString();
-        p = s->getCString();
+        p = (char *)s->c_str();
         l = s->getLength();
         if (strlen(p) == (unsigned int) l) {
             pdf_puts("(");
@@ -599,7 +600,7 @@
     } else if (obj->isArray()) {
         pdf_puts("[");
         for (i = 0, l = obj->arrayGetLength(); i < l; ++i) {
-            obj1 = obj->arrayGetNF(i);
+            obj1 = obj->arrayGetNF(i).copy();
             if (!obj1.isName())
                 pdf_puts(" ");
             copyObject(&obj1);
@@ -659,7 +660,8 @@
 static void writeEncodings()
 {
     UsedEncoding *r, *n;
-    char *glyphNames[256], *s;
+    char *glyphNames[256];
+    const char *s;
     int i;
     for (r = encodingList; r != 0; r = r->next) {
         for (i = 0; i < 256; i++) {
@@ -669,7 +671,7 @@
                      " (try to disable font replacement to fix this)");
             }
             if ((s = ((Gfx8BitFont *) r->font)->getCharName(i)) != 0)
-                glyphNames[i] = s;
+                glyphNames[i] = (char *)s;
             else
                 glyphNames[i] = notdef;
         }
@@ -687,7 +689,7 @@
 }
 
 // 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();
@@ -719,7 +721,7 @@
 {
     PdfDocument *pdf_doc;
     Page *page;
-    PDFRectangle *pagebox;
+    const PDFRectangle *pagebox;
 #ifdef POPPLER_VERSION
     int pdf_major_version_found, pdf_minor_version_found;
 #else
@@ -728,8 +730,8 @@
     // initialize
     if (!isInit) {
         globalParams = new GlobalParams();
-        globalParams->setErrQuiet(gFalse);
-        isInit = gTrue;
+        globalParams->setErrQuiet(false);
+        isInit = true;
     }
     // open PDF file
     pdf_doc = find_add_document(image_name);
@@ -765,7 +767,7 @@
         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.num, ref.gen});
         if (page_num == 0)
             pdftex_fail("PDF inclusion: destination is not a page <%s>",
                         page_name);
@@ -826,7 +828,7 @@
     Object groupDict;
     bool writeSepGroup = false;
     Object info;
-    char *key;
+    const char *key;
     char s[256];
     int i, l;
     int rotate;
@@ -853,7 +855,7 @@
     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");
@@ -925,13 +927,13 @@
     pdf_puts(stripzeros(s));
 
     // Metadata validity check (as a stream it must be indirect)
-    dictObj = pageDict->lookupNF("Metadata");
+    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++) {
-        dictObj = pageDict->lookupNF(pageDictKeys[i]);
+        dictObj = pageDict->lookupNF(pageDictKeys[i]).copy();
         if (!dictObj.isNull()) {
             pdf_newline();
             pdf_printf("/%s ", pageDictKeys[i]);
@@ -940,7 +942,7 @@
     }
 
     // handle page group
-    dictObj = pageDict->lookupNF("Group");
+    dictObj = pageDict->lookupNF("Group").copy();
     if (!dictObj.isNull()) {
         if (pdfpagegroupval == 0) {
             // another pdf with page group was included earlier on the
@@ -981,8 +983,8 @@
             }
             l = dic1.getLength();
             for (i = 0; i < l; i++) {
-                groupDict.dictAdd(copyString(dic1.getKey(i)),
-                                  dic1.getValNF(i));
+                groupDict.dictAdd((const char *)copyString(dic1.getKey(i)),
+                                  dic1.getValNF(i).copy());
             }
 // end modification
             pdf_printf("/Group %ld 0 R\n", (long)pdfpagegroupval);
@@ -1004,7 +1006,7 @@
         pdf_newline();
         pdf_puts("/Resources <<\n");
         for (i = 0, l = obj1->dictGetLength(); i < l; ++i) {
-            obj2 = obj1->dictGetVal(i);
+            obj2 = obj1->dictGetVal(i).copy();
             key = obj1->dictGetKey(i);
             if (strcmp("Font", key) == 0)
                 copyFontResources(&obj2);
--- ./texk/web2c/luatexdir/image/pdftoepdf.w.original	2019-10-29 10:46:33.716686386 +0000
+++ ./texk/web2c/luatexdir/image/pdftoepdf.w	2019-10-29 10:58:13.095749896 +0000
@@ -29,9 +29,9 @@
     the functions of poppler, which happens to be written in C++.
 */
 
-extern void md5(Guchar *msg, int msgLen, Guchar *digest);
+extern void md5(unsigned char *msg, int msgLen, unsigned char *digest);
 
-static GBool isInit = gFalse;
+static bool isInit = false;
 
 /* Maintain AVL tree of all PDF files for embedding */
 
@@ -357,12 +357,12 @@
     pdf->cave = true;
 }
 
-static void copyString(PDF pdf, GooString * string)
+static void copyString(PDF pdf, const GooString * string)
 {
     char *p;
     unsigned char c;
     size_t i, l;
-    p = string->getCString();
+    p = const_cast<char *>(string->c_str());
     l = (size_t) string->getLength();
     if (pdf->cave)
         pdf_out(pdf, ' ');
@@ -389,15 +389,16 @@
     pdf->cave = true;
 }
 
-static void copyName(PDF pdf, char *s)
+static void copyName(PDF pdf, const char *s)
 {
     pdf_out(pdf, '/');
-    for (; *s != 0; s++) {
-        if (isdigit(*s) || isupper(*s) || islower(*s) || *s == '_' ||
-            *s == '.' || *s == '-' || *s == '+')
-            pdf_out(pdf, *s);
+    char *p = const_cast<char *>(s);
+    for (; *p != 0; p++) {
+        if (isdigit(*p) || isupper(*p) || islower(*p) || *p == '_' ||
+            *p == '.' || *p == '-' || *p == '+')
+            pdf_out(pdf, *p);
         else
-            pdf_printf(pdf, "#%.2X", *s & 0xFF);
+            pdf_printf(pdf, "#%.2X", *p & 0xFF);
     }
     pdf->cave = true;
 }
@@ -408,7 +409,7 @@
     Object obj1;
     pdf_begin_array(pdf);
     for (i = 0, l = array->getLength(); i < l; ++i) {
-        obj1 = array->getNF(i);
+        obj1 = array->getNF(i).copy();
         copyObject(pdf, pdf_doc, &obj1);
     }
     pdf_end_array(pdf);
@@ -421,7 +422,7 @@
     pdf_begin_dict(pdf);
     for (i = 0, l = dict->getLength(); i < l; ++i) {
         copyName(pdf, dict->getKey(i));
-        obj1 = dict->getValNF(i);
+        obj1 = dict->getValNF(i).copy();
         copyObject(pdf, pdf_doc, &obj1);
     }
     pdf_end_dict(pdf);
@@ -523,7 +524,7 @@
 
 /* get the pagebox coordinates according to the pagebox_spec */
 
-static PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
+static const PDFRectangle *get_pagebox(Page * page, int pagebox_spec)
 {
     switch (pagebox_spec) {
         case PDF_BOX_SPEC_MEDIA:
@@ -580,14 +581,14 @@
     Catalog *catalog;
     Page *page;
     int rotate;
-    PDFRectangle *pagebox;
+    const PDFRectangle *pagebox;
     int pdf_major_version_found, pdf_minor_version_found;
     float xsize, ysize, xorig, yorig;
-    if (isInit == gFalse) {
+    if (isInit == false) {
         if (!(globalParams))
             globalParams = new GlobalParams();
-        globalParams->setErrQuiet(gFalse);
-        isInit = gTrue;
+        globalParams->setErrQuiet(false);
+        isInit = true;
     }
     if (img_type(idict) == IMG_TYPE_PDF)
         pdf_doc = refPdfDocument(img_filepath(idict), FE_FAIL);
@@ -626,7 +627,7 @@
         if (link == NULL || !link->isOk())
             formatted_error("pdf inclusion","invalid destination '%s'",img_pagename(idict));
         Ref ref = link->getPageRef();
-        img_pagenum(idict) = catalog->findPage(ref.num, ref.gen);
+        img_pagenum(idict) = catalog->findPage({ref.num, ref.gen});
         if (img_pagenum(idict) == 0)
             formatted_error("pdf inclusion","destination is not a page '%s'",img_pagename(idict));
         delete link;
@@ -717,7 +718,7 @@
     Ref *pageref;
     Dict *pageDict;
     Object obj1, contents, pageobj, pagesobj1, pagesobj2, *op1, *op2, *optmp;
-    PDFRectangle *pagebox;
+    const PDFRectangle *pagebox;
     int i, l;
     double bbox[4];
     /* char s[256]; */
@@ -784,12 +785,12 @@
         Now all relevant parts of the Page dictionary are copied. Metadata validity
         check is needed(as a stream it must be indirect).
     */
-    obj1 = pageDict->lookupNF("Metadata");
+    obj1 = pageDict->lookupNF("Metadata").copy();
     if (!obj1.isNull() && !obj1.isRef())
         formatted_warning("pdf inclusion","/Metadata must be indirect object");
     /* copy selected items in Page dictionary */
     for (i = 0; pagedictkeys[i] != NULL; i++) {
-        obj1 = pageDict->lookupNF(pagedictkeys[i]);
+        obj1 = pageDict->lookupNF(pagedictkeys[i]).copy();
         if (!obj1.isNull()) {
             pdf_add_name(pdf, pagedictkeys[i]);
             /* preserves indirection */
@@ -802,13 +803,13 @@
         PDF file, climbing up the tree until the Resources are found.
         (This fixes a problem with Scribus 1.3.3.14.)
     */
-    obj1 = pageDict->lookupNF("Resources");
+    obj1 = pageDict->lookupNF("Resources").copy();
     if (obj1.isNull()) {
         op1 = &pagesobj1;
         op2 = &pagesobj2;
         *op1 = pageDict->lookup("Parent");
         while (op1->isDict()) {
-            obj1 = op1->dictLookupNF("Resources");
+            obj1 = op1->dictLookupNF("Resources").copy();
             if (!obj1.isNull()) {
                 pdf_add_name(pdf, "Resources");
                 copyObject(pdf, pdf_doc, &obj1);
@@ -956,7 +957,7 @@
     if (PdfDocumentTree != NULL)
         avl_destroy(PdfDocumentTree, destroyPdfDocument);
     PdfDocumentTree = NULL;
-    if (isInit == gTrue)
+    if (isInit == true)
         delete globalParams;
-    isInit = gFalse;
+    isInit = false;
 }
--- ./texk/web2c/pdftexdir/pdftex-common.h.original	2019-10-29 11:19:40.728778850 +0000
+++ ./texk/web2c/pdftexdir/pdftex-common.h	2019-10-29 11:19:53.520822186 +0000
@@ -76,7 +76,7 @@
 extern char notdef[];
 
 /* mapfile.c */
-extern fm_entry *lookup_fontmap(char *);
+extern fm_entry *lookup_fontmap(const char *);
 #undef fd_entry
 #undef fm_entry
 
--- ./texk/web2c/xetexdir/pdfimage.cpp.original	2019-10-29 12:19:09.971269148 +0000
+++ ./texk/web2c/xetexdir/pdfimage.cpp	2019-10-29 12:19:22.147368792 +0000
@@ -78,7 +78,7 @@
 
 	Page*		page = doc->getCatalog()->getPage(page_num);
 
-	PDFRectangle*	r;
+	const PDFRectangle*	r;
 	switch (pdf_box) {
 		default:
 		case pdfbox_crop:
openSUSE Build Service is sponsored by