From 7055a5da817cab0e269d3de168b5169cbb1db7d5 Mon Sep 17 00:00:00 2001 From: Jakub Kucharski 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 f3383fc..9e428cb 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -1024,10 +1024,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.9.2