# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
-AC_TYPE_UID_T
+# AC_TYPE_UID_T defaults to "int", which is incorrect for MinGW
+# and MSVC. Use a customized version.
+la_TYPE_UID_T
AC_TYPE_MODE_T
# AC_TYPE_OFF_T defaults to "long", which limits us to 4GB files on
# most systems... default to "long long" instead.
# else
# define __LA_SSIZE_T long
# endif
-#define __LA_UID_T unsigned int
-#define __LA_GID_T unsigned int
+#define __LA_UID_T short
+#define __LA_GID_T short
#else
#include <unistd.h> /* ssize_t, uid_t, and gid_t */
#define __LA_INT64_T int64_t
/* These should match the types used in 'struct stat' */
#if defined(_WIN32) && !defined(__CYGWIN__)
#define __LA_INT64_T __int64
-#define __LA_UID_T unsigned int
-#define __LA_GID_T unsigned int
+#define __LA_UID_T short
+#define __LA_GID_T short
#define __LA_DEV_T unsigned int
#define __LA_MODE_T unsigned short
#else
archive_strlen(&(pax->pax_header)));
/* Copy uid/gid (but clip to ustar limits). */
uid = archive_entry_uid(entry_main);
- if (uid >= 1 << 18)
- uid = (1 << 18) - 1;
+ if ((long long)uid >= 1 << 18)
+ uid = (uid_t)(1 << 18) - 1;
archive_entry_set_uid(pax_attr_entry, uid);
gid = archive_entry_gid(entry_main);
- if (gid >= 1 << 18)
- gid = (1 << 18) - 1;
+ if ((long long)gid >= 1 << 18)
+ gid = (gid_t)(1 << 18) - 1;
archive_entry_set_gid(pax_attr_entry, gid);
/* Copy mode over (but not setuid/setgid bits) */
mode = archive_entry_mode(entry_main);