From ac7d0468ca68d92913db1e8cd45fbc1e7327adab Mon Sep 17 00:00:00 2001 From: Jason Crain Date: Fri, 25 Apr 2014 05:33:40 -0500 Subject: [PATCH 1/2] Use time_t instead of GTime in PopplerAttachment GTime is deprecated because it will overflow in 2038. Change PopplerAttachment to use time_t instead. Fixes an incompatible cast from GTime* to time_t*. CID #16825 and 16826. --- glib/poppler-annot.cc | 2 +- glib/poppler-attachment.cc | 4 ++-- glib/poppler-attachment.h | 4 ++-- glib/poppler-document.cc | 8 ++++---- glib/poppler-private.h | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/glib/poppler-annot.cc b/glib/poppler-annot.cc index 13bc768..dbd743e 100644 --- a/glib/poppler-annot.cc +++ b/glib/poppler-annot.cc @@ -1317,7 +1317,7 @@ poppler_annot_markup_get_date (PopplerAnnotMarkup *poppler_annot) if (!annot_date) return NULL; - if (_poppler_convert_pdf_date_to_gtime (annot_date, &timet)) { + if (_poppler_convert_pdf_date_to_time_t (annot_date, &timet)) { GDate *date; date = g_date_new (); diff --git a/glib/poppler-attachment.cc b/glib/poppler-attachment.cc index 874bffb..85362a3 100644 --- a/glib/poppler-attachment.cc +++ b/glib/poppler-attachment.cc @@ -120,9 +120,9 @@ _poppler_attachment_new (FileSpec *emb_file) attachment->size = embFile->size (); if (embFile->createDate ()) - _poppler_convert_pdf_date_to_gtime (embFile->createDate (), (time_t *)&attachment->ctime); + _poppler_convert_pdf_date_to_time_t (embFile->createDate (), &attachment->ctime); if (embFile->modDate ()) - _poppler_convert_pdf_date_to_gtime (embFile->modDate (), (time_t *)&attachment->mtime); + _poppler_convert_pdf_date_to_time_t (embFile->modDate (), &attachment->mtime); if (embFile->checksum () && embFile->checksum ()->getLength () > 0) attachment->checksum = g_string_new_len (embFile->checksum ()->getCString (), diff --git a/glib/poppler-attachment.h b/glib/poppler-attachment.h index ff8c849..d2d9ba8 100644 --- a/glib/poppler-attachment.h +++ b/glib/poppler-attachment.h @@ -61,8 +61,8 @@ struct _PopplerAttachment gchar *name; gchar *description; gsize size; - GTime mtime; - GTime ctime; + time_t mtime; + time_t ctime; GString *checksum; }; diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc index 61d92e8..3e9a118 100644 --- a/glib/poppler-document.cc +++ b/glib/poppler-document.cc @@ -767,7 +767,7 @@ info_dict_get_date (Dict *info_dict, const gchar *key) return (time_t)-1; } - if (!_poppler_convert_pdf_date_to_gtime (obj.getString (), &result)) + if (!_poppler_convert_pdf_date_to_time_t (obj.getString (), &result)) result = (time_t)-1; obj.free (); @@ -2699,8 +2699,8 @@ poppler_document_get_form_field (PopplerDocument *document, } gboolean -_poppler_convert_pdf_date_to_gtime (GooString *date, - time_t *gdate) +_poppler_convert_pdf_date_to_time_t (GooString *date, + time_t *timet) { gchar *date_string; gboolean retval; @@ -2713,7 +2713,7 @@ _poppler_convert_pdf_date_to_gtime (GooString *date, date_string = g_strndup (date->getCString (), date->getLength ()); } - retval = poppler_date_parse (date_string, gdate); + retval = poppler_date_parse (date_string, timet); g_free (date_string); return retval; diff --git a/glib/poppler-private.h b/glib/poppler-private.h index 874cfdb..1668ca6 100644 --- a/glib/poppler-private.h +++ b/glib/poppler-private.h @@ -136,8 +136,8 @@ PopplerAnnot *_poppler_annot_circle_new (Annot *annot); PopplerAnnot *_poppler_annot_square_new (Annot *annot); char *_poppler_goo_string_to_utf8(GooString *s); -gboolean _poppler_convert_pdf_date_to_gtime (GooString *date, - time_t *gdate); +gboolean _poppler_convert_pdf_date_to_time_t (GooString *date, + time_t *timet); /* * A convenience macro for boxed type implementations, which defines a -- 1.9.2