Blame SOURCES/cups-filters-poppler023.patch

d35507
diff -up cups-filters-1.0.35/filter/pdf.cxx.poppler023 cups-filters-1.0.35/filter/pdf.cxx
d35507
--- cups-filters-1.0.35/filter/pdf.cxx.poppler023	2015-06-16 15:47:21.870132195 +0100
d35507
+++ cups-filters-1.0.35/filter/pdf.cxx	2015-06-16 15:47:59.623128579 +0100
d35507
@@ -17,6 +17,10 @@
d35507
 #include "pdf.h"
d35507
 
d35507
 #include <PDFDoc.h>
d35507
+#include <config.h>
d35507
+#ifdef HAVE_CPP_POPPLER_VERSION_H
d35507
+#include "cpp/poppler-version.h"
d35507
+#endif
d35507
 
d35507
 
d35507
 extern "C" pdf_t * pdf_load_template(const char *filename)
d35507
@@ -343,7 +347,11 @@ public:
d35507
     {
d35507
     }
d35507
 
d35507
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 23
d35507
+    Goffset getPos()
d35507
+#else
d35507
     int getPos()
d35507
+#endif
d35507
     {
d35507
         return this->pos;
d35507
     }
d35507
diff -up cups-filters-1.0.35/filter/pdftoijs.cxx.poppler023 cups-filters-1.0.35/filter/pdftoijs.cxx
d35507
--- cups-filters-1.0.35/filter/pdftoijs.cxx.poppler023	2015-06-16 15:47:21.871132195 +0100
d35507
+++ cups-filters-1.0.35/filter/pdftoijs.cxx	2015-06-16 15:47:59.623128579 +0100
d35507
@@ -70,8 +70,13 @@ namespace {
d35507
 }
d35507
 
d35507
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
d35507
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 23
d35507
+void CDECL myErrorFun(void *data, ErrorCategory category,
d35507
+    Goffset pos, char *msg)
d35507
+#else
d35507
 void CDECL myErrorFun(void *data, ErrorCategory category,
d35507
     int pos, char *msg)
