From 9b84c0a0b4043d78a3a39d604673f6f33ae815da Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Wed, 4 May 2016 04:24:00 +0000 Subject: dvipdfm-x: improve SOURCE_DATE_EPOCH support git-svn-id: svn://tug.org/texlive/trunk@40881 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/dvipdfm-x/ChangeLog | 5 +++++ Build/source/texk/dvipdfm-x/pdfdoc.c | 4 ++-- Build/source/texk/dvipdfm-x/pdfencrypt.c | 4 ++-- Build/source/texk/dvipdfm-x/pdffont.c | 7 ++++--- Build/source/texk/dvipdfm-x/pdfobj.h | 1 + Build/source/texk/dvipdfm-x/xbb.c | 2 +- 6 files changed, 15 insertions(+), 8 deletions(-) (limited to 'Build') diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index 182ebfd2157..ab7dc976e24 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,8 @@ +2016-05-04 Akira Kakuto + + * pdfdoc.c, pdfencrypt.c, pdffont.c, pdfobj.h, xbb.c: Improve the + support of SOURCE_DATE_EPOCH. + 2016-05-02 Akira Kakuto * pdfdoc.c, xbb.c: Apply the patch by Alexis, diff --git a/Build/source/texk/dvipdfm-x/pdfdoc.c b/Build/source/texk/dvipdfm-x/pdfdoc.c index 3bf163ab4d9..21d47c06e67 100644 --- a/Build/source/texk/dvipdfm-x/pdfdoc.c +++ b/Build/source/texk/dvipdfm-x/pdfdoc.c @@ -443,7 +443,7 @@ compute_timezone_offset() time_t gmtoff; now = get_unique_time_if_given(); - if (now == 0) { + if (now == INVALID_EPOCH_VALUE) { now = time(NULL); localtime_r(&now, &local); gmtime_r(&now, &tm); @@ -467,7 +467,7 @@ asn_date (char *date_string) struct tm *bd_time; current_time = get_unique_time_if_given(); - if (current_time == 0) { + if (current_time == INVALID_EPOCH_VALUE) { time(¤t_time); bd_time = localtime(¤t_time); diff --git a/Build/source/texk/dvipdfm-x/pdfencrypt.c b/Build/source/texk/dvipdfm-x/pdfencrypt.c index 1771fff722d..c29543f7e25 100644 --- a/Build/source/texk/dvipdfm-x/pdfencrypt.c +++ b/Build/source/texk/dvipdfm-x/pdfencrypt.c @@ -101,7 +101,7 @@ pdf_enc_init (int use_aes, int encrypt_metadata) struct pdf_sec *p = &sec_data; current_time = get_unique_time_if_given(); - if (current_time == 0) + if (current_time == INVALID_EPOCH_VALUE) current_time = time(NULL); srand(current_time); /* For AES IV */ p->setting.use_aes = use_aes; @@ -127,7 +127,7 @@ pdf_enc_compute_id_string (char *dviname, char *pdfname) date_string = NEW(15, char); current_time = get_unique_time_if_given(); - if (current_time == 0) { + if (current_time == INVALID_EPOCH_VALUE) { time(¤t_time); bd_time = localtime(¤t_time); } else { diff --git a/Build/source/texk/dvipdfm-x/pdffont.c b/Build/source/texk/dvipdfm-x/pdffont.c index 66578da8915..7c8a94ea435 100644 --- a/Build/source/texk/dvipdfm-x/pdffont.c +++ b/Build/source/texk/dvipdfm-x/pdffont.c @@ -90,7 +90,8 @@ pdf_font_set_dpi (int font_dpi) /* If an environment variable SOURCE_DATE_EPOCH is correctly defined like * SOURCE_DATE_EPOCH=1456304492, then returns this value, to be used as the - * 'current time', otherwise returns 0. + * 'current time', otherwise returns INVALID_EPOCH_VALUE (= 0xfffffffffULL). + * The value should be less than about (3000 - 1970) years in seconds. */ time_t @@ -99,7 +100,7 @@ get_unique_time_if_given(void) const char *source_date_epoch; int64_t epoch; char *endptr; - time_t ret = 0; + time_t ret = INVALID_EPOCH_VALUE; source_date_epoch = getenv("SOURCE_DATE_EPOCH"); if (source_date_epoch) { @@ -121,7 +122,7 @@ pdf_font_make_uniqueTag (char *tag) if (first) { time_t current_time; current_time = get_unique_time_if_given(); - if (current_time == 0) + if (current_time == INVALID_EPOCH_VALUE) current_time = time(NULL); srand(current_time); first = 0; diff --git a/Build/source/texk/dvipdfm-x/pdfobj.h b/Build/source/texk/dvipdfm-x/pdfobj.h index 98347a8f77a..7485c68d17a 100644 --- a/Build/source/texk/dvipdfm-x/pdfobj.h +++ b/Build/source/texk/dvipdfm-x/pdfobj.h @@ -199,5 +199,6 @@ extern int pdfobj_escape_str (char *buffer, int size, const unsigned char * extern pdf_obj *pdf_new_indirect (pdf_file *pf, unsigned label, unsigned short generation); extern time_t get_unique_time_if_given(void); +#define INVALID_EPOCH_VALUE 0xfffffffffULL #endif /* _PDFOBJ_H_ */ diff --git a/Build/source/texk/dvipdfm-x/xbb.c b/Build/source/texk/dvipdfm-x/xbb.c index a15bf6aa14f..70fb5d3557d 100644 --- a/Build/source/texk/dvipdfm-x/xbb.c +++ b/Build/source/texk/dvipdfm-x/xbb.c @@ -95,7 +95,7 @@ static void do_time(FILE *file) struct tm *bd_time; current_time = get_unique_time_if_given(); - if (current_time == 0) { + if (current_time == INVALID_EPOCH_VALUE) { time(¤t_time); bd_time = localtime(¤t_time); } else { -- cgit v1.2.3