From 4c3d5ba560884db54bfb1f5b9e8d147f901db3c2 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Fri, 30 Sep 2005 21:26:31 +0000 Subject: [PATCH] Rearrange preprocessor guards. Improve commentary. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_3_X@10504 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/support/os_win32.C | 27 +++++++-------------------- src/support/os_win32.h | 17 ++++++++++++----- 2 files changed, 19 insertions(+), 25 deletions(-) diff --git a/src/support/os_win32.C b/src/support/os_win32.C index 6fb769a4bf..5d0c8c7930 100644 --- a/src/support/os_win32.C +++ b/src/support/os_win32.C @@ -3,20 +3,6 @@ // Various OS specific functions #include -/* The GetLongPathNameA function declaration in - * under MinGW or Cygwin is protected - * by the WINVER macro which is defined in - * - * SHGFP_TYPE_CURRENT is defined in for __W32API_VERSION >= 3.2 - * where it is protected by _WIN32_IE. - * It is missing in earlier versions of the MinGW w32api headers. - */ -#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__CYGWIN32__) -# include -# define WINVER 0x0500 -# define _WIN32_IE 0x0500 -#endif - #include "os.h" #include "support/os_win32.h" #include "support/filetools.h" @@ -48,12 +34,13 @@ #include // _getdrive #include // SHGetFolderPath -// Needed by older versions of MinGW. -#if defined (__W32API_MAJOR_VERSION) && \ - defined (__W32API_MINOR_VERSION) && \ - (__W32API_MAJOR_VERSION < 3 || \ - __W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION < 2) -# define SHGFP_TYPE_CURRENT 0 +// Must define SHGFP_TYPE_CURRENT for older versions of MinGW. +#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__CYGWIN32__) +# include +# if __W32API_MAJOR_VERSION < 3 || \ + __W32API_MAJOR_VERSION == 3 && __W32API_MINOR_VERSION < 2 +# define SHGFP_TYPE_CURRENT 0 +# endif #endif string const os::nulldev_ = "nul"; diff --git a/src/support/os_win32.h b/src/support/os_win32.h index 7b4520e5b6..8dd3d8bce3 100644 --- a/src/support/os_win32.h +++ b/src/support/os_win32.h @@ -21,18 +21,25 @@ #endif /* The GetLongPathNameA function declaration in - * winbase.h under MinGW or Cygwin is protected - * by the WINVER macro which is defined in windef.h + * is protected by the WINVER macro which is + * defined to a default value in under MinGW and Cygwin. * - * We need to #include this file to make available the - * DWORD, HMODULE et al. typedefs, so check WINVER now. + * SHGFP_TYPE_CURRENT is defined in for __W32API_VERSION >= 3.2 + * where it is protected by _WIN32_IE, also defined to a default value + * in under MinGW and Cygwin. + * It is missing in earlier versions of the MinGW w32api headers. + * + * We need to #include now to make available the + * DWORD, HMODULE et al. typedefs, so first define WINVER, _WIN32_IE. * * Note: __CYGWIN__ can be defined here if building in _WIN32 mode. */ #if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__CYGWIN32__) -# if !defined(WINVER) || WINVER < 0x0500 +# if defined(WINVER) && WINVER < 0x0500 # error WINVER must be >= 0x0500 # endif +# define WINVER 0x0500 +# define _WIN32_IE 0x0500 #endif #include