Commit 6818363c authored by Rocky Automation's avatar Rocky Automation 📺
Browse files

import poppler-20.11.0-2.el8

parent 8b583e6f
SOURCES/poppler-0.66.0.tar.xz SOURCES/poppler-20.11.0.tar.xz
SOURCES/poppler-test-2009-05-13_0d2bfd4af4c76a3bac27ccaff793d9129df7b57a.tar.xz SOURCES/poppler-test-2009-05-13_0d2bfd4af4c76a3bac27ccaff793d9129df7b57a.tar.xz
95f58069ddbeb7db9bee68873266a5dc8aaaef96 SOURCES/poppler-0.66.0.tar.xz 0aa751121aed6ee2220ef3ea16b9df8f9b2e81c1 SOURCES/poppler-20.11.0.tar.xz
b58229322eb8f44a2bb1d98114b9fa3dfbef6a0a SOURCES/poppler-test-2009-05-13_0d2bfd4af4c76a3bac27ccaff793d9129df7b57a.tar.xz b58229322eb8f44a2bb1d98114b9fa3dfbef6a0a SOURCES/poppler-test-2009-05-13_0d2bfd4af4c76a3bac27ccaff793d9129df7b57a.tar.xz
...@@ -17,18 +17,18 @@ index 7c2ca78..e93908c 100644 ...@@ -17,18 +17,18 @@ index 7c2ca78..e93908c 100644
--- a/poppler/TextOutputDev.cc --- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc +++ b/poppler/TextOutputDev.cc
@@ -178,6 +178,12 @@ @@ -178,6 +178,12 @@
#define combMaxMidDelta 0.3 // to read the underlying image. Issue #157
#define combMaxBaseDelta 0.4 #define glyphlessSelectionOpacity 0.4
+// Returns whether x is between a and b or equal to a or b. +// Returns whether x is between a and b or equal to a or b.
+// a and b don't need to be sorted. +// a and b don't need to be sorted.
+#define XBetweenAB(x,a,b) (!(((x) > (a) && (x) > (b)) || \ +#define XBetweenAB(x,a,b) (!(((x) > (a) && (x) > (b)) || \
+ ((x) < (a) && (x) < (b))) ? \ + ((x) < (a) && (x) < (b))) ? \
+ gTrue : gFalse) + true : false)
+ +
static int reorderText(Unicode *text, int len, UnicodeMap *uMap, GBool primaryLR, GooString *s, Unicode* u) { namespace {
char lre[8], rle[8], popdf[8], buf[8];
int lreLen = 0, rleLen = 0, popdfLen = 0, n; inline bool isAscii7(Unicode uchar)
@@ -4411,11 +4417,37 @@ void TextSelectionSizer::visitLine (TextLine *line, @@ -4411,11 +4417,37 @@ void TextSelectionSizer::visitLine (TextLine *line,
PDFRectangle *rect; PDFRectangle *rect;
double x1, y1, x2, y2, margin; double x1, y1, x2, y2, margin;
...@@ -70,17 +70,17 @@ index 7c2ca78..e93908c 100644 ...@@ -70,17 +70,17 @@ index 7c2ca78..e93908c 100644
+ break; + break;
+ } + }
rect = new PDFRectangle (floor (x1 * scale), rect = new PDFRectangle(floor(x1 * scale), floor(y1 * scale), ceil(x2 * scale), ceil(y2 * scale));
floor (y1 * scale), list->push_back(rect);
@@ -4499,19 +4531,56 @@ void TextSelectionPainter::visitLine (TextLine *line, @@ -4499,19 +4531,56 @@ void TextSelectionPainter::visitLine (TextLine *line,
{ {
double x1, y1, x2, y2, margin; double x1, y1, x2, y2, margin;
- margin = (line->yMax - line->yMin) / 8; - margin = (line->yMax - line->yMin) / 8;
- x1 = floor (line->edge[edge_begin]); - x1 = floor(line->edge[edge_begin]);
- y1 = floor (line->yMin - margin); - y1 = floor(line->yMin - margin);
- x2 = ceil (line->edge[edge_end]); - x2 = ceil(line->edge[edge_end]);
- y2 = ceil (line->yMax + margin); - y2 = ceil(line->yMax + margin);
+ switch (line->rot) { + switch (line->rot) {
+ default: + default:
+ case 0: + case 0:
...@@ -119,29 +119,29 @@ index 7c2ca78..e93908c 100644 ...@@ -119,29 +119,29 @@ index 7c2ca78..e93908c 100644
- ctm.transform(line->edge[edge_begin], line->yMin - margin, &x1, &y1); - ctm.transform(line->edge[edge_begin], line->yMin - margin, &x1, &y1);
- ctm.transform(line->edge[edge_end], line->yMax + margin, &x2, &y2); - ctm.transform(line->edge[edge_end], line->yMax + margin, &x2, &y2);
+ if (x1 < x2) { + if (x1 < x2) {
+ x1 = floor (x1); + x1 = floor(x1);
+ x2 = ceil (x2); + x2 = ceil(x2);
+ } else { + } else {
+ x1 = ceil (x1); + x1 = ceil(x1);
+ x2 = floor (x2); + x2 = floor(x2);
+ } + }
- x1 = floor (x1); - x1 = floor(x1);
- y1 = floor (y1); - y1 = floor(y1);
- x2 = ceil (x2); - x2 = ceil(x2);
- y2 = ceil (y2); - y2 = ceil(y2);
+ if (y1 < y2) { + if (y1 < y2) {
+ y1 = floor (y1); + y1 = floor(y1);
+ y2 = ceil (y2); + y2 = ceil(y2);
+ } else { + } else {
+ y1 = ceil (y1); + y1 = ceil(y1);
+ y2 = floor (y2); + y2 = floor(y2);
+ } + }
ictm.transform(x1, y1, &x1, &y1); ictm.transform(x1, y1, &x1, &y1);
ictm.transform(x2, y2, &x2, &y2); ictm.transform(x2, y2, &x2, &y2);
@@ -4589,17 +4658,27 @@ void TextWord::visitSelection(TextSelectionVisitor *visitor, @@ -4589,17 +4658,26 @@ void TextWord::visitSelection(TextSelectionVisitor *visitor,
SelectionStyle style) void TextWord::visitSelection(TextSelectionVisitor *visitor, const PDFRectangle *selection, SelectionStyle style)
{ {
int i, begin, end; int i, begin, end;
- double mid; - double mid;
...@@ -164,8 +164,7 @@ index 7c2ca78..e93908c 100644 ...@@ -164,8 +164,7 @@ index 7c2ca78..e93908c 100644
- begin = i; - begin = i;
- if (mid < selection->x1 || mid < selection->x2) - if (mid < selection->x1 || mid < selection->x2)
- end = i + 1; - end = i + 1;
+ if (XBetweenAB (mid, s1, s2)) + if (XBetweenAB (mid, s1, s2)) {
+ {
+ if (i < begin) + if (i < begin)
+ begin = i; + begin = i;
+ +
...@@ -174,7 +173,7 @@ index 7c2ca78..e93908c 100644 ...@@ -174,7 +173,7 @@ index 7c2ca78..e93908c 100644
} }
/* Skip empty selection. */ /* Skip empty selection. */
@@ -4615,30 +4694,41 @@ void TextLine::visitSelection(TextSelectionVisitor *visitor, @@ -4615,26 +4694,41 @@ void TextLine::visitSelection(TextSelectionVisitor *visitor,
TextWord *p, *begin, *end, *current; TextWord *p, *begin, *end, *current;
int i, edge_begin, edge_end; int i, edge_begin, edge_end;
PDFRectangle child_selection; PDFRectangle child_selection;
...@@ -201,34 +200,30 @@ index 7c2ca78..e93908c 100644 ...@@ -201,34 +200,30 @@ index 7c2ca78..e93908c 100644
+ } + }
+ +
if (blk->page->primaryLR) { if (blk->page->primaryLR) {
- if ((selection->x1 < p->xMax) || - if ((selection->x1 < p->xMax) || (selection->x2 < p->xMax))
- (selection->x2 < p->xMax))
- if (begin == nullptr) - if (begin == nullptr)
- begin = p; - begin = p;
+ if (((s1 < p_max) || (s2 < p_max)) && begin == nullptr) + if (((s1 < p_max) || (s2 < p_max)) && begin == nullptr)
+ begin = p; + begin = p;
- if (((selection->x1 > p->xMin) || - if (((selection->x1 > p->xMin) || (selection->x2 > p->xMin)) && (begin != nullptr)) {
- (selection->x2 > p->xMin)) && (begin != nullptr)) {
+ if (((s1 > p_min) || (s2 > p_min)) && begin != nullptr) { + if (((s1 > p_min) || (s2 > p_min)) && begin != nullptr) {
end = p->next; end = p->next;
current = p; current = p;
} }
} else { } else {
- if ((selection->x1 > p->xMin) || - if ((selection->x1 > p->xMin) || (selection->x2 > p->xMin))
- (selection->x2 > p->xMin))
- if (begin == nullptr) - if (begin == nullptr)
- begin = p; - begin = p;
+ if (((s1 > p_min) || (s2 > p_min)) && begin == nullptr) + if (((s1 > p_min) || (s2 > p_min)) && begin == nullptr)
+ begin = p; + begin = p;
- if (((selection->x1 < p->xMax) || - if (((selection->x1 < p->xMax) || (selection->x2 < p->xMax)) && (begin != nullptr)) {
- (selection->x2 < p->xMax)) && (begin != nullptr)) {
+ if (((s1 < p_max) || (s2 < p_max)) && begin != nullptr) { + if (((s1 < p_max) || (s2 < p_max)) && begin != nullptr) {
end = p->next; end = p->next;
current = p; current = p;
} }
@@ -4650,23 +4740,42 @@ void TextLine::visitSelection(TextSelectionVisitor *visitor, @@ -4650,23 +4740,41 @@ void TextLine::visitSelection(TextSelectionVisitor *visitor,
child_selection = *selection; child_selection = *selection;
if (style == selectionStyleWord) { if (style == selectionStyleWord) {
...@@ -270,8 +265,7 @@ index 7c2ca78..e93908c 100644 ...@@ -270,8 +265,7 @@ index 7c2ca78..e93908c 100644
- edge_begin = i; - edge_begin = i;
- if (mid < child_selection.x2 || mid < child_selection.x1) - if (mid < child_selection.x2 || mid < child_selection.x1)
- edge_end = i + 1; - edge_end = i + 1;
+ if (XBetweenAB (mid, s1, s2)) + if (XBetweenAB (mid, s1, s2)) {
+ {
+ if (i < edge_begin) + if (i < edge_begin)
+ edge_begin = i; + edge_begin = i;
+ +
......
--- poppler/glib/poppler-document.cc --- poppler/glib/poppler-document.cc
+++ poppler/glib/poppler-document.cc +++ poppler/glib/poppler-document.cc
@@ -2872,6 +2872,7 @@ poppler_document_get_form_field (Poppler @@ -3405,6 +3405,7 @@ PopplerFormField *poppler_document_get_f
unsigned fieldNum; unsigned fieldNum;
FormPageWidgets *widgets; FormPageWidgets *widgets;
FormWidget *field; FormWidget *field;
+ PopplerFormField *formField; + PopplerFormField *formField;
FormWidget::decodeID (id, &pageNum, &fieldNum); FormWidget::decodeID(id, &pageNum, &fieldNum);
@@ -2884,8 +2885,14 @@ poppler_document_get_form_field (Poppler @@ -3417,8 +3418,14 @@ PopplerFormField *poppler_document_get_f
return nullptr; return nullptr;
field = widgets->getWidget (fieldNum); field = widgets->getWidget(fieldNum);
- if (field) - if (field)
- return _poppler_form_field_new (document, field); - return _poppler_form_field_new(document, field);
+ if (field) { + if (field) {
+ formField = _poppler_form_field_new (document, field); + formField = _poppler_form_field_new(document, field);
+ delete widgets; + delete widgets;
+ +
+ return formField; + return formField;
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
} }
--- poppler/poppler/CairoOutputDev.cc --- poppler/poppler/CairoOutputDev.cc
+++ poppler/poppler/CairoOutputDev.cc +++ poppler/poppler/CairoOutputDev.cc
@@ -3010,8 +3010,10 @@ void CairoOutputDev::setMimeData(GfxStat @@ -2921,8 +2921,10 @@ void CairoOutputDev::setMimeData(GfxStat
// colorspace in stream dict may be different from colorspace in jpx // colorspace in stream dict may be different from colorspace in jpx
// data // data
...@@ -39,55 +39,25 @@ ...@@ -39,55 +39,25 @@
// only embed mime data for gray, rgb, and cmyk colorspaces. // only embed mime data for gray, rgb, and cmyk colorspaces.
if (colorSpace) { if (colorSpace) {
--- poppler/poppler/Link.cc
+++ poppler/poppler/Link.cc
@@ -193,6 +193,7 @@ LinkAction *LinkAction::parseAction(cons
const Ref ref = obj3Ref.getRef();
if (!seenNextActions->insert(ref.num).second) {
error(errSyntaxWarning, -1, "parseAction: Circular next actions detected in array.");
+ delete actionList;
return action;
}
}
--- poppler/poppler/SplashOutputDev.cc
+++ poppler/poppler/SplashOutputDev.cc
@@ -2207,6 +2207,8 @@ reload:
error(errSyntaxError, -1, "Couldn't create a font for '{0:s}'",
gfxFont->getName() ? gfxFont->getName()->getCString()
: "(unnamed)");
+ if (fontsrc && fontsrc->isFile)
+ fontsrc->unref();
goto err2;
}
codeToGID = ((GfxCIDFont *)gfxFont)->getCodeToGIDMap(ff, &n);
@@ -2225,6 +2227,8 @@ reload:
break;
default:
// this shouldn't happen
+ if (fontsrc && fontsrc->isFile)
+ fontsrc->unref();
goto err2;
}
fontFile->doAdjustMatrix = doAdjustFontMatrix;
--- poppler/poppler/TextOutputDev.cc --- poppler/poppler/TextOutputDev.cc
+++ poppler/poppler/TextOutputDev.cc +++ poppler/poppler/TextOutputDev.cc
@@ -1526,7 +1526,6 @@ TextBlock::~TextBlock() { @@ -1619,7 +1619,6 @@ TextBlock::~TextBlock()
}
void TextBlock::addWord(TextWord *word) { void TextBlock::addWord(TextWord *word)
{
- pool->addWord(word); - pool->addWord(word);
if (xMin > xMax) { if (xMin > xMax) {
xMin = word->xMin; xMin = word->xMin;
xMax = word->xMax; xMax = word->xMax;
@@ -1546,6 +1545,7 @@ void TextBlock::addWord(TextWord *word) @@ -1639,6 +1638,7 @@ void TextBlock::addWord(TextWord *word)
yMax = word->yMax; yMax = word->yMax;
} }
} }
+ pool->addWord(word); + pool->addWord(word);
} }
void TextBlock::coalesce(UnicodeMap *uMap, double fixedPitch) { void TextBlock::coalesce(const UnicodeMap *uMap, double fixedPitch)
@@ -2999,11 +2999,13 @@ void TextPage::coalesce(GBool physLayout @@ -3064,11 +3064,13 @@ void TextPage::coalesce(bool physLayout,
word0 = pool->getPool(startBaseIdx); word0 = pool->getPool(startBaseIdx);
pool->setPool(startBaseIdx, word0->next); pool->setPool(startBaseIdx, word0->next);
word0->next = nullptr; word0->next = nullptr;
...@@ -103,29 +73,29 @@ ...@@ -103,29 +73,29 @@
colSpace1 = minColSpacing1 * fontSize; colSpace1 = minColSpacing1 * fontSize;
colSpace2 = minColSpacing2 * fontSize; colSpace2 = minColSpacing2 * fontSize;
lineSpace = maxLineSpacingDelta * fontSize; lineSpace = maxLineSpacingDelta * fontSize;
@@ -3037,9 +3039,9 @@ void TextPage::coalesce(GBool physLayout @@ -3095,9 +3097,9 @@ void TextPage::coalesce(bool physLayout,
} }
word1 = word1->next; word1 = word1->next;
word2->next = nullptr; word2->next = nullptr;
+ newMinBase = word2->base; + newMinBase = word2->base;
blk->addWord(word2); blk->addWord(word2);
found = gTrue; found = true;
- newMinBase = word2->base; - newMinBase = word2->base;
} else { } else {
word0 = word1; word0 = word1;
word1 = word1->next; word1 = word1->next;
@@ -3072,9 +3074,9 @@ void TextPage::coalesce(GBool physLayout @@ -3123,9 +3125,9 @@ void TextPage::coalesce(bool physLayout,
} }
word1 = word1->next; word1 = word1->next;
word2->next = nullptr; word2->next = nullptr;
+ newMaxBase = word2->base; + newMaxBase = word2->base;
blk->addWord(word2); blk->addWord(word2);
found = gTrue; found = true;
- newMaxBase = word2->base; - newMaxBase = word2->base;
} else { } else {
word0 = word1; word0 = word1;
word1 = word1->next; word1 = word1->next;
@@ -3171,12 +3173,12 @@ void TextPage::coalesce(GBool physLayout @@ -3198,12 +3200,12 @@ void TextPage::coalesce(bool physLayout,
} }
word1 = word1->next; word1 = word1->next;
word2->next = nullptr; word2->next = nullptr;
...@@ -136,10 +106,10 @@ ...@@ -136,10 +106,10 @@
maxBase = word2->base; maxBase = word2->base;
} }
+ blk->addWord(word2); + blk->addWord(word2);
found = gTrue; found = true;
break; break;
} else { } else {
@@ -3235,12 +3237,12 @@ void TextPage::coalesce(GBool physLayout @@ -3246,12 +3248,12 @@ void TextPage::coalesce(bool physLayout,
} }
word1 = word1->next; word1 = word1->next;
word2->next = nullptr; word2->next = nullptr;
...@@ -150,64 +120,12 @@ ...@@ -150,64 +120,12 @@
maxBase = word2->base; maxBase = word2->base;
} }
+ blk->addWord(word2); + blk->addWord(word2);
found = gTrue; found = true;
break; break;
} else { } else {
@@ -4509,7 +4511,7 @@ GooList **TextSelectionDumper::takeWordL
class TextSelectionSizer : public TextSelectionVisitor {
public:
TextSelectionSizer(TextPage *page, double scale);
- ~TextSelectionSizer() { }
+ ~TextSelectionSizer();
void visitBlock (TextBlock *block,
TextLine *begin,
@@ -4526,7 +4526,7 @@ public:
void visitWord (TextWord *word, int begin, int end,
PDFRectangle *selection) override { };
- GooList *getRegion () { return list; }
+ GooList *getRegion ();
private:
GooList *list;
@@ -4538,6 +4540,11 @@ TextSelectionSizer::TextSelectionSizer(T
list = new GooList();
}
+TextSelectionSizer::~TextSelectionSizer()
+{
+ deleteGooList(list, PDFRectangle);
+}
+
void TextSelectionSizer::visitLine (TextLine *line,
TextWord *begin,
TextWord *end,
@@ -4594,6 +4594,21 @@ void TextSelectionSizer::visitLine (Text
list->append (rect);
}
+GooList *TextSelectionSizer::getRegion () {
+ GooList *recList;
+ int i;
+
+ recList = new GooList();
+
+ for (i = 0; i < list->getLength(); i++) {
+ PDFRectangle *selection_rect = (PDFRectangle *) list->get(i);
+
+ recList->append (new PDFRectangle(selection_rect->x1, selection_rect->y1, selection_rect->x2, selection_rect->y2));
+ }
+
+ return recList;
+}
+
class TextSelectionPainter : public TextSelectionVisitor {
public:
--- poppler/poppler/XRef.cc --- poppler/poppler/XRef.cc
+++ poppler/poppler/XRef.cc +++ poppler/poppler/XRef.cc
@@ -456,6 +456,7 @@ int XRef::reserve(int newSize) @@ -402,6 +402,7 @@ int XRef::reserve(int newSize)
void *p = greallocn_checkoverflow(entries, realNewSize, sizeof(XRefEntry)); void *p = greallocn_checkoverflow(entries, realNewSize, sizeof(XRefEntry));
if (p == nullptr) { if (p == nullptr) {
...@@ -215,7 +133,7 @@ ...@@ -215,7 +133,7 @@
return 0; return 0;
} }
@@ -877,7 +878,6 @@ GBool XRef::constructXRef(GBool *wasReco @@ -835,7 +836,6 @@ bool XRef::constructXRef(bool *wasRecons
int offset = 0; int offset = 0;
resize(0); // free entries properly resize(0); // free entries properly
...@@ -223,97 +141,31 @@ ...@@ -223,97 +141,31 @@
capacity = 0; capacity = 0;
size = 0; size = 0;
entries = nullptr; entries = nullptr;
--- poppler/qt5/src/ArthurOutputDev.cc
+++ poppler/qt5/src/ArthurOutputDev.cc
@@ -703,7 +703,11 @@ void ArthurOutputDev::updateFont(GfxStat
else
ff = FoFiTrueType::make(tmpBuf, tmpBufLen);
if (! ff)
+ {
+ if (fontsrc && fontsrc->isFile)
+ fontsrc->unref();
goto err2;
+ }
codeToGID = ((GfxCIDFont *)gfxFont)->getCodeToGIDMap(ff, &n);
delete ff;
}
@@ -719,6 +723,8 @@ void ArthurOutputDev::updateFont(GfxStat
break;
default:
// this shouldn't happen
+ if (fontsrc && fontsrc->isFile)
+ fontsrc->unref();
goto err2;
}
}
@@ -738,6 +744,8 @@ void ArthurOutputDev::updateFont(GfxStat
return;
err2:
+ if (fontsrc && !fontsrc->isFile)
+ fontsrc->unref();
delete id;
#endif
}
--- poppler/qt5/src/poppler-page.cc
+++ poppler/qt5/src/poppler-page.cc
@@ -782,6 +782,7 @@ QList<TextBox*> Page::textList(Rotation
if (!word_list || (shouldAbortExtractionCallback && shouldAbortExtractionCallback(closure))) {
delete output_dev;
+ delete word_list;
return output_list;
}
--- poppler/test/pdf-inspector.cc --- poppler/test/pdf-inspector.cc
+++ poppler/test/pdf-inspector.cc +++ poppler/test/pdf-inspector.cc
@@ -46,6 +46,7 @@ class PdfInspector { @@ -43,6 +43,7 @@ class PdfInspector
{
public: public:
PdfInspector();
+ ~PdfInspector();
PdfInspector(void); void set_file_name(const char *file_name);
+ ~PdfInspector(void); void load(const char *file_name);
@@ -108,6 +109,11 @@ PdfInspector::PdfInspector()
void set_file_name (const char *file_name); load(nullptr);
void load (const char *file_name);
@@ -136,6 +137,11 @@ PdfInspector::PdfInspector(void)
// set up initial widgets
load (nullptr);
} }
+
+PdfInspector::~PdfInspector(void) +PdfInspector::~PdfInspector(void)
+{ +{
+ delete output; + delete output;
+} +}
+
void void PdfInspector::set_file_name(const char *file_name)
PdfInspector::set_file_name(const char *file_name) {
--- poppler/test/perf-test.cc GtkWidget *widget;
+++ poppler/test/perf-test.cc
@@ -1053,6 +1053,7 @@ static void ParseCommandLine(int argc, c
++i;
if (i == argc)
PrintUsageAndExit(argc, argv);
+ free(gOutFileName);
gOutFileName = str_dup(argv[i]);
} else if (str_ieq(arg, PREVIEW_ARG)) {
gfPreview = true;
--- poppler/utils/HtmlOutputDev.cc --- poppler/utils/HtmlOutputDev.cc
+++ poppler/utils/HtmlOutputDev.cc +++ poppler/utils/HtmlOutputDev.cc
@@ -920,10 +920,11 @@ void HtmlPage::dumpComplex(FILE *file, i @@ -1337,6 +1337,7 @@ void HtmlOutputDev::drawPngImage(GfxStat
fputs("</div>\n", pageFile);
- if( !noframes )
- {
+ if( !noframes ){
fputs("</body>\n</html>\n",pageFile);
fclose(pageFile);
+ } else if (pageFile != nullptr && pageFile != file){
+ fclose(pageFile);
}
}
@@ -1376,6 +1377,7 @@ void HtmlOutputDev::drawPngImage(GfxStat
// TODO can we calculate the resolution of the image? // TODO can we calculate the resolution of the image?
if (!writer->init(f1, width, height, 72, 72)) { if (!writer->init(f1, width, height, 72, 72)) {