[tracker-miners/wip/carlosg/compile-warnings: 6/9] tracker-extract: Drop GTime usage in PDF extractor



commit 0318bdeac073d5658e99dcbb2a2e7ecb0a5de7bf
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Feb 17 01:30:51 2020 +0100

    tracker-extract: Drop GTime usage in PDF extractor
    
    The document creation time is already a time_t, so we were shooting
    ourselves in the foot. However, avoid getting it through the property,
    as it's defined with G_TYPE_INT type, so it's not year 2038 safe. The
    getter method gives us a time_t we can readily use.

 src/tracker-extract/tracker-extract-pdf.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/tracker-extract/tracker-extract-pdf.c b/src/tracker-extract/tracker-extract-pdf.c
index 50eab921d..14bd881b7 100644
--- a/src/tracker-extract/tracker-extract-pdf.c
+++ b/src/tracker-extract/tracker-extract-pdf.c
@@ -281,7 +281,7 @@ G_MODULE_EXPORT gboolean
 tracker_extract_get_metadata (TrackerExtractInfo *info)
 {
        TrackerConfig *config;
-       GTime creation_date;
+       time_t creation_date;
        GError *error = NULL;
        TrackerResource *metadata;
        TrackerXmpData *xd = NULL;
@@ -388,12 +388,13 @@ tracker_extract_get_metadata (TrackerExtractInfo *info)
                      "author", &pd.author,
                      "subject", &pd.subject,
                      "keywords", &pd.keywords,
-                     "creation-date", &creation_date,
                      "metadata", &xml,
                      NULL);
 
+       creation_date = poppler_document_get_creation_date (document);
+
        if (creation_date > 0) {
-               pd.creation_date = tracker_date_to_string ((time_t) creation_date);
+               pd.creation_date = tracker_date_to_string (creation_date);
        }
 
        keywords = g_ptr_array_new_with_free_func ((GDestroyNotify) g_free);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]