summaryrefslogtreecommitdiff
path: root/glib
diff options
context:
space:
mode:
authorAlbert Astals Cid <aacid@kde.org>2022-03-07 16:15:25 +0100
committerAlbert Astals Cid <tsdgeos@yahoo.es>2022-03-08 09:36:40 +0000
commitb41c92c66885ad5849db8337c104ff1e7ee64b60 (patch)
treeee42a0a6edc1a289233d95a0369e382d3ae42a7a /glib
parent3d4db6773c46ac4f5df1bdb212a276db51f8d371 (diff)
Annot::getRect: Return a const & instead of a pointer
Makes it clear the result is never null
Diffstat (limited to 'glib')
-rw-r--r--glib/poppler-annot.cc22
-rw-r--r--glib/poppler-page.cc11
2 files changed, 15 insertions, 18 deletions
diff --git a/glib/poppler-annot.cc b/glib/poppler-annot.cc
index a8bbd76f..08cd3633 100644
--- a/glib/poppler-annot.cc
+++ b/glib/poppler-annot.cc
@@ -924,7 +924,6 @@ const PDFRectangle *_poppler_annot_get_cropbox(PopplerAnnot *poppler_annot)
*/
void poppler_annot_get_rectangle(PopplerAnnot *poppler_annot, PopplerRectangle *poppler_rect)
{
- PDFRectangle *annot_rect;
const PDFRectangle *crop_box;
PDFRectangle zerobox;
Page *page = nullptr;
@@ -938,11 +937,11 @@ void poppler_annot_get_rectangle(PopplerAnnot *poppler_annot, PopplerRectangle *
crop_box = &zerobox;
}
- annot_rect = poppler_annot->annot->getRect();
- poppler_rect->x1 = annot_rect->x1 - crop_box->x1;
- poppler_rect->x2 = annot_rect->x2 - crop_box->x1;
- poppler_rect->y1 = annot_rect->y1 - crop_box->y1;
- poppler_rect->y2 = annot_rect->y2 - crop_box->y1;
+ const PDFRectangle &annot_rect = poppler_annot->annot->getRect();
+ poppler_rect->x1 = annot_rect.x1 - crop_box->x1;
+ poppler_rect->x2 = annot_rect.x2 - crop_box->x1;
+ poppler_rect->y1 = annot_rect.y1 - crop_box->y1;
+ poppler_rect->y2 = annot_rect.y2 - crop_box->y1;
}
/**
@@ -1139,7 +1138,6 @@ gboolean poppler_annot_markup_get_popup_rectangle(PopplerAnnotMarkup *poppler_an
{
AnnotMarkup *annot;
Annot *annot_popup;
- PDFRectangle *annot_rect;
g_return_val_if_fail(POPPLER_IS_ANNOT_MARKUP(poppler_annot), FALSE);
g_return_val_if_fail(poppler_rect != nullptr, FALSE);
@@ -1149,11 +1147,11 @@ gboolean poppler_annot_markup_get_popup_rectangle(PopplerAnnotMarkup *poppler_an
if (!annot_popup)
return FALSE;
- annot_rect = annot_popup->getRect();
- poppler_rect->x1 = annot_rect->x1;
- poppler_rect->x2 = annot_rect->x2;
- poppler_rect->y1 = annot_rect->y1;
- poppler_rect->y2 = annot_rect->y2;
+ const PDFRectangle &annot_rect = annot_popup->getRect();
+ poppler_rect->x1 = annot_rect.x1;
+ poppler_rect->x2 = annot_rect.x2;
+ poppler_rect->y1 = annot_rect.y1;
+ poppler_rect->y2 = annot_rect.y2;
return TRUE;
}
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index a0efd6fa..98d253be 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -1289,7 +1289,6 @@ GList *poppler_page_get_annot_mapping(PopplerPage *page)
PopplerAnnotMapping *mapping;
PopplerRectangle rect;
Annot *annot;
- PDFRectangle *annot_rect;
gboolean flag_no_rotate;
gint rotation = 0;
@@ -1335,11 +1334,11 @@ GList *poppler_page_get_annot_mapping(PopplerPage *page)
break;
}
- annot_rect = annot->getRect();
- rect.x1 = annot_rect->x1 - crop_box->x1;
- rect.y1 = annot_rect->y1 - crop_box->y1;
- rect.x2 = annot_rect->x2 - crop_box->x1;
- rect.y2 = annot_rect->y2 - crop_box->y1;
+ const PDFRectangle &annot_rect = annot->getRect();
+ rect.x1 = annot_rect.x1 - crop_box->x1;
+ rect.y1 = annot_rect.y1 - crop_box->y1;
+ rect.x2 = annot_rect.x2 - crop_box->x1;
+ rect.y2 = annot_rect.y2 - crop_box->y1;
rotation = page->page->getRotate();