Kaydet (Commit) ce43d0ae authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Michael Stahl

use consistent #define checks for the Windows platform

stage 1 of replacing usage of various checks for the windows platform
with the compiler-defined '_WIN32' macro

Change-Id: Iece73abdee530937e0737190b1aa97a46cd3075f
Reviewed-on: https://gerrit.libreoffice.org/22390Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarMichael Stahl <mstahl@redhat.com>
üst 049cf885
......@@ -34,7 +34,7 @@ SbxDecimal::SbxDecimal()
SbxDecimal::SbxDecimal( const SbxDecimal& rDec )
{
#ifdef WIN32
#ifdef _WIN32
maDec = rDec.maDec;
#else
(void)rDec;
......@@ -45,7 +45,7 @@ SbxDecimal::SbxDecimal( const SbxDecimal& rDec )
SbxDecimal::SbxDecimal
( const css::bridge::oleautomation::Decimal& rAutomationDec )
{
#ifdef WIN32
#ifdef _WIN32
maDec.scale = rAutomationDec.Scale;
maDec.sign = rAutomationDec.Sign;
maDec.Lo32 = rAutomationDec.LowValue;
......@@ -60,7 +60,7 @@ SbxDecimal::SbxDecimal
void SbxDecimal::fillAutomationDecimal
( css::bridge::oleautomation::Decimal& rAutomationDec )
{
#ifdef WIN32
#ifdef _WIN32
rAutomationDec.Scale = maDec.scale;
rAutomationDec.Sign = maDec.sign;
rAutomationDec.LowValue = maDec.Lo32;
......@@ -88,7 +88,7 @@ void releaseDecimalPtr( SbxDecimal*& rpDecimal )
}
}
#ifdef WIN32
#ifdef _WIN32
bool SbxDecimal::operator -= ( const SbxDecimal &r )
{
......@@ -351,7 +351,7 @@ bool SbxDecimal::getDouble( double& rVal ) { (void)rVal; return false; }
void SbxDecimal::getString( OUString& rString )
{
#ifdef WIN32
#ifdef _WIN32
static LCID nLANGID = MAKELANGID( LANG_ENGLISH, SUBLANG_ENGLISH_US );
bool bRet = false;
......
......@@ -45,7 +45,7 @@ class SbxDecimal
{
friend void releaseDecimalPtr( SbxDecimal*& rpDecimal );
#ifdef WIN32
#ifdef _WIN32
DECIMAL maDec;
#endif
sal_Int32 mnRefCount;
......@@ -75,7 +75,7 @@ public:
bool setString( OUString* pOUString );
void setDecimal( SbxDecimal* pDecimal )
{
#ifdef WIN32
#ifdef _WIN32
if( pDecimal )
maDec = pDecimal->maDec;
#else
......
......@@ -45,7 +45,7 @@ namespace
::osl::Security aSecurity;
OUString aConfigPath;
#if defined(XP_WIN) || defined(MACOSX)
#if defined(_WIN32) || defined(MACOSX)
aSecurity.getConfigDir( aConfigPath );
#else
//This is to find the dir under which .mozilla/.thunderbird is created.
......@@ -67,7 +67,7 @@ namespace
// DO NOT CHANGE THE ORDER; ADD ONLY TO THE END
static const char* DefaultProductDir[NB_PRODUCTS][NB_CANDIDATES] =
{
#if defined(XP_WIN)
#if defined(_WIN32)
{ "Mozilla/SeaMonkey/", NULL, NULL, NULL },
{ "Mozilla/Firefox/", NULL, NULL, NULL },
{ "Thunderbird/", "Mozilla/Thunderbird/", NULL, NULL }
......
......@@ -88,7 +88,7 @@ static void s_test__loadSharedLibComponentFactory(rtl::OUString const & clientPu
uno::Reference<uno::XInterface> xItf(
cppu::loadSharedLibComponentFactory(
rtl::OUString(SAL_DLLPREFIX "TestComponent.uno" SAL_DLLEXTENSION),
#ifdef WIN32
#ifdef _WIN32
"",
#else
"file://../lib/",
......
......@@ -299,7 +299,7 @@ void CommandLineArgs::ParseCommandLine_Impl( Supplier& supplier )
exit(0);
}
#endif
#ifdef WIN32
#ifdef _WIN32
/* fdo#57203 ignore -Embedding on Windows
when LibreOffice is launched by COM+
*/
......
......@@ -19,17 +19,7 @@
#include "launcher.hxx"
#ifndef _WINDOWS_
# define WIN32_LEAN_AND_MEAN
#if defined _MSC_VER
#pragma warning(push, 1)
#endif
# include <windows.h>
# include <shellapi.h>
#if defined _MSC_VER
#pragma warning(pop)
#endif
#endif
#include <shellapi.h>
#include <stdlib.h>
#include <malloc.h>
......
......@@ -380,7 +380,7 @@ namespace drawinglayer
const sal_uInt32 nWidth(basegfx::fround(fabs(fFontScaleX)));
const bool bFontIsScaled(nHeight != nWidth);
#ifdef WIN32
#ifdef _WIN32
// for WIN32 systems, start with creating an unscaled font. If FontScaling
// is wanted, that width needs to be adapted using FontMetric again to get a
// width of the unscaled font
......@@ -409,7 +409,7 @@ namespace drawinglayer
aRetval.SetPitch(rFontAttribute.getMonospaced() ? PITCH_FIXED : PITCH_VARIABLE);
aRetval.SetLanguage(LanguageTag::convertToLanguageType( rLocale, false));
#ifdef WIN32
#ifdef _WIN32
// for WIN32 systems, correct the FontWidth if FontScaling is used
if(bFontIsScaled && nHeight > 0)
{
......@@ -456,7 +456,7 @@ namespace drawinglayer
o_rSize.setY(rFont.GetFontSize().getHeight() > 0 ? rFont.GetFontSize().getHeight() : 0);
o_rSize.setX(o_rSize.getY());
#ifdef WIN32
#ifdef _WIN32
// for WIN32 systems, the FontScaling at the Font is detected by
// checking that FontWidth != 0. When FontScaling is used, WIN32
// needs to do extra stuff to detect the correct width (since it's
......
......@@ -80,7 +80,7 @@ public:
static OUString getImplementationName_Static() throw();
static Sequence< OUString > getSupportedServiceNames_Static() throw();
#ifdef WIN32
#ifdef _WIN32
void* GetData() const { return mpData; }
#endif
void SetData( void* pData ) { ReleaseData(); mpData = pData; }
......
......@@ -15,7 +15,7 @@
int curl_win32_idn_to_ascii(const char *in, char **out);
#endif /* USE_LIBIDN */
+#ifdef WIN32
+#ifdef _WIN32
+#include <WinHttp.h>
+#endif
+
......@@ -26,7 +26,7 @@
return FALSE;
}
+#ifdef WIN32
+#ifdef _WIN32
+static char* wstrToCstr( LPWSTR wStr )
+{
+ int bufSize;
......@@ -57,7 +57,7 @@
* checked if the lowercase versions don't exist.
*/
- char *no_proxy=NULL;
+#ifdef WIN32
+#ifdef _WIN32
+ WINHTTP_CURRENT_USER_IE_PROXY_CONFIG *ieProxyConfig;
+ ieProxyConfig = (WINHTTP_CURRENT_USER_IE_PROXY_CONFIG*)
+ malloc(sizeof(WINHTTP_CURRENT_USER_IE_PROXY_CONFIG));
......
......@@ -25,7 +25,7 @@
/* Define to 1 if you have the declaration of `h_errno', and to 0 if you
don't. */
#ifdef WIN32
#ifdef _WIN32
#define HAVE_DECL_H_ERRNO 1
#endif
......@@ -239,7 +239,7 @@
#define HAVE_SNPRINTF 1
#endif
#ifdef WIN32
#ifdef _WIN32
#if _MSC_VER >= 1900 // VS 2015
#define HAVE_SNPRINTF 1
#else
......@@ -274,7 +274,7 @@
#define HAVE_STRCASECMP 1
#endif
#ifdef WIN32
#ifdef _WIN32
#define strcasecmp strcmpi
#endif
......@@ -588,7 +588,7 @@
char *stpcpy(char *, const char *);
#endif
#ifdef WIN32
#ifdef _WIN32
#include <io.h>
......
......@@ -366,7 +366,7 @@
#include <pthread.h>
#endif
+#ifdef WIN32
+#ifdef _WIN32
+#define X509_NAME WIN32_X509_NAME
+#include <windows.h>
+#include <wincrypt.h>
......@@ -380,7 +380,7 @@
X509_STORE_load_locations(store, NE_SSL_CA_BUNDLE, NULL);
#else
X509_STORE_set_default_paths(store);
+#ifdef WIN32
+#ifdef _WIN32
+ {
+ HCERTSTORE hStore;
+ PCCERT_CONTEXT pContext = NULL;
......
......@@ -339,7 +339,7 @@
// from raptor_config_cmake.h.in ////////////////////////////////////////////
#ifdef WIN32
#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
# ifndef _CRT_NONSTDC_NO_DEPRECATE
# define _CRT_NONSTDC_NO_DEPRECATE
......
......@@ -117,8 +117,15 @@ const struct FontEntry FontMapTab[] =
{"\xbd\xc5\xb8\xed \xb1\xc3\xbc\xad",3, 0.97}
};
#ifndef WIN32
#if defined(LINUX)
#if defined(_WIN32)
const char* RepFontTab[] =
{
"\xb9\xd9\xc5\xc1", /* 0 */
"\xb5\xb8\xbf\xf2", /* 1 */
"\xb1\xbc\xb8\xb2", /* 2 */
"\xb1\xc3\xbc\xad" /* 3 */
};
#elif defined(LINUX)
const char* RepFontTab[] =
{
"\xb9\xe9\xb9\xac \xb9\xd9\xc5\xc1", /* 0 */
......@@ -135,15 +142,6 @@ const char* RepFontTab[] =
"Gungso" /* 3 */
};
#endif
#else
const char* RepFontTab[] =
{
"\xb9\xd9\xc5\xc1", /* 0 */
"\xb5\xb8\xbf\xf2", /* 1 */
"\xb1\xbc\xb8\xb2", /* 2 */
"\xb1\xc3\xbc\xad" /* 3 */
};
#endif
int getRepFamilyName(const char* orig, char *buf, double &ratio)
{
......
......@@ -20,7 +20,7 @@
#include <stdio.h>
#include <errno.h>
#ifdef WIN32
#ifdef _WIN32
# include <io.h>
#else
# include <unistd.h>
......
......@@ -52,7 +52,7 @@ EmPicture::EmPicture(size_t tsize)
else
data = new uchar[size];
}
#ifdef WIN32
#ifdef _WIN32
#define unlink _unlink
#endif
EmPicture::~EmPicture()
......@@ -83,14 +83,14 @@ OlePicture::OlePicture(int tsize)
size = tsize - 4;
if (size <= 0)
return;
#ifndef WIN32
#ifndef _WIN32
pis = new char[size];
#endif
};
OlePicture::~OlePicture()
{
#ifdef WIN32
#ifdef _WIN32
if( pis )
pis->Release();
#else
......@@ -109,7 +109,7 @@ void OlePicture::Read(HWPFile & hwpf)
hwpf.Read4b(&signature, 1);
if (signature != FILESTG_SIGNATURE_NORMAL)
return;
#ifdef WIN32
#ifdef _WIN32
char *data = new char[size];
if (hwpf.ReadBlock(data,size) == 0)
{
......
......@@ -55,7 +55,7 @@ struct OlePicture
{
int size;
uint signature;
#ifdef WIN32
#ifdef _WIN32
IStorage *pis;
#else
char *pis;
......
......@@ -33,7 +33,7 @@ using namespace std;
#include <sal/macros.h>
/* @Man: change the hwp formula to LaTeX */
#ifdef WIN32
#ifdef _WIN32
# define ENDL "\r\n"
#else /* !WIN32 */
# define ENDL "\n"
......@@ -48,7 +48,7 @@ using namespace std;
#define IS_WS(ch) (strchr(WS, ch))
#define IS_BINARY(ch) (strchr("+-<=>", ch))
#ifdef WIN32
#ifdef _WIN32
#define STRICMP stricmp
#else
#define STRICMP strcasecmp
......
......@@ -3921,7 +3921,7 @@ void HwpReader::makePicture(Picture * hbox)
}
else{
if( hwpfile.oledata ){
#ifdef WIN32
#ifdef _WIN32
LPSTORAGE srcsto;
LPUNKNOWN pObj;
wchar_t pathname[200];
......
......@@ -48,7 +48,7 @@
#ifdef __cplusplus
#include <stdlib.h>
#ifndef WIN32
#ifndef _WIN32
#include <unistd.h>
#else
#include <io.h>
......@@ -960,7 +960,7 @@ char *yytext;
#include <string.h>
#include "nodes.h"
#ifdef WIN32
#ifdef _WIN32
#define strdup _strdup
#define fileno _fileno
#define isatty _isatty
......@@ -975,7 +975,7 @@ int yywrap();
}
#endif
#ifdef WIN32
#ifdef _WIN32
extern YYSTYPE yylval;
#endif
#ifdef TOKEN_DEBUG
......
......@@ -23,22 +23,14 @@
#include "mzstring.h"
#ifndef WIN32
#else
#if defined _MSC_VER
#pragma warning(push, 1)
#endif
#ifdef _WIN32
# include <windows.h>
#if defined _MSC_VER
#pragma warning(pop)
#endif
#endif /* WIN32 */
#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifndef WIN32
#ifndef _WIN32
# define wsprintf sprintf
#endif
......
......@@ -26,7 +26,7 @@
#include <stdlib.h>
#ifdef WIN32
#ifdef _WIN32
#define SAL_W32
#define SAL_DLLEXTENSION ".dll"
#define SAL_PATHSEPARATOR ';'
......
......@@ -24,7 +24,7 @@
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef WIN32
#ifdef _WIN32
/*
* TerminateProcess and GetCurrentProcess are defined in <winbase.h>, which
* further depends on <windef.h>. We hardcode these few definitions manually
......
......@@ -37,7 +37,7 @@
* These macros are designed for use by library interfaces -- not for normal
* methods or data used cross-file.
*/
#if defined(WIN32)
#if defined(_WIN32)
# define MOZ_EXPORT __declspec(dllexport)
#else /* Unix */
# ifdef HAVE_VISIBILITY_ATTRIBUTE
......
......@@ -24,7 +24,7 @@
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#ifdef WIN32
#ifdef _WIN32
/*
* TerminateProcess and GetCurrentProcess are defined in <winbase.h>, which
* further depends on <windef.h>. We hardcode these few definitions manually
......
......@@ -37,7 +37,7 @@
* These macros are designed for use by library interfaces -- not for normal
* methods or data used cross-file.
*/
#if defined(WIN32)
#if defined(_WIN32)
# define MOZ_EXPORT __declspec(dllexport)
#else /* Unix */
# ifdef HAVE_VISIBILITY_ATTRIBUTE
......
......@@ -27,7 +27,7 @@
#include "regimpl.hxx"
#include "regkey.hxx"
#if defined(WIN32) || defined(WNT)
#if defined(_WIN32)
#include <io.h>
#endif
......
......@@ -247,7 +247,7 @@ public:
manager.load(testlib, args);
} catch (const CppUnit::DynamicLibraryManagerException &e) {
std::cerr << "DynamicLibraryManagerException: \"" << e.what() << "\"\n";
#ifdef WIN32
#ifdef _WIN32
const char *pPath = getenv ("PATH");
if (pPath && strlen (pPath) > 256)
{
......
......@@ -52,7 +52,7 @@ public:
CPPUNIT_TEST_SUITE_END( );
};
#ifndef WIN32
#ifndef _WIN32
const char * const aSource1[] =
{
"a" , "file:///" TEST_VOLUME "bla/a",
......@@ -87,7 +87,7 @@ using ::rtl::OString;
void oldtestfile::test_file_001()
{
#ifndef WIN32
#ifndef _WIN32
OUString base1( "file:///" TEST_VOLUME "bla" );
int i;
for( i = 0 ; aSource1[i] ; i +=2 )
......@@ -106,7 +106,7 @@ void oldtestfile::test_file_001()
void oldtestfile::test_file_002()
{
#ifndef WIN32
#ifndef _WIN32
OUString base2( "file:///" TEST_VOLUME "bla/blubs/schnubbel" );
int i;
for( i = 0 ; aSource2[i] ; i +=2 )
......@@ -125,7 +125,7 @@ void oldtestfile::test_file_002()
void oldtestfile::test_file_004()
{
#ifndef WIN32
#ifndef _WIN32
OUString base4( "file:///" TEST_VOLUME "bla/" );
int i;
for( i = 0 ; aSource1[i] ; i +=2 )
......
......@@ -82,7 +82,7 @@ static const char* publicFunc =
"double strequal(unsigned a, unsigned b) { return (a==b)?1.0:0; }\n"
;
#ifdef WIN32
#ifdef _WIN32
#ifndef NAN
namespace {
......
......@@ -7,7 +7,7 @@
using namespace std;
#ifdef WIN32
#ifdef _WIN32
#define OPENCL_DLL_NAME "OpenCL.dll"
#elif defined(MACOSX)
#define OPENCL_DLL_NAME NULL
......
......@@ -29,7 +29,7 @@
#include "BufferedStreamSocket.hxx"
#endif
#ifdef WIN32
#ifdef _WIN32
// LO vs WinAPI conflict
#undef WB_LEFT
#undef WB_RIGHT
......
......@@ -11,7 +11,7 @@
#include <algorithm>
#ifdef WIN32
#ifdef _WIN32
// LO vs WinAPI conflict
#undef WB_LEFT
#undef WB_RIGHT
......@@ -70,7 +70,7 @@ void BufferedStreamSocket::close()
{
if( usingCSocket && mSocket != -1 )
{
#ifdef WIN32
#ifdef _WIN32
::closesocket( mSocket );
#else
::close( mSocket );
......
......@@ -20,7 +20,7 @@
#include "DiscoveryService.hxx"
#ifdef WIN32
#ifdef _WIN32
// LO vs WinAPI conflict
#undef WB_LEFT
#undef WB_RIGHT
......@@ -91,7 +91,7 @@ void DiscoveryService::setupSockets()
zService = new AvahiNetworkService(hostname);
#endif
#ifdef WIN32
#ifdef _WIN32
zService = new WINNetworkService();
#endif
......
......@@ -298,7 +298,7 @@ public:
~PDFReader() {}
static PDFEntry* read( const char* pFileName );
#ifdef WIN32
#ifdef _WIN32
static PDFEntry* read( const char* pBuffer, unsigned int nLen );
#endif
};
......
......@@ -540,7 +540,7 @@ public:
}
};
#ifdef WIN32
#ifdef _WIN32
PDFEntry* PDFReader::read( const char* pBuffer, unsigned int nLen )
{
PDFGrammar<const char*> aGrammar( pBuffer );
......@@ -588,7 +588,7 @@ PDFEntry* PDFReader::read( const char* pBuffer, unsigned int nLen )
PDFEntry* PDFReader::read( const char* pFileName )
{
#ifdef WIN32
#ifdef _WIN32
/* #i106583#
since converting to boost 1.39 file_iterator does not work anymore on all Windows systems
C++ stdlib istream_iterator does not allow "-" apparently
......
......@@ -59,7 +59,7 @@ static bool _SHGetSpecialFolderW32( int nFolderID, WCHAR* pszFolder, int nSize )
// time to time to very nasty compilation errors. If someone finds a better
// way to solve these probs please remove this copied part!
typedef unsigned short sal_uInt16;
#if ( defined(WIN32) && !defined(__MINGW32__) )
#if defined(_WIN32) && !defined(__MINGW32__)
typedef wchar_t sal_Unicode;
#else
typedef sal_uInt16 sal_Unicode;
......
......@@ -20,10 +20,6 @@
#ifndef INCLUDED_SHELL_INC_INTERNAL_ZIPFILE_HXX
#define INCLUDED_SHELL_INC_INTERNAL_ZIPFILE_HXX
#ifndef _WINDOWS
#define _WINDOWS
#endif
#include <zlib.h>
#include <string>
......
......@@ -29,7 +29,7 @@ in this Software without prior written authorization from the X Consortium.
#ifndef NO_X11
#include <X11/Xosdefs.h>
#ifdef WIN32
#ifdef _WIN32
#include <X11/Xw32defs.h>
#endif
#ifndef SUNOS4
......
......@@ -96,7 +96,7 @@ parse_number (IfParser *g, const char *cp, int *valp)
if (!isdigit(*cp))
return CALLFUNC(g, handle_error) (g, cp, "number");
#ifdef WIN32
#ifdef _WIN32
{
char *cp2;
*valp = strtol(cp, &cp2, 0);
......
......@@ -118,7 +118,7 @@ in this Software without prior written authorization from the X Consortium.
#define imake_ccflags "-DX_NOT_POSIX"
#endif
#ifdef WIN32
#ifdef _WIN32
#define imake_ccflags "-nologo -batch -D__STDC__"
#endif
......@@ -174,10 +174,10 @@ in this Software without prior written authorization from the X Consortium.
* all colons). One way to tell if you need this is to see whether or not
* your Makefiles have no tabs in them and lots of @@ strings.
*/
#if defined(sun) || defined(SYSV) || defined(SVR4) || defined(hcx) || defined(WIN32) || (defined(AMOEBA) && defined(CROSS_COMPILE))
#if defined(sun) || defined(SYSV) || defined(SVR4) || defined(hcx) || defined(_WIN32) || (defined(AMOEBA) && defined(CROSS_COMPILE))
#define FIXUP_CPP_WHITESPACE
#endif
#ifdef WIN32
#ifdef _WIN32
#define REMOVE_CPP_LEADSPACE
#define INLINE_SYNTAX
#define MAGIC_MAKE_VARS
......@@ -192,7 +192,7 @@ in this Software without prior written authorization from the X Consortium.
* If use cc -E but want a different compiler, define DEFAULT_CC.
* If the cpp you need is not in /lib/cpp, define DEFAULT_CPP.
*/
#ifdef WIN32
#ifdef _WIN32
#define USE_CC_E
#define DEFAULT_CC "cl"
#endif
......@@ -433,7 +433,7 @@ char *cpp_argv[ARGUMENTS] = {
"-DSVR4",
#endif
#endif
#ifdef WIN32
#ifdef _WIN32
"-DWIN32",
"-nologo",
"-batch",
......
......@@ -147,7 +147,7 @@ catch (int sig)
fatalerr ("got signal %d\n", sig);
}
#if (defined(i386) && defined(SYSV)) || defined(WIN32)
#if (defined(i386) && defined(SYSV)) || defined(_WIN32)
#define USGISH
#endif
......
......@@ -91,7 +91,7 @@ OUString getExePath()
{
OUString exe;
OSL_VERIFY( osl_getExecutableFile( &exe.pData ) == osl_Process_E_None);
#if defined(WIN32) || defined(WNT)
#if defined(_WIN32)
exe = exe.copy(0, exe.getLength() - 16);
#else
exe = exe.copy(0, exe.getLength() - 12);
......
......@@ -47,7 +47,7 @@ OUString getExePath()
OSL_VERIFY( osl_getExecutableFile( &exe.pData) == osl_Process_E_None);
#if defined(WIN32) || defined(WNT)
#if defined(_WIN32)
exe = exe.copy(0, exe.getLength() - 16);
#else
exe = exe.copy(0, exe.getLength() - 12);
......
......@@ -710,7 +710,7 @@ bool SvtOptionsDrawinglayer_Impl::IsAAPossibleOnThisSystem() const
SvtOptionsDrawinglayer_Impl* pThat = const_cast< SvtOptionsDrawinglayer_Impl* >(this);
pThat->m_bAllowAAChecked = true;
#ifdef WIN32