Commit 8112e911 authored by Pino Toscano's avatar Pino Toscano

[cpp] add a time_type typedef

... defined as unsigned int, and use it all around
(it changes nothing for client code)
parent bc5bdb43
......@@ -334,21 +334,21 @@ ustring document::info_key(const std::string &key) const
\returns the time_t value for the \p key
\see info_keys, info_date
unsigned int document::info_date(const std::string &key) const
time_type document::info_date(const std::string &key) const
if (d->is_locked) {
return (unsigned int)(-1);
return time_type(-1);
Object info;
if (!d->doc->getDocInfo(&info)->isDict()) {;
return (unsigned int)(-1);
return time_type(-1);
Dict *info_dict = info.getDict();
Object obj;
unsigned int result = (unsigned int)(-1);
time_type result = time_type(-1);
if (info_dict->lookup(PSTR(key.c_str()), &obj)->isString()) {
result = convert_date(obj.getString()->getCString());
......@@ -62,7 +62,7 @@ public:
void get_pdf_version(int *major, int *minor) const;
std::vector<std::string> info_keys() const;
ustring info_key(const std::string &key) const;
unsigned int /*time_t*/ info_date(const std::string &key) const;
time_type info_date(const std::string &key) const;
bool is_encrypted() const;
bool is_linearized() const;
bool has_permission(permission_enum which) const;
......@@ -101,7 +101,7 @@ int embedded_file::size() const
\returns the time_t representing the modification date of the embedded file,
if available
unsigned int embedded_file::modification_date() const
time_type embedded_file::modification_date() const
return convert_date(d->emb_file->modDate()->getCString());
......@@ -110,7 +110,7 @@ unsigned int embedded_file::modification_date() const
\returns the time_t representing the creation date of the embedded file,
if available
unsigned int embedded_file::creation_date() const
time_type embedded_file::creation_date() const
return convert_date(d->emb_file->createDate()->getCString());
......@@ -37,8 +37,8 @@ public:
std::string name() const;
ustring description() const;
int size() const;
unsigned int /*time_t*/ modification_date() const;
unsigned int /*time_t*/ creation_date() const;
time_type modification_date() const;
time_type creation_date() const;
byte_array checksum() const;
std::string mime_type() const;
byte_array data() const;
......@@ -188,14 +188,14 @@ ustring ustring::from_latin1(const std::string &str)
Converts a string representing a PDF date to a value compatible with time_t.
unsigned int poppler::convert_date(const std::string &date)
time_type poppler::convert_date(const std::string &date)
int year, mon, day, hour, min, sec, tzHours, tzMins;
char tz;
if (!parseDateString(date.c_str(), &year, &mon, &day, &hour, &min, &sec,
&tz, &tzHours, &tzMins)) {
return (unsigned int)(-1);
return time_type(-1);
struct tm time;
......@@ -72,6 +72,8 @@ enum case_sensitivity_enum { case_sensitive, case_insensitive };
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)
......@@ -100,7 +102,7 @@ private:
#pragma warning(pop)
POPPLER_CPP_EXPORT unsigned int /*time_t*/ convert_date(const std::string &date);
POPPLER_CPP_EXPORT time_type convert_date(const std::string &date);
POPPLER_CPP_EXPORT std::ostream& operator<<(std::ostream& stream, const byte_array &array);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment