summaryrefslogtreecommitdiff
path: root/libarchive
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2022-12-28 14:05:16 -0800
committerGitHub <noreply@github.com>2022-12-28 23:05:16 +0100
commit2e9bcba70685383426ad42c8856c50ce3214ae24 (patch)
tree7c9e8e2499110a20559cddadc20f06424c2032f9 /libarchive
parent1f35c466aaa9444335a1b854b0b7223b0d2346c2 (diff)
downloadlibarchive-2e9bcba70685383426ad42c8856c50ce3214ae24.tar.gz
further cleanup _localtime64_s (#1824)
These were missing from 2d329073435d36065ce30bfd29428f6a45e41016 Signed-off-by: Rosen Penev <rosenp@gmail.com> Signed-off-by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'libarchive')
-rw-r--r--libarchive/test/test_write_format_zip_compression_store.c11
-rw-r--r--libarchive/test/test_write_format_zip_file.c11
-rw-r--r--libarchive/test/test_write_format_zip_file_zip64.c11
3 files changed, 3 insertions, 30 deletions
diff --git a/libarchive/test/test_write_format_zip_compression_store.c b/libarchive/test/test_write_format_zip_compression_store.c
index aae50afb..4d086edf 100644
--- a/libarchive/test/test_write_format_zip_compression_store.c
+++ b/libarchive/test/test_write_format_zip_compression_store.c
@@ -132,21 +132,12 @@ static void verify_uncompressed_contents(const char *buff, size_t used)
#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
struct tm tmbuf;
#endif
-#if defined(HAVE__LOCALTIME64_S)
- errno_t terr;
- __time64_t tmptime;
-#endif
/* p is the pointer to walk over the central directory,
* q walks over the local headers, the data and the data descriptors. */
const char *p, *q, *local_header, *extra_start;
#if defined(HAVE__LOCALTIME64_S)
- tmptime = now;
- terr = _localtime64_s(&tmbuf, &tmptime);
- if (terr)
- tm = NULL;
- else
- tm = &tmbuf;
+ tm = _localtime64_s(&tmbuf, &now) ? NULL : &tmbuf;
#elif defined(HAVE_LOCALTIME_R)
tm = localtime_r(&now, &tmbuf);
#else
diff --git a/libarchive/test/test_write_format_zip_file.c b/libarchive/test/test_write_format_zip_file.c
index ff3c13dc..afd0eb6e 100644
--- a/libarchive/test/test_write_format_zip_file.c
+++ b/libarchive/test/test_write_format_zip_file.c
@@ -77,10 +77,6 @@ DEFINE_TEST(test_write_format_zip_file)
#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
struct tm tmbuf;
#endif
-#if defined(HAVE__LOCALTIME64_S)
- errno_t terr;
- __time64_t tmptime;
-#endif
size_t used, buffsize = 1000000;
unsigned long crc;
int file_perm = 00644;
@@ -99,12 +95,7 @@ DEFINE_TEST(test_write_format_zip_file)
#endif
#if defined(HAVE__LOCALTIME64_S)
- tmptime = t;
- terr = _localtime64_s(&tmbuf, &tmptime);
- if (terr)
- tm = NULL;
- else
- tm = &tmbuf;
+ tm = _localtime64_s(&tmbuf, &t) ? NULL : &tmbuf;
#elif defined(HAVE_LOCALTIME_R)
tm = localtime_r(&t, &tmbuf);
#else
diff --git a/libarchive/test/test_write_format_zip_file_zip64.c b/libarchive/test/test_write_format_zip_file_zip64.c
index 8e3b12e1..8a506226 100644
--- a/libarchive/test/test_write_format_zip_file_zip64.c
+++ b/libarchive/test/test_write_format_zip_file_zip64.c
@@ -79,10 +79,6 @@ DEFINE_TEST(test_write_format_zip_file_zip64)
#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
struct tm tmbuf;
#endif
-#if defined(HAVE__LOCALTIME64_S)
- errno_t terr;
- __time64_t tmptime;
-#endif
size_t used, buffsize = 1000000;
unsigned long crc;
int file_perm = 00644;
@@ -100,12 +96,7 @@ DEFINE_TEST(test_write_format_zip_file_zip64)
#endif
#if defined(HAVE__LOCALTIME64_S)
- tmptime = t;
- terr = _localtime64_s(&tmbuf, &tmptime);
- if (terr)
- tm = NULL;
- else
- tm = &tmbuf;
+ tm = _localtime64_s(&tmbuf, &t) ? NULL : &tmbuf;
#elif defined(HAVE_LOCALTIME_R)
tm = localtime_r(&t, &tmbuf);
#else