Merge pull request #858 from SixTrack/fix_CYGWIN64-MSYS
Fix cygwin64 compilation
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 85df246..bad694a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -608,7 +608,7 @@
ELSE(ENABLE_CNG)
UNSET(HAVE_BCRYPT_H CACHE)
ENDIF(ENABLE_CNG)
-# Following files need windwos.h, so we should test it after windows.h test.
+# Following files need windows.h, so we should test it after windows.h test.
LA_CHECK_INCLUDE_FILE("wincrypt.h" HAVE_WINCRYPT_H)
LA_CHECK_INCLUDE_FILE("winioctl.h" HAVE_WINIOCTL_H)
diff --git a/libarchive/archive_random.c b/libarchive/archive_random.c
index a20b9b1..357f973 100644
--- a/libarchive/archive_random.c
+++ b/libarchive/archive_random.c
@@ -80,7 +80,7 @@
success = CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL,
CRYPT_VERIFYCONTEXT);
- if (!success && GetLastError() == NTE_BAD_KEYSET) {
+ if (!success && GetLastError() == (DWORD)NTE_BAD_KEYSET) {
success = CryptAcquireContext(&hProv, NULL, NULL,
PROV_RSA_FULL, CRYPT_NEWKEYSET);
}
diff --git a/libarchive/archive_windows.c b/libarchive/archive_windows.c
index 8663bef..6ff8749 100644
--- a/libarchive/archive_windows.c
+++ b/libarchive/archive_windows.c
@@ -891,7 +891,7 @@
return;
}
- for (i = 0; i < (int)sizeof(doserrors)/sizeof(doserrors[0]); i++)
+ for (i = 0; i < (int)(sizeof(doserrors)/sizeof(doserrors[0])); i++)
{
if (doserrors[i].winerr == e)
{
diff --git a/libarchive/archive_windows.h b/libarchive/archive_windows.h
index 8cf1c56..e77cd08 100644
--- a/libarchive/archive_windows.h
+++ b/libarchive/archive_windows.h
@@ -218,16 +218,20 @@
#define S_IWUSR _S_IWUSR
#define S_IRUSR _S_IRUSR
#endif
+#ifndef S_IRWXG
#define S_IRWXG _S_IRWXG
#define S_IXGRP _S_IXGRP
#define S_IWGRP _S_IWGRP
+#endif
#ifndef S_IRGRP
#define S_IRGRP _S_IRGRP
#endif
+#ifndef S_IRWXO
#define S_IRWXO _S_IRWXO
#define S_IXOTH _S_IXOTH
#define S_IWOTH _S_IWOTH
#define S_IROTH _S_IROTH
+#endif
#endif
diff --git a/libarchive/archive_write_set_format_iso9660.c b/libarchive/archive_write_set_format_iso9660.c
index 1d1f04e..95c7361 100644
--- a/libarchive/archive_write_set_format_iso9660.c
+++ b/libarchive/archive_write_set_format_iso9660.c
@@ -2524,7 +2524,8 @@
tzset();
localtime_r(t, tm);
#elif HAVE__LOCALTIME64_S
- _localtime64_s(tm, t);
+ __time64_t tmp_t = (__time64_t) *t; //time_t may be shorter than 64 bits
+ _localtime64_s(tm, &tmp_t);
#else
memcpy(tm, localtime(t), sizeof(*tm));
#endif
@@ -4073,7 +4074,8 @@
memset(info.s, 0, info_size);
opt = 0;
#if defined(HAVE__CTIME64_S)
- _ctime64_s(buf, sizeof(buf), &(iso9660->birth_time));
+ __time64_t iso9660_birth_time_tmp = (__time64_t) iso9660->birth_time; //time_t may be shorter than 64 bits
+ _ctime64_s(buf, sizeof(buf), &(iso9660_birth_time_tmp));
#elif defined(HAVE_CTIME_R)
ctime_r(&(iso9660->birth_time), buf);
#else
diff --git a/libarchive/test/main.c b/libarchive/test/main.c
index d59f155..46685f8 100644
--- a/libarchive/test/main.c
+++ b/libarchive/test/main.c
@@ -216,6 +216,12 @@
unsigned int line, uintptr_t pReserved)
{
/* nop */
+ // Silence unused-parameter compiler warnings.
+ (void)expression;
+ (void)function;
+ (void)file;
+ (void)line;
+ (void)pReserved;
}
#endif
@@ -1412,6 +1418,8 @@
failure_start(file, line, "assertFileMode not yet implemented for Windows");
(void)mode; /* UNUSED */
(void)r; /* UNUSED */
+ (void)pathname; /* UNUSED */
+ (void)expected_mode; /* UNUSED */
#else
{
struct stat st;