]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix build failure on Windows.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Sun, 12 Oct 2014 01:50:09 +0000 (10:50 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Sun, 12 Oct 2014 01:50:09 +0000 (10:50 +0900)
libarchive/archive_cryptor_private.h
libarchive/archive_hmac.c
libarchive/archive_hmac_private.h
libarchive/archive_random.c
libarchive/archive_read_support_format_lha.c
libarchive/archive_read_support_format_mtree.c
libarchive/test/test_archive_string.c
libarchive/test/test_read_format_7zip.c
libarchive/test/test_write_format_zip_large.c

index 7e2033b19051263932ed7aaf34f8a8a25fb5d9e9..35b3385e0a11a13306aaa2973f12d3a88d64c5d4 100644 (file)
@@ -45,6 +45,19 @@ typedef struct {
        unsigned        encr_pos;
 } archive_crypto_ctx;
 
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+
+#define AES_MAX_KEY_SIZE 32
+#define AES_BLOCK_SIZE 16
+typedef struct {
+       int     ctx;
+       uint8_t         key[AES_MAX_KEY_SIZE];
+       unsigned        key_len;
+       uint8_t         nonce[AES_BLOCK_SIZE];
+       uint8_t         encr_buf[AES_BLOCK_SIZE];
+       unsigned        encr_pos;
+} archive_crypto_ctx;
+
 #elif defined(HAVE_LIBNETTLE)
 #if defined(HAVE_NETTLE_PBKDF2_H)
 #include <nettle/pbkdf2.h>
index 34ce7d49bf0bf916e65b14f78c6b64ced601a574..9e6834ec9edbcb781e44970edb9f67dcaf421c09 100644 (file)
@@ -142,10 +142,11 @@ __hmac_sha1_update(archive_hmac_sha1_ctx *ctx, const uint8_t *data,
 }
 
 static void
-__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out)
+__hmac_sha1_final(archive_hmac_sha1_ctx *ctx, uint8_t *out, size_t *out_len)
 {
        (void)ctx;/* UNUSED */
        (void)out;/* UNUSED */
+       (void)out_len;/* UNUSED */
 }
 
 static void
index 324deb6f32d8d9894ffee0b6fad2658ef4dd25ef..223e7ca6629f66e0d126e00382695dabfc0bba1c 100644 (file)
 
 typedef        CCHmacContext archive_hmac_sha1_ctx;
 
+#elif defined(_WIN32) && !defined(__CYGWIN__)
+
+typedef int archive_hmac_sha1_ctx;
+
 #elif defined(HAVE_LIBNETTLE)
 #include <nettle/hmac.h>
 
index 7786323dc777737242d9955fe29aace0761ea35c..57c49d5abbdce9ab4d2c30e77465854202ec76db 100644 (file)
@@ -51,10 +51,6 @@ __FBSDID("$FreeBSD$");
 #include <pthread.h>
 #endif
 
-#if defined(HAVE_WINCRYPT_H) && !defined(__CYGWIN__)
-#include <wincrypt.h>
-#endif
-
 static void arc4random_buf(void *, size_t);
 
 #endif /* HAVE_ARC4RANDOM_BUF */
@@ -62,6 +58,10 @@ static void arc4random_buf(void *, size_t);
 #include "archive.h"
 #include "archive_random_private.h"
 
+#if defined(HAVE_WINCRYPT_H) && !defined(__CYGWIN__)
+#include <wincrypt.h>
+#endif
+
 /*
  * Random number generator function.
  * This simply calls arc4random_buf function if the platform provides it.
@@ -81,7 +81,7 @@ archive_random(void *buf, size_t nbytes)
                    PROV_RSA_FULL, CRYPT_NEWKEYSET);
        }
        if (success) {
-               success = CryptGenRandom(hProv, (DWORD)nbytes, (BYTE*)buf))
+               success = CryptGenRandom(hProv, (DWORD)nbytes, (BYTE*)buf);
                CryptReleaseContext(hProv, 0);
                if (success)
                        return ARCHIVE_OK;
index 953a16c922f1fb9247b3d01a06591b78c27b609d..572686ab84e972f2c93e4e7978a4b44debf068fe 100644 (file)
@@ -1492,7 +1492,7 @@ lha_read_data_lzh(struct archive_read *a, const void **buff,
        if (bytes_avail > lha->entry_bytes_remaining)
                bytes_avail = (ssize_t)lha->entry_bytes_remaining;
 
-       lha->strm.avail_in = bytes_avail;
+       lha->strm.avail_in = (int)bytes_avail;
        lha->strm.total_in = 0;
        lha->strm.avail_out = 0;
 
@@ -2001,7 +2001,7 @@ static void
 lzh_emit_window(struct lzh_stream *strm, size_t s)
 {
        strm->ref_ptr = strm->ds->w_buff;
-       strm->avail_out = s;
+       strm->avail_out = (int)s;
        strm->total_out += s;
 }
 
index 62902206a5fa483bacdad5981b2a1c8aacd2dd74..b58f592a3f29b962ebe9fa64ee7f6719f093dff2 100644 (file)
@@ -1377,7 +1377,7 @@ parse_device(dev_t *pdev, struct archive *a, char *val)
                                    "Missing number");
                                return ARCHIVE_WARN;
                        }
-                       numbers[argc++] = mtree_atol(&p);
+                       numbers[argc++] = (unsigned long)mtree_atol(&p);
                        if (argc > MAX_PACK_ARGS) {
                                archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT,
                                    "Too many arguments");
index 7303be84deba9177ed1c6d018e4a168cfc35548a..9e3f90702dbca713556cfae71d5aff1b11056006 100644 (file)
@@ -380,7 +380,7 @@ DEFINE_TEST(test_archive_string_sort)
   unsigned int i, j, size;
   char **test_strings, *tmp;
 
-  srand(time(NULL));
+  srand((unsigned int)time(NULL));
   size = sizeof(strings) / sizeof(char *);
   assert((test_strings = (char **)calloc(1, sizeof(strings))) != NULL);
   for (i = 0; i < (size - 1); i++)
index ea9035aa79e83ff729a6c4d6416ff5f0222065ee..14447def898a4d6c2f00b6f658ce046855ca8170 100644 (file)
 #include "test.h"
 __FBSDID("$FreeBSD");
 
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define        close           _close
+#define        open            _open
+#endif
+
 /*
  * Extract a non-encoded file.
  * The header of the 7z archive files is not encoded.
index 12cd1059d1c8568bedb0c8f29373ea97c62281ba..06045525e79559e1f0df85bca3acc3c31502e4f0 100644 (file)
@@ -84,7 +84,7 @@ memory_write(struct archive *a, void *_private, const void *buff, size_t size)
                /* It's header or metadata, copy and save it. */
                block = (struct fileblock *)malloc(sizeof(*block));
                memset(block, 0, sizeof(*block));
-               block->size = size;
+               block->size = (int)size;
                block->buff = malloc(size);
                memcpy(block->buff, buff, size);
                if (private->last == NULL) {