From f9d148d66cc0827bbe8ed4e1f722c44b27d1e038 Mon Sep 17 00:00:00 2001 From: Michihiro NAKAJIMA Date: Mon, 11 Apr 2011 12:46:37 -0400 Subject: Improve archive_write_disk_windows.c. - Use WCS to pathname. This has made following changes. - FindFirstFileW and GetFileInformationByHandle instead of stat/lstat. - Move __la_chmod and __la_ftruncate used only in the file from archive_windows.c and change it to wide char version. - Remove __la_mkdir and directly use CreateDirectoryW in the file. - Remove __la_rmdir and use _wrmdir in the file. - Remove __la_unlink and use _wunlink in the file. - Remove __la_link and Move la_CreateHardLinkW into the file to use it directly. - Use _wopen instead of __la_open. Unfortunately, at this time we cannot use full-pathname through __la_win_permissive_name_w() completely at the file because __la_win_permissive_name_w() trim "../". For example, the path "abc/a/../b../c", which is multi dirs in one entry, will be converted to "/abc/c", so we could not make both abc/a and abc/b directories if we applied __la_win_permissive_name_w() to the path at _archive_write_disk_header(). SVN-Revision: 3213 --- libarchive/archive_windows.h | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) (limited to 'libarchive/archive_windows.h') diff --git a/libarchive/archive_windows.h b/libarchive/archive_windows.h index 6e97d3c4..448fd1f6 100644 --- a/libarchive/archive_windows.h +++ b/libarchive/archive_windows.h @@ -90,21 +90,16 @@ /* Alias the Windows _function to the POSIX equivalent. */ #define chdir __la_chdir -#define chmod __la_chmod #define close _close #define fcntl __la_fcntl #ifndef fileno #define fileno _fileno #endif #define fstat __la_fstat -#define ftruncate __la_ftruncate -#define link __la_link #define lseek __la_lseek #define lstat __la_stat -#define mkdir(d,m) __la_mkdir(d, m) #define open __la_open #define read __la_read -#define rmdir __la_rmdir #if !defined(__BORLANDC__) #define setmode _setmode #endif @@ -116,7 +111,6 @@ #if !defined(__BORLANDC__) #define umask _umask #endif -#define unlink __la_unlink #define waitpid __la_waitpid #define write __la_write @@ -249,14 +243,6 @@ #endif -/* Tell libarchive code that we have simulations for these. */ -#ifndef HAVE_FTRUNCATE -#define HAVE_FTRUNCATE 1 -#endif -#ifndef HAVE_LINK -#define HAVE_LINK 1 -#endif - /* Replacement POSIX function */ extern int __la_chdir(const char *path); extern int __la_chmod(const char *path, mode_t mode); @@ -284,5 +270,8 @@ extern ssize_t __la_write(int fd, const void *buf, size_t nbytes); extern wchar_t *__la_win_permissive_name(const char *name); extern wchar_t *__la_win_permissive_name_w(const wchar_t *wname); +extern void __la_dosmaperr(unsigned long e); +#define la_dosmaperr(e) __la_dosmaperr(e) + #endif /* LIBARCHIVE_ARCHIVE_WINDOWS_H_INCLUDED */ -- cgit v1.2.1