diff --git a/src/xpdev/dirwrap.c b/src/xpdev/dirwrap.c index 40daea2c6a0d473861f428bc4968d15972f64698..a785204c6df18f2f2cc5ff3d0f2e7cbf558d96db 100644 --- a/src/xpdev/dirwrap.c +++ b/src/xpdev/dirwrap.c @@ -37,28 +37,28 @@ #include <string.h> /* strrchr */ -#ifdef _WIN32 +#if defined(_WIN32) -#include <windows.h> /* WINAPI, etc */ -#include <io.h> /* _findfirst */ + #include <windows.h> /* WINAPI, etc */ + #include <io.h> /* _findfirst */ #elif defined __unix__ -#include <unistd.h> /* usleep */ -#include <fcntl.h> /* O_NOCCTY */ -#include <ctype.h> /* toupper */ + #include <unistd.h> /* usleep */ + #include <fcntl.h> /* O_NOCCTY */ + #include <ctype.h> /* toupper */ -#ifdef __FreeBSD__ -#include <sys/param.h> -#include <sys/mount.h> -#include <sys/kbio.h> -#endif + #if defined(__FreeBSD__) + #include <sys/param.h> + #include <sys/mount.h> + #include <sys/kbio.h> + #endif -#include <sys/ioctl.h> /* ioctl */ + #include <sys/ioctl.h> /* ioctl */ -#ifdef __GLIBC__ /* actually, BSD, but will work for now */ -#include <sys/vfs.h> /* statfs() */ -#endif + #if defined(__GLIBC__) /* actually, BSD, but will work for now */ + #include <sys/vfs.h> /* statfs() */ + #endif #endif /* __unix__ */ @@ -99,7 +99,7 @@ static int glob_compare( const void *arg1, const void *arg2 ) return stricmp( * ( char** ) arg1, * ( char** ) arg2 ); } -#ifdef __BORLANDC__ +#if defined(__BORLANDC__) #pragma argsused #endif @@ -256,7 +256,7 @@ time_t DLLCALL fdate(char *filename) /****************************************************************************/ long DLLCALL flength(char *filename) { -#ifdef __BORLANDC__ /* stat() doesn't work right */ +#if defined(__BORLANDC__) /* stat() doesn't work right */ long handle; struct _finddata_t f; @@ -293,7 +293,7 @@ long DLLCALL flength(char *filename) /****************************************************************************/ BOOL DLLCALL fexist(char *filespec) { -#ifdef _WIN32 +#if defined(_WIN32) long handle; struct _finddata_t f; @@ -369,7 +369,7 @@ BOOL DLLCALL isdir(char *filename) /****************************************************************************/ int DLLCALL getfattr(char* filename) { -#ifdef _WIN32 +#if defined(_WIN32) long handle; struct _finddata_t finddata; @@ -394,14 +394,14 @@ int DLLCALL getfattr(char* filename) /****************************************************************************/ /* Return free disk space in bytes (up to a maximum of 4GB) */ /****************************************************************************/ -#ifdef _WIN32 +#if defined(_WIN32) typedef BOOL(WINAPI * GetDiskFreeSpaceEx_t) (LPCTSTR,PULARGE_INTEGER,PULARGE_INTEGER,PULARGE_INTEGER); #endif ulong DLLCALL getfreediskspace(char* path) { -#ifdef _WIN32 +#if defined(_WIN32) char root[16]; DWORD TotalNumberOfClusters; DWORD NumberOfFreeClusters; @@ -424,14 +424,14 @@ ulong DLLCALL getfreediskspace(char* path) &size, // receives the number of bytes on disk NULL)) // receives the free bytes on disk return(0); -#ifdef _ANONYMOUS_STRUCT +#if defined(_ANONYMOUS_STRUCT) if(avail.HighPart) #else if(avail.u.HighPart) #endif return(0xffffffff); /* 4GB max */ -#ifdef _ANONYMOUS_STRUCT +#if defined(_ANONYMOUS_STRUCT) return(avail.LowPart); #else return(avail.u.LowPart); diff --git a/src/xpdev/dirwrap.h b/src/xpdev/dirwrap.h index 65cf1cc2af526e405d66edbf763fb10f984599e5..d63f9989613395bc003c4ce4c57cb35a41e9d2d5 100644 --- a/src/xpdev/dirwrap.h +++ b/src/xpdev/dirwrap.h @@ -40,20 +40,20 @@ #include "gen_defs.h" /* ulong */ -#ifdef DLLEXPORT -#undef DLLEXPORT +#if defined(DLLEXPORT) + #undef DLLEXPORT #endif -#ifdef DLLCALL -#undef DLLCALL +#if defined(DLLCALL) + #undef DLLCALL #endif -#ifdef _WIN32 - #ifdef WRAPPER_DLL +#if defined(_WIN32) + #if defined(WRAPPER_DLL) #define DLLEXPORT __declspec(dllexport) #else #define DLLEXPORT __declspec(dllimport) #endif - #ifdef __BORLANDC__ + #if defined(__BORLANDC__) #define DLLCALL __stdcall #else #define DLLCALL @@ -63,21 +63,15 @@ #define DLLCALL #endif -#ifdef __cplusplus +#if defined(__cplusplus) extern "C" { #endif -#ifdef _MSC_VER - #include "msdirent.h" -#else - #include <dirent.h> /* POSIX directory functions */ -#endif - /****************/ /* RTL-specific */ /****************/ -#ifdef __unix__ +#if defined(__unix__) #define ALLFILES "*" /* matches all files in a directory */ #include <glob.h> /* POSIX.2 directory pattern matching function */ @@ -159,8 +153,11 @@ extern "C" { struct dirent * readdir (DIR *__dir); int closedir (DIR *__dir); void rewinddir(DIR *__dir); +#else + #include <dirent.h> /* POSIX directory functions */ #endif + /**********/ /* Macros */ /**********/ @@ -205,7 +202,7 @@ DLLEXPORT char* DLLCALL getfname(char* path); DLLEXPORT int DLLCALL getfattr(char* filename); DLLEXPORT ulong DLLCALL getfreediskspace(char* path); -#ifdef __cplusplus +#if defined(__cplusplus) } #endif diff --git a/src/xpdev/filewrap.h b/src/xpdev/filewrap.h index 4e8088f561c246423e9f9526380cfb03dfe51a2d..390d0405ea87fa75394f8b53b54d2df685acd193 100644 --- a/src/xpdev/filewrap.h +++ b/src/xpdev/filewrap.h @@ -82,20 +82,20 @@ /* Prototypes */ /**************/ -#ifdef DLLEXPORT -#undef DLLEXPORT +#if defined(DLLEXPORT) + #undef DLLEXPORT #endif -#ifdef DLLCALL -#undef DLLCALL +#if defined(DLLCALL) + #undef DLLCALL #endif -#ifdef _WIN32 - #ifdef WRAPPER_DLL +#if defined(_WIN32) + #if defined(WRAPPER_DLL) #define DLLEXPORT __declspec(dllexport) #else #define DLLEXPORT __declspec(dllimport) #endif - #ifdef __BORLANDC__ + #if defined(__BORLANDC__) #define DLLCALL __stdcall #else #define DLLCALL @@ -105,7 +105,7 @@ #define DLLCALL #endif -#ifdef __cplusplus +#if defined(__cplusplus) extern "C" { #endif @@ -121,7 +121,7 @@ extern "C" { DLLEXPORT time_t DLLCALL filetime(int fd); -#ifdef __cplusplus +#if defined(__cplusplus) } #endif diff --git a/src/xpdev/gen_defs.h b/src/xpdev/gen_defs.h index 2d110968e4839342019e6ee7dfa4d835042e819f..5a7b1a1e84b67c9d0c2ef78aa08cc60c5f21d681 100644 --- a/src/xpdev/gen_defs.h +++ b/src/xpdev/gen_defs.h @@ -38,9 +38,9 @@ #ifndef _GEN_DEFS_H #define _GEN_DEFS_H -#ifdef _WIN32 -#define WIN32_LEAN_AND_MEAN /* Don't bring in excess baggage */ -#include <windows.h> +#if defined(_WIN32) + #define WIN32_LEAN_AND_MEAN /* Don't bring in excess baggage */ + #include <windows.h> #endif #include <sys/types.h> @@ -88,7 +88,7 @@ enum { }; #ifndef MAX_PATH - #ifdef MAXPATHLEN + #if defined MAXPATHLEN #define MAX_PATH MAXPATHLEN /* clib.h */ #elif defined PATH_MAX #define MAX_PATH PATH_MAX diff --git a/src/xpdev/genwrap.c b/src/xpdev/genwrap.c index 3cb19521c9bfce626abaa7d2fcd75af4fc1729c8..0058a327f5bf27ec2495fe3f1a3d614dd3e61bc5 100644 --- a/src/xpdev/genwrap.c +++ b/src/xpdev/genwrap.c @@ -39,13 +39,12 @@ #include <stdlib.h> /* RAND_MAX */ #include <fcntl.h> /* O_NOCTTY */ -#ifdef __unix__ -#ifndef __FreeBSD__ -#include <sys/kd.h> /* KIOCSOUND */ -#endif -#ifdef __FreeBSD__ -#include <sys/kbio.h> -#endif +#if defined(__unix__) + /* KIOCSOUND */ + #if defined(__FreeBSD__) + #include <sys/kbio.h> + #else + #include <sys/kd.h> #endif /* __unix__ */ #include "genwrap.h" /* Verify prototypes */ @@ -53,7 +52,7 @@ /****************************************************************************/ /* Convert ASCIIZ string to upper case */ /****************************************************************************/ -#ifdef __unix__ +#if defined(__unix__) char* DLLCALL strupr(char* str) { char* p=str; @@ -95,7 +94,7 @@ char* strrev(char* str) /* Generate a tone at specified frequency for specified milliseconds */ /* Thanks to Casey Martin for this code */ /****************************************************************************/ -#ifdef __unix__ +#if defined(__unix__) void DLLCALL unix_beep(int freq, int dur) { static int console_fd=-1; @@ -114,7 +113,7 @@ void DLLCALL unix_beep(int freq, int dur) /****************************************************************************/ /* Return random number between 0 and n-1 */ /****************************************************************************/ -#ifndef __BORLANDC__ +#if !defined(__BORLANDC__j) int DLLCALL xp_random(int n) { float f; diff --git a/src/xpdev/genwrap.h b/src/xpdev/genwrap.h index 26c023de84814c1ef9a6f2b6ec5e68d9f996666e..14d45cf427973aa750e27feb09b52df147d776a5 100644 --- a/src/xpdev/genwrap.h +++ b/src/xpdev/genwrap.h @@ -41,20 +41,20 @@ #include <stdio.h> /* sprintf */ #include "gen_defs.h" /* ulong */ -#ifdef DLLEXPORT -#undef DLLEXPORT +#if defined(DLLEXPORT) + #undef DLLEXPORT #endif -#ifdef DLLCALL -#undef DLLCALL +#if defined(DLLCALL) + #undef DLLCALL #endif -#ifdef _WIN32 - #ifdef WRAPPER_DLL +#if defined(_WIN32) + #if defined(WRAPPER_DLL) #define DLLEXPORT __declspec(dllexport) #else #define DLLEXPORT __declspec(dllimport) #endif - #ifdef __BORLANDC__ + #if defined(__BORLANDC__) #define DLLCALL __stdcall #else #define DLLCALL @@ -64,7 +64,7 @@ #define DLLCALL #endif -#ifdef __cplusplus +#if defined(__cplusplus) extern "C" { #endif @@ -167,11 +167,11 @@ extern "C" { #endif -#ifdef __BORLANDC__ +#if defined(__BORLANDC__) #define xp_random random #endif -#ifdef __cplusplus +#if defined(__cplusplus) } #endif diff --git a/src/xpdev/sockwrap.h b/src/xpdev/sockwrap.h index 84e0132a5346c489669bdcac465a5ae8dfec6341..94bb07a7a3ede9f17f66865d72be6512d1dd2332 100644 --- a/src/xpdev/sockwrap.h +++ b/src/xpdev/sockwrap.h @@ -68,7 +68,7 @@ /**********************************/ /* Socket Implementation-specific */ /**********************************/ -#ifdef _WINSOCKAPI_ +#if defined(_WINSOCKAPI_) #undef EINTR #define EINTR (WSAEINTR-WSABASEERR)