176 lines
7.4 KiB
Diff
176 lines
7.4 KiB
Diff
|
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
|
||
|
|