Blame SOURCES/poppler-20.11.0.patch

45cd74
--- cups-filters-1.20.0/filter/pdf.cxx
45cd74
+++ cups-filters-1.20.0/filter/pdf.cxx
45cd74
@@ -87,7 +87,11 @@ static EMB_PARAMS *Font;
45cd74
 extern "C" pdf_t * pdf_load_template(const char *filename)
45cd74
 {
45cd74
     /* Init poppler */
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 83
45cd74
+    globalParams.reset(new GlobalParams());
45cd74
+#else
45cd74
     globalParams = new GlobalParams();
45cd74
+#endif
45cd74
 
45cd74
     PDFDoc *doc = new PDFDoc(new GooString(filename));
45cd74
 
45cd74
@@ -136,7 +140,7 @@ extern "C" void pdf_prepend_stream(pdf_t
45cd74
 #endif
45cd74
     if (!pageobj.isDict() ||
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
-        (contents = pageobj.dictLookupNF("Contents")).isNull()
45cd74
+        (contents = pageobj.dictLookupNF("Contents").copy()).isNull()
45cd74
 #else
45cd74
         !pageobj.dictLookupNF("Contents", &contents)
45cd74
 #endif
45cd74
@@ -166,11 +170,15 @@ extern "C" void pdf_prepend_stream(pdf_t
45cd74
 #endif
45cd74
 
45cd74
     r = xref->addIndirectObject(&stream);
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 75
45cd74
+    streamrefobj = Object(r);
45cd74
+#else
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
     streamrefobj = Object(r.num, r.gen);
45cd74
 #else
45cd74
     streamrefobj.initRef(r.num, r.gen);
45cd74
 #endif
45cd74
+#endif
45cd74
 
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
     array = Object(new Array(xref));
45cd74
@@ -182,7 +190,7 @@ extern "C" void pdf_prepend_stream(pdf_t
45cd74
 
45cd74
     if (contents.isStream()) {
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
-        contents = pageobj.dictLookupNF("Contents"); // streams must be indirect, i.e. not fetch()-ed
45cd74
+        contents = pageobj.dictLookupNF("Contents").copy(); // streams must be indirect, i.e. not fetch()-ed
45cd74
         array.arrayAdd(std::move(contents));
45cd74
 #else
45cd74
         pageobj.dictLookupNF("Contents", &contents); // streams must be indirect, i.e. not fetch()-ed
45cd74
@@ -194,7 +202,7 @@ extern "C" void pdf_prepend_stream(pdf_t
45cd74
         Object obj;
45cd74
         for (i = 0; i < len; i++) {
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
-            obj = contents.arrayGetNF(i);
45cd74
+            obj = contents.arrayGetNF(i).copy();
45cd74
             array.arrayAdd(std::move(obj));
45cd74
 #else
45cd74
             contents.arrayGetNF(i, &obj);
45cd74
@@ -258,7 +266,7 @@ static Object * get_resource_dict(XRef *
45cd74
 
45cd74
     /* TODO resource dict can also be inherited */
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
-    res = pagedict->lookupNF("Resources");
45cd74
+    res = pagedict->lookupNF("Resources").copy();
45cd74
     if (res.isNull())
45cd74
 #else
45cd74
     if (!pagedict->lookupNF("Resources", &res))
45cd74
@@ -331,7 +339,7 @@ extern "C" void pdf_add_type1_font(pdf_t
45cd74
     xref->addIndirectObject(&font);
45cd74
 
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
-    fonts = resdict.dictLookupNF("Font");
45cd74
+    fonts = resdict.dictLookupNF("Font").copy();
45cd74
 #else
45cd74
     resdict.dictLookupNF("Font", &fonts);
45cd74
 #endif
45cd74
@@ -540,7 +548,7 @@ extern "C" void pdf_duplicate_page (pdf_
45cd74
     }
45cd74
 
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
-    parentref = page.dictLookupNF("Parent");
45cd74
+    parentref = page.dictLookupNF("Parent").copy();
45cd74
     parent = parentref.fetch(xref);
45cd74
 #else
45cd74
     page.dictLookupNF("Parent", &parentref);
45cd74
@@ -568,6 +576,9 @@ extern "C" void pdf_duplicate_page (pdf_
45cd74
     // the pages tree (not supported by major pdf implementations).
45cd74
     for (i = 1; i < count; i++) {
45cd74
         Ref r = xref->addIndirectObject(&page);
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 75
45cd74
+        kids.arrayAdd(Object(r));
45cd74
+#else
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
         kids.arrayAdd(Object(r.num, r.gen));
45cd74
 #else
45cd74
@@ -575,6 +586,7 @@ extern "C" void pdf_duplicate_page (pdf_
45cd74
         kids.arrayAdd(&ref;;
45cd74
         ref.free();
45cd74
 #endif
45cd74
+#endif
45cd74
     }
45cd74
 
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
@@ -734,7 +746,7 @@ extern "C" int pdf_fill_form(pdf_t *doc,
45cd74
         }
45cd74
 
45cd74
         FormField *ff = fm_text->getField();
45cd74
-        GooString *field_name;
45cd74
+        const GooString *field_name;
45cd74
         field_name = ff->getFullyQualifiedName();
45cd74
         if ( ! field_name )
45cd74
             field_name = ff->getPartialName();
45cd74
@@ -743,7 +755,11 @@ extern "C" int pdf_fill_form(pdf_t *doc,
45cd74
             continue;
45cd74
         }
45cd74
 
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 72
45cd74
+        const char *name = field_name->c_str();
45cd74
+#else
45cd74
         const char *name = field_name->getCString();
45cd74
+#endif
45cd74
         const char *fill_with = lookup_opt(opt, name);
45cd74
         if ( ! fill_with ) {
45cd74
             fprintf(stderr, "Lack information for widget: %s.\n", name);
45cd74
@@ -831,6 +847,9 @@ extern "C" int pdf_fill_form(pdf_t *doc,
45cd74
         appearance_stream_dic.dictSet("Type", name_object("XObject"));
45cd74
         appearance_stream_dic.dictSet("Subtype", name_object("Form"));
45cd74
         appearance_stream_dic.dictSet("FormType", int_object(1));
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 75
45cd74
+        appearance_stream_dic.dictSet("Resources", Object(resref));
45cd74
+#else
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
         appearance_stream_dic.dictSet("Resources", Object(resref.num, resref.gen));
45cd74
 #else
45cd74
@@ -838,6 +857,7 @@ extern "C" int pdf_fill_form(pdf_t *doc,
45cd74
         obj_ref_x.initRef(resref.num, resref.gen);
45cd74
         appearance_stream_dic.dictSet("Resources", &obj_ref_x);
45cd74
 #endif
45cd74
+#endif
45cd74
 
45cd74
         /* BBox array: TODO. currently out of the head. */
45cd74
         Object array;
45cd74
@@ -851,8 +871,13 @@ extern "C" int pdf_fill_form(pdf_t *doc,
45cd74
         appearance_stream_dic.dictSet("BBox", std::move(array));
45cd74
         appearance_stream_dic.dictSet("Length", Object(appearance_stream->getLength()));
45cd74
 
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 72
45cd74
+        MemStream *mem_stream = new MemStream(appearance_stream->c_str(),
45cd74
+                0, appearance_stream->getLength(), std::move(appearance_stream_dic));
45cd74
+#else
45cd74
         MemStream *mem_stream = new MemStream(appearance_stream->getCString(),
45cd74
                 0, appearance_stream->getLength(), std::move(appearance_stream_dic));
45cd74
+#endif
45cd74
 
45cd74
         /* Make obj stream */
45cd74
         Object stream = Object(static_cast<Stream *>(mem_stream));
45cd74
@@ -860,8 +885,11 @@ extern "C" int pdf_fill_form(pdf_t *doc,
45cd74
         Ref r = xref->addIndirectObject(&stream);
45cd74
 
45cd74
         /* Update Xref table */
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 75
45cd74
+        Object obj_ref = Object(r);
45cd74
+#else
45cd74
         Object obj_ref = Object(r.num, r.gen);
45cd74
-
45cd74
+#endif
45cd74
         /*
45cd74
          * Fill Annotation's appearance streams dic /AP
45cd74
          * See: 8.4.4 Appearance Streams
45cd74
@@ -884,8 +912,13 @@ extern "C" int pdf_fill_form(pdf_t *doc,
45cd74
         appearance_stream_dic.dictSet("BBox", &array);
45cd74
         appearance_stream_dic.dictSet("Length", int_object(appearance_stream->getLength()));
45cd74
 
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 72
45cd74
+        MemStream *mem_stream = new MemStream(appearance_stream->c_str(),
45cd74
+                0, appearance_stream->getLength(), &appearance_stream_dic);
45cd74
+#else
45cd74
         MemStream *mem_stream = new MemStream(appearance_stream->getCString(),
45cd74
                 0, appearance_stream->getLength(), &appearance_stream_dic);
45cd74
+#endif
45cd74
 
45cd74
         /* Make obj stream */
45cd74
         Object stream;
45cd74
@@ -925,10 +958,10 @@ extern "C" int pdf_fill_form(pdf_t *doc,
45cd74
      */
45cd74
     Object *obj_form = catalog->getAcroForm();
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
-    obj_form->dictSet("NeedAppearances", Object(gFalse));
45cd74
+    obj_form->dictSet("NeedAppearances", Object(false));
45cd74
 #else
45cd74
     Object obj1;
45cd74
-    obj1.initBool(gFalse);
45cd74
+    obj1.initBool(false);
45cd74
     obj_form->dictSet("NeedAppearances", &obj1);
45cd74
 #endif
45cd74
 
45cd74
@@ -948,7 +981,11 @@ extern "C" int pdf_fill_form(pdf_t *doc,
45cd74
     catRef.gen = xref->getRootGen();
45cd74
     catRef.num = xref->getRootNum();
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 75
45cd74
+    catObj.dictSet("AcroForm", Object(ref_form));
45cd74
+#else
45cd74
     catObj.dictSet("AcroForm", Object(ref_form.num, ref_form.gen));
45cd74
+#endif
45cd74
     xref->setModifiedObject(&catObj, catRef);
45cd74
 #else
45cd74
     Object obj2;
45cd74
@@ -1020,12 +1057,22 @@ static int pdf_embed_font(pdf_t *doc,
45cd74
 
45cd74
     /* Create memory stream font. Add it to font dic. */
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 72
45cd74
+    MemStream *mem_stream = new MemStream(font_stream->c_str(),
45cd74
+            0, outlen, std::move(f_dic));
45cd74
+#else
45cd74
     MemStream *mem_stream = new MemStream(font_stream->getCString(),
45cd74
             0, outlen, std::move(f_dic));
45cd74
+#endif
45cd74
     Object stream = Object(static_cast<Stream *>(mem_stream));
45cd74
 #else
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 72
45cd74
+    MemStream *mem_stream = new MemStream(font_stream->c_str(),
45cd74
+            0, outlen, &f_dic);
45cd74
+#else
45cd74
     MemStream *mem_stream = new MemStream(font_stream->getCString(),
45cd74
             0, outlen, &f_dic);
45cd74
+#endif
45cd74
 
45cd74
     /* Make obj stream */
45cd74
     Object stream;
45cd74
@@ -1066,7 +1113,7 @@ static int pdf_embed_font(pdf_t *doc,
45cd74
     Object fonts;
45cd74
 
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
-    fonts = resdict.dictLookupNF("Font");
45cd74
+    fonts = resdict.dictLookupNF("Font").copy();
45cd74
 #else
45cd74
     resdict.dictLookupNF("Font", &fonts);
45cd74
 #endif
45cd74
@@ -1074,7 +1121,7 @@ static int pdf_embed_font(pdf_t *doc,
45cd74
         /* Create new one, if doesn't exists */
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
         resdict.dictSet("Font", Object(new Dict(xref)));
45cd74
-        fonts = resdict.dictLookupNF("Font");
45cd74
+        fonts = resdict.dictLookupNF("Font").copy();
45cd74
 #else
45cd74
         fonts.initDict(xref);
45cd74
         resdict.dictSet("Font", &fonts);
45cd74
@@ -1108,11 +1155,15 @@ static int pdf_embed_font(pdf_t *doc,
45cd74
 
45cd74
     /* r - cid resource dic */
45cd74
     Object font_res_obj_ref;
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 75
45cd74
+    font_res_obj_ref = Object(r);
45cd74
+#else
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
     font_res_obj_ref = Object(r.num, r.gen);
45cd74
 #else
45cd74
     font_res_obj_ref.initRef(r.num, r.gen);
45cd74
 #endif
45cd74
+#endif
45cd74
 
45cd74
     Object *fonts_dic;
45cd74
     Object dereferenced_obj;
45cd74
@@ -1440,6 +1491,9 @@ static Object *make_fontdescriptor_dic(
45cd74
 #endif
45cd74
     }
45cd74
 
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 75
45cd74
+    dic->dictSet(emb_pdf_get_fontfile_key(emb), Object(fontfile_obj_ref));
45cd74
+#else
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
     dic->dictSet(emb_pdf_get_fontfile_key(emb), Object(fontfile_obj_ref.num, fontfile_obj_ref.gen));
45cd74
 #else
45cd74
@@ -1447,6 +1501,7 @@ static Object *make_fontdescriptor_dic(
45cd74
     ref_obj.initRef(fontfile_obj_ref.num, fontfile_obj_ref.gen);
45cd74
     dic->dictSet(emb_pdf_get_fontfile_key(emb), &ref_obj);
45cd74
 #endif
45cd74
+#endif
45cd74
 
45cd74
     return dic;
45cd74
 }
45cd74
@@ -1480,6 +1535,9 @@ static Object *make_font_dic(
45cd74
             "BaseFont",
45cd74
             name_object(copyString(emb_pdf_escape_name(fdes->fontname,-1))));
45cd74
 
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 75
45cd74
+    dic->dictSet("FontDescriptor", Object(fontdescriptor_obj_ref));
45cd74
+#else
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
     dic->dictSet("FontDescriptor", Object(fontdescriptor_obj_ref.num, fontdescriptor_obj_ref.gen));
45cd74
 #else
45cd74
@@ -1487,6 +1545,7 @@ static Object *make_font_dic(
45cd74
     ref_obj.initRef(fontdescriptor_obj_ref.num, fontdescriptor_obj_ref.gen);
45cd74
     dic->dictSet("FontDescriptor", &ref_obj);
45cd74
 #endif
45cd74
+#endif
45cd74
 
45cd74
     if ( emb->plan & EMB_A_MULTIBYTE ) {
45cd74
         assert(fwid->warray);
45cd74
@@ -1573,17 +1632,26 @@ static Object *make_cidfont_dic(
45cd74
     basefont->append(addenc);
45cd74
     basefont->append((addenc[0])?encoding:"");
45cd74
 
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 72
45cd74
+    dic->dictSet("BaseFont",
45cd74
+            name_object(copyString(basefont->c_str())));
45cd74
+#else
45cd74
     dic->dictSet("BaseFont",
45cd74
             name_object(copyString(basefont->getCString())));
45cd74
+#endif
45cd74
 
45cd74
     dic->dictSet("Encoding", name_object(copyString(encoding)));
45cd74
 
45cd74
     Object obj;
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 75
45cd74
+    obj = Object(fontdescriptor_obj_ref);
45cd74
+#else
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
     obj = Object(fontdescriptor_obj_ref.num, fontdescriptor_obj_ref.gen);
45cd74
 #else
45cd74
     obj.initRef(fontdescriptor_obj_ref.num, fontdescriptor_obj_ref.gen);
45cd74
 #endif
45cd74
+#endif
45cd74
 
45cd74
     Object array;
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 58
45cd74
--- cups-filters-1.20.0/filter/pdftoraster.cxx
45cd74
+++ cups-filters-1.20.0/filter/pdftoraster.cxx
45cd74
@@ -282,8 +282,13 @@ cmsHPROFILE sgray_profile()
45cd74
 
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 23
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 85
45cd74
+void CDECL myErrorFun(ErrorCategory category,
45cd74
+    Goffset pos, const char *msg)
45cd74
+#else
45cd74
 void CDECL myErrorFun(void *data, ErrorCategory category,
45cd74
     Goffset pos, char *msg)
45cd74
+#endif
45cd74
 #else
45cd74
 void CDECL myErrorFun(void *data, ErrorCategory category,
45cd74
     int pos, char *msg)
45cd74
@@ -412,9 +417,9 @@ static GBool getColorProfilePath(ppd_fil
45cd74
 	    path->append("/profiles/");
45cd74
 	}
45cd74
 	path->append(attr->value);
45cd74
-	return gTrue;
45cd74
+	return true;
45cd74
     }
45cd74
-    return gFalse;
45cd74
+    return false;
45cd74
 }
45cd74
 #endif
45cd74
 
45cd74
@@ -1686,7 +1691,7 @@ static void outPage(PDFDoc *doc, Catalog
45cd74
 {
45cd74
   SplashBitmap *bitmap;
45cd74
   Page *page = catalog->getPage(pageNo);
45cd74
-  PDFRectangle *mediaBox = page->getMediaBox();
45cd74
+  const PDFRectangle *mediaBox = page->getMediaBox();
45cd74
   int rotate = page->getRotate();
45cd74
   double paperdimensions[2], /* Physical size of the paper */
45cd74
     margins[4];	/* Physical margins of print */
45cd74
@@ -1814,7 +1819,7 @@ static void outPage(PDFDoc *doc, Catalog
45cd74
 
45cd74
   doc->displayPage(out,pageNo,header.HWResolution[0],
45cd74
 		   header.HWResolution[1],(landscape == 0 ? 0 : 90),
45cd74
-		   gTrue,gTrue,gTrue);
45cd74
+		   true,true,true);
45cd74
   bitmap = out->getBitmap();
45cd74
   bitmapoffset[0] = margins[0] / 72.0 * header.HWResolution[0];
45cd74
   bitmapoffset[1] = margins[3] / 72.0 * header.HWResolution[1];
45cd74
@@ -1867,7 +1872,7 @@ static void outPage(PDFDoc *doc, Catalog
45cd74
   writePageImage(raster,bitmap,pageNo);
45cd74
 }
45cd74
 
45cd74
-static void setPopplerColorProfile()
45cd74
+static void setPopplerColorProfile(SplashOutputDev *out)
45cd74
 {
45cd74
   if (header.cupsBitsPerColor != 8 && header.cupsBitsPerColor != 16) {
45cd74
     /* color Profile is not supported */
45cd74
@@ -1951,7 +1956,13 @@ static void setPopplerColorProfile()
45cd74
     break;
45cd74
   }
45cd74
   if (popplerColorProfile != NULL) {
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 90
45cd74
+#ifdef USE_CMS
45cd74
+    out->setDisplayProfile(make_GfxLCMSProfilePtr(popplerColorProfile));
45cd74
+#endif
45cd74
+#else
45cd74
     GfxColorSpace::setDisplayProfile(popplerColorProfile);
45cd74
+#endif
45cd74
   }
45cd74
 }
45cd74
 
45cd74
@@ -1966,13 +1977,21 @@ int main(int argc, char *argv[]) {
45cd74
   int rowpad;
45cd74
   Catalog *catalog;
45cd74
 
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 85
45cd74
+  setErrorCallback(::myErrorFun);
45cd74
+#else
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
45cd74
   setErrorCallback(::myErrorFun,NULL);
45cd74
 #else
45cd74
   setErrorFunction(::myErrorFun);
45cd74
 #endif
45cd74
+#endif
45cd74
   cmsSetLogErrorHandler(lcmsErrorHandler);
45cd74
-  globalParams = new GlobalParams();
45cd74
+#if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 83
45cd74
+    globalParams.reset(new GlobalParams());
45cd74
+#else
45cd74
+    globalParams = new GlobalParams();
45cd74
+#endif
45cd74
   parseOpts(argc, argv);
45cd74
 
45cd74
   if (argc == 6) {
45cd74
@@ -2119,14 +2138,10 @@ int main(int argc, char *argv[]) {
45cd74
     break;
45cd74
   }
45cd74
 
45cd74
-  if (!cm_disabled) {
45cd74
-    setPopplerColorProfile();
45cd74
-  }
45cd74
-
45cd74
   out = new SplashOutputDev(cmode,rowpad/* row padding */,
45cd74
-    gFalse,paperColor,gTrue
45cd74
+    false,paperColor,true
45cd74
 #if POPPLER_VERSION_MAJOR == 0 && POPPLER_VERSION_MINOR <= 30
45cd74
-    ,gFalse
45cd74
+    ,false
45cd74
 #endif
45cd74
     );
45cd74
 #if POPPLER_VERSION_MAJOR > 0 || POPPLER_VERSION_MINOR >= 19
45cd74
@@ -2135,6 +2150,10 @@ int main(int argc, char *argv[]) {
45cd74
   out->startDoc(doc->getXRef());
45cd74
 #endif
45cd74
 
45cd74
+  if (!cm_disabled) {
45cd74
+    setPopplerColorProfile(out);
45cd74
+  }
45cd74
+
45cd74
   if ((raster = cupsRasterOpen(1, pwgraster ? CUPS_RASTER_WRITE_PWG :
45cd74
 			       CUPS_RASTER_WRITE)) == 0) {
45cd74
         pdfError(-1,const_cast<char *>("Can't open raster stream"));
45cd74
@@ -2162,9 +2181,11 @@ err1:
45cd74
     cmsDeleteTransform(colorTransform);
45cd74
   }
45cd74
 
45cd74
+#if POPPLER_VERSION_MAJOR == 0 && POPPLER_VERSION_MINOR <= 68
45cd74
   // Check for memory leaks
45cd74
   Object::memCheck(stderr);
45cd74
   gMemReport(stderr);
45cd74
+#endif
45cd74
 
45cd74
   return exitCode;
45cd74
 }