From 2f77decfd2340c9a241dc508ae984a93dfef2643 Mon Sep 17 00:00:00 2001 From: Andreas Sturmlechner Date: Sat, 12 Jan 2019 21:43:29 +0100 Subject: [PATCH 2/2] Fix build with poppler-0.71.0 Thanks-to: maurerpe --- texk/web2c/luatexdir/image/pdftoepdf.w | 10 +++++----- texk/web2c/luatexdir/lua/lepdflib.cc | 18 +++++++++--------- texk/web2c/pdftexdir/pdftex-common.h | 2 +- texk/web2c/pdftexdir/pdftoepdf.cc | 20 ++++++++++---------- texk/web2c/pdftexdir/writeenc.c | 2 +- texk/web2c/xetexdir/pdfimage.cpp | 2 +- 6 files changed, 27 insertions(+), 27 deletions(-) diff --git a/texk/web2c/luatexdir/image/pdftoepdf.w b/texk/web2c/luatexdir/image/pdftoepdf.w index 0a23b201..aa1d7f25 100644 --- a/texk/web2c/luatexdir/image/pdftoepdf.w +++ b/texk/web2c/luatexdir/image/pdftoepdf.w @@ -363,7 +363,7 @@ void copyReal(PDF pdf, double d) static void copyString(PDF pdf, GooString * string) { - char *p; + const char *p; unsigned char c; size_t i, l; p = string->getCString(); @@ -393,7 +393,7 @@ static void copyString(PDF pdf, GooString * string) 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++) { @@ -527,7 +527,7 @@ static void writeRefs(PDF pdf, PdfDocument * pdf_doc) /* 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: @@ -584,7 +584,7 @@ void read_pdf_info(image_dict * idict) 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 == false) { @@ -721,7 +721,7 @@ void write_epdf(PDF pdf, image_dict * idict, int suppress_optional_info) 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]; */ diff --git a/texk/web2c/luatexdir/lua/lepdflib.cc b/texk/web2c/luatexdir/lua/lepdflib.cc index d47ec941..01f9415c 100644 --- a/texk/web2c/luatexdir/lua/lepdflib.cc +++ b/texk/web2c/luatexdir/lua/lepdflib.cc @@ -238,7 +238,7 @@ static int l_new_Attribute(lua_State * L) 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,7 @@ static int m_##in##_##function(lua_State * L) \ 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 = (out *) ((in *) uin->d)->function(); \ if (o != NULL) { \ uout = new_##out##_userdata(L); \ uout->d = o; \ @@ -972,12 +972,12 @@ m_poppler_get_INT(Dict, getLength); static int m_Dict_add(lua_State * L) { - char *s; + const char *s; udstruct *uin, *uobj; uin = (udstruct *) luaL_checkudata(L, 1, M_Dict); if (uin->pd != NULL && uin->pd->pc != uin->pc) pdfdoc_changed_error(L); - s = copyString(luaL_checkstring(L, 2)); + s = luaL_checkstring(L, 2); uobj = (udstruct *) luaL_checkudata(L, 3, M_Object); ((Dict *) uin->d)->add(s, std::move(*((Object *) uobj->d))); return 0; @@ -1894,7 +1894,7 @@ static int m_Object_dictAdd(lua_State * L) 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; } @@ -2308,7 +2308,7 @@ m_PDFDoc_INT(getErrorCode); 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) @@ -2396,7 +2396,7 @@ m_PDFDoc_INT(getNumPages); 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) @@ -2414,7 +2414,7 @@ static int m_PDFDoc_readMetadata(lua_State * L) static int m_PDFDoc_getStructTreeRoot(lua_State * L) { - StructTreeRoot *obj; + const StructTreeRoot *obj; udstruct *uin, *uout; uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc); if (uin->pd != NULL && uin->pd->pc != uin->pc) @@ -2422,7 +2422,7 @@ static int m_PDFDoc_getStructTreeRoot(lua_State * L) if (((PdfDocument *) uin->d)->doc->getCatalog()->isOk()) { obj = ((PdfDocument *) uin->d)->doc->getStructTreeRoot(); uout = new_StructTreeRoot_userdata(L); - uout->d = obj; + uout->d = (StructTreeRoot *) obj; uout->pc = uin->pc; uout->pd = uin->pd; } else diff --git a/texk/web2c/pdftexdir/pdftex-common.h b/texk/web2c/pdftexdir/pdftex-common.h index 307ba64a..09741707 100644 --- a/texk/web2c/pdftexdir/pdftex-common.h +++ b/texk/web2c/pdftexdir/pdftex-common.h @@ -101,7 +101,7 @@ extern void tex_printf(const char *, ...); extern void write_epdf(void); /* writeenc.c */ -extern void epdf_write_enc(char **, int); +extern void epdf_write_enc(const char **, int); /* writeimg.c */ extern float epdf_width; diff --git a/texk/web2c/pdftexdir/pdftoepdf.cc b/texk/web2c/pdftexdir/pdftoepdf.cc index af12c74e..e353b652 100644 --- a/texk/web2c/pdftexdir/pdftoepdf.cc +++ b/texk/web2c/pdftexdir/pdftoepdf.cc @@ -270,7 +270,7 @@ static int getNewObjectNumber(Ref ref) static void copyObject(Object *); -static void copyName(char *s) +static void copyName(const char *s) { pdf_puts("/"); for (; *s != 0; s++) { @@ -305,7 +305,7 @@ static void copyDict(Object * obj) 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()); @@ -377,7 +377,7 @@ static bool embeddableFont(Object * fontdesc) return false; } -static void copyFont(char *tag, Object * fontRef) +static void copyFont(const char *tag, Object * fontRef) { Object fontdict, subtype, basefont, fontdescRef, fontdesc, charset, stemV; @@ -462,7 +462,7 @@ static void copyFontResources(Object * obj) 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), @@ -549,7 +549,7 @@ static void copyObject(Object * obj) Object obj1; int i, l, c; Ref ref; - char *p; + const char *p; GString *s; if (obj->isBool()) { pdf_printf("%s", obj->getBool()? "true" : "false"); @@ -650,7 +650,7 @@ static void writeRefs() static void writeEncodings() { UsedEncoding *r, *n; - char *glyphNames[256], *s; + const char *glyphNames[256], *s; int i; for (r = encodingList; r != 0; r = r->next) { for (i = 0; i < 256; i++) { @@ -678,7 +678,7 @@ static void writeEncodings() } // 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(); @@ -710,7 +710,7 @@ 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 @@ -829,7 +829,7 @@ void write_epdf(void) Object groupDict; bool writeSepGroup = false; Object info; - char *key; + const char *key; char s[256]; int i, l; int rotate; @@ -856,7 +856,7 @@ void write_epdf(void) 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"); diff --git a/texk/web2c/pdftexdir/writeenc.c b/texk/web2c/pdftexdir/writeenc.c index bd55103f..08f44633 100644 --- a/texk/web2c/pdftexdir/writeenc.c +++ b/texk/web2c/pdftexdir/writeenc.c @@ -83,7 +83,7 @@ fe_entry *get_fe_entry(char *s) /**********************************************************************/ -void epdf_write_enc(char **glyph_names, int fe_objnum) +void epdf_write_enc(const char **glyph_names, int fe_objnum) { int i, i_old; assert(glyph_names != NULL); diff --git a/texk/web2c/xetexdir/pdfimage.cpp b/texk/web2c/xetexdir/pdfimage.cpp index 85389136..ce46cae1 100644 --- a/texk/web2c/xetexdir/pdfimage.cpp +++ b/texk/web2c/xetexdir/pdfimage.cpp @@ -78,7 +78,7 @@ pdf_get_rect(char* filename, int page_num, int pdf_box, realrect* box) Page* page = doc->getCatalog()->getPage(page_num); - PDFRectangle* r; + const PDFRectangle* r; switch (pdf_box) { default: case pdfbox_crop: -- 2.20.1