From: Eric Biggers Date: Sat, 2 May 2015 22:47:07 +0000 (-0500) Subject: Make win32.h includable on non-Windows X-Git-Tag: v1.8.1~22 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=944944f4627d18da3b4124ec34df15706baf0d9b Make win32.h includable on non-Windows --- diff --git a/include/wimlib/win32.h b/include/wimlib/win32.h index 9ab141f1..dd3c5c9c 100644 --- a/include/wimlib/win32.h +++ b/include/wimlib/win32.h @@ -1,9 +1,7 @@ #ifndef _WIMLIB_WIN32_H #define _WIMLIB_WIN32_H -#ifndef __WIN32__ -# error "This header is for Win32 only" -#endif +#ifdef __WIN32__ #include "wimlib/callback.h" #include "wimlib/types.h" @@ -56,4 +54,6 @@ pread(int fd, void *buf, size_t count, off_t offset); extern ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset); +#endif /* __WIN32__ */ + #endif /* _WIMLIB_WIN32_H */ diff --git a/src/compress_parallel.c b/src/compress_parallel.c index 0569b176..9b3c8521 100644 --- a/src/compress_parallel.c +++ b/src/compress_parallel.c @@ -42,9 +42,7 @@ #include "wimlib/error.h" #include "wimlib/list.h" #include "wimlib/util.h" -#ifdef __WIN32__ -# include "wimlib/win32.h" /* win32_get_number_of_processors() */ -#endif +#include "wimlib/win32.h" /* win32_get_number_of_processors() */ struct message_queue { struct list_head list; diff --git a/src/error.c b/src/error.c index 06f09f5d..49f83294 100644 --- a/src/error.c +++ b/src/error.c @@ -43,9 +43,7 @@ #include "wimlib.h" #include "wimlib/error.h" #include "wimlib/util.h" -#ifdef __WIN32__ -# include "wimlib/win32.h" -#endif +#include "wimlib/win32.h" #ifdef ENABLE_ERROR_MESSAGES bool wimlib_print_errors = false; diff --git a/src/extract.c b/src/extract.c index 9359c53f..b1448937 100644 --- a/src/extract.c +++ b/src/extract.c @@ -58,12 +58,10 @@ #include "wimlib/resource.h" #include "wimlib/security.h" #include "wimlib/unix_data.h" -#ifdef __WIN32__ -# include "wimlib/win32.h" /* for realpath() equivalent */ -#endif -#include "wimlib/xml.h" #include "wimlib/wildcard.h" #include "wimlib/wim.h" +#include "wimlib/win32.h" /* for realpath() equivalent */ +#include "wimlib/xml.h" #define WIMLIB_EXTRACT_FLAG_FROM_PIPE 0x80000000 #define WIMLIB_EXTRACT_FLAG_IMAGEMODE 0x40000000 diff --git a/src/file_io.c b/src/file_io.c index 9455ed63..317a00d0 100644 --- a/src/file_io.c +++ b/src/file_io.c @@ -29,9 +29,7 @@ #include "wimlib/error.h" #include "wimlib/file_io.h" #include "wimlib/util.h" -#ifdef __WIN32__ -# include "wimlib/win32.h" /* For pread(), pwrite() replacements */ -#endif +#include "wimlib/win32.h" /* For pread(), pwrite() replacements */ /* Wrapper around read() that checks for errors keeps retrying until all * requested bytes have been read or until end-of file has occurred. diff --git a/src/resource.c b/src/resource.c index fb1047e0..13482197 100644 --- a/src/resource.c +++ b/src/resource.c @@ -36,15 +36,11 @@ #include "wimlib/endianness.h" #include "wimlib/error.h" #include "wimlib/file_io.h" -#include "wimlib/ntfs_3g.h" /* for read_ntfs_attribute_prefix() */ +#include "wimlib/ntfs_3g.h" #include "wimlib/resource.h" #include "wimlib/sha1.h" #include "wimlib/wim.h" - -#ifdef __WIN32__ -/* for read_winnt_stream_prefix(), read_win32_encrypted_file_prefix() */ -# include "wimlib/win32.h" -#endif +#include "wimlib/win32.h" /* * Compressed WIM resources diff --git a/src/wim.c b/src/wim.c index 600176e6..ff43ba59 100644 --- a/src/wim.c +++ b/src/wim.c @@ -44,9 +44,7 @@ #include "wimlib/security.h" #include "wimlib/wim.h" #include "wimlib/xml.h" -#ifdef __WIN32__ -# include "wimlib/win32.h" /* for realpath() replacement */ -#endif +#include "wimlib/win32.h" /* Information about the available compression types for the WIM format. */ static const struct { diff --git a/src/write.c b/src/write.c index a7135942..e33759a2 100644 --- a/src/write.c +++ b/src/write.c @@ -52,9 +52,7 @@ #include "wimlib/progress.h" #include "wimlib/resource.h" #include "wimlib/solid.h" -#ifdef __WIN32__ -# include "wimlib/win32.h" /* win32_rename_replacement() */ -#endif +#include "wimlib/win32.h" /* win32_rename_replacement() */ #include "wimlib/write.h" #include "wimlib/xml.h"