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 9264b375eec19e639c524b677f770ad750b1cb43 Author: Albert Astals Cid <[email protected]> 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 <[email protected]> -// Copyright (C) 2005-2011 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2012 Albert Astals Cid <[email protected]> // Copyright (C) 2005 Jeff Muizelaar <[email protected]> // Copyright (C) 2005 Jonathan Blandford <[email protected]> // Copyright (C) 2005 Marco Pesenti Gritti <[email protected]> @@ -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 01528eaedc77d5559f6dc4229b66f1a819678fb7 Author: Albert Astals Cid <[email protected]> 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 <[email protected]> + * Copyright (C) 2005, 2008, 2009, 2012, Albert Astals Cid <[email protected]> * Copyright (C) 2005, Brad Hards <[email protected]> * Copyright (C) 2008, 2011, Pino Toscano <[email protected]> * @@ -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 <[email protected]> + * Copyright (C) 2005, 2008, 2009, 2012, Albert Astals Cid <[email protected]> * Copyright (C) 2005, Brad Hards <[email protected]> * Copyright (C) 2008, 2011, Pino Toscano <[email protected]> * @@ -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 c1fba45be106dc30a5136efe41493b1cf6d2a1b5 Author: Albert Astals Cid <[email protected]> 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 <[email protected]> // Copyright (C) 2009 Kovid Goyal <[email protected]> +// Copyright (C) 2012 Albert Astals Cid <[email protected]> // // 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;
_______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
