From 869d45b8d7cfdf46245393f14583bde599983c1e Mon Sep 17 00:00:00 2001 From: Jakub Alba Date: Sun, 7 Aug 2016 01:57:39 +0200 Subject: [PATCH] PDFDoc::saveIncrementalUpdate: don't check if there are updated entries The caller should check if the document is modified. And this is what actually happens right now - PDFDoc::saveIncrementalUpdate is private and the only place where we call this function is from PDFDoc::saveAs(OutStream *outStr, PDFWriteMode mode). --- poppler/PDFDoc.cc | 4 ---- poppler/PDFDoc.h | 3 +++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index ed2dbba..e8974e3 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -1028,10 +1028,6 @@ void PDFDoc::saveIncrementalUpdate (OutStream* outStr) } } xref->unlock(); - if (uxref->getNumObjects() == 0) { //we have nothing to update - delete uxref; - return; - } Goffset uxrefOffset = outStr->getPos(); int numobjects = xref->getNumObjects(); diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h index daff3f4..21b878a 100644 --- a/poppler/PDFDoc.h +++ b/poppler/PDFDoc.h @@ -332,7 +332,10 @@ private: int uxrefSize, OutStream* outStr, GBool incrUpdate); static void writeString (GooString* s, OutStream* outStr, Guchar *fileKey, CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen); + + // the caller must ensure there are updated entries void saveIncrementalUpdate (OutStream* outStr); + void saveCompleteRewrite (OutStream* outStr); Page *parsePage(int page); -- 2.10.1