]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Issue 23: Fix a number of minor compatibility problems with MinGW.
authorTim Kientzle <kientzle@gmail.com>
Fri, 15 May 2009 00:11:13 +0000 (20:11 -0400)
committerTim Kientzle <kientzle@gmail.com>
Fri, 15 May 2009 00:11:13 +0000 (20:11 -0400)
SVN-Revision: 1083

libarchive/archive_windows.c
libarchive/archive_windows.h

index 378232f751eec7821a2779fbbb729a39aca073a9..df9c106eecdab4498368654c1b5b54a94f82c4f2 100644 (file)
@@ -49,6 +49,7 @@
 #define WINVER       0x0500
 
 #include "archive_platform.h"
+#include <ctype.h>
 #include <errno.h>
 #include <stddef.h>
 #include <sys/utime.h>
@@ -185,7 +186,8 @@ permissive_name(const char *name)
                wsp += 4;
                slen -= 4;
        }
-       wcsncpy_s(wsp, slen, wnp, _TRUNCATE);
+       wcsncpy(wsp, wnp, slen);
+       wsp[slen - 1] = L'\0'; /* Ensure null termination. */
        free(wn);
        return (ws);
 }
@@ -1051,7 +1053,7 @@ la_waitpid(pid_t wpid, int *status, int option)
 ssize_t
 la_write(int fd, const void *buf, size_t nbytes)
 {
-       uint32_t bytes_written;
+       DWORD bytes_written;
 
 #ifdef _WIN64
        if (nbytes > UINT32_MAX)
@@ -1108,7 +1110,9 @@ Digest_Update(Digest_CTX *ctx, const unsigned char *buf, size_t len)
        if (!ctx->valid)
        return;
 
-       CryptHashData(ctx->hash, buf, (DWORD)len, 0);
+       CryptHashData(ctx->hash,
+                     (unsigned char *)(uintptr_t)buf,
+                     (DWORD)len, 0);
 }
 
 static void
index d3369013eae72446d26acfec74f81049a10090c0..1a15a773d9ecdd18ea451113d5550fe34d8a76a1 100644 (file)
@@ -86,7 +86,9 @@
 #define        chmod           la_chmod
 #define        close           _close
 #define        fcntl           la_fcntl
+#ifndef fileno
 #define        fileno          _fileno
+#endif
 #define        fstat           la_fstat
 #define        getcwd          _getcwd
 #define        lseek           la_lseek
@@ -262,6 +264,7 @@ typedef int pid_t;
 
 /* Message digest define */
 #if !defined(HAVE_OPENSSL_MD5_H) && !defined(HAVE_OPENSSL_SHA_H)
+#include <wincrypt.h>
 typedef struct {
        int             valid;
        HCRYPTPROV cryptProv;