Skip to content

Commit a50483a

Browse files
authored
Merge pull request #32 from edporras/v0.7.2.7.3-poppler-0.72.0
Fix compilation against poppler 0.72.0
2 parents d7ded93 + 865ba46 commit a50483a

File tree

4 files changed

+25
-19
lines changed

4 files changed

+25
-19
lines changed

pdftoipe/pdftoipe.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -104,18 +104,18 @@ int main(int argc, char *argv[])
104104
return 1;
105105

106106
// construct XML file name
107-
GooString *xmlFileName;
107+
std::string xmlFileName;
108108
if (argc == 3) {
109-
xmlFileName = new GooString(argv[2]);
109+
xmlFileName = argv[2];
110110
} else {
111-
const char *p = fileName->getCString() + fileName->getLength() - 4;
111+
const char *p = fileName->c_str() + fileName->getLength() - 4;
112112
if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")) {
113-
xmlFileName = new GooString(fileName->getCString(),
114-
fileName->getLength() - 4);
113+
xmlFileName = std::string(fileName->c_str(),
114+
fileName->getLength() - 4);
115115
} else {
116-
xmlFileName = fileName->copy();
116+
xmlFileName = fileName->c_str();
117117
}
118-
xmlFileName->append(".ipe");
118+
xmlFileName += ".ipe";
119119
}
120120

121121
// get page range
@@ -127,8 +127,8 @@ int main(int argc, char *argv[])
127127

128128
// write XML file
129129
XmlOutputDev *xmlOut =
130-
new XmlOutputDev(xmlFileName->getCString(), doc->getXRef(),
131-
doc->getCatalog(), firstPage, lastPage);
130+
new XmlOutputDev(xmlFileName, doc->getXRef(),
131+
doc->getCatalog(), firstPage, lastPage);
132132

133133
// tell output device about text handling
134134
xmlOut->setTextHandling(math, notext, literal, mergeLevel, unicodeLevel);
@@ -152,7 +152,6 @@ int main(int argc, char *argv[])
152152

153153
// clean up
154154
delete xmlOut;
155-
delete xmlFileName;
156155
delete doc;
157156
delete globalParams;
158157

pdftoipe/readme.txt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ option) any later version.
4646
Compiling
4747
=========
4848

49-
You need the Poppler library (http://poppler.freedesktop.org) v0.71.0
49+
You need the Poppler library (http://poppler.freedesktop.org) v0.72.0
5050
or greater. On Debian/Ubuntu, install the packages 'libpoppler-dev'
5151
and 'libpoppler-private-dev'.
5252

@@ -55,7 +55,7 @@ In source directory, say
5555
make
5656

5757
This will create the single executable "pdftoipe". Copy it to
58-
whereever you like. You may also install the man page "pdftoipe.1".
58+
wherever you like. You may also install the man page "pdftoipe.1".
5959

6060
If you want to compile pdftoipe on Windows, please refer to
6161
"compile_on_windows.pdf", written by Daniel Beckmann.
@@ -65,7 +65,12 @@ If you want to compile pdftoipe on Windows, please refer to
6565
Changes
6666
=======
6767

68-
* 2018/11/01
68+
* 2018/12/07
69+
Changes to compile with poppler 0.72.0. GString is now based on
70+
std::string and may be gettng deprecated soon so get rid of some
71+
uses.
72+
73+
* 2018/11/01
6974
Poppler keeps changing: gBool -> bool (issue #31).
7075

7176
* 2018/10/23

pdftoipe/xmloutputdev.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <stddef.h>
77
#include <stdarg.h>
88

9+
#include <string>
10+
911
#include "Object.h"
1012
#include "Error.h"
1113
#include "Gfx.h"
@@ -24,13 +26,13 @@
2426
// XmlOutputDev
2527
//------------------------------------------------------------------------
2628

27-
XmlOutputDev::XmlOutputDev(const char *fileName, XRef *xrefA, Catalog *catalog,
28-
int firstPage, int lastPage)
29+
XmlOutputDev::XmlOutputDev(const std::string& fileName, XRef *xrefA, Catalog *catalog,
30+
int firstPage, int lastPage)
2931
{
3032
FILE *f;
3133

32-
if (!(f = fopen(fileName, "wb"))) {
33-
fprintf(stderr, "Couldn't open output file '%s'\n", fileName);
34+
if (!(f = fopen(fileName.c_str(), "wb"))) {
35+
fprintf(stderr, "Couldn't open output file '%s'\n", fileName.c_str());
3436
ok = false;
3537
return;
3638
}

pdftoipe/xmloutputdev.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
class GfxPath;
1515
class GfxFont;
1616

17-
#define PDFTOIPE_VERSION "2018/11/01"
17+
#define PDFTOIPE_VERSION "2018/12/07"
1818

1919
class XmlOutputDev : public OutputDev
2020
{
2121
public:
2222

2323
// Open an XML output file, and write the prolog.
24-
XmlOutputDev(const char *fileName, XRef *xrefA, Catalog *catalog,
24+
XmlOutputDev(const std::string& fileName, XRef *xrefA, Catalog *catalog,
2525
int firstPage, int lastPage);
2626

2727
// Destructor -- writes the trailer and closes the file.

0 commit comments

Comments
 (0)