[tracker-miners/wip/carlosg/compiler-warnings: 8/12] tracker-extract: Avoid deprecated poppler API
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker-miners/wip/carlosg/compiler-warnings: 8/12] tracker-extract: Avoid deprecated poppler API
- Date: Sun, 28 Aug 2022 21:28:01 +0000 (UTC)
commit abd2eac873c5c233c8aa8194b5d92840be5e40c3
Author: Carlos Garnacho <carlosg gnome org>
Date: Sun Aug 28 23:02:04 2022 +0200
tracker-extract: Avoid deprecated poppler API
Since 0.82, poppler offers API to load a document from GBytes, and prefers
that over the variant passing data/len. Use that API if building against
a newer poppler.
src/tracker-extract/tracker-extract-pdf.c | 7 +++++++
1 file changed, 7 insertions(+)
---
diff --git a/src/tracker-extract/tracker-extract-pdf.c b/src/tracker-extract/tracker-extract-pdf.c
index eb62ddf95..5cfddfbc7 100644
--- a/src/tracker-extract/tracker-extract-pdf.c
+++ b/src/tracker-extract/tracker-extract-pdf.c
@@ -292,6 +292,7 @@ tracker_extract_get_metadata (TrackerExtractInfo *info,
TrackerXmpData *xd = NULL;
PDFData pd = { 0 }; /* actual data */
PDFData md = { 0 }; /* for merging */
+ G_GNUC_UNUSED GBytes *bytes;
PopplerDocument *document;
gchar *xml = NULL;
gchar *content, *uri;
@@ -346,7 +347,13 @@ tracker_extract_get_metadata (TrackerExtractInfo *info,
g_free (filename);
uri = g_file_get_uri (file);
+#if POPPLER_CHECK_VERSION (0, 82, 0)
+ bytes = g_bytes_new (contents, len);
+ document = poppler_document_new_from_bytes (bytes, NULL, &inner_error);
+ g_bytes_unref (bytes);
+#else
document = poppler_document_new_from_data (contents, len, NULL, &inner_error);
+#endif
if (inner_error) {
if (inner_error->code == POPPLER_ERROR_ENCRYPTED) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]