[poppler] 3 commits - poppler/PDFDoc.cc qt4/src

Albert Astals Cid aacid at kemper.freedesktop.org
Sat Oct 4 10:49:27 PDT 2008


 poppler/PDFDoc.cc                |   11 +++++++++++
 qt4/src/poppler-pdf-converter.cc |    8 +++++---
 2 files changed, 16 insertions(+), 3 deletions(-)

New commits:
commit df7317f1320513b4f66cb6618d753b82042671f5
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat Oct 4 19:48:57 2008 +0200

    free the object

diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 16846fb..791f851 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -484,7 +484,11 @@ GBool PDFDoc::saveAs(OutStream *outStr, PDFWriteMode mode) {
   Object obj;
   xref->getTrailerDict()->getDict()->lookupNF("Encrypt", &obj);
   if (!obj.isNull())
+  {
+    obj.free();
     return gFalse;
+  }
+  obj.free();
 
   if (mode == writeForceRewrite) {
     saveCompleteRewrite(outStr);
commit 9946d9af9dd5d5b96d5c777413a3e253dfd1f291
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat Oct 4 19:39:46 2008 +0200

    If we try saving a document that was encrypted, we break everything, so just fail early

diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index 19bb933..16846fb 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -479,6 +479,13 @@ GBool PDFDoc::saveAs(GooString *name, PDFWriteMode mode) {
 }
 
 GBool PDFDoc::saveAs(OutStream *outStr, PDFWriteMode mode) {
+
+  // we don't support files with Encrypt at the moment
+  Object obj;
+  xref->getTrailerDict()->getDict()->lookupNF("Encrypt", &obj);
+  if (!obj.isNull())
+    return gFalse;
+
   if (mode == writeForceRewrite) {
     saveCompleteRewrite(outStr);
   } else if (mode == writeForceIncremental) {
commit 108959432af7714cb8ffe42d98d40c97f936a2e6
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat Oct 4 19:39:24 2008 +0200

    Correctly return wheter it was saved or not

diff --git a/qt4/src/poppler-pdf-converter.cc b/qt4/src/poppler-pdf-converter.cc
index 6e1868b..7f90416 100644
--- a/qt4/src/poppler-pdf-converter.cc
+++ b/qt4/src/poppler-pdf-converter.cc
@@ -1,5 +1,6 @@
 /* poppler-pdf-converter.cc: qt4 interface to poppler
  * Copyright (C) 2008, Pino Toscano <pino at kde.org>
+ * Copyright (C) 2008, Albert Astals Cid <aacid at kde.org>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -72,18 +73,19 @@ bool PDFConverter::convert()
 	if (!dev)
 		return false;
 
+	bool success;
 	QIODeviceOutStream stream(dev);
 	if (d->opts & WithChanges)
 	{
-		d->document->doc->saveAs(&stream);
+		success = d->document->doc->saveAs(&stream);
 	}
 	else
 	{
-		d->document->doc->saveWithoutChangesAs(&stream);
+		success = d->document->doc->saveWithoutChangesAs(&stream);
 	}
 	d->closeDevice();
 
-	return true;
+	return success;
 }
 
 }


More information about the poppler mailing list