[poppler] 2 commits - glib/poppler-document.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 7 09:04:39 UTC 2021


 glib/poppler-document.cc |   20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

New commits:
commit 172c1bbe6d15c0096f869fea35b6a83b8622fb32
Author: Christian Persch <chpe at src.gnome.org>
Date:   Fri Dec 3 13:22:40 2021 +0100

    glib: Replace use of deprecated g_time_zone_new()
    
    Use g_time_zone_new_identifier() instead.

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index ef869827..fd2c7fbc 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -3665,7 +3665,15 @@ GDateTime *_poppler_convert_pdf_date_to_date_time(const GooString *date)
             gchar *identifier;
 
             identifier = g_strdup_printf("%c%02u:%02u", tz, tzHours, tzMins);
+#if GLIB_CHECK_VERSION(2, 68, 0)
+            time_zone = g_time_zone_new_identifier(identifier);
+            if (!time_zone) {
+                g_debug("Failed to create time zone for identifier \"%s\"", identifier);
+                time_zone = g_time_zone_new_utc();
+            }
+#else
             time_zone = g_time_zone_new(identifier);
+#endif
             g_free(identifier);
         } else if (tz == '\0' || tz == 'Z') {
             time_zone = g_time_zone_new_utc();
commit 8351fa3fd29dc69566afe4704c503433be21f26c
Author: Christian Persch <chpe at src.gnome.org>
Date:   Fri Dec 3 13:22:40 2021 +0100

    glib: Replace use of deprecated g_memdup
    
    g_memdup() is deprecated. Replace it with straight malloc + memcpy. This
    fixes two compile warnings with newer glib (>= 2.68).

diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
index cd3e4047..ef869827 100644
--- a/glib/poppler-document.cc
+++ b/glib/poppler-document.cc
@@ -677,10 +677,14 @@ gboolean poppler_document_get_id(PopplerDocument *document, gchar **permanent_id
         *update_id = nullptr;
 
     if (document->doc->getID(permanent_id ? &permanent : nullptr, update_id ? &update : nullptr)) {
-        if (permanent_id)
-            *permanent_id = (gchar *)g_memdup(permanent.c_str(), 32);
-        if (update_id)
-            *update_id = (gchar *)g_memdup(update.c_str(), 32);
+        if (permanent_id) {
+            *permanent_id = g_new(char, 32);
+            memcpy(*permanent_id, permanent.c_str(), 32);
+        }
+        if (update_id) {
+            *update_id = g_new(char, 32);
+            memcpy(*update_id, update.c_str(), 32);
+        }
 
         retval = TRUE;
     }


More information about the poppler mailing list