From: ljdarj Date: Sat, 25 Jan 2025 18:14:42 +0000 (+0100) Subject: Remove dev_t and time_t from public API in 4.0 (#2392) X-Git-Tag: v3.8.0~73 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=65196fdd1a385f22114f245a9002ee8dc899f2c4;p=thirdparty%2Flibarchive.git Remove dev_t and time_t from public API in 4.0 (#2392) Removing dev_t and time_t from the public include files from 4.0 on and updating some tests in consequence. Fixes #2279 . --- diff --git a/libarchive/archive.h b/libarchive/archive.h index 0dfb02f9d..2067fa80d 100644 --- a/libarchive/archive.h +++ b/libarchive/archive.h @@ -39,7 +39,10 @@ #include #include /* for wchar_t */ #include /* For FILE * */ +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* time_t is slated to be removed from public includes in 4.0 */ #include /* For time_t */ +#endif /* * Note: archive.h is for use outside of libarchive; the configuration @@ -94,6 +97,22 @@ typedef ssize_t la_ssize_t; # endif #endif +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* Use the platform types for time_t */ +#define __LA_TIME_T time_t +#else +/* Use 64-bytes integer types for time_t */ +#define __LA_TIME_T la_int64_t +#endif + +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* Use the platform types for dev_t */ +#define __LA_DEV_T dev_t +#else +/* Use 64-bytes integer types for dev_t */ +#define __LA_DEV_T la_int64_t +#endif + /* Large file support for Android */ #if defined(__LIBARCHIVE_BUILD) && defined(__ANDROID__) #include "android_lf.h" diff --git a/libarchive/archive_entry.c b/libarchive/archive_entry.c index 4ebfc5fa6..f20bb2efc 100644 --- a/libarchive/archive_entry.c +++ b/libarchive/archive_entry.c @@ -275,7 +275,7 @@ archive_entry_new2(struct archive *a) * Functions for reading fields from an archive_entry. */ -time_t +__LA_TIME_T archive_entry_atime(struct archive_entry *entry) { return (entry->ae_stat.aest_atime); @@ -293,7 +293,7 @@ archive_entry_atime_is_set(struct archive_entry *entry) return (entry->ae_set & AE_SET_ATIME); } -time_t +__LA_TIME_T archive_entry_birthtime(struct archive_entry *entry) { return (entry->ae_stat.aest_birthtime); @@ -311,7 +311,7 @@ archive_entry_birthtime_is_set(struct archive_entry *entry) return (entry->ae_set & AE_SET_BIRTHTIME); } -time_t +__LA_TIME_T archive_entry_ctime(struct archive_entry *entry) { return (entry->ae_stat.aest_ctime); @@ -329,7 +329,7 @@ archive_entry_ctime_nsec(struct archive_entry *entry) return (entry->ae_stat.aest_ctime_nsec); } -dev_t +__LA_DEV_T archive_entry_dev(struct archive_entry *entry) { if (entry->ae_stat.aest_dev_is_broken_down) @@ -345,7 +345,7 @@ archive_entry_dev_is_set(struct archive_entry *entry) return (entry->ae_set & AE_SET_DEV); } -dev_t +__LA_DEV_T archive_entry_devmajor(struct archive_entry *entry) { if (entry->ae_stat.aest_dev_is_broken_down) @@ -354,7 +354,7 @@ archive_entry_devmajor(struct archive_entry *entry) return major(entry->ae_stat.aest_dev); } -dev_t +__LA_DEV_T archive_entry_devminor(struct archive_entry *entry) { if (entry->ae_stat.aest_dev_is_broken_down) @@ -568,7 +568,7 @@ archive_entry_mode(struct archive_entry *entry) return (entry->acl.mode); } -time_t +__LA_TIME_T archive_entry_mtime(struct archive_entry *entry) { return (entry->ae_stat.aest_mtime); @@ -667,7 +667,7 @@ archive_entry_rdev_is_set(struct archive_entry *entry) return (entry->ae_set & AE_SET_RDEV); } -dev_t +__LA_DEV_T archive_entry_rdev(struct archive_entry *entry) { if (archive_entry_rdev_is_set(entry)) { @@ -681,7 +681,7 @@ archive_entry_rdev(struct archive_entry *entry) } } -dev_t +__LA_DEV_T archive_entry_rdevmajor(struct archive_entry *entry) { if (archive_entry_rdev_is_set(entry)) { @@ -694,7 +694,7 @@ archive_entry_rdevmajor(struct archive_entry *entry) } } -dev_t +__LA_DEV_T archive_entry_rdevminor(struct archive_entry *entry) { if (archive_entry_rdev_is_set(entry)) { @@ -1088,7 +1088,7 @@ _archive_entry_copy_hardlink_l(struct archive_entry *entry, } void -archive_entry_set_atime(struct archive_entry *entry, time_t t, long ns) +archive_entry_set_atime(struct archive_entry *entry, __LA_TIME_T t, long ns) { FIX_NS(t, ns); entry->stat_valid = 0; @@ -1105,7 +1105,7 @@ archive_entry_unset_atime(struct archive_entry *entry) } void -archive_entry_set_birthtime(struct archive_entry *entry, time_t t, long ns) +archive_entry_set_birthtime(struct archive_entry *entry, __LA_TIME_T t, long ns) { FIX_NS(t, ns); entry->stat_valid = 0; @@ -1122,7 +1122,7 @@ archive_entry_unset_birthtime(struct archive_entry *entry) } void -archive_entry_set_ctime(struct archive_entry *entry, time_t t, long ns) +archive_entry_set_ctime(struct archive_entry *entry, __LA_TIME_T t, long ns) { FIX_NS(t, ns); entry->stat_valid = 0; @@ -1139,7 +1139,7 @@ archive_entry_unset_ctime(struct archive_entry *entry) } void -archive_entry_set_dev(struct archive_entry *entry, dev_t d) +archive_entry_set_dev(struct archive_entry *entry, __LA_DEV_T d) { entry->stat_valid = 0; entry->ae_set |= AE_SET_DEV; @@ -1148,7 +1148,7 @@ archive_entry_set_dev(struct archive_entry *entry, dev_t d) } void -archive_entry_set_devmajor(struct archive_entry *entry, dev_t m) +archive_entry_set_devmajor(struct archive_entry *entry, __LA_DEV_T m) { entry->stat_valid = 0; entry->ae_set |= AE_SET_DEV; @@ -1157,7 +1157,7 @@ archive_entry_set_devmajor(struct archive_entry *entry, dev_t m) } void -archive_entry_set_devminor(struct archive_entry *entry, dev_t m) +archive_entry_set_devminor(struct archive_entry *entry, __LA_DEV_T m) { entry->stat_valid = 0; entry->ae_set |= AE_SET_DEV; @@ -1243,7 +1243,7 @@ archive_entry_set_mode(struct archive_entry *entry, mode_t m) } void -archive_entry_set_mtime(struct archive_entry *entry, time_t t, long ns) +archive_entry_set_mtime(struct archive_entry *entry, __LA_TIME_T t, long ns) { FIX_NS(t, ns); entry->stat_valid = 0; @@ -1319,7 +1319,7 @@ archive_entry_set_perm(struct archive_entry *entry, mode_t p) } void -archive_entry_set_rdev(struct archive_entry *entry, dev_t m) +archive_entry_set_rdev(struct archive_entry *entry, __LA_DEV_T m) { entry->stat_valid = 0; entry->ae_stat.aest_rdev = m; @@ -1330,7 +1330,7 @@ archive_entry_set_rdev(struct archive_entry *entry, dev_t m) } void -archive_entry_set_rdevmajor(struct archive_entry *entry, dev_t m) +archive_entry_set_rdevmajor(struct archive_entry *entry, __LA_DEV_T m) { entry->stat_valid = 0; entry->ae_stat.aest_rdev_is_broken_down = 1; @@ -1340,7 +1340,7 @@ archive_entry_set_rdevmajor(struct archive_entry *entry, dev_t m) } void -archive_entry_set_rdevminor(struct archive_entry *entry, dev_t m) +archive_entry_set_rdevminor(struct archive_entry *entry, __LA_DEV_T m) { entry->stat_valid = 0; entry->ae_stat.aest_rdev_is_broken_down = 1; diff --git a/libarchive/archive_entry.h b/libarchive/archive_entry.h index 079233c27..8a3215dcc 100644 --- a/libarchive/archive_entry.h +++ b/libarchive/archive_entry.h @@ -41,7 +41,10 @@ #include #include /* for wchar_t */ #include +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* time_t is slated to be removed from public includes in 4.0 */ #include +#endif #if defined(_WIN32) && !defined(__CYGWIN__) #include @@ -96,6 +99,22 @@ typedef ssize_t la_ssize_t; # define __LA_MODE_T mode_t #endif +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* Use the platform types for time_t */ +#define __LA_TIME_T time_t +#else +/* Use 64-bytes integer types for time_t */ +#define __LA_TIME_T la_int64_t +#endif + +#if ARCHIVE_VERSION_NUMBER < 4000000 +/* Use the platform types for dev_t */ +#define __LA_DEV_T dev_t +#else +/* Use 64-bytes integer types for dev_t */ +#define __LA_DEV_T la_int64_t +#endif + /* Large file support for Android */ #if defined(__LIBARCHIVE_BUILD) && defined(__ANDROID__) #include "android_lf.h" @@ -236,19 +255,19 @@ __LA_DECL struct archive_entry *archive_entry_new2(struct archive *); * also return NULL when implicit character set conversions fail. * This is usually what you want. */ -__LA_DECL time_t archive_entry_atime(struct archive_entry *); +__LA_DECL __LA_TIME_T archive_entry_atime(struct archive_entry *); __LA_DECL long archive_entry_atime_nsec(struct archive_entry *); __LA_DECL int archive_entry_atime_is_set(struct archive_entry *); -__LA_DECL time_t archive_entry_birthtime(struct archive_entry *); +__LA_DECL __LA_TIME_T archive_entry_birthtime(struct archive_entry *); __LA_DECL long archive_entry_birthtime_nsec(struct archive_entry *); __LA_DECL int archive_entry_birthtime_is_set(struct archive_entry *); -__LA_DECL time_t archive_entry_ctime(struct archive_entry *); +__LA_DECL __LA_TIME_T archive_entry_ctime(struct archive_entry *); __LA_DECL long archive_entry_ctime_nsec(struct archive_entry *); __LA_DECL int archive_entry_ctime_is_set(struct archive_entry *); -__LA_DECL dev_t archive_entry_dev(struct archive_entry *); +__LA_DECL __LA_DEV_T archive_entry_dev(struct archive_entry *); __LA_DECL int archive_entry_dev_is_set(struct archive_entry *); -__LA_DECL dev_t archive_entry_devmajor(struct archive_entry *); -__LA_DECL dev_t archive_entry_devminor(struct archive_entry *); +__LA_DECL __LA_DEV_T archive_entry_devmajor(struct archive_entry *); +__LA_DECL __LA_DEV_T archive_entry_devminor(struct archive_entry *); __LA_DECL __LA_MODE_T archive_entry_filetype(struct archive_entry *); __LA_DECL int archive_entry_filetype_is_set(struct archive_entry *); __LA_DECL void archive_entry_fflags(struct archive_entry *, @@ -279,9 +298,9 @@ __LA_DECL const wchar_t *archive_entry_pathname_w(struct archive_entry *); __LA_DECL __LA_MODE_T archive_entry_perm(struct archive_entry *); __LA_DECL int archive_entry_perm_is_set(struct archive_entry *); __LA_DECL int archive_entry_rdev_is_set(struct archive_entry *); -__LA_DECL dev_t archive_entry_rdev(struct archive_entry *); -__LA_DECL dev_t archive_entry_rdevmajor(struct archive_entry *); -__LA_DECL dev_t archive_entry_rdevminor(struct archive_entry *); +__LA_DECL __LA_DEV_T archive_entry_rdev(struct archive_entry *); +__LA_DECL __LA_DEV_T archive_entry_rdevmajor(struct archive_entry *); +__LA_DECL __LA_DEV_T archive_entry_rdevminor(struct archive_entry *); __LA_DECL const char *archive_entry_sourcepath(struct archive_entry *); __LA_DECL const wchar_t *archive_entry_sourcepath_w(struct archive_entry *); __LA_DECL la_int64_t archive_entry_size(struct archive_entry *); @@ -310,18 +329,18 @@ __LA_DECL int archive_entry_is_encrypted(struct archive_entry *); * always copied. */ -__LA_DECL void archive_entry_set_atime(struct archive_entry *, time_t, long); +__LA_DECL void archive_entry_set_atime(struct archive_entry *, __LA_TIME_T, long); __LA_DECL void archive_entry_unset_atime(struct archive_entry *); #if defined(_WIN32) && !defined(__CYGWIN__) __LA_DECL void archive_entry_copy_bhfi(struct archive_entry *, BY_HANDLE_FILE_INFORMATION *); #endif -__LA_DECL void archive_entry_set_birthtime(struct archive_entry *, time_t, long); +__LA_DECL void archive_entry_set_birthtime(struct archive_entry *, __LA_TIME_T, long); __LA_DECL void archive_entry_unset_birthtime(struct archive_entry *); -__LA_DECL void archive_entry_set_ctime(struct archive_entry *, time_t, long); +__LA_DECL void archive_entry_set_ctime(struct archive_entry *, __LA_TIME_T, long); __LA_DECL void archive_entry_unset_ctime(struct archive_entry *); -__LA_DECL void archive_entry_set_dev(struct archive_entry *, dev_t); -__LA_DECL void archive_entry_set_devmajor(struct archive_entry *, dev_t); -__LA_DECL void archive_entry_set_devminor(struct archive_entry *, dev_t); +__LA_DECL void archive_entry_set_dev(struct archive_entry *, __LA_DEV_T); +__LA_DECL void archive_entry_set_devmajor(struct archive_entry *, __LA_DEV_T); +__LA_DECL void archive_entry_set_devminor(struct archive_entry *, __LA_DEV_T); __LA_DECL void archive_entry_set_filetype(struct archive_entry *, unsigned int); __LA_DECL void archive_entry_set_fflags(struct archive_entry *, unsigned long /* set */, unsigned long /* clear */); @@ -352,7 +371,7 @@ __LA_DECL void archive_entry_copy_link(struct archive_entry *, const char *); __LA_DECL void archive_entry_copy_link_w(struct archive_entry *, const wchar_t *); __LA_DECL int archive_entry_update_link_utf8(struct archive_entry *, const char *); __LA_DECL void archive_entry_set_mode(struct archive_entry *, __LA_MODE_T); -__LA_DECL void archive_entry_set_mtime(struct archive_entry *, time_t, long); +__LA_DECL void archive_entry_set_mtime(struct archive_entry *, __LA_TIME_T, long); __LA_DECL void archive_entry_unset_mtime(struct archive_entry *); __LA_DECL void archive_entry_set_nlink(struct archive_entry *, unsigned int); __LA_DECL void archive_entry_set_pathname(struct archive_entry *, const char *); @@ -361,9 +380,9 @@ __LA_DECL void archive_entry_copy_pathname(struct archive_entry *, const char *) __LA_DECL void archive_entry_copy_pathname_w(struct archive_entry *, const wchar_t *); __LA_DECL int archive_entry_update_pathname_utf8(struct archive_entry *, const char *); __LA_DECL void archive_entry_set_perm(struct archive_entry *, __LA_MODE_T); -__LA_DECL void archive_entry_set_rdev(struct archive_entry *, dev_t); -__LA_DECL void archive_entry_set_rdevmajor(struct archive_entry *, dev_t); -__LA_DECL void archive_entry_set_rdevminor(struct archive_entry *, dev_t); +__LA_DECL void archive_entry_set_rdev(struct archive_entry *, __LA_DEV_T); +__LA_DECL void archive_entry_set_rdevmajor(struct archive_entry *, __LA_DEV_T); +__LA_DECL void archive_entry_set_rdevminor(struct archive_entry *, __LA_DEV_T); __LA_DECL void archive_entry_set_size(struct archive_entry *, la_int64_t); __LA_DECL void archive_entry_unset_size(struct archive_entry *); __LA_DECL void archive_entry_copy_sourcepath(struct archive_entry *, const char *);