diff options
Diffstat (limited to 'Utilities/cmlibarchive/libarchive/archive_write_set_format_warc.c')
-rw-r--r-- | Utilities/cmlibarchive/libarchive/archive_write_set_format_warc.c | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/Utilities/cmlibarchive/libarchive/archive_write_set_format_warc.c b/Utilities/cmlibarchive/libarchive/archive_write_set_format_warc.c index 80abc6f..ea66929 100644 --- a/Utilities/cmlibarchive/libarchive/archive_write_set_format_warc.c +++ b/Utilities/cmlibarchive/libarchive/archive_write_set_format_warc.c @@ -186,16 +186,18 @@ _warc_header(struct archive_write *a, struct archive_entry *entry) /* check whether warcinfo record needs outputting */ if (!w->omit_warcinfo) { + ssize_t r; warc_essential_hdr_t wi = { WT_INFO, /*uri*/NULL, /*urn*/NULL, - /*rtm*/w->now, - /*mtm*/w->now, + /*rtm*/0, + /*mtm*/0, /*cty*/"application/warc-fields", /*len*/sizeof(warcinfo) - 1U, }; - ssize_t r; + wi.rtime = w->now; + wi.mtime = w->now; archive_string_init(&hdr); r = _popul_ehdr(&hdr, MAX_HDR_SIZE, wi); @@ -226,14 +228,18 @@ _warc_header(struct archive_write *a, struct archive_entry *entry) if (w->typ == AE_IFREG) { warc_essential_hdr_t rh = { WT_RSRC, - /*uri*/archive_entry_pathname(entry), + /*uri*/NULL, /*urn*/NULL, - /*rtm*/w->now, - /*mtm*/archive_entry_mtime(entry), + /*rtm*/0, + /*mtm*/0, /*cty*/NULL, - /*len*/(size_t)archive_entry_size(entry), + /*len*/0, }; ssize_t r; + rh.tgturi = archive_entry_pathname(entry); + rh.rtime = w->now; + rh.mtime = archive_entry_mtime(entry); + rh.cntlen = (size_t)archive_entry_size(entry); archive_string_init(&hdr); r = _popul_ehdr(&hdr, MAX_HDR_SIZE, rh); @@ -325,16 +331,16 @@ xstrftime(struct archive_string *as, const char *fmt, time_t t) /** like strftime(3) but for time_t objects */ struct tm *rt; #if defined(HAVE_GMTIME_R) || defined(HAVE__GMTIME64_S) - struct tm time; + struct tm timeHere; #endif char strtime[100]; size_t len; #ifdef HAVE_GMTIME_R - if ((rt = gmtime_r(&t, &time)) == NULL) + if ((rt = gmtime_r(&t, &timeHere)) == NULL) return; #elif defined(HAVE__GMTIME64_S) - _gmtime64_s(&time, &t); + _gmtime64_s(&timeHere, &t); #else if ((rt = gmtime(&t)) == NULL) return; @@ -396,7 +402,7 @@ _popul_ehdr(struct archive_string *tgt, size_t tsz, warc_essential_hdr_t hdr) * handle the minimum number following '%'. * So we have to use snprintf function here instead * of archive_string_snprintf function. */ -#if defined(_WIN32) && !defined(__CYGWIN__) +#if defined(_WIN32) && !defined(__CYGWIN__) && !( defined(_MSC_VER) && _MSC_VER >= 1900) #define snprintf _snprintf #endif snprintf( |