[poppler] 3 commits - glib/poppler-action.cc glib/poppler-document.cc glib/poppler-page.cc
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu Nov 28 18:40:49 UTC 2019
glib/poppler-action.cc | 9 ++++-----
glib/poppler-document.cc | 10 +++-------
glib/poppler-page.cc | 20 +++++++-------------
3 files changed, 14 insertions(+), 25 deletions(-)
New commits:
commit 98dbe4becbebb96dc46a581dad338e84d747334e
Author: Jason Crain <jason at inspiresomeone.us>
Date: Tue Nov 26 23:44:30 2019 -0700
glib: Fix poppler_action_layer_copy function cast warning
In our call to g_list_foreach, the GFunc callback type takes two
arguments, but we pass the g_object_ref function, which only takes one,
so the compiler warns about an incompatible function cast.
Fix this by using a for loop instead of g_list_foreach.
diff --git a/glib/poppler-action.cc b/glib/poppler-action.cc
index 025e69f7..62169089 100644
--- a/glib/poppler-action.cc
+++ b/glib/poppler-action.cc
@@ -87,7 +87,8 @@ poppler_action_layer_copy (PopplerActionLayer *action_layer)
PopplerActionLayer *retval = g_slice_dup (PopplerActionLayer, action_layer);
retval->layers = g_list_copy (action_layer->layers);
- g_list_foreach (action_layer->layers, (GFunc)g_object_ref, nullptr);
+ for (GList *l = retval->layers; l != nullptr; l = l->next)
+ g_object_ref (l->data);
return retval;
}
commit 0e6790f1eb36786ce7832a0415162b6967e42128
Author: Jason Crain <jason at inspiresomeone.us>
Date: Tue Nov 26 23:44:22 2019 -0700
glib: Fix return in poppler_page_get_text_attributes_for_area
Since this function returns a GList*, it should return nullptr on error,
not FALSE.
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index da4939bb..dc12d04a 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -2383,7 +2383,7 @@ poppler_page_get_text_attributes_for_area (PopplerPage *page,
GList *attributes = nullptr;
g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL);
- g_return_val_if_fail (area != nullptr, FALSE);
+ g_return_val_if_fail (area != nullptr, nullptr);
selection.x1 = area->x1;
selection.y1 = area->y1;
commit 9b4503048e7d0eeb882aeea75140c2b6e3599c48
Author: Jason Crain <jason at inspiresomeone.us>
Date: Tue Nov 26 23:44:15 2019 -0700
glib: Use g_list_free_full
Use g_list_free_full instead of g_list_foreach followed by g_list_free.
This fixes a compiler warning.
The g_list_foreach function takes a "GFunc" callback, which takes two
arguments, but the free functions we pass only take one argument, so the
compiler warns about an incompatible cast. Using g_list_free_full fixes
this because it takes a "GDestroyNotify" callback, which takes one
argument.
diff --git a/glib/poppler-action.cc b/glib/poppler-action.cc
index 3efa8994..025e69f7 100644
--- a/glib/poppler-action.cc
+++ b/glib/poppler-action.cc
@@ -74,8 +74,7 @@ poppler_action_layer_free (PopplerActionLayer *action_layer)
return;
if (action_layer->layers) {
- g_list_foreach (action_layer->layers, (GFunc)g_object_unref, nullptr);
- g_list_free (action_layer->layers);
+ g_list_free_full (action_layer->layers, g_object_unref);
action_layer->layers = nullptr;
}
@@ -136,8 +135,7 @@ poppler_action_free (PopplerAction *action)
break;
case POPPLER_ACTION_OCG_STATE:
if (action->ocg_state.state_list) {
- g_list_foreach (action->ocg_state.state_list, (GFunc)poppler_action_layer_free, nullptr);
- g_list_free (action->ocg_state.state_list);
+ g_list_free_full (action->ocg_state.state_list, (GDestroyNotify)poppler_action_layer_free);
}
break;
case POPPLER_ACTION_JAVASCRIPT:
diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index e9c27796..e2d4f335 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -3127,8 +3127,7 @@ layer_free (Layer *layer)
return;
if (layer->kids) {
- g_list_foreach (layer->kids, (GFunc)layer_free, nullptr);
- g_list_free (layer->kids);
+ g_list_free_full (layer->kids, (GDestroyNotify)layer_free);
}
if (layer->label) {
@@ -3276,11 +3275,8 @@ poppler_document_layers_free (PopplerDocument *document)
if (G_UNLIKELY (!document->layers))
return;
- g_list_foreach (document->layers, (GFunc)layer_free, nullptr);
- g_list_free (document->layers);
-
- g_list_foreach (document->layers_rbgroups, (GFunc)g_list_free, nullptr);
- g_list_free (document->layers_rbgroups);
+ g_list_free_full (document->layers, (GDestroyNotify)layer_free);
+ g_list_free_full (document->layers_rbgroups, (GDestroyNotify)g_list_free);
document->layers = nullptr;
document->layers_rbgroups = nullptr;
diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 0c43e768..da4939bb 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -729,8 +729,7 @@ poppler_page_selection_region_free (GList *region)
if (G_UNLIKELY (!region))
return;
- g_list_foreach (region, (GFunc)poppler_rectangle_free, nullptr);
- g_list_free (region);
+ g_list_free_full (region, (GDestroyNotify)poppler_rectangle_free);
}
/**
@@ -1117,8 +1116,7 @@ poppler_page_free_image_mapping (GList *list)
if (G_UNLIKELY (list == nullptr))
return;
- g_list_foreach (list, (GFunc)poppler_image_mapping_free, nullptr);
- g_list_free (list);
+ g_list_free_full (list, (GDestroyNotify)poppler_image_mapping_free);
}
/**
@@ -1301,8 +1299,7 @@ poppler_page_free_link_mapping (GList *list)
if (G_UNLIKELY (list == nullptr))
return;
- g_list_foreach (list, (GFunc)poppler_link_mapping_free, nullptr);
- g_list_free (list);
+ g_list_free_full (list, (GDestroyNotify)poppler_link_mapping_free);
}
/**
@@ -1368,8 +1365,7 @@ poppler_page_free_form_field_mapping (GList *list)
if (G_UNLIKELY (list == nullptr))
return;
- g_list_foreach (list, (GFunc) poppler_form_field_mapping_free, nullptr);
- g_list_free (list);
+ g_list_free_full (list, (GDestroyNotify)poppler_form_field_mapping_free);
}
/**
@@ -1505,8 +1501,7 @@ poppler_page_free_annot_mapping (GList *list)
if (G_UNLIKELY (!list))
return;
- g_list_foreach (list, (GFunc)poppler_annot_mapping_free, nullptr);
- g_list_free (list);
+ g_list_free_full (list, (GDestroyNotify)poppler_annot_mapping_free);
}
/**
@@ -2306,8 +2301,7 @@ poppler_page_free_text_attributes (GList *list)
if (G_UNLIKELY (list == nullptr))
return;
- g_list_foreach (list, (GFunc)poppler_text_attributes_free, nullptr);
- g_list_free (list);
+ g_list_free_full (list, (GDestroyNotify)poppler_text_attributes_free);
}
static gboolean
More information about the poppler
mailing list