[poppler] Branch 'poppler-0.20' - 3 commits - poppler/Catalog.cc poppler/FileSpec.cc qt4/src

Albert Astals Cid aacid at kemper.freedesktop.org
Wed Aug 29 15:46:19 PDT 2012


 poppler/Catalog.cc                     |    4 +++-
 poppler/FileSpec.cc                    |    4 ++++
 qt4/src/poppler-embeddedfile-private.h |    4 +++-
 qt4/src/poppler-embeddedfile.cc        |   19 ++++++++++++-------
 4 files changed, 22 insertions(+), 9 deletions(-)

New commits:
commit 46948868dee6d4e68b658c68d7df482590e34da3
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Aug 30 00:43:45 2012 +0200

    Accept FileSpec as Dict too and not only as Ref
    
    File to try in KDE bug #306008

diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc
index 664c421..0f42356 100644
--- a/poppler/Catalog.cc
+++ b/poppler/Catalog.cc
@@ -14,7 +14,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2005 Kristian Høgsberg <krh at redhat.com>
-// Copyright (C) 2005-2011 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005-2012 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2005 Jeff Muizelaar <jrmuizel at nit.ca>
 // Copyright (C) 2005 Jonathan Blandford <jrb at redhat.com>
 // Copyright (C) 2005 Marco Pesenti Gritti <mpg at redhat.com>
@@ -462,6 +462,8 @@ FileSpec *Catalog::embeddedFile(int i)
       Object fsDict;
       embeddedFile = new FileSpec(obj.fetch(xref, &fsDict));
       fsDict.free();
+    } else if (obj.isDict()) {
+      embeddedFile = new FileSpec(&obj);
     } else {
       Object null;
       embeddedFile = new FileSpec(&null);
commit debc8fb497bc22c0f9f34d785852981a87475c30
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Aug 30 00:35:40 2012 +0200

    Take into account the embFile returned by the core may be NULL

diff --git a/qt4/src/poppler-embeddedfile-private.h b/qt4/src/poppler-embeddedfile-private.h
index f109d36..83549da 100644
--- a/qt4/src/poppler-embeddedfile-private.h
+++ b/qt4/src/poppler-embeddedfile-private.h
@@ -1,5 +1,5 @@
 /* poppler-embeddedfile-private.h: Qt4 interface to poppler
- * Copyright (C) 2005, 2008, 2009, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2005, 2008, 2009, 2012, Albert Astals Cid <aacid at kde.org>
  * Copyright (C) 2005, Brad Hards <bradh at frogmouth.net>
  * Copyright (C) 2008, 2011, Pino Toscano <pino at kde.org>
  *
@@ -31,6 +31,8 @@ class EmbeddedFileData
 public:
 	EmbeddedFileData(FileSpec *fs);
 	~EmbeddedFileData();
+    
+	EmbFile *embFile() const;
 
 	FileSpec *filespec;
 };
diff --git a/qt4/src/poppler-embeddedfile.cc b/qt4/src/poppler-embeddedfile.cc
index 1052fd1..cebd3e7 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, 2009, Albert Astals Cid <aacid at kde.org>
+ * Copyright (C) 2005, 2008, 2009, 2012, Albert Astals Cid <aacid at kde.org>
  * Copyright (C) 2005, Brad Hards <bradh at frogmouth.net>
  * Copyright (C) 2008, 2011, Pino Toscano <pino at kde.org>
  *
@@ -44,6 +44,11 @@ EmbeddedFileData::~EmbeddedFileData()
 	delete filespec;
 }
 
+EmbFile *EmbeddedFileData::embFile() const
+{
+	return filespec->isOk() ? filespec->getEmbeddedFile() : NULL;
+}
+
 
 EmbeddedFile::EmbeddedFile(EmbFile *embfile)
 	: m_embeddedFile(0)
@@ -75,30 +80,30 @@ QString EmbeddedFile::description() const
 
 int EmbeddedFile::size() const
 {
-	return m_embeddedFile->filespec->getEmbeddedFile()->size();
+	return m_embeddedFile->embFile() ? m_embeddedFile->embFile()->size() : -1;
 }
 
 QDateTime EmbeddedFile::modDate() const
 {
-	GooString *goo = m_embeddedFile->filespec->getEmbeddedFile()->modDate();
+	GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->modDate() : NULL;
 	return goo ? convertDate(goo->getCString()) : QDateTime();
 }
 
 QDateTime EmbeddedFile::createDate() const
 {
-	GooString *goo = m_embeddedFile->filespec->getEmbeddedFile()->createDate();
+    GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->createDate() : NULL;
 	return goo ? convertDate(goo->getCString()) : QDateTime();
 }
 
 QByteArray EmbeddedFile::checksum() const
 {
-	GooString *goo = m_embeddedFile->filespec->getEmbeddedFile()->checksum();
+    GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->checksum() : NULL;
 	return goo ? QByteArray::fromRawData(goo->getCString(), goo->getLength()) : QByteArray();
 }
 
 QString EmbeddedFile::mimeType() const
 {
-	GooString *goo = m_embeddedFile->filespec->getEmbeddedFile()->mimeType();
+    GooString *goo = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->mimeType() : NULL;
 	return goo ? QString(goo->getCString()) : QString();
 }
 
@@ -106,7 +111,7 @@ QByteArray EmbeddedFile::data()
 {
 	if (!isValid())
 		return QByteArray();
-	Stream *stream = m_embeddedFile->filespec->getEmbeddedFile()->stream();
+	Stream *stream = m_embeddedFile->embFile() ? m_embeddedFile->embFile()->stream() : NULL;
 	if (!stream)
 		return QByteArray();
 	
commit 3ca67a59fc15782abb1e479eb2b8916de5b1b6ed
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Aug 30 00:34:06 2012 +0200

    Return NULL EmbFile if the FileSpec is not ok
    
    Otherwise we might end up asserting

diff --git a/poppler/FileSpec.cc b/poppler/FileSpec.cc
index 1360608..1adcf5b 100644
--- a/poppler/FileSpec.cc
+++ b/poppler/FileSpec.cc
@@ -7,6 +7,7 @@
 //
 // Copyright (C) 2008-2009 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2009 Kovid Goyal <kovid at kovidgoyal.net>
+// Copyright (C) 2012 Albert Astals Cid <aacid at kde.org>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -151,6 +152,9 @@ FileSpec::~FileSpec()
 
 EmbFile *FileSpec::getEmbeddedFile()
 {
+  if(!ok)
+    return NULL;
+
   if (embFile)
     return embFile;
 


More information about the poppler mailing list