poppler/Annot.cc | 12 ++++++------ poppler/Form.cc | 2 +- poppler/GfxFont.cc | 6 +++--- poppler/Object.h | 4 +++- poppler/PDFDoc.cc | 2 +- poppler/PSOutputDev.cc | 4 ++-- poppler/Page.cc | 12 ++++++------ poppler/XRef.cc | 4 ++-- qt5/src/poppler-document.cc | 4 ++-- utils/pdfunite.cc | 4 ++-- 10 files changed, 28 insertions(+), 26 deletions(-)
New commits: commit fc555c756becd50d75d87b820b695363030d9ab9 Author: Albert Astals Cid <[email protected]> Date: Sun Feb 10 16:28:28 2019 +0100 Object: Add constructor that takes a const Ref makes it easier to not have to unbox the Ref for no reason diff --git a/poppler/Annot.cc b/poppler/Annot.cc index 1750dc70..294aa7b1 100644 --- a/poppler/Annot.cc +++ b/poppler/Annot.cc @@ -15,7 +15,7 @@ // // Copyright (C) 2006 Scott Turner <[email protected]> // Copyright (C) 2007, 2008 Julien Rebetez <[email protected]> -// Copyright (C) 2007-2013, 2015-2018 Albert Astals Cid <[email protected]> +// Copyright (C) 2007-2013, 2015-2019 Albert Astals Cid <[email protected]> // Copyright (C) 2007-2013, 2018 Carlos Garcia Campos <[email protected]> // Copyright (C) 2007, 2008 Iñigo Martínez <[email protected]> // Copyright (C) 2007 Jeff Muizelaar <[email protected]> @@ -1439,8 +1439,8 @@ void Annot::setPage(int pageIndex, bool updateP) { Object obj1(objNull); if (pageobj) { - Ref pageRef = pageobj->getRef(); - obj1 = Object(pageRef.num, pageRef.gen); + const Ref pageRef = pageobj->getRef(); + obj1 = Object(pageRef); page = pageIndex; } else { page = 0; @@ -1881,7 +1881,7 @@ void AnnotPopup::initialize(PDFDoc *docA, Dict *dict) { void AnnotPopup::setParent(Annot *parentA) { const Ref parentRef = parentA->getRef(); - update ("Parent", Object(parentRef.num, parentRef.gen)); + update ("Parent", Object(parentRef)); } void AnnotPopup::setOpen(bool openA) { @@ -1994,7 +1994,7 @@ void AnnotMarkup::setPopup(std::unique_ptr<AnnotPopup> &&new_popup) { if (new_popup) { const Ref popupRef = new_popup->getRef(); - update ("Popup", Object(popupRef.num, popupRef.gen)); + update ("Popup", Object(popupRef)); new_popup->setParent(this); popup = std::move(new_popup); @@ -4920,7 +4920,7 @@ void AnnotWidget::updateAppearanceStream() // Write the AP dictionary obj1 = Object(new Dict(xref)); - obj1.dictAdd("N", Object(updatedAppearanceStream.num, updatedAppearanceStream.gen)); + obj1.dictAdd("N", Object(updatedAppearanceStream)); // Update our internal pointers to the appearance dictionary appearStreams = std::make_unique<AnnotAppearance>(doc, &obj1); diff --git a/poppler/Form.cc b/poppler/Form.cc index 6f7f6ee4..e37212ee 100644 --- a/poppler/Form.cc +++ b/poppler/Form.cc @@ -112,7 +112,7 @@ void FormWidget::createWidgetAnnotation() { if (widget) return; - Object obj1(ref.num, ref.gen); + Object obj1(ref); widget = new AnnotWidget(doc, &obj, &obj1, field); } diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc index 41b8bb95..15604999 100644 --- a/poppler/GfxFont.cc +++ b/poppler/GfxFont.cc @@ -407,7 +407,7 @@ GfxFontType GfxFont::getFontType(XRef *xref, Dict *fontDict, Ref *embID) { t = fontUnknownType; if (embID->num >= 0) { - Object obj3(embID->num, embID->gen); + Object obj3(*embID); Object obj4 = obj3.fetch(xref); if (obj4.isStream()) { obj4.streamReset(); @@ -603,7 +603,7 @@ GfxFontLoc *GfxFont::locateFont(XRef *xref, PSOutputDev *ps) { //----- embedded font if (embFontID.num >= 0) { embed = true; - Object refObj(embFontID.num, embFontID.gen); + Object refObj(embFontID); Object embFontObj = refObj.fetch(xref); if (!embFontObj.isStream()) { error(errSyntaxError, -1, "Embedded font object is wrong type"); @@ -819,7 +819,7 @@ char *GfxFont::readEmbFontFile(XRef *xref, int *len) { char *buf; Stream *str; - Object obj1(embFontID.num, embFontID.gen); + Object obj1(embFontID); Object obj2 = obj1.fetch(xref); if (!obj2.isStream()) { error(errSyntaxError, -1, "Embedded font file is not a stream"); diff --git a/poppler/Object.h b/poppler/Object.h index 5c7058a5..01668652 100644 --- a/poppler/Object.h +++ b/poppler/Object.h @@ -15,7 +15,7 @@ // // Copyright (C) 2007 Julien Rebetez <[email protected]> // Copyright (C) 2008 Kees Cook <[email protected]> -// Copyright (C) 2008, 2010, 2017, 2018 Albert Astals Cid <[email protected]> +// Copyright (C) 2008, 2010, 2017-2019 Albert Astals Cid <[email protected]> // Copyright (C) 2009 Jakub Wilk <[email protected]> // Copyright (C) 2012 Fabio D'Urso <[email protected]> // Copyright (C) 2013 Thomas Freitag <[email protected]> @@ -174,6 +174,8 @@ public: { assert(streamA); type = objStream; stream = streamA; } Object(int numA, int genA) { type = objRef; ref.num = numA; ref.gen = genA; } + Object(const Ref r) + { type = objRef; ref.num = r.num; ref.gen = r.gen; } template<typename T> Object(T) = delete; diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index 8e7b4733..6f0dd0e1 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -1583,7 +1583,7 @@ Object PDFDoc::createTrailerDict(int uxrefSize, bool incrUpdate, Goffset startxR trailerDict->set("ID", Object(array)); } - trailerDict->set("Root", Object(root->num, root->gen)); + trailerDict->set("Root", Object(*root)); if (incrUpdate) { trailerDict->set("Prev", Object(startxRef)); diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc index 9a7adc1d..5f1db1f5 100644 --- a/poppler/PSOutputDev.cc +++ b/poppler/PSOutputDev.cc @@ -15,7 +15,7 @@ // // Copyright (C) 2005 Martin Kretzschmar <[email protected]> // Copyright (C) 2005, 2006 Kristian Høgsberg <[email protected]> -// Copyright (C) 2006-2009, 2011-2013, 2015-2018 Albert Astals Cid <[email protected]> +// Copyright (C) 2006-2009, 2011-2013, 2015-2019 Albert Astals Cid <[email protected]> // Copyright (C) 2006 Jeff Muizelaar <[email protected]> // Copyright (C) 2007, 2008 Brad Hards <[email protected]> // Copyright (C) 2008, 2009 Koji Otani <[email protected]> @@ -2119,7 +2119,7 @@ void PSOutputDev::setupEmbeddedType1Font(Ref *id, GooString *psName) { // get the font stream and info Object obj1, obj2, obj3; - Object refObj(id->num, id->gen); + Object refObj(*id); Object strObj = refObj.fetch(xref); if (!strObj.isStream()) { error(errSyntaxError, -1, "Embedded font file object is not a stream"); diff --git a/poppler/Page.cc b/poppler/Page.cc index 9aa25dfc..775c1a51 100644 --- a/poppler/Page.cc +++ b/poppler/Page.cc @@ -15,7 +15,7 @@ // // Copyright (C) 2005 Kristian Høgsberg <[email protected]> // Copyright (C) 2005 Jeff Muizelaar <[email protected]> -// Copyright (C) 2005-2013, 2016-2018 Albert Astals Cid <[email protected]> +// Copyright (C) 2005-2013, 2016-2019 Albert Astals Cid <[email protected]> // Copyright (C) 2006-2008 Pino Toscano <[email protected]> // Copyright (C) 2006 Nickolay V. Shmyrev <[email protected]> // Copyright (C) 2006 Scott Turner <[email protected]> @@ -366,7 +366,7 @@ Annots *Page::getAnnots(XRef *xrefA) { } void Page::addAnnot(Annot *annot) { - Ref annotRef = annot->getRef (); + const Ref annotRef = annot->getRef (); // Make sure we have annots before adding the new one // even if it's an empty list so that we can safely @@ -380,16 +380,16 @@ void Page::addAnnot(Annot *annot) { // we have to create it Object obj1 = Object(new Array(xref)); - obj1.arrayAdd(Object(annotRef.num, annotRef.gen)); + obj1.arrayAdd(Object(annotRef)); annotsRef = xref->addIndirectObject (&obj1); - annotsObj = Object(annotsRef.num, annotsRef.gen); - pageObj.dictSet ("Annots", Object(annotsRef.num, annotsRef.gen)); + annotsObj = Object(annotsRef); + pageObj.dictSet ("Annots", Object(annotsRef)); xref->setModifiedObject (&pageObj, pageRef); } else { Object obj1 = getAnnotsObject(); if (obj1.isArray()) { - obj1.arrayAdd (Object(annotRef.num, annotRef.gen)); + obj1.arrayAdd (Object(annotRef)); if (annotsObj.isRef()) xref->setModifiedObject (&obj1, annotsObj.getRef()); else diff --git a/poppler/XRef.cc b/poppler/XRef.cc index 9f25ff88..2541d113 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -15,7 +15,7 @@ // // Copyright (C) 2005 Dan Sheridan <[email protected]> // Copyright (C) 2005 Brad Hards <[email protected]> -// Copyright (C) 2006, 2008, 2010, 2012-2014, 2016-2018 Albert Astals Cid <[email protected]> +// Copyright (C) 2006, 2008, 2010, 2012-2014, 2016-2019 Albert Astals Cid <[email protected]> // Copyright (C) 2007-2008 Julien Rebetez <[email protected]> // Copyright (C) 2007 Carlos Garcia Campos <[email protected]> // Copyright (C) 2009, 2010 Ilya Gorenbein <[email protected]> @@ -1206,7 +1206,7 @@ Object XRef::createDocInfoIfNoneExists() { obj = Object(new Dict(this)); const Ref ref = addIndirectObject(&obj); - trailerDict.dictSet("Info", Object(ref.num, ref.gen)); + trailerDict.dictSet("Info", Object(ref)); return obj; } diff --git a/qt5/src/poppler-document.cc b/qt5/src/poppler-document.cc index 0aa5bed4..c0def750 100644 --- a/qt5/src/poppler-document.cc +++ b/qt5/src/poppler-document.cc @@ -1,7 +1,7 @@ /* poppler-document.cc: qt interface to poppler * Copyright (C) 2005, Net Integration Technologies, Inc. * Copyright (C) 2005, 2008, Brad Hards <[email protected]> - * Copyright (C) 2005-2010, 2012, 2013, 2015, 2017, 2018, Albert Astals Cid <[email protected]> + * Copyright (C) 2005-2010, 2012, 2013, 2015, 2017-2019, Albert Astals Cid <[email protected]> * Copyright (C) 2006-2010, Pino Toscano <[email protected]> * Copyright (C) 2010, 2011 Hib Eris <[email protected]> * Copyright (C) 2012 Koji Otani <[email protected]> @@ -246,7 +246,7 @@ namespace Poppler { { XRef *xref = m_doc->doc->getXRef()->copy(); - Object refObj(fi.m_data->embRef.num, fi.m_data->embRef.gen); + Object refObj(fi.m_data->embRef); Object strObj = refObj.fetch(xref); if (strObj.isStream()) { diff --git a/utils/pdfunite.cc b/utils/pdfunite.cc index dc57afe8..aa22592f 100644 --- a/utils/pdfunite.cc +++ b/utils/pdfunite.cc @@ -7,7 +7,7 @@ // Copyright (C) 2011-2015, 2017 Thomas Freitag <[email protected]> // Copyright (C) 2012 Arseny Solokha <[email protected]> // Copyright (C) 2012 Fabio D'Urso <[email protected]> -// Copyright (C) 2012, 2014, 2017, 2018 Albert Astals Cid <[email protected]> +// Copyright (C) 2012, 2014, 2017-2019 Albert Astals Cid <[email protected]> // Copyright (C) 2013 Adrian Johnson <[email protected]> // Copyright (C) 2013 Hib Eris <[email protected]> // Copyright (C) 2015 Arthur Stavisky <[email protected]> @@ -68,7 +68,7 @@ static void doMergeNameTree(PDFDoc *doc, XRef *srcXRef, XRef *countRef, int oldR } } newNameArray->add(Object(new GooString(key.getString()->c_str()))); - newNameArray->add(Object(value.getRef().num, value.getRef().gen)); + newNameArray->add(Object(value.getRef())); } } while (j < mergeNameArray.arrayGetLength() - 1) { _______________________________________________ poppler mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/poppler
