glib/tests/CMakeLists.txt | 2 +- glib/tests/check_bb.c | 2 +- poppler/CairoFontEngine.cc | 4 +--- 3 files changed, 3 insertions(+), 5 deletions(-)
New commits: commit 0c9bfb401780d6e05adba58e03c3dbdfa44c9895 Author: Oliver Sander <[email protected]> Date: Wed Aug 31 11:07:14 2022 +0200 Store 'gfx' as a std::unique_ptr Otherwise it will leak if charProc is not a stream (line 488). Found by https://sonarcloud.io/project/overview?id=tsdgeos_poppler_mirror diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc index 0f6191e6..841e9efd 100644 --- a/poppler/CairoFontEngine.cc +++ b/poppler/CairoFontEngine.cc @@ -445,7 +445,6 @@ static cairo_status_t _render_type3_glyph(cairo_scaled_font_t *scaled_font, unsi double wx, wy; PDFRectangle box; type3_font_info_t *info; - Gfx *gfx; cairo_status_t status; info = (type3_font_info_t *)cairo_font_face_get_user_data(cairo_scaled_font_get_font_face(scaled_font), &type3_font_key); @@ -480,7 +479,7 @@ static cairo_status_t _render_type3_glyph(cairo_scaled_font_t *scaled_font, unsi box.y1 = mat[1]; box.x2 = mat[2]; box.y2 = mat[3]; - gfx = new Gfx(info->doc, output_dev, resDict, &box, nullptr); + auto gfx = std::make_unique<Gfx>(info->doc, output_dev, resDict, &box, nullptr); output_dev->startDoc(info->doc, info->fontEngine); output_dev->startType3Render(gfx->getState(), gfx->getXRef()); output_dev->setInType3Char(true); @@ -521,7 +520,6 @@ static cairo_status_t _render_type3_glyph(cairo_scaled_font_t *scaled_font, unsi status = CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED; } - delete gfx; delete output_dev; return status; commit 9a3d991e62ba936495780007132299d73f3d603b Author: Oliver Sander <[email protected]> Date: Wed Aug 31 11:05:18 2022 +0200 Fix copy'n'paste bug in the check for bounding box correctness Found by https://sonarcloud.io/project/overview?id=tsdgeos_poppler_mirror diff --git a/glib/tests/CMakeLists.txt b/glib/tests/CMakeLists.txt index 02985dfa..19ebf57e 100644 --- a/glib/tests/CMakeLists.txt +++ b/glib/tests/CMakeLists.txt @@ -19,7 +19,7 @@ target_link_libraries(poppler-check-text poppler-glib PkgConfig::GTK3) target_link_libraries(poppler-check-bb poppler-glib PkgConfig::GTK3) poppler_add_testcase(poppler-check-bb shapes+attachments.pdf 42.5 42.5 557.5 557.5) -poppler_add_testcase(poppler-check-bb orientation.pdf 34 34 83.74 49 793 34 808 97.19 488.02 793 561 808 34 503.61 49 56) +poppler_add_testcase(poppler-check-bb orientation.pdf 34 34 83.74 49 793 34 808 97.19 488.02 793 561 808 34 503.61 49 561) poppler_add_testcase(poppler-check-bb xr01.pdf 148.71 126.35 308.11 704.57) poppler_add_testcase(poppler-check-bb xr02.pdf 133.77 124.81 308.11 704.57 133.77 124.80 308.11 704.57) poppler_add_testcase(poppler-check-bb russian.pdf 71.5 76.81 197.69 131.09) diff --git a/glib/tests/check_bb.c b/glib/tests/check_bb.c index ba6a713c..7a4805fd 100644 --- a/glib/tests/check_bb.c +++ b/glib/tests/check_bb.c @@ -85,7 +85,7 @@ int main(int argc, char *argv[]) correct.x2 = atof(argv[argx++]); correct.y2 = atof(argv[argx++]); g_print(" correct: %g,%g - %g,%g\n", correct.x1, correct.y1, correct.x2, correct.y2); - if (!equal(bb.x1, correct.x1, precision) || !equal(bb.x2, correct.x2, precision) || !equal(bb.y1, correct.y1, precision) || !equal(bb.x2, correct.x2, precision)) { + if (!equal(bb.x1, correct.x1, precision) || !equal(bb.x2, correct.x2, precision) || !equal(bb.y1, correct.y1, precision) || !equal(bb.y2, correct.y2, precision)) { g_print("bounding box differs from expected\n"); exit(EXIT_FAILURE); }