d35507
+#endif
d35507
 {
d35507
   if (pos >= 0) {
d35507
     fprintf(stderr, "ERROR (%d): ", pos);
d35507
@@ -297,19 +302,15 @@ int main(int argc, char *argv[]) {
d35507
   if (argc == 6) {
d35507
     /* stdin */
d35507
     int fd;
d35507
-    Object obj;
d35507
-    BaseStream *str;
d35507
-    FILE *fp;
d35507
+    char name[BUFSIZ];
d35507
     char buf[BUFSIZ];
d35507
     int n;
d35507
 
d35507
-    fd = cupsTempFd(buf,sizeof(buf));
d35507
+    fd = cupsTempFd(name,sizeof(name));
d35507
     if (fd < 0) {
d35507
       pdfError(-1,"Can't create temporary file");
d35507
       exit(1);
d35507
     }
d35507
-    /* remove name */
d35507
-    unlink(buf);
d35507
 
d35507
     /* copy stdin to the tmp file */
d35507
     while ((n = read(0,buf,BUFSIZ)) > 0) {
d35507
@@ -319,23 +320,10 @@ int main(int argc, char *argv[]) {
d35507
 	exit(1);
d35507
       }
d35507
     }
d35507
-    if (lseek(fd,0,SEEK_SET) < 0) {
d35507
-        pdfError(-1,"Can't rewind temporary file");
d35507
-        close(fd);
d35507
-	exit(1);
d35507
-    }
d35507
-
d35507
-    if ((fp = fdopen(fd,"rb")) == 0) {
d35507
-        pdfError(-1,"Can't fdopen temporary file");
d35507
-        close(fd);
d35507
-	exit(1);
d35507
-    }
d35507
-
d35507
-    obj.initNull();
d35507
-//    parsePDFTOPDFComment(fp); // TODO?
d35507
-    rewind(fp);
d35507
-    str = new FileStream(fp,0,gFalse,0,&obj);
d35507
-    doc = new PDFDoc(str);
d35507
+    close(fd);
d35507
+    doc = new PDFDoc(new GooString(name));
d35507
+    /* remove name */
d35507
+    unlink(name);
d35507
   } else {
d35507
     GooString *fileName = new GooString(argv[6]);
d35507
     /* argc == 7 filenmae is specified */
d35507
diff -up cups-filters-1.0.35/filter/pdftoopvp/pdftoopvp.cxx.poppler023 cups-filters-1.0.35/filter/pdftoopvp/pdftoopvp.cxx
d35507
--- cups-filters-1.0.35/filter/pdftoopvp/pdftoopvp.cxx.poppler023	2015-06-16 15:47:21.871132195 +0100
d35507
+++ cups-filters-1.0.35/filter/pdftoopvp/pdftoopvp.cxx	2015-06-16 15:47:59.624128579 +0100
d35507
@@ -112,8 +112,13 @@ static int outOnePage(PDFDoc *doc, OPVPO
d35507
 #define MAX_OPVP_OPTIONS 20
d35507
 
d35507
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
d35507
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 23
d35507
+void CDECL myErrorFun(void *data, ErrorCategory category,
d35507
+    Goffset pos, char *msg)
d35507
+#else
d35507
 void CDECL myErrorFun(void *data, ErrorCategory category,
d35507
     int pos, char *msg)
d35507
+#endif
d35507
 {
d35507
   if (pos >= 0) {
d35507
     fprintf(stderr, "ERROR (%d): ", pos);
d35507
@@ -619,9 +624,6 @@ exit(0);
d35507
     char *s;
d35507
     GooString name;
d35507
     int fd;
d35507
-    Object obj;
d35507
-    BaseStream *str;
d35507
-    FILE *fp;
d35507
     char buf[4096];
d35507
     int n;
d35507
 
d35507
@@ -633,8 +635,6 @@ exit(0);
d35507
     }
d35507
     name.append("/XXXXXX");
d35507
     fd = mkstemp(name.getCString());
d35507
-    /* remove name */
d35507
-    unlink(name.getCString());
d35507
     if (fd < 0) {
d35507
       opvpError(-1,"Can't create temporary file");
d35507
       exitCode = 2;
d35507
@@ -675,23 +675,10 @@ exit(0);
d35507
 	goto err0;
d35507
       }
d35507
     }
d35507
-    if (lseek(fd,0,SEEK_SET) < 0) {
d35507
-	opvpError(-1,"Can't rewind temporary file");
d35507
-	close(fd);
d35507
-	exitCode = 2;
d35507
-	goto err0;
d35507
-    }
d35507
-
d35507
-    if ((fp = fdopen(fd,"rb")) == 0) {
d35507
-	opvpError(-1,"Can't fdopen temporary file");
d35507
-	close(fd);
d35507
-	exitCode = 2;
d35507
-	goto err0;
d35507
-    }
d35507
-
d35507
-    obj.initNull();
d35507
-    str = new FileStream(fp,0,gFalse,0,&obj);
d35507
-    doc = new PDFDoc(str);
d35507
+    close(fd);
d35507
+    doc = new PDFDoc(&name);
d35507
+    /* remove name */
d35507
+    unlink(name.getCString());
d35507
   } else {
d35507
     /* no jcl check */
d35507
     doc = new PDFDoc(fileName.copy());
d35507
diff -up cups-filters-1.0.35/filter/pdftoraster.cxx.poppler023 cups-filters-1.0.35/filter/pdftoraster.cxx
d35507
--- cups-filters-1.0.35/filter/pdftoraster.cxx.poppler023	2015-06-16 15:47:21.871132195 +0100
d35507
+++ cups-filters-1.0.35/filter/pdftoraster.cxx	2015-06-16 15:47:59.624128579 +0100
d35507
@@ -185,8 +185,13 @@ namespace {
d35507
 }
d35507
 
d35507
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
d35507
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 23
d35507
+void CDECL myErrorFun(void *data, ErrorCategory category,
d35507
+    Goffset pos, char *msg)
d35507
+#else
d35507
 void CDECL myErrorFun(void *data, ErrorCategory category,
d35507
     int pos, char *msg)
d35507
+#endif
d35507
 {
d35507
   if (pos >= 0) {
d35507
     fprintf(stderr, "ERROR (%d): ", pos);
d35507
@@ -1762,19 +1767,15 @@ int main(int argc, char *argv[]) {
d35507
   if (argc == 6) {
d35507
     /* stdin */
d35507
     int fd;
d35507
-    Object obj;
d35507
-    BaseStream *str;
d35507
-    FILE *fp;
d35507
+    char name[BUFSIZ];
d35507
     char buf[BUFSIZ];
d35507
     int n;
d35507
 
d35507
-    fd = cupsTempFd(buf,sizeof(buf));
d35507
+    fd = cupsTempFd(name,sizeof(name));
d35507
     if (fd < 0) {
d35507
       pdfError(-1,const_cast<char *>("Can't create temporary file"));
d35507
       exit(1);
d35507
     }
d35507
-    /* remove name */
d35507
-    unlink(buf);
d35507
 
d35507
     /* copy stdin to the tmp file */
d35507
     while ((n = read(0,buf,BUFSIZ)) > 0) {
d35507
@@ -1784,23 +1785,10 @@ int main(int argc, char *argv[]) {
d35507
 	exit(1);
d35507
       }
d35507
     }
d35507
-    if (lseek(fd,0,SEEK_SET) < 0) {
d35507
-        pdfError(-1,const_cast<char *>("Can't rewind temporary file"));
d35507
-        close(fd);
d35507
-	exit(1);
d35507
-    }
d35507
-
d35507
-    if ((fp = fdopen(fd,"rb")) == 0) {
d35507
-        pdfError(-1,const_cast<char *>("Can't fdopen temporary file"));
d35507
-        close(fd);
d35507
-	exit(1);
d35507
-    }
d35507
-
d35507
-    obj.initNull();
d35507
-    parsePDFTOPDFComment(fp);
d35507
-    rewind(fp);
d35507
-    str = new FileStream(fp,0,gFalse,0,&obj);
d35507
-    doc = new PDFDoc(str);
d35507
+    close(fd);
d35507
+    doc = new PDFDoc(new GooString(name));
d35507
+    /* remove name */
d35507
+    unlink(name);
d35507
   } else {
d35507
     GooString *fileName = new GooString(argv[6]);
d35507
     /* argc == 7 filenmae is specified */
d35507
diff -up cups-filters-1.0.35/NEWS.poppler023 cups-filters-1.0.35/NEWS