cpp: Remove deprecated time functions that have a Y2K38 problem Their counterparts were added more than 3 years ago, hopefully anyone using them has already ported to the new ones
diff --git a/cpp/poppler-document.cpp b/cpp/poppler-document.cpp index f3de298..d7d036c 100644 --- a/cpp/poppler-document.cpp +++ b/cpp/poppler-document.cpp
@@ -327,27 +327,6 @@ } /** - Gets the time_type value of the specified \p key of the document - information. - - \returns the time_t value for the \p key - \see info_keys, info_date - */ -time_type document::info_date(const std::string &key) const -{ - if (d->is_locked) { - return time_type(-1); - } - - std::unique_ptr<GooString> goo_date(d->doc->getDocInfoStringEntry(key.c_str())); - if (!goo_date) { - return time_type(-1); - } - - return static_cast<time_type>(dateStringToTime(goo_date.get())); -} - -/** Gets the time_t value of the specified \p key of the document information. @@ -369,30 +348,6 @@ } /** - Sets the time_type value of the specified \p key of the %document information - to \p val. - If \p val == time_type(-1), the entry specified by \p key is removed. - - \returns true on success, false on failure - */ -bool document::set_info_date(const std::string &key, time_type val) -{ - if (d->is_locked) { - return false; - } - - std::unique_ptr<GooString> goo_date; - - if (val != time_type(-1)) { - time_t t = static_cast<time_t>(val); - goo_date = timeToDateString(&t); - } - - d->doc->setDocInfoStringEntry(key.c_str(), std::move(goo_date)); - return true; -} - -/** Sets the time_t value of the specified \p key of the %document information to \p val. If \p val == time_t(-1), the entry specified by \p key is removed. @@ -668,26 +623,6 @@ } /** - Gets the document's creation date as a time_type value. - - \returns the document's creation date as a time_type value - \see set_creation_date, info_date - */ -time_type document::get_creation_date() const -{ - if (d->is_locked) { - return time_type(-1); - } - - std::unique_ptr<GooString> goo_creation_date(d->doc->getDocInfoCreatDate()); - if (!goo_creation_date) { - return time_type(-1); - } - - return static_cast<time_type>(dateStringToTime(goo_creation_date.get())); -} - -/** Gets the document's creation date as a time_t value. \returns the document's creation date as a time_t value @@ -709,29 +644,6 @@ /** Sets the %document's creation date to \p creation_date. - If \p creation_date == time_type(-1), the %document's creation date is removed. - - \returns true on success, false on failure - */ -bool document::set_creation_date(time_type creation_date) -{ - if (d->is_locked) { - return false; - } - - std::unique_ptr<GooString> goo_creation_date; - - if (creation_date != time_type(-1)) { - time_t t = static_cast<time_t>(creation_date); - goo_creation_date = timeToDateString(&t); - } - - d->doc->setDocInfoCreatDate(std::move(goo_creation_date)); - return true; -} - -/** - Sets the %document's creation date to \p creation_date. If \p creation_date == time_t(-1), the %document's creation date is removed. \returns true on success, false on failure @@ -753,26 +665,6 @@ } /** - Gets the document's modification date as a time_type value. - - \returns the document's modification date as a time_type value - \see set_modification_date, info_date - */ -time_type document::get_modification_date() const -{ - if (d->is_locked) { - return time_type(-1); - } - - std::unique_ptr<GooString> goo_modification_date(d->doc->getDocInfoModDate()); - if (!goo_modification_date) { - return time_type(-1); - } - - return static_cast<time_type>(dateStringToTime(goo_modification_date.get())); -} - -/** Gets the document's modification date as a time_t value. \returns the document's modification date as a time_t value @@ -794,29 +686,6 @@ /** Sets the %document's modification date to \p mod_date. - If \p mod_date == time_type(-1), the %document's modification date is removed. - - \returns true on success, false on failure - */ -bool document::set_modification_date(time_type mod_date) -{ - if (d->is_locked) { - return false; - } - - std::unique_ptr<GooString> goo_mod_date; - - if (mod_date != time_type(-1)) { - time_t t = static_cast<time_t>(mod_date); - goo_mod_date = timeToDateString(&t); - } - - d->doc->setDocInfoModDate(std::move(goo_mod_date)); - return true; -} - -/** - Sets the %document's modification date to \p mod_date. If \p mod_date == time_t(-1), the %document's modification date is removed. \returns true on success, false on failure
diff --git a/cpp/poppler-document.h b/cpp/poppler-document.h index dfbdf17..a6a4f84 100644 --- a/cpp/poppler-document.h +++ b/cpp/poppler-document.h
@@ -80,8 +80,6 @@ ustring info_key(const std::string &key) const; bool set_info_key(const std::string &key, const ustring &val); - [[deprecated]] time_type info_date(const std::string &key) const; - [[deprecated]] bool set_info_date(const std::string &key, time_type val); time_t info_date_t(const std::string &key) const; bool set_info_date_t(const std::string &key, time_t val); @@ -97,12 +95,8 @@ bool set_creator(const ustring &creator); ustring get_producer() const; bool set_producer(const ustring &producer); - [[deprecated]] time_type get_creation_date() const; - [[deprecated]] bool set_creation_date(time_type creation_date); time_t get_creation_date_t() const; bool set_creation_date_t(time_t creation_date); - [[deprecated]] time_type get_modification_date() const; - [[deprecated]] bool set_modification_date(time_type mod_date); time_t get_modification_date_t() const; bool set_modification_date_t(time_t mod_date);
diff --git a/cpp/poppler-embedded-file.cpp b/cpp/poppler-embedded-file.cpp index 6f72743..aa508a2 100644 --- a/cpp/poppler-embedded-file.cpp +++ b/cpp/poppler-embedded-file.cpp
@@ -107,28 +107,6 @@ } /** - \returns the time_type representing the modification date of the embedded file, - if available - */ -time_type embedded_file::modification_date() const -{ - const EmbFile *ef = d->file_spec->getEmbeddedFile(); - const GooString *goo = ef ? ef->modDate() : nullptr; - return goo ? static_cast<time_type>(dateStringToTime(goo)) : time_type(-1); -} - -/** - \returns the time_type representing the creation date of the embedded file, - if available - */ -time_type embedded_file::creation_date() const -{ - const EmbFile *ef = d->file_spec->getEmbeddedFile(); - const GooString *goo = ef ? ef->createDate() : nullptr; - return goo ? static_cast<time_type>(dateStringToTime(goo)) : time_type(-1); -} - -/** \returns the time_t representing the modification date of the embedded file, if available */
diff --git a/cpp/poppler-embedded-file.h b/cpp/poppler-embedded-file.h index 47e37c7..f8d9009 100644 --- a/cpp/poppler-embedded-file.h +++ b/cpp/poppler-embedded-file.h
@@ -39,8 +39,6 @@ ustring unicodeName() const; ustring description() const; int size() const; - [[deprecated]] time_type modification_date() const; - [[deprecated]] time_type creation_date() const; time_t modification_date_t() const; time_t creation_date_t() const; byte_array checksum() const;
diff --git a/cpp/poppler-global.cpp b/cpp/poppler-global.cpp index 04903a8..dffea25 100644 --- a/cpp/poppler-global.cpp +++ b/cpp/poppler-global.cpp
@@ -321,15 +321,6 @@ } /** - Converts a string representing a PDF date to a value compatible with time_type. - */ -time_type poppler::convert_date(const std::string &date) -{ - GooString gooDateStr(date.c_str()); - return static_cast<time_type>(dateStringToTime(&gooDateStr)); -} - -/** Converts a string representing a PDF date to a value compatible with time_t. */ time_t poppler::convert_date_t(const std::string &date)
diff --git a/cpp/poppler-global.h b/cpp/poppler-global.h index 037abdb..cdfa072 100644 --- a/cpp/poppler-global.h +++ b/cpp/poppler-global.h
@@ -92,8 +92,6 @@ typedef std::vector<char> byte_array; -typedef unsigned int /* time_t */ time_type; - // to disable warning only for this occurrence #ifdef _MSC_VER # pragma warning(push) @@ -122,8 +120,6 @@ # pragma warning(pop) #endif -[[deprecated]] POPPLER_CPP_EXPORT time_type convert_date(const std::string &date); - POPPLER_CPP_EXPORT time_t convert_date_t(const std::string &date); POPPLER_CPP_EXPORT std::ostream &operator<<(std::ostream &stream, const byte_array &array);