Accepting request 662394 from Publishing:TeXLive

- Add patches for poppler 0.72:
  * Rebase/extend source-fix-const-poppler0.66.0.patch and apply for
    all versions using pdf*-newpoppler.cc
  * source-fix-bool-poppler.patch
  * source-poppler-use-std_string.patch
  * source-poppler-fix-dict-memleak.patch
- Add source-lua-fix-bad-compare.patch
- Drop source-lua-poppler0640.dif, instead of casting the const's
  away, add const where appropriate (forwarded request 661288 from StefanBruens)

OBS-URL: https://build.opensuse.org/request/show/662394
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/texlive?expand=0&rev=52
This commit is contained in:
Dominique Leuenberger 2019-01-08 11:18:02 +00:00 committed by Git OBS Bridge
commit 0de979177a
8 changed files with 809 additions and 47 deletions

View File

@ -0,0 +1,176 @@
From 497c0e42d91d78837ddca8906bf7246c93654d41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Sat, 22 Dec 2018 00:25:44 +0100
Subject: [PATCH] Use bool instead of GBool
---
luatexdir/image/pdftoepdf.w | 12 ++++++------
luatexdir/lua/lepdflib.cc | 20 ++++++++++----------
pdftexdir/pdftoepdf.cc | 6 +++---
pdftexdir/pdftosrc.cc | 4 ++--
4 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/texk/web2c/luatexdir/image/pdftoepdf.w b/texk/web2c/luatexdir/image/pdftoepdf.w
index 7ba2973..dedc489 100644
--- a/texk/web2c/luatexdir/image/pdftoepdf.w
+++ b/texk/web2c/luatexdir/image/pdftoepdf.w
@@ -35,7 +35,7 @@
extern void md5(Guchar *msg, int msgLen, Guchar *digest);
-static GBool isInit = gFalse;
+static bool isInit = false;
/* Maintain AVL tree of all PDF files for embedding */
@@ -587,11 +587,11 @@ void read_pdf_info(image_dict * idict)
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);
@@ -966,7 +966,7 @@ void epdf_free()
if (PdfDocumentTree != NULL)
avl_destroy(PdfDocumentTree, destroyPdfDocument);
PdfDocumentTree = NULL;
- if (isInit == gTrue)
+ if (isInit == true)
delete globalParams;
- isInit = gFalse;
+ isInit = false;
}
diff --git a/texk/web2c/luatexdir/lua/lepdflib.cc b/texk/web2c/luatexdir/lua/lepdflib.cc
index a16bf3b..36f1601 100644
--- a/texk/web2c/luatexdir/lua/lepdflib.cc
+++ b/texk/web2c/luatexdir/lua/lepdflib.cc
@@ -439,7 +439,7 @@ static int l_new_Object(lua_State * L)
break;
case 1:
if (lua_isboolean (L,1)) {
- uout->d = new Object(lua_toboolean(L, 1)? gTrue : gFalse);
+ uout->d = new Object(lua_toboolean(L, 1)? true : false);
uout->atype = ALLOC_LEPDF;
uout->pc = 0;
uout->pd = NULL;
@@ -1527,9 +1527,9 @@ static int m_Object_initBool(lua_State * L)
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;
}
@@ -3038,12 +3038,12 @@ m_poppler_get_BOOL(Attribute, isHidden);
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 = lua_toboolean(L, 2);
((Attribute *) uin->d)->setHidden(i);
return 0;
}
@@ -3180,7 +3180,7 @@ static int m_StructElement_getParentRef(lua_State * L)
// 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);
@@ -3226,13 +3226,13 @@ static int m_StructElement_setRevision(lua_State * L)
static int m_StructElement_getText(lua_State * L)
{
- GBool i;
+ bool i;
const 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 = lua_toboolean(L, 2);
gs = ((StructElement *) uin->d)->getText(i);
if (gs != NULL)
lua_pushlstring(L, gs->getCString(), gs->getLength());
@@ -3321,7 +3321,7 @@ static int m_StructElement_findAttribute(lua_State * L)
{
Attribute::Type t;
Attribute::Owner o;
- GBool g;
+ bool g;
udstruct *uin, *uout;
const Attribute *a;
uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement);
@@ -3329,7 +3329,7 @@ static int m_StructElement_findAttribute(lua_State * L)
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 = lua_toboolean(L, 3);
a = ((StructElement *) uin->d)->findAttribute(t,g,o);
if (a!=NULL){
diff --git a/texk/web2c/pdftexdir/pdftoepdf.cc b/texk/web2c/pdftexdir/pdftoepdf.cc
index 013cf13..d26ac61 100644
--- a/texk/web2c/pdftexdir/pdftoepdf.cc
+++ b/texk/web2c/pdftexdir/pdftoepdf.cc
@@ -120,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
@@ -724,8 +724,8 @@ read_pdf_info(char *image_name, char *page_name, int page_num,
// 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);
diff --git a/texk/web2c/pdftexdir/pdftosrc.cc b/texk/web2c/pdftexdir/pdftosrc.cc
index 3b1d250..7dbee00 100644
--- a/texk/web2c/pdftexdir/pdftosrc.cc
+++ b/texk/web2c/pdftexdir/pdftosrc.cc
@@ -173,9 +173,9 @@ 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, lexer, false);
for (n = 0; n < nObjects; ++n) {
obj1 = parser->getObj();
obj2 = parser->getObj();
--
2.19.2

View File

@ -2,7 +2,7 @@ Index: texk/web2c/pdftexdir/pdftosrc.cc
===================================================================
--- texk/web2c/pdftexdir/pdftosrc.cc
+++ texk/web2c/pdftexdir/pdftosrc.cc
@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
@@ -72,7 +72,7 @@ int main(int argc, char *argv[])
Stream *s;
Object srcStream, srcName, catalogDict;
FILE *outfile;
@ -15,7 +15,7 @@ Index: texk/web2c/pdftexdir/pdftoepdf.cc
===================================================================
--- texk/web2c/pdftexdir/pdftoepdf.cc
+++ texk/web2c/pdftexdir/pdftoepdf.cc
@@ -306,7 +306,7 @@ static int getNewObjectNumber(Ref ref)
@@ -279,7 +279,7 @@ static int getNewObjectNumber(Ref ref)
static void copyObject(Object *);
@ -24,7 +24,7 @@ Index: texk/web2c/pdftexdir/pdftoepdf.cc
{
pdf_puts("/");
for (; *s != 0; s++) {
@@ -318,7 +318,7 @@ static void copyName(char *s)
@@ -291,7 +291,7 @@ static void copyName(char *s)
}
}
@ -33,7 +33,7 @@ Index: texk/web2c/pdftexdir/pdftoepdf.cc
{
Object obj1;
copyName(obj->dictGetKey(i));
@@ -328,7 +328,7 @@ static void copyDictEntry(Object * obj,
@@ -301,7 +301,7 @@ static void copyDictEntry(Object * obj,
pdf_puts("\n");
}
@ -42,7 +42,7 @@ Index: texk/web2c/pdftexdir/pdftoepdf.cc
{
int i, l;
if (!obj->isDict())
@@ -338,7 +338,7 @@ static void copyDict(Object * obj)
@@ -311,10 +311,10 @@ static void copyDict(Object * obj)
copyDictEntry(obj, i);
}
@ -50,8 +50,12 @@ Index: texk/web2c/pdftexdir/pdftoepdf.cc
+static void copyFontDict(const Object * obj, InObj * r)
{
int i, l;
char *key;
@@ -394,7 +394,7 @@ static void copyProcSet(Object * obj)
- char *key;
+ const char *key;
if (!obj->isDict())
pdftex_fail("PDF inclusion: invalid dict type <%s>",
obj->getTypeName());
@@ -386,7 +386,7 @@ static void copyProcSet(Object * obj)
return false;
}
@ -60,7 +64,16 @@ Index: texk/web2c/pdftexdir/pdftoepdf.cc
{
Object fontdict, subtype, basefont, fontdescRef, fontdesc, charset,
stemV;
@@ -561,8 +561,8 @@ static void copyObject(Object * obj)
@@ -471,7 +471,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),
@@ -558,8 +558,8 @@ static void copyObject(Object * obj)
Object obj1;
int i, l, c;
Ref ref;
@ -71,6 +84,51 @@ Index: texk/web2c/pdftexdir/pdftoepdf.cc
if (obj->isBool()) {
pdf_printf("%s", obj->getBool()? "true" : "false");
} else if (obj->isInt()) {
@@ -662,7 +662,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++) {
@@ -690,7 +690,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();
@@ -722,7 +722,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");
Index: texk/web2c/pdftexdir/epdf.c
===================================================================
--- texk/web2c/pdftexdir/epdf.c
@ -119,3 +177,264 @@ Index: texk/web2c/pdftexdir/pdftex-common.h
#undef fd_entry
#undef fm_entry
@@ -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;
Index: texk/web2c/pdftexdir/writeenc.c
===================================================================
--- texk/web2c/pdftexdir/writeenc.c
+++ 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);
Index: texk/web2c/luatexdir/image/pdftoepdf.w
===================================================================
--- texk/web2c/luatexdir/image/pdftoepdf.w
+++ texk/web2c/luatexdir/image/pdftoepdf.w
@@ -361,9 +361,9 @@ void copyReal(PDF pdf, double d)
pdf->cave = true;
}
-static void copyString(PDF pdf, GooString * string)
+static void copyString(PDF pdf, const 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 == gFalse) {
@@ -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]; */
Index: texk/web2c/luatexdir/lua/lepdflib.cc
===================================================================
--- texk/web2c/luatexdir/lua/lepdflib.cc
+++ texk/web2c/luatexdir/lua/lepdflib.cc
@@ -591,7 +591,7 @@ static const struct luaL_Reg epdflib_f[] = {
#define m_poppler_get_poppler(in, out, function) \
static int m_##in##_##function(lua_State * L) \
{ \
- out *o; \
+ const out *o; \
udstruct *uin, *uout; \
uin = (udstruct *) luaL_checkudata(L, 1, M_##in); \
if (uin->pd != NULL && uin->pd->pc != uin->pc) \
@@ -599,7 +599,8 @@ static int m_##in##_##function(lua_State * L) \
o = ((in *) uin->d)->function(); \
if (o != NULL) { \
uout = new_##out##_userdata(L); \
- uout->d = o; \
+ uout->d = (void *)(o); \
+ uout->atype = ALLOC_POPPLER; \
uout->pc = uin->pc; \
uout->pd = uin->pd; \
} else \
@@ -669,7 +670,7 @@ static int m_##in##_##function(lua_State * L) \
#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) \
@@ -1807,7 +1808,7 @@ static int m_Object_getNum(lua_State * L)
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)
@@ -2465,7 +2466,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)
@@ -2553,7 +2554,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)
@@ -2571,7 +2572,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)
@@ -2579,7 +2580,8 @@ 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 = (void *)(obj);
+ uout->atype = ALLOC_POPPLER;
uout->pc = uin->pc;
uout->pd = uin->pd;
} else
@@ -2610,7 +2612,7 @@ static int m_PDFDoc_findPage(lua_State * L)
static int m_PDFDoc_getLinks(lua_State * L)
{
int i, pages;
- Links *links;
+ const Links *links;
udstruct *uin, *uout;
uin = (udstruct *) luaL_checkudata(L, 1, M_PDFDoc);
if (uin->pd != NULL && uin->pd->pc != uin->pc)
@@ -2621,7 +2623,8 @@ static int m_PDFDoc_getLinks(lua_State * L)
links = ((PdfDocument *) uin->d)->doc->getLinks(i);
if (links != NULL) {
uout = new_Links_userdata(L);
- uout->d = links;
+ uout->d = (void *)(links);
+ uout->atype = ALLOC_POPPLER;
uout->pc = uin->pc;
uout->pd = uin->pd;
} else
@@ -2634,7 +2637,7 @@ static int m_PDFDoc_getLinks(lua_State * L)
static int m_PDFDoc_findDest(lua_State * L)
{
GooString *name;
- LinkDest *dest;
+ const LinkDest *dest;
const char *s;
size_t len;
udstruct *uin, *uout;
@@ -2647,7 +2650,8 @@ static int m_PDFDoc_findDest(lua_State * L)
dest = ((PdfDocument *) uin->d)->doc->findDest(name);
if (dest != NULL) {
uout = new_LinkDest_userdata(L);
- uout->d = dest;
+ uout->d = (void *)(dest);
+ uout->atype = ALLOC_POPPLER;
uout->pc = uin->pc;
uout->pd = uin->pd;
} else
@@ -3227,7 +3231,7 @@ static int m_StructElement_setRevision(lua_State * L)
static int m_StructElement_getText(lua_State * L)
{
GBool i;
- GooString *gs;
+ const GooString *gs;
udstruct *uin;
uin = (udstruct *) luaL_checkudata(L, 1, M_StructElement);
if (uin->pd != NULL && uin->pd->pc != uin->pc)
Index: texk/web2c/xetexdir/pdfimage.cpp
===================================================================
--- texk/web2c/xetexdir/pdfimage.cpp
+++ 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:
@@ -98,32 +98,33 @@ pdf_get_rect(char* filename, int page_num, int pdf_box, realrect* box)
break;
}
+ PDFRectangle r2 = *r;
int RotAngle = 0;
RotAngle = (int)page->getRotate() % 360;
if (RotAngle < 0)
RotAngle += 360;
if (RotAngle == 90 || RotAngle == 270) {
double tmpvalue;
- if (r->x1 > r->x2) {
- tmpvalue = r->x1;
- r->x1 = r->x2;
- r->x2 = tmpvalue;
+ if (r2.x1 > r2.x2) {
+ tmpvalue = r2.x1;
+ r2.x1 = r2.x2;
+ r2.x2 = tmpvalue;
}
- if (r->y1 > r->y2) {
- tmpvalue = r->y1;
- r->y1 = r->y2;
- r->y2 = tmpvalue;
+ if (r2.y1 > r2.y2) {
+ tmpvalue = r2.y1;
+ r2.y1 = r2.y2;
+ r2.y2 = tmpvalue;
}
- tmpvalue = r->x2;
- r->x2 = r->x1 + r->y2 - r->y1;
- r->y2 = r->y1 + tmpvalue - r->x1;
+ tmpvalue = r2.x2;
+ r2.x2 = r2.x1 + r2.y2 - r2.y1;
+ r2.y2 = r2.y1 + tmpvalue - r2.x1;
}
- box->x = 72.27 / 72 * my_fmin(r->x1, r->x2);
- box->y = 72.27 / 72 * my_fmin(r->y1, r->y2);
- box->wd = 72.27 / 72 * fabs(r->x2 - r->x1);
- box->ht = 72.27 / 72 * fabs(r->y2 - r->y1);
+ box->x = 72.27 / 72 * my_fmin(r2.x1, r2.x2);
+ box->y = 72.27 / 72 * my_fmin(r2.y1, r2.y2);
+ box->wd = 72.27 / 72 * fabs(r2.x2 - r2.x1);
+ box->ht = 72.27 / 72 * fabs(r2.y2 - r2.y1);
delete doc;

View File

@ -0,0 +1,47 @@
From bcac61bbec874191c5efa748be5246e0a6835d38 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Sat, 22 Dec 2018 03:37:33 +0100
Subject: [PATCH] Fix tautological (always false) compare
The current code compares the PDF document change counter with itself, which
is always false. Compare change counter of the wrapped document with the
counter of the wrapper instead.
---
luatexdir/lua/lepdflib.cc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/texk/web2c/luatexdir/lua/lepdflib.cc b/texk/web2c/luatexdir/lua/lepdflib.cc
index 795550e..63fcc11 100644
--- a/texk/web2c/luatexdir/lua/lepdflib.cc
+++ b/texk/web2c/luatexdir/lua/lepdflib.cc
@@ -1966,7 +1966,7 @@ static int m_Object_arrayAdd(lua_State * L)
if (uin->pd != NULL && uobj->pd != NULL && uin->pd != uobj->pd)
pdfdoc_differs_error(L);
if ((uin->pd != NULL && uin->pd->pc != uin->pc)
- || (uobj->pd != NULL && uobj->pd->pc != uobj->pd->pc))
+ || (uobj->pd != NULL && uobj->pd->pc != uobj->pc))
pdfdoc_changed_error(L);
if (!((Object *) uin->d)->isArray())
luaL_error(L, "Object is not an Array");
@@ -2047,7 +2047,7 @@ static int m_Object_dictAdd(lua_State * L)
if (uin->pd != NULL && uobj->pd != NULL && uin->pd != uobj->pd)
pdfdoc_differs_error(L);
if ((uin->pd != NULL && uin->pd->pc != uin->pc)
- || (uobj->pd != NULL && uobj->pd->pc != uobj->pd->pc))
+ || (uobj->pd != NULL && uobj->pd->pc != uobj->pc))
pdfdoc_changed_error(L);
if (!((Object *) uin->d)->isDict())
luaL_error(L, "Object is not a Dict");
@@ -2065,7 +2065,7 @@ static int m_Object_dictSet(lua_State * L)
if (uin->pd != NULL && uobj->pd != NULL && uin->pd != uobj->pd)
pdfdoc_differs_error(L);
if ((uin->pd != NULL && uin->pd->pc != uin->pc)
- || (uobj->pd != NULL && uobj->pd->pc != uobj->pd->pc))
+ || (uobj->pd != NULL && uobj->pd->pc != uobj->pc))
pdfdoc_changed_error(L);
if (!((Object *) uin->d)->isDict())
luaL_error(L, "Object is not a Dict");
--
2.19.2

View File

@ -1,35 +0,0 @@
--- texk/web2c/luatexdir/image/pdftoepdf.w
+++ texk/web2c/luatexdir/image/pdftoepdf.w Mon Apr 23 17:29:28 2018
@@ -472,10 +472,10 @@
break;
*/
case objString:
- copyString(pdf, obj->getString());
+ copyString(pdf, (GooString *)obj->getString());
break;
case objName:
- copyName(pdf, obj->getName());
+ copyName(pdf, (char *)obj->getName());
break;
case objNull:
pdf_add_null(pdf);
--- texk/web2c/luatexdir/lua/lepdflib.cc
+++ texk/web2c/luatexdir/lua/lepdflib.cc Mon Apr 23 17:29:12 2018
@@ -674,7 +674,7 @@
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(); \
+ gs = (GooString *)((in *) uin->d)->function(); \
if (gs != NULL) \
lua_pushlstring(L, gs->getCString(), gs->getLength()); \
else \
@@ -1813,7 +1813,7 @@
if (uin->pd != NULL && uin->pd->pc != uin->pc)
pdfdoc_changed_error(L);
if (((Object *) uin->d)->isString()) {
- gs = ((Object *) uin->d)->getString();
+ gs = (GooString *)((Object *) uin->d)->getString();
lua_pushlstring(L, gs->getCString(), gs->getLength());
} else
lua_pushnil(L);

View File

@ -0,0 +1,54 @@
From 599cc7afea4c418ff9eff1bd3b4b3d4f157162e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Sat, 22 Dec 2018 03:00:04 +0100
Subject: [PATCH] Avoid leaking string copy
---
luatexdir/lua/lepdflib.cc | 4 ++--
pdftexdir/pdftoepdf.cc | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/luatexdir/lua/lepdflib.cc b/luatexdir/lua/lepdflib.cc
index 6ac6f7a..8239518 100644
--- a/texk/web2c/luatexdir/lua/lepdflib.cc
+++ b/texk/web2c/luatexdir/lua/lepdflib.cc
@@ -1125,12 +1125,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;
@@ -2051,7 +2051,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;
}
diff --git a/pdftexdir/pdftoepdf.cc b/pdftexdir/pdftoepdf.cc
index 98156ca..2ea5555 100644
--- a/texk/web2c/pdftexdir/pdftoepdf.cc
+++ b/texk/web2c/pdftexdir/pdftoepdf.cc
@@ -977,7 +977,7 @@ The changes below seem to work fine.
}
l = dic1.getLength();
for (i = 0; i < l; i++) {
- groupDict.dictAdd(copyString(dic1.getKey(i)),
+ groupDict.dictAdd(dic1.getKey(i),
dic1.getValNF(i));
}
// end modification
--
2.19.2

View File

@ -0,0 +1,175 @@
From 2ba61d7e191d753ce9f8bfeed1dacf0922ff8a1f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Br=C3=BCns?= <stefan.bruens@rwth-aachen.de>
Date: Sat, 22 Dec 2018 00:42:23 +0100
Subject: [PATCH] std::string
---
luatexdir/image/pdftoepdf.w | 2 +-
luatexdir/lua/lepdflib.cc | 20 ++++++++++++--------
pdftexdir/pdftoepdf.cc | 6 +++---
pdftexdir/pdftosrc.cc | 6 +++---
4 files changed, 19 insertions(+), 15 deletions(-)
diff --git a/texk/web2c/luatexdir/image/pdftoepdf.w b/texk/web2c/luatexdir/image/pdftoepdf.w
index dedc489..241bf1d 100644
--- a/texk/web2c/luatexdir/image/pdftoepdf.w
+++ b/texk/web2c/luatexdir/image/pdftoepdf.w
@@ -366,7 +366,7 @@ static void copyString(PDF pdf, const GooString * string)
const char *p;
unsigned char c;
size_t i, l;
- p = string->getCString();
+ p = string->c_str();
l = (size_t) string->getLength();
if (pdf->cave)
pdf_out(pdf, ' ');
diff --git a/texk/web2c/luatexdir/lua/lepdflib.cc b/texk/web2c/luatexdir/lua/lepdflib.cc
index 36f1601..b816745 100644
--- a/texk/web2c/luatexdir/lua/lepdflib.cc
+++ b/texk/web2c/luatexdir/lua/lepdflib.cc
@@ -240,7 +240,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({n, nlen}, (Object *)uobj->d);
uout->atype = ALLOC_LEPDF;
uout->pc = uobj->pc;
uout->pd = uobj->pd;
@@ -677,7 +677,7 @@ static int m_##in##_##function(lua_State * L) \
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; \
@@ -912,7 +912,7 @@ static int m_Array_getString(lua_State * L)
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;
@@ -1064,7 +1064,7 @@ static int m_Catalog_getJS(lua_State * L)
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;
@@ -1379,7 +1379,7 @@ static int m_GooString__tostring(lua_State * L)
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;
}
@@ -1815,7 +1815,7 @@ static int m_Object_getString(lua_State * L)
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;
@@ -2473,7 +2473,7 @@ static int m_PDFDoc_getFileName(lua_State * L)
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;
@@ -2562,7 +2562,7 @@ static int m_PDFDoc_readMetadata(lua_State * L)
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
@@ -3239,7 +3239,7 @@ static int m_StructElement_getText(lua_State * L)
i = 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;
diff --git a/texk/web2c/pdftexdir/pdftoepdf.cc b/texk/web2c/pdftexdir/pdftoepdf.cc
index d26ac61..7c14570 100644
--- a/texk/web2c/pdftexdir/pdftoepdf.cc
+++ b/texk/web2c/pdftexdir/pdftoepdf.cc
@@ -22,7 +22,7 @@ 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.59.0 or newer versions.
+The poppler should be 0.72.0 or newer versions.
POPPLER_VERSION should be defined.
*/
@@ -427,7 +427,7 @@ static void copyFont(const char *tag, Object * fontRef)
charset = fontdesc.dictLookup("CharSet");
if (!charset.isNull() &&
charset.isString() && is_subsetable(fontmap))
- epdf_mark_glyphs(fd, charset.getString()->getCString());
+ epdf_mark_glyphs(fd, charset.getString()->c_str());
else
embed_whole_font(fd);
addFontDesc(fontdescRef.getRef(), fd);
@@ -566,7 +566,7 @@ static void copyObject(Object * obj)
pdf_printf("%s", convertNumToPDF(obj->getNum()));
} else if (obj->isString()) {
s = obj->getString();
- p = s->getCString();
+ p = s->c_str();
l = s->getLength();
if (strlen(p) == (unsigned int) l) {
pdf_puts("(");
diff --git a/texk/web2c/pdftexdir/pdftosrc.cc b/texk/web2c/pdftexdir/pdftosrc.cc
index 7dbee00..cc44daf 100644
--- a/texk/web2c/pdftexdir/pdftosrc.cc
+++ b/texk/web2c/pdftexdir/pdftosrc.cc
@@ -109,7 +109,7 @@ int main(int argc, char *argv[])
fprintf(stderr, "No SourceName found\n");
exit(1);
}
- outname = srcName.getString()->getCString();
+ outname = srcName.getString()->c_str();
// We cannot free srcName, as objname shares its string.
// srcName.free();
} else if (objnum > 0) {
@@ -118,7 +118,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)
@@ -128,7 +128,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");
--
2.20.1

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Fri Dec 21 23:59:40 UTC 2018 - Stefan Brüns <stefan.bruens@rwth-aachen.de>
- Add patches for poppler 0.72:
* Rebase/extend source-fix-const-poppler0.66.0.patch and apply for
all versions using pdf*-newpoppler.cc
* source-fix-bool-poppler.patch
* source-poppler-use-std_string.patch
* source-poppler-fix-dict-memleak.patch
- Add source-lua-fix-bad-compare.patch
- Drop source-lua-poppler0640.dif, instead of casting the const's
away, add const where appropriate
-------------------------------------------------------------------
Wed Sep 26 11:54:24 UTC 2018 - Dr. Werner Fink <werner@suse.de>

