[poppler] 2 commits - poppler/Catalog.h qt4/src

Albert Astals Cid aacid at kemper.freedesktop.org
Sat Sep 5 06:21:35 PDT 2009


 poppler/Catalog.h               |    3 ++-
 qt4/src/poppler-embeddedfile.cc |   10 +++++++++-
 qt4/src/poppler-qt4.h           |    9 ++++++++-
 3 files changed, 19 insertions(+), 3 deletions(-)

New commits:
commit 842e00f3114666609ef4dec6fa613d46f330a40c
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat Sep 5 15:20:35 2009 +0200

    Add EmbeddedFile::isValid
    
    Also do not crash if data() is called on an invalid file

diff --git a/qt4/src/poppler-embeddedfile.cc b/qt4/src/poppler-embeddedfile.cc
index c9a83fb..d54cf1e 100644
--- a/qt4/src/poppler-embeddedfile.cc
+++ b/qt4/src/poppler-embeddedfile.cc
@@ -1,5 +1,5 @@
 /* poppler-document.cc: qt interface to poppler
- * Copyright (C) 2005, 2008, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2005, 2008, 2009, Albert Astals Cid <aacid at kde.org>
  * Copyright (C) 2005, Brad Hards <bradh at frogmouth.net>
  * Copyright (C) 2008, Pino Toscano <pino at kde.org>
  *
@@ -88,6 +88,9 @@ QString EmbeddedFile::mimeType() const
 
 QByteArray EmbeddedFile::data()
 {
+	if (!isValid())
+		return QByteArray();
+	
 	Object obj;
 	Stream *stream = m_embeddedFile->embfile->streamObject().getStream();
 	stream->reset();
@@ -102,4 +105,9 @@ QByteArray EmbeddedFile::data()
 	return fileArray;
 }
 
+bool EmbeddedFile::isValid() const
+{
+	return m_embeddedFile->embfile->isOk();
+}
+
 }
diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h
index f8a9a07..e174e0e 100644
--- a/qt4/src/poppler-qt4.h
+++ b/qt4/src/poppler-qt4.h
@@ -1,7 +1,7 @@
 /* poppler-qt.h: qt interface to poppler
  * Copyright (C) 2005, Net Integration Technologies, Inc.
  * Copyright (C) 2005, 2007, Brad Hards <bradh at frogmouth.net>
- * Copyright (C) 2005-2008, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2005-2009, Albert Astals Cid <aacid at kde.org>
  * Copyright (C) 2005, Stefan Kebekus <stefan.kebekus at math.uni-koeln.de>
  * Copyright (C) 2006-2009, Pino Toscano <pino at kde.org>
  * Copyright (C) 2009 Shawn Rutledge <shawn.t.rutledge at gmail.com>
@@ -337,6 +337,13 @@ delete it;
 	QByteArray data();
 
 	/**
+	   Is the embedded file valid?
+	   
+	   \since 0.12
+	*/
+	bool isValid() const;
+
+	/**
 	   A QDataStream for the actual data?
 	*/
 	//QDataStream dataStream() const;
commit 9d40b268f5a9a9a0fb79da0e1627dd8eebc4db6a
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat Sep 5 15:19:27 2009 +0200

    Add EmbFile::isOk
    
    At the moment returns false if the object stream is not really a stream

diff --git a/poppler/Catalog.h b/poppler/Catalog.h
index 193f2be..f5b389f 100644
--- a/poppler/Catalog.h
+++ b/poppler/Catalog.h
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005 Kristian Høgsberg <krh at redhat.com>
-// Copyright (C) 2005, 2007 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005, 2007, 2009 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2005 Jonathan Blandford <jrb at redhat.com>
 // Copyright (C) 2005, 2006, 2008 Brad Hards <bradh at frogmouth.net>
 // Copyright (C) 2007 Julien Rebetez <julienr at svn.gnome.org>
@@ -117,6 +117,7 @@ public:
   GooString *checksum() { return m_checksum; }
   GooString *mimeType() { return m_mimetype; }
   Object &streamObject() { return m_objStr; }
+  bool isOk() { return m_objStr.isStream(); }
 
 private:
   GooString *m_name;


More information about the poppler mailing list