|
|
2e1d9e |
--- poppler/glib/poppler-document.cc
|
|
|
2e1d9e |
+++ poppler/glib/poppler-document.cc
|
|
|
55f31b |
@@ -3405,6 +3405,7 @@ PopplerFormField *poppler_document_get_f
|
|
|
55f31b |
unsigned fieldNum;
|
|
|
55f31b |
FormPageWidgets *widgets;
|
|
|
55f31b |
FormWidget *field;
|
|
|
55f31b |
+ PopplerFormField *formField;
|
|
|
55f31b |
|
|
|
55f31b |
FormWidget::decodeID(id, &pageNum, &fieldNum);
|
|
|
55f31b |
|
|
|
55f31b |
@@ -3417,8 +3418,14 @@ PopplerFormField *poppler_document_get_f
|
|
|
55f31b |
return nullptr;
|
|
|
55f31b |
|
|
|
55f31b |
field = widgets->getWidget(fieldNum);
|
|
|
55f31b |
- if (field)
|
|
|
55f31b |
- return _poppler_form_field_new(document, field);
|
|
|
55f31b |
+ if (field) {
|
|
|
55f31b |
+ formField = _poppler_form_field_new(document, field);
|
|
|
55f31b |
+ delete widgets;
|
|
|
2e1d9e |
+
|
|
|
55f31b |
+ return formField;
|
|
|
55f31b |
+ }
|
|
|
2e1d9e |
+
|
|
|
55f31b |
+ delete widgets;
|
|
|
2e1d9e |
|
|
|
55f31b |
return nullptr;
|
|
|
2e1d9e |
}
|
|
|
2e1d9e |
--- poppler/poppler/CairoOutputDev.cc
|
|
|
2e1d9e |
+++ poppler/poppler/CairoOutputDev.cc
|
|
|
55f31b |
@@ -2921,8 +2921,10 @@ void CairoOutputDev::setMimeData(GfxStat
|
|
|
55f31b |
|
|
|
55f31b |
// colorspace in stream dict may be different from colorspace in jpx
|
|
|
55f31b |
// data
|
|
|
55f31b |
- if (strKind == strJPX && colorSpace)
|
|
|
55f31b |
+ if (strKind == strJPX && colorSpace) {
|
|
|
55f31b |
+ delete colorSpace;
|
|
|
55f31b |
return;
|
|
|
55f31b |
+ }
|
|
|
55f31b |
|
|
|
55f31b |
// only embed mime data for gray, rgb, and cmyk colorspaces.
|
|
|
55f31b |
if (colorSpace) {
|
|
|
2e1d9e |
--- poppler/poppler/TextOutputDev.cc
|
|
|
2e1d9e |
+++ poppler/poppler/TextOutputDev.cc
|
|
|
55f31b |
@@ -1619,7 +1619,6 @@ TextBlock::~TextBlock()
|
|
|
55f31b |
|
|
|
55f31b |
void TextBlock::addWord(TextWord *word)
|
|
|
55f31b |
{
|
|
|
55f31b |
- pool->addWord(word);
|
|
|
55f31b |
if (xMin > xMax) {
|
|
|
55f31b |
xMin = word->xMin;
|
|
|
55f31b |
xMax = word->xMax;
|
|
|
55f31b |
@@ -1639,6 +1638,7 @@ void TextBlock::addWord(TextWord *word)
|
|
|
55f31b |
yMax = word->yMax;
|
|
|
55f31b |
}
|
|
|
2e1d9e |
}
|
|
|
55f31b |
+ pool->addWord(word);
|
|
|
2e1d9e |
}
|
|
|
2e1d9e |
|
|
|
55f31b |
void TextBlock::coalesce(const UnicodeMap *uMap, double fixedPitch)
|
|
|
55f31b |
@@ -3064,11 +3064,13 @@ void TextPage::coalesce(bool physLayout,
|
|
|
55f31b |
word0 = pool->getPool(startBaseIdx);
|
|
|
55f31b |
pool->setPool(startBaseIdx, word0->next);
|
|
|
55f31b |
word0->next = nullptr;
|
|
|
55f31b |
- blk = new TextBlock(this, rot);
|
|
|
55f31b |
- blk->addWord(word0);
|
|
|
2e1d9e |
|
|
|
55f31b |
fontSize = word0->fontSize;
|
|
|
55f31b |
minBase = maxBase = word0->base;
|
|
|
2e1d9e |
+
|
|
|
55f31b |
+ blk = new TextBlock(this, rot);
|
|
|
55f31b |
+ blk->addWord(word0);
|
|
|
2e1d9e |
+
|
|
|
55f31b |
colSpace1 = minColSpacing1 * fontSize;
|
|
|
55f31b |
colSpace2 = minColSpacing2 * fontSize;
|
|
|
55f31b |
lineSpace = maxLineSpacingDelta * fontSize;
|
|
|
55f31b |
@@ -3095,9 +3097,9 @@ void TextPage::coalesce(bool physLayout,
|
|
|
55f31b |
}
|
|
|
55f31b |
word1 = word1->next;
|
|
|
55f31b |
word2->next = nullptr;
|
|
|
55f31b |
+ newMinBase = word2->base;
|
|
|
55f31b |
blk->addWord(word2);
|
|
|
55f31b |
found = true;
|
|
|
55f31b |
- newMinBase = word2->base;
|
|
|
55f31b |
} else {
|
|
|
55f31b |
word0 = word1;
|
|
|
55f31b |
word1 = word1->next;
|
|
|
55f31b |
@@ -3123,9 +3125,9 @@ void TextPage::coalesce(bool physLayout,
|
|
|
55f31b |
}
|
|
|
55f31b |
word1 = word1->next;
|
|
|
55f31b |
word2->next = nullptr;
|
|
|
55f31b |
+ newMaxBase = word2->base;
|
|
|
55f31b |
blk->addWord(word2);
|
|
|
55f31b |
found = true;
|
|
|
55f31b |
- newMaxBase = word2->base;
|
|
|
55f31b |
} else {
|
|
|
55f31b |
word0 = word1;
|
|
|
55f31b |
word1 = word1->next;
|
|
|
55f31b |
@@ -3198,12 +3200,12 @@ void TextPage::coalesce(bool physLayout,
|
|
|
55f31b |
}
|
|
|
55f31b |
word1 = word1->next;
|
|
|
55f31b |
word2->next = nullptr;
|
|
|
55f31b |
- blk->addWord(word2);
|
|
|
55f31b |
if (word2->base < minBase) {
|
|
|
55f31b |
minBase = word2->base;
|
|
|
55f31b |
} else if (word2->base > maxBase) {
|
|
|
55f31b |
maxBase = word2->base;
|
|
|
55f31b |
}
|
|
|
55f31b |
+ blk->addWord(word2);
|
|
|
55f31b |
found = true;
|
|
|
55f31b |
break;
|
|
|
55f31b |
} else {
|
|
|
55f31b |
@@ -3246,12 +3248,12 @@ void TextPage::coalesce(bool physLayout,
|
|
|
55f31b |
}
|
|
|
55f31b |
word1 = word1->next;
|
|
|
55f31b |
word2->next = nullptr;
|
|
|
55f31b |
- blk->addWord(word2);
|
|
|
55f31b |
if (word2->base < minBase) {
|
|
|
55f31b |
minBase = word2->base;
|
|
|
55f31b |
} else if (word2->base > maxBase) {
|
|
|
55f31b |
maxBase = word2->base;
|
|
|
55f31b |
}
|
|
|
55f31b |
+ blk->addWord(word2);
|
|
|
55f31b |
found = true;
|
|
|
55f31b |
break;
|
|
|
55f31b |
} else {
|
|
|
2e1d9e |
--- poppler/poppler/XRef.cc
|
|
|
2e1d9e |
+++ poppler/poppler/XRef.cc
|
|
|
55f31b |
@@ -402,6 +402,7 @@ int XRef::reserve(int newSize)
|
|
|
55f31b |
|
|
|
55f31b |
void *p = greallocn_checkoverflow(entries, realNewSize, sizeof(XRefEntry));
|
|
|
55f31b |
if (p == nullptr) {
|
|
|
55f31b |
+ entries = nullptr;
|
|
|
55f31b |
return 0;
|
|
|
55f31b |
}
|
|
|
55f31b |
|
|
|
55f31b |
@@ -835,7 +836,6 @@ bool XRef::constructXRef(bool *wasRecons
|
|
|
55f31b |
int offset = 0;
|
|
|
55f31b |
|
|
|
55f31b |
resize(0); // free entries properly
|
|
|
55f31b |
- gfree(entries);
|
|
|
55f31b |
capacity = 0;
|
|
|
55f31b |
size = 0;
|
|
|
55f31b |
entries = nullptr;
|
|
|
2e1d9e |
--- poppler/test/pdf-inspector.cc
|
|
|
2e1d9e |
+++ poppler/test/pdf-inspector.cc
|
|
|
55f31b |
@@ -43,6 +43,7 @@ class PdfInspector
|
|
|
55f31b |
{
|
|
|
2e1d9e |
public:
|
|
|
55f31b |
PdfInspector();
|
|
|
55f31b |
+ ~PdfInspector();
|
|
|
2e1d9e |
|
|
|
55f31b |
void set_file_name(const char *file_name);
|
|
|
55f31b |
void load(const char *file_name);
|
|
|
55f31b |
@@ -108,6 +109,11 @@ PdfInspector::PdfInspector()
|
|
|
55f31b |
load(nullptr);
|
|
|
2e1d9e |
}
|
|
|
55f31b |
|
|
|
2e1d9e |
+PdfInspector::~PdfInspector(void)
|
|
|
2e1d9e |
+{
|
|
|
55f31b |
+ delete output;
|
|
|
2e1d9e |
+}
|
|
|
55f31b |
+
|
|
|
55f31b |
void PdfInspector::set_file_name(const char *file_name)
|
|
|
55f31b |
{
|
|
|
55f31b |
GtkWidget *widget;
|
|
|
2e1d9e |
--- poppler/utils/HtmlOutputDev.cc
|
|
|
2e1d9e |
+++ poppler/utils/HtmlOutputDev.cc
|
|
|
55f31b |
@@ -1337,6 +1337,7 @@ void HtmlOutputDev::drawPngImage(GfxStat
|
|
|
55f31b |
// TODO can we calculate the resolution of the image?
|
|
|
55f31b |
if (!writer->init(f1, width, height, 72, 72)) {
|
|
|
55f31b |
error(errInternal, -1, "Can't init PNG for image '{0:t}'", fName);
|
|
|
2e1d9e |
+ delete fName;
|
|
|
2e1d9e |
delete writer;
|
|
|
2e1d9e |
fclose(f1);
|
|
|
55f31b |
return;
|
|
|
2e1d9e |
--- poppler/utils/pdftotext.cc
|
|
|
2e1d9e |
+++ poppler/utils/pdftotext.cc
|
|
|
55f31b |
@@ -329,6 +329,7 @@ int main(int argc, char *argv[])
|
|
|
55f31b |
fputs("\n", f);
|
|
|
55f31b |
if (f != stdout) {
|
|
|
55f31b |
fclose(f);
|
|
|
55f31b |
+ f = nullptr;
|
|
|
55f31b |
}
|
|
|
55f31b |
}
|
|
|
2e1d9e |
}
|
|
|
55f31b |
@@ -348,8 +349,9 @@ int main(int argc, char *argv[])
|
|
|
55f31b |
printWordBBox(f, doc, textOut, firstPage, lastPage);
|
|
|
55f31b |
}
|
|
|
55f31b |
}
|
|
|
55f31b |
- if (f != stdout) {
|
|
|
55f31b |
+ if (f != stdout && f != nullptr) {
|
|
|
55f31b |
fclose(f);
|
|
|
55f31b |
+ f = nullptr;
|
|
|
55f31b |
}
|
|
|
55f31b |
} else {
|
|
|
55f31b |
textOut = new TextOutputDev(textFileName->c_str(), physLayout, fixedPitch, rawOrder, htmlMeta, discardDiag);
|
|
|
55f31b |
@@ -390,7 +392,7 @@ int main(int argc, char *argv[])
|
|
|
55f31b |
fputs("\n", f);
|
|
|
55f31b |
fputs("</body>\n", f);
|
|
|
55f31b |
fputs("</html>\n", f);
|
|
|
55f31b |
- if (f != stdout) {
|
|
|
55f31b |
+ if (f != stdout && f != nullptr) {
|
|
|
55f31b |
fclose(f);
|
|
|
55f31b |
}
|
|
|
2e1d9e |
}
|