View File

@ -258,8 +258,6 @@ Patch22: source-synctex-bump-soname.dif
# PATCH-FIX-TEXLIVE
Patch23: source-fix-synctex-missing-header-install.dif
# PATCH-FIX-TEXLIVE
Patch24: source-lua-poppler0640.dif
# PATCH-FIX-TEXLIVE
Patch25: source-patgen.dif
# PATCH-FIX-SUSE Make biber work with our perl
Patch42: biblatex-encoding.dif
@ -277,6 +275,14 @@ Patch52: source-tounicode.dif
Patch53: source-fix-const-poppler0.66.0.patch
# PATCH-FIX-TEXLIVE
Patch54: source-bsc1109673.dif
# PATCH-FIX-TEXLIVE
Patch55: source-fix-bool-poppler.patch
# PATCH-FIX-TEXLIVE
Patch56: source-poppler-use-std_string.patch
# PATCH-FIX-SUSE Fix leaking string copy
Patch57: source-poppler-fix-dict-memleak.patch
# PATCH-FIX-SUSE Fix bad comparison
Patch58: source-lua-fix-bad-compare.patch
Prefix: %{_bindir}
Provides: pdfjam = %{version}
Obsoletes: pdfjam < %{version}
@ -3560,7 +3566,6 @@ fi
%patch21 -p0 -b .m-tx
%patch22 -p0 -b .synctexAPI
%patch23 -p0 -b .synctexINC
%patch24 -p0 -b .popp064
%patch25 -p0 -b .patgen
%patch0 -p0 -b .p0
%if %{with buildbiber}
@ -3579,10 +3584,18 @@ popd
%patch51 -p1 -b .fft2
%patch52 -p0 -b .2utf8
%if %{?pkg_vcmp:%{pkg_vcmp libpoppler-devel >= 0.66.0}}%{!?pkg_vcmp:0}
%if %{?pkg_vcmp:%{pkg_vcmp libpoppler-devel >= 0.59.0}}%{!?pkg_vcmp:0}
%patch53 -p0 -b .poppler
%patch55 -p1 -b .popplerbool
%endif
%patch54 -p2 -b .type1
%if %{?pkg_vcmp:%{pkg_vcmp libpoppler-devel >= 0.72.0}}%{!?pkg_vcmp:0}
%patch56 -p1 -b .popplerstring
%endif
%if %{?pkg_vcmp:%{pkg_vcmp libpoppler-devel >= 0.69.0}}%{!?pkg_vcmp:0}
%patch57 -p1 -b .popplerdict
%endif
%patch58 -p1 -b .luacompare
# Correct FHS paths
paths=$(find -name cnf-to-paths.awk)