From 2087484c65a3d5e75a9e8ad116d11a4e13366219 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 16 Feb 2016 14:14:43 +0200 Subject: use consistent #define checks for the Windows platform stage 2 of replacing usage of various checks for the windows platform with the compiler-defined '_WIN32' macro In this stage we focus on replacing usage of the WIN macro Change-Id: Ie8a4a63198a6de96bd158ecd707dadafb9c8ea84 Reviewed-on: https://gerrit.libreoffice.org/22393 Tested-by: Jenkins Reviewed-by: Noel Grandin --- onlineupdate/source/libmar/sign/mar_sign.c | 4 +- onlineupdate/source/libmar/sign/nss_secutil.c | 2 +- onlineupdate/source/libmar/src/mar.h | 2 +- onlineupdate/source/libmar/src/mar_create.c | 2 +- onlineupdate/source/libmar/src/mar_extract.c | 6 +- onlineupdate/source/libmar/src/mar_private.h | 2 +- onlineupdate/source/libmar/src/mar_read.c | 4 +- onlineupdate/source/libmar/tool/mar.c | 20 +++--- onlineupdate/source/libmar/verify/cryptox.c | 2 +- onlineupdate/source/libmar/verify/mar_verify.c | 2 +- onlineupdate/source/update/common/pathhash.cxx | 2 +- onlineupdate/source/update/common/readstrings.cxx | 2 +- onlineupdate/source/update/common/readstrings.h | 2 +- onlineupdate/source/update/common/uachelper.cxx | 2 +- onlineupdate/source/update/common/updatedefines.h | 2 +- onlineupdate/source/update/common/updatehelper.cxx | 2 +- .../source/update/common/updatelogging.cxx | 2 +- onlineupdate/source/update/common/win_dirent.h | 2 +- onlineupdate/source/update/src/mar.h | 2 +- onlineupdate/source/update/src/mar_create.c | 2 +- onlineupdate/source/update/src/mar_extract.c | 6 +- onlineupdate/source/update/src/mar_private.h | 2 +- onlineupdate/source/update/src/mar_read.c | 4 +- .../source/update/updater/archivereader.cxx | 6 +- onlineupdate/source/update/updater/archivereader.h | 2 +- onlineupdate/source/update/updater/bspatch.cxx | 4 +- onlineupdate/source/update/updater/loaddlls.cxx | 2 +- .../source/update/updater/nsWindowsRestart.cxx | 2 +- onlineupdate/source/update/updater/progressui.h | 4 +- .../source/update/updater/progressui_null.cxx | 4 +- .../source/update/updater/progressui_win.cxx | 2 +- onlineupdate/source/update/updater/updater.cxx | 74 +++++++++++----------- onlineupdate/source/update/updater/win_dirent.cxx | 2 +- .../updater/xpcom/glue/nsVersionComparator.cxx | 12 ++-- .../updater/xpcom/glue/nsVersionComparator.h | 6 +- 35 files changed, 99 insertions(+), 99 deletions(-) (limited to 'onlineupdate') diff --git a/onlineupdate/source/libmar/sign/mar_sign.c b/onlineupdate/source/libmar/sign/mar_sign.c index 68bff67acce6..a8e0f306d18a 100644 --- a/onlineupdate/source/libmar/sign/mar_sign.c +++ b/onlineupdate/source/libmar/sign/mar_sign.c @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifdef WNT +#ifdef _WIN32 #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif @@ -17,7 +17,7 @@ #include "mar_cmdline.h" #include "mar.h" #include "cryptox.h" -#ifndef WNT +#ifndef _WIN32 #include #endif diff --git a/onlineupdate/source/libmar/sign/nss_secutil.c b/onlineupdate/source/libmar/sign/nss_secutil.c index 2fa53e7b81b8..9fe5fe4d49e2 100644 --- a/onlineupdate/source/libmar/sign/nss_secutil.c +++ b/onlineupdate/source/libmar/sign/nss_secutil.c @@ -8,7 +8,7 @@ #include "nss_secutil.h" #include "prprf.h" -#ifdef WNT +#ifdef _WIN32 #include #else #include diff --git a/onlineupdate/source/libmar/src/mar.h b/onlineupdate/source/libmar/src/mar.h index 31cc3934e395..0e21efb920a5 100644 --- a/onlineupdate/source/libmar/src/mar.h +++ b/onlineupdate/source/libmar/src/mar.h @@ -69,7 +69,7 @@ typedef int (* MarItemCallback)(MarFile *mar, const MarItem *item, void *data); */ MarFile *mar_open(const char *path); -#ifdef WNT +#ifdef _WIN32 MarFile *mar_wopen(const wchar_t *path); #endif diff --git a/onlineupdate/source/libmar/src/mar_create.c b/onlineupdate/source/libmar/src/mar_create.c index c874b44e96ec..4e4e2b4058c2 100644 --- a/onlineupdate/source/libmar/src/mar_create.c +++ b/onlineupdate/source/libmar/src/mar_create.c @@ -13,7 +13,7 @@ #include "mar_cmdline.h" #include "mar.h" -#ifdef WNT +#ifdef _WIN32 #include #else #include diff --git a/onlineupdate/source/libmar/src/mar_extract.c b/onlineupdate/source/libmar/src/mar_extract.c index af2276614bdb..75cbd645f296 100644 --- a/onlineupdate/source/libmar/src/mar_extract.c +++ b/onlineupdate/source/libmar/src/mar_extract.c @@ -12,7 +12,7 @@ #include "mar_private.h" #include "mar.h" -#ifdef WNT +#ifdef _WIN32 #include #include #endif @@ -25,7 +25,7 @@ static int mar_ensure_parent_dir(const char *path) { *slash = '\0'; mar_ensure_parent_dir(path); -#ifdef WNT +#ifdef _WIN32 _mkdir(path); #else mkdir(path, 0755); @@ -45,7 +45,7 @@ static int mar_test_callback(MarFile *mar, const MarItem *item, void *unused) { if (mar_ensure_parent_dir(item->name)) return -1; -#ifdef WNT +#ifdef _WIN32 fd = _open(item->name, _O_BINARY|_O_CREAT|_O_TRUNC|_O_WRONLY, item->flags); #else fd = creat(item->name, item->flags); diff --git a/onlineupdate/source/libmar/src/mar_private.h b/onlineupdate/source/libmar/src/mar_private.h index 39a77d1ac03e..a770998da6fe 100644 --- a/onlineupdate/source/libmar/src/mar_private.h +++ b/onlineupdate/source/libmar/src/mar_private.h @@ -53,7 +53,7 @@ MOZ_STATIC_ASSERT(sizeof(BLOCKSIZE) < \ /* The mar program is compiled as a host bin so we don't have access to NSPR at runtime. For that reason we use ntohl, htonl, and define HOST_TO_NETWORK64 instead of the NSPR equivalents. */ -#ifdef WNT +#ifdef _WIN32 #include #define ftello _ftelli64 #define fseeko _fseeki64 diff --git a/onlineupdate/source/libmar/src/mar_read.c b/onlineupdate/source/libmar/src/mar_read.c index 34f8e8060485..0ed8c6be6ea9 100644 --- a/onlineupdate/source/libmar/src/mar_read.c +++ b/onlineupdate/source/libmar/src/mar_read.c @@ -11,7 +11,7 @@ #include "mar_private.h" #include "mar.h" -#ifdef WNT +#ifdef _WIN32 #include #else #include @@ -177,7 +177,7 @@ MarFile *mar_open(const char *path) { return mar_fpopen(fp); } -#ifdef WNT +#ifdef _WIN32 MarFile *mar_wopen(const wchar_t *path) { FILE *fp; diff --git a/onlineupdate/source/libmar/tool/mar.c b/onlineupdate/source/libmar/tool/mar.c index 8fb1666605dc..dadb8d25b98a 100644 --- a/onlineupdate/source/libmar/tool/mar.c +++ b/onlineupdate/source/libmar/tool/mar.c @@ -10,7 +10,7 @@ #include "mar.h" #include "mar_cmdline.h" -#ifdef WNT +#ifdef _WIN32 #include #include #define chdir _chdir @@ -23,7 +23,7 @@ #define MAR_CHANNEL_ID "LOOnlineUpdater" /* Dummy value; replace or remove in the future */ -#if !defined(NO_SIGN_VERIFY) && (!defined(WNT) || defined(MAR_NSS)) +#if !defined(NO_SIGN_VERIFY) && (!defined(_WIN32) || defined(MAR_NSS)) #include "cert.h" #include "pk11pub.h" int NSSInitCryptoContext(const char *NSSConfigDir); @@ -66,7 +66,7 @@ static void print_usage(void) { "signed_input_archive.mar base_64_encoded_signature_file " "changed_signed_output.mar\n"); printf("(i) is the index of the certificate to extract\n"); -#if defined(MACOSX) || (defined(WNT) && !defined(MAR_NSS)) +#if defined(MACOSX) || (defined(_WIN32) && !defined(MAR_NSS)) printf("Verify a MAR file:\n"); printf(" mar [-C workingDir] -D DERFilePath -v signed_archive.mar\n"); printf("At most %d signature certificate DER files are specified by " @@ -135,16 +135,16 @@ int main(int argc, char **argv) { uint32_t fileSizes[MAX_SIGNATURES]; const uint8_t* certBuffers[MAX_SIGNATURES]; char* DERFilePaths[MAX_SIGNATURES]; -#if (!defined(WNT) && !defined(MACOSX)) || defined(MAR_NSS) +#if (!defined(_WIN32) && !defined(MACOSX)) || defined(MAR_NSS) CERTCertificate* certs[MAX_SIGNATURES]; #endif #endif memset((void*)certNames, 0, sizeof(certNames)); -#if defined(WNT) && !defined(MAR_NSS) && !defined(NO_SIGN_VERIFY) +#if defined(_WIN32) && !defined(MAR_NSS) && !defined(NO_SIGN_VERIFY) memset((void*)certBuffers, 0, sizeof(certBuffers)); #endif -#if !defined(NO_SIGN_VERIFY) && ((!defined(MAR_NSS) && defined(WNT)) || \ +#if !defined(NO_SIGN_VERIFY) && ((!defined(MAR_NSS) && defined(_WIN32)) || \ defined(MACOSX)) memset(DERFilePaths, 0, sizeof(DERFilePaths)); memset(fileSizes, 0, sizeof(fileSizes)); @@ -174,7 +174,7 @@ int main(int argc, char **argv) { argv += 2; argc -= 2; } -#if !defined(NO_SIGN_VERIFY) && ((!defined(MAR_NSS) && defined(WNT)) || \ +#if !defined(NO_SIGN_VERIFY) && ((!defined(MAR_NSS) && defined(_WIN32)) || \ defined(MACOSX)) /* -D DERFilePath, also matches -D[index] DERFilePath We allow an index for verifying to be symmetric @@ -333,7 +333,7 @@ int main(int argc, char **argv) { return -1; } -#if (!defined(WNT) && !defined(MACOSX)) || defined(MAR_NSS) +#if (!defined(_WIN32) && !defined(MACOSX)) || defined(MAR_NSS) if (!NSSConfigDir || certCount == 0) { print_usage(); return -1; @@ -347,7 +347,7 @@ int main(int argc, char **argv) { rv = 0; for (k = 0; k < certCount; ++k) { -#if (defined(WNT) || defined(MACOSX)) && !defined(MAR_NSS) +#if (defined(_WIN32) || defined(MACOSX)) && !defined(MAR_NSS) rv = mar_read_entire_file(DERFilePaths[k], MAR_MAX_CERT_SIZE, &certBuffers[k], &fileSizes[k]); #else @@ -384,7 +384,7 @@ int main(int argc, char **argv) { } } for (k = 0; k < certCount; ++k) { -#if (defined(WNT) || defined(MACOSX)) && !defined(MAR_NSS) +#if (defined(_WIN32) || defined(MACOSX)) && !defined(MAR_NSS) free((void*)certBuffers[k]); #else /* certBuffers[k] is owned by certs[k] so don't free it */ diff --git a/onlineupdate/source/libmar/verify/cryptox.c b/onlineupdate/source/libmar/verify/cryptox.c index c5bef7387514..0e17f77033dc 100644 --- a/onlineupdate/source/libmar/verify/cryptox.c +++ b/onlineupdate/source/libmar/verify/cryptox.c @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifdef WNT +#ifdef _WIN32 #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif diff --git a/onlineupdate/source/libmar/verify/mar_verify.c b/onlineupdate/source/libmar/verify/mar_verify.c index ff0909a16f29..74eb36935102 100644 --- a/onlineupdate/source/libmar/verify/mar_verify.c +++ b/onlineupdate/source/libmar/verify/mar_verify.c @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifdef WNT +#ifdef _WIN32 #ifndef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif diff --git a/onlineupdate/source/update/common/pathhash.cxx b/onlineupdate/source/update/common/pathhash.cxx index fea123cda366..aa5644c896bc 100644 --- a/onlineupdate/source/update/common/pathhash.cxx +++ b/onlineupdate/source/update/common/pathhash.cxx @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifdef WNT +#ifdef _WIN32 #include #include #include "pathhash.h" diff --git a/onlineupdate/source/update/common/readstrings.cxx b/onlineupdate/source/update/common/readstrings.cxx index 83580a80bc74..d2792117773e 100644 --- a/onlineupdate/source/update/common/readstrings.cxx +++ b/onlineupdate/source/update/common/readstrings.cxx @@ -10,7 +10,7 @@ #include "readstrings.h" #include "errors.h" -#ifdef WNT +#ifdef _WIN32 # define NS_tfopen _wfopen # define OPEN_MODE L"rb" #else diff --git a/onlineupdate/source/update/common/readstrings.h b/onlineupdate/source/update/common/readstrings.h index ecef9aa5e6b9..5b3cde6acaaa 100644 --- a/onlineupdate/source/update/common/readstrings.h +++ b/onlineupdate/source/update/common/readstrings.h @@ -9,7 +9,7 @@ #define MAX_TEXT_LEN 600 -#ifdef WNT +#ifdef _WIN32 # define UNICODE # include typedef WCHAR NS_tchar; diff --git a/onlineupdate/source/update/common/uachelper.cxx b/onlineupdate/source/update/common/uachelper.cxx index 55053f3d7932..4cae3ad4e5fc 100644 --- a/onlineupdate/source/update/common/uachelper.cxx +++ b/onlineupdate/source/update/common/uachelper.cxx @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifdef WNT +#ifdef _WIN32 #include #include #include "uachelper.h" diff --git a/onlineupdate/source/update/common/updatedefines.h b/onlineupdate/source/update/common/updatedefines.h index db4553312384..52a8b8437cc2 100644 --- a/onlineupdate/source/update/common/updatedefines.h +++ b/onlineupdate/source/update/common/updatedefines.h @@ -21,7 +21,7 @@ # endif #endif -#if defined(WNT) +#if defined(_WIN32) # include # include # include diff --git a/onlineupdate/source/update/common/updatehelper.cxx b/onlineupdate/source/update/common/updatehelper.cxx index 1768e5334048..c10ea8d580d4 100644 --- a/onlineupdate/source/update/common/updatehelper.cxx +++ b/onlineupdate/source/update/common/updatehelper.cxx @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifdef WNT +#ifdef _WIN32 #include // Needed for CreateToolhelp32Snapshot diff --git a/onlineupdate/source/update/common/updatelogging.cxx b/onlineupdate/source/update/common/updatelogging.cxx index 2f1472ef277d..22a74e17e953 100644 --- a/onlineupdate/source/update/common/updatelogging.cxx +++ b/onlineupdate/source/update/common/updatelogging.cxx @@ -2,7 +2,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#if defined(WNT) +#if defined(_WIN32) #include #endif diff --git a/onlineupdate/source/update/common/win_dirent.h b/onlineupdate/source/update/common/win_dirent.h index a1c79d6cdc78..a2281557e25a 100644 --- a/onlineupdate/source/update/common/win_dirent.h +++ b/onlineupdate/source/update/common/win_dirent.h @@ -6,7 +6,7 @@ #ifndef WINDIRENT_H__ #define WINDIRENT_H__ -#ifdef WNT +#ifdef _WIN32 #include struct DIR { diff --git a/onlineupdate/source/update/src/mar.h b/onlineupdate/source/update/src/mar.h index 31cc3934e395..0e21efb920a5 100644 --- a/onlineupdate/source/update/src/mar.h +++ b/onlineupdate/source/update/src/mar.h @@ -69,7 +69,7 @@ typedef int (* MarItemCallback)(MarFile *mar, const MarItem *item, void *data); */ MarFile *mar_open(const char *path); -#ifdef WNT +#ifdef _WIN32 MarFile *mar_wopen(const wchar_t *path); #endif diff --git a/onlineupdate/source/update/src/mar_create.c b/onlineupdate/source/update/src/mar_create.c index c874b44e96ec..4e4e2b4058c2 100644 --- a/onlineupdate/source/update/src/mar_create.c +++ b/onlineupdate/source/update/src/mar_create.c @@ -13,7 +13,7 @@ #include "mar_cmdline.h" #include "mar.h" -#ifdef WNT +#ifdef _WIN32 #include #else #include diff --git a/onlineupdate/source/update/src/mar_extract.c b/onlineupdate/source/update/src/mar_extract.c index af2276614bdb..75cbd645f296 100644 --- a/onlineupdate/source/update/src/mar_extract.c +++ b/onlineupdate/source/update/src/mar_extract.c @@ -12,7 +12,7 @@ #include "mar_private.h" #include "mar.h" -#ifdef WNT +#ifdef _WIN32 #include #include #endif @@ -25,7 +25,7 @@ static int mar_ensure_parent_dir(const char *path) { *slash = '\0'; mar_ensure_parent_dir(path); -#ifdef WNT +#ifdef _WIN32 _mkdir(path); #else mkdir(path, 0755); @@ -45,7 +45,7 @@ static int mar_test_callback(MarFile *mar, const MarItem *item, void *unused) { if (mar_ensure_parent_dir(item->name)) return -1; -#ifdef WNT +#ifdef _WIN32 fd = _open(item->name, _O_BINARY|_O_CREAT|_O_TRUNC|_O_WRONLY, item->flags); #else fd = creat(item->name, item->flags); diff --git a/onlineupdate/source/update/src/mar_private.h b/onlineupdate/source/update/src/mar_private.h index 39a77d1ac03e..a770998da6fe 100644 --- a/onlineupdate/source/update/src/mar_private.h +++ b/onlineupdate/source/update/src/mar_private.h @@ -53,7 +53,7 @@ MOZ_STATIC_ASSERT(sizeof(BLOCKSIZE) < \ /* The mar program is compiled as a host bin so we don't have access to NSPR at runtime. For that reason we use ntohl, htonl, and define HOST_TO_NETWORK64 instead of the NSPR equivalents. */ -#ifdef WNT +#ifdef _WIN32 #include #define ftello _ftelli64 #define fseeko _fseeki64 diff --git a/onlineupdate/source/update/src/mar_read.c b/onlineupdate/source/update/src/mar_read.c index 34f8e8060485..0ed8c6be6ea9 100644 --- a/onlineupdate/source/update/src/mar_read.c +++ b/onlineupdate/source/update/src/mar_read.c @@ -11,7 +11,7 @@ #include "mar_private.h" #include "mar.h" -#ifdef WNT +#ifdef _WIN32 #include #else #include @@ -177,7 +177,7 @@ MarFile *mar_open(const char *path) { return mar_fpopen(fp); } -#ifdef WNT +#ifdef _WIN32 MarFile *mar_wopen(const wchar_t *path) { FILE *fp; diff --git a/onlineupdate/source/update/updater/archivereader.cxx b/onlineupdate/source/update/updater/archivereader.cxx index a7884df2d8de..23f416a17b2a 100644 --- a/onlineupdate/source/update/updater/archivereader.cxx +++ b/onlineupdate/source/update/updater/archivereader.cxx @@ -10,7 +10,7 @@ #include "bzlib.h" #include "archivereader.h" #include "errors.h" -#ifdef WNT +#ifdef _WIN32 #include "updatehelper.h" #endif @@ -202,7 +202,7 @@ ArchiveReader::Open(const NS_tchar *path) } } -#ifdef WNT +#ifdef _WIN32 mArchive = mar_wopen(path); #else mArchive = mar_open(path); @@ -239,7 +239,7 @@ ArchiveReader::ExtractFile(const char *name, const NS_tchar *dest) if (!item) return READ_ERROR; -#ifdef WNT +#ifdef _WIN32 FILE* fp = _wfopen(dest, L"wb+"); #else int fd = creat(dest, item->flags); diff --git a/onlineupdate/source/update/updater/archivereader.h b/onlineupdate/source/update/updater/archivereader.h index 5fa9523eba40..8d0b7c3d74ee 100644 --- a/onlineupdate/source/update/updater/archivereader.h +++ b/onlineupdate/source/update/updater/archivereader.h @@ -10,7 +10,7 @@ #include #include "mar.h" -#ifdef WNT +#ifdef _WIN32 typedef WCHAR NS_tchar; #else typedef char NS_tchar; diff --git a/onlineupdate/source/update/updater/bspatch.cxx b/onlineupdate/source/update/updater/bspatch.cxx index 8f8e0420000a..09a3c4354fcb 100644 --- a/onlineupdate/source/update/updater/bspatch.cxx +++ b/onlineupdate/source/update/updater/bspatch.cxx @@ -39,13 +39,13 @@ #include #include -#if defined(WNT) +#if defined(_WIN32) # include #else # include #endif -#ifdef WNT +#ifdef _WIN32 # include #else # include diff --git a/onlineupdate/source/update/updater/loaddlls.cxx b/onlineupdate/source/update/updater/loaddlls.cxx index 541cf4a3a683..94a4222136b5 100644 --- a/onlineupdate/source/update/updater/loaddlls.cxx +++ b/onlineupdate/source/update/updater/loaddlls.cxx @@ -4,7 +4,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifdef WNT +#ifdef _WIN32 #ifndef UNICODE #define UNICODE #endif diff --git a/onlineupdate/source/update/updater/nsWindowsRestart.cxx b/onlineupdate/source/update/updater/nsWindowsRestart.cxx index 6f275abcaef5..20f584f4f146 100644 --- a/onlineupdate/source/update/updater/nsWindowsRestart.cxx +++ b/onlineupdate/source/update/updater/nsWindowsRestart.cxx @@ -11,7 +11,7 @@ #define nsWindowsRestart_cxx #endif -#ifdef WNT +#ifdef _WIN32 #include #endif #include diff --git a/onlineupdate/source/update/updater/progressui.h b/onlineupdate/source/update/updater/progressui.h index 55d0d9ebf0c3..7392ac167bc4 100644 --- a/onlineupdate/source/update/updater/progressui.h +++ b/onlineupdate/source/update/updater/progressui.h @@ -9,7 +9,7 @@ #include "updatedefines.h" -#if defined(WNT) +#if defined(_WIN32) typedef WCHAR NS_tchar; #define NS_main wmain #else @@ -20,7 +20,7 @@ // Called to perform any initialization of the widget toolkit int InitProgressUI(int *argc, NS_tchar ***argv); -#if defined(WNT) +#if defined(_WIN32) // Called on the main thread at startup int ShowProgressUI(bool indeterminate = false, bool initUIStrings = true); int InitProgressUIStrings(); diff --git a/onlineupdate/source/update/updater/progressui_null.cxx b/onlineupdate/source/update/updater/progressui_null.cxx index 7c3019e0f010..c4cd6413ff1f 100644 --- a/onlineupdate/source/update/updater/progressui_null.cxx +++ b/onlineupdate/source/update/updater/progressui_null.cxx @@ -4,7 +4,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#if !defined(MACOSX) && !defined(UNIX) && !defined(WNT) +#if !defined(MACOSX) && !defined(UNIX) && !defined(_WIN32) #include "progressui.h" int InitProgressUI(int *argc, char ***argv) @@ -24,4 +24,4 @@ void QuitProgressUI() void UpdateProgressUI(float progress) { } -#endif // !defined(MACOSX) && !defined(UNIX) && !defined(WNT) +#endif // !defined(MACOSX) && !defined(UNIX) && !defined(_WIN32) diff --git a/onlineupdate/source/update/updater/progressui_win.cxx b/onlineupdate/source/update/updater/progressui_win.cxx index 49ae81e68d07..7a0ff249442f 100644 --- a/onlineupdate/source/update/updater/progressui_win.cxx +++ b/onlineupdate/source/update/updater/progressui_win.cxx @@ -4,7 +4,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifdef WNT +#ifdef _WIN32 #include #ifndef UNICODE #define UNICODE diff --git a/onlineupdate/source/update/updater/updater.cxx b/onlineupdate/source/update/updater/updater.cxx index 5545d18f301d..2d5e614dbf59 100644 --- a/onlineupdate/source/update/updater/updater.cxx +++ b/onlineupdate/source/update/updater/updater.cxx @@ -64,7 +64,7 @@ #define PROGRESS_FINISH_SIZE 5.0f // Amount of time in ms to wait for the parent process to close -#ifdef WNT +#ifdef _WIN32 #define PARENT_WAIT 5000 #endif @@ -113,12 +113,12 @@ static bool sUseHardLinks = true; # define MAYBE_USE_HARD_LINKS 0 #endif -#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(WNT) && !defined(MACOSX) +#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(_WIN32) && !defined(MACOSX) #include "nss.h" #include "prerror.h" #endif -#ifdef WNT +#ifdef _WIN32 #include "updatehelper.h" // Closes the handle if valid and if the updater is elevated returns with the @@ -208,7 +208,7 @@ struct MARChannelStringTable { typedef void (* ThreadFunc)(void *param); -#ifdef WNT +#ifdef _WIN32 #include class Thread @@ -278,7 +278,7 @@ static bool sReplaceRequest = false; static bool sUsingService = false; static bool sIsOSUpdate = false; -#ifdef WNT +#ifdef _WIN32 // The current working directory specified in the command line. static NS_tchar* gDestPath; static NS_tchar gCallbackRelPath[MAXPATHLEN]; @@ -343,7 +343,7 @@ EnvHasValue(const char *name) return (val && *val); } -#ifdef WNT +#ifdef _WIN32 /** * Coverts a relative update path to a full path for Windows. * @@ -397,7 +397,7 @@ get_valid_path(NS_tchar **line, bool isdir = false) return nullptr; } -#ifdef WNT +#ifdef _WIN32 // All paths must be relative from the current working directory if (path[0] == NS_T('\\') || path[1] == NS_T(':')) { LOG(("get_valid_path: path must be relative: " LOG_S, path)); @@ -452,7 +452,7 @@ get_quoted_path(const NS_tchar *path) static void ensure_write_permissions(const NS_tchar *path) { -#ifdef WNT +#ifdef _WIN32 (void) _wchmod(path, _S_IREAD | _S_IWRITE); #else struct stat fs; @@ -639,7 +639,7 @@ create_hard_link(const NS_tchar *srcFilename, const NS_tchar *destFilename) // Copy the file named path onto a new file named dest. static int ensure_copy(const NS_tchar *path, const NS_tchar *dest) { -#ifdef WNT +#ifdef _WIN32 // Fast path for Windows bool result = CopyFileW(path, dest, false); if (!result) { @@ -850,7 +850,7 @@ static int rename_file(const NS_tchar *spath, const NS_tchar *dpath, return OK; } -#ifdef WNT +#ifdef _WIN32 // Remove the directory pointed to by path and all of its files and // sub-directories. If a file is in use move it to the tobedeleted directory // and attempt to schedule removal of the file on reboot @@ -958,7 +958,7 @@ static int backup_discard(const NS_tchar *path) } int rv = ensure_remove(backup); -#if defined(WNT) +#if defined(_WIN32) if (rv && !sStagedUpdate && !sReplaceRequest) { LOG(("backup_discard: unable to remove: " LOG_S, backup)); NS_tchar path[MAXPATHLEN]; @@ -1302,7 +1302,7 @@ AddFile::Execute() return rv; } -#ifdef WNT +#ifdef _WIN32 char sourcefile[MAXPATHLEN]; if (!WideCharToMultiByte(CP_UTF8, 0, mFile, -1, sourcefile, MAXPATHLEN, nullptr, nullptr)) { @@ -1456,7 +1456,7 @@ PatchFile::Prepare() if (!fp) return WRITE_ERROR; -#ifdef WNT +#ifdef _WIN32 char sourcefile[MAXPATHLEN]; if (!WideCharToMultiByte(CP_UTF8, 0, mPatchFile, -1, sourcefile, MAXPATHLEN, nullptr, nullptr)) { @@ -1486,7 +1486,7 @@ PatchFile::Execute() return rv; FILE *origfile = nullptr; -#ifdef WNT +#ifdef _WIN32 if (NS_tstrcmp(mFile, gCallbackRelPath) == 0) { // Read from the copy of the callback when patching since the callback can't // be opened for reading to prevent the application from being launched. @@ -1580,7 +1580,7 @@ PatchFile::Execute() return WRITE_ERROR_OPEN_PATCH_FILE; } -#ifdef WNT +#ifdef _WIN32 if (!shouldTruncate) { fseek(ofile, 0, SEEK_SET); } @@ -1793,7 +1793,7 @@ PatchIfFile::Finish(int status) //----------------------------------------------------------------------------- -#ifdef WNT +#ifdef _WIN32 #include "nsWindowsRestart.cxx" #include "nsWindowsHelpers.h" #include "uachelper.h" @@ -1908,7 +1908,7 @@ IsUpdateStatusPendingService() } #endif -#ifdef WNT +#ifdef _WIN32 /* * Read the update.status file and sets isSuccess to true if * the status is set to succeeded. @@ -1949,7 +1949,7 @@ static int CopyInstallDirToDestDir() { // These files should not be copied over to the updated app -#ifdef WNT +#ifdef _WIN32 #define SKIPLIST_COUNT 3 #elif defined(MACOSX) #define SKIPLIST_COUNT 0 @@ -1960,7 +1960,7 @@ CopyInstallDirToDestDir() #ifndef MACOSX skiplist.append(0, gInstallDirPath, NS_T("updated")); skiplist.append(1, gInstallDirPath, NS_T("updates/0")); -#ifdef WNT +#ifdef _WIN32 skiplist.append(2, gInstallDirPath, NS_T("updated.update_in_progress.lock")); #endif #endif @@ -2023,7 +2023,7 @@ ProcessReplaceRequest() LOG(("Begin moving destDir (" LOG_S ") to tmpDir (" LOG_S ")", destDir, tmpDir)); int rv = rename_file(destDir, tmpDir, true); -#ifdef WNT +#ifdef _WIN32 // On Windows, if Firefox is launched using the shortcut, it will hold a handle // to its installation directory open, which might not get released in time. // Therefore we wait a little bit here to see if the handle is released. @@ -2075,7 +2075,7 @@ ProcessReplaceRequest() rv = ensure_remove_recursive(tmpDir, true); if (rv) { LOG(("Removing tmpDir failed, err: %d", rv)); -#ifdef WNT +#ifdef _WIN32 NS_tchar deleteDir[MAXPATHLEN]; NS_tsnprintf(deleteDir, sizeof(deleteDir)/sizeof(deleteDir[0]), NS_T("%s\\%s"), destDir, DELETE_DIR); @@ -2103,7 +2103,7 @@ ProcessReplaceRequest() return 0; } -#ifdef WNT +#ifdef _WIN32 static void WaitForServiceFinishThread(void *param) { @@ -2199,7 +2199,7 @@ UpdateThreadFunc(void * /*param*/) #ifdef MOZ_VERIFY_MAR_SIGNATURE if (rv == OK) { -#ifdef WNT +#ifdef _WIN32 HKEY baseKey = nullptr; wchar_t valueName[] = L"Image Path"; wchar_t rasenh[] = L"rsaenh.dll"; @@ -2225,7 +2225,7 @@ UpdateThreadFunc(void * /*param*/) } #endif rv = gArchiveReader.VerifySignature(); -#ifdef WNT +#ifdef _WIN32 if (baseKey) { if (reset) { RegSetValueExW(baseKey, valueName, 0, REG_SZ, @@ -2342,7 +2342,7 @@ int NS_main(int argc, NS_tchar **argv) } #endif -#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(WNT) && !defined(MACOSX) +#if defined(MOZ_VERIFY_MAR_SIGNATURE) && !defined(_WIN32) && !defined(MACOSX) // On Windows and Mac we rely on native APIs to do verifications so we don't // need to initialize NSS at all there. // Otherwise, minimize the amount of NSS we depend on by avoiding all the NSS @@ -2389,7 +2389,7 @@ int NS_main(int argc, NS_tchar **argv) *slash = NS_T('\0'); } -#ifdef WNT +#ifdef _WIN32 bool useService = false; bool testOnlyFallbackKeyExists = false; bool noServiceFallback = EnvHasValue("MOZ_NO_SERVICE_FALLBACK"); @@ -2425,13 +2425,13 @@ int NS_main(int argc, NS_tchar **argv) #endif // If there is a PID specified and it is not '0' then wait for the process to exit. -#ifdef WNT +#ifdef _WIN32 __int64 pid = 0; #else int pid = 0; #endif if (argc > 4) { -#ifdef WNT +#ifdef _WIN32 pid = _wtoi64(argv[4]); #else pid = atoi(argv[4]); @@ -2466,7 +2466,7 @@ int NS_main(int argc, NS_tchar **argv) if (sReplaceRequest) { // If we're attempting to replace the application, try to append to the // log generated when staging the staged update. -#ifdef WNT +#ifdef _WIN32 NS_tchar* logDir = gPatchDirPath; #else #ifdef MACOSX @@ -2529,7 +2529,7 @@ int NS_main(int argc, NS_tchar **argv) } #endif -#ifdef WNT +#ifdef _WIN32 if (pid > 0) { HANDLE parent = OpenProcess(SYNCHRONIZE, false, (DWORD) pid); // May return nullptr if the parent process has already gone away. @@ -2549,7 +2549,7 @@ int NS_main(int argc, NS_tchar **argv) #endif if (sReplaceRequest) { -#ifdef WNT +#ifdef _WIN32 // On Windows, the current working directory of the process should be changed // so that it's not locked. NS_tchar sysDir[MAX_PATH + 1] = { L'\0' }; @@ -2564,7 +2564,7 @@ int NS_main(int argc, NS_tchar **argv) // argument prior to callbackIndex is the working directory. const int callbackIndex = 6; -#if defined(WNT) +#if defined(_WIN32) sUsingService = EnvHasValue("MOZ_USING_SERVICE"); putenv(const_cast("MOZ_USING_SERVICE=")); // lastFallbackError keeps track of the last error for the service not being @@ -2907,7 +2907,7 @@ int NS_main(int argc, NS_tchar **argv) } } -#ifdef WNT +#ifdef _WIN32 // For replace requests, we don't need to do any real updates, so this is not // necessary. if (!sReplaceRequest) { @@ -3108,7 +3108,7 @@ int NS_main(int argc, NS_tchar **argv) } t.Join(); -#ifdef WNT +#ifdef _WIN32 if (argc > callbackIndex && !sReplaceRequest) { if (callbackFile != INVALID_HANDLE_VALUE) { CloseHandle(callbackFile); @@ -3186,7 +3186,7 @@ int NS_main(int argc, NS_tchar **argv) LogFinish(); if (argc > callbackIndex) { -#if defined(WNT) +#if defined(_WIN32) if (gSucceeded) { // The service update will only be executed if it is already installed. // For first time installs of the service, the install will happen from @@ -3335,7 +3335,7 @@ ActionList::Finish(int status) } -#ifdef WNT +#ifdef _WIN32 int add_dir_entries(const NS_tchar *dirpath, ActionList *list) { int rv = OK; @@ -3642,7 +3642,7 @@ GetManifestContents(const NS_tchar *manifest) mbuf[ms.st_size] = '\0'; rb = mbuf; -#ifndef WNT +#ifndef _WIN32 return rb; #else NS_tchar *wrb = (NS_tchar *) malloc((ms.st_size + 1) * sizeof(NS_tchar)); diff --git a/onlineupdate/source/update/updater/win_dirent.cxx b/onlineupdate/source/update/updater/win_dirent.cxx index 7df6c26f2bbe..d7bf872194f6 100644 --- a/onlineupdate/source/update/updater/win_dirent.cxx +++ b/onlineupdate/source/update/updater/win_dirent.cxx @@ -4,7 +4,7 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#ifdef WNT +#ifdef _WIN32 #include "win_dirent.h" #include #include diff --git a/onlineupdate/source/update/updater/xpcom/glue/nsVersionComparator.cxx b/onlineupdate/source/update/updater/xpcom/glue/nsVersionComparator.cxx index 3f859db06aae..b8562354b586 100644 --- a/onlineupdate/source/update/updater/xpcom/glue/nsVersionComparator.cxx +++ b/onlineupdate/source/update/updater/xpcom/glue/nsVersionComparator.cxx @@ -9,13 +9,13 @@ #include #include #include -#if defined(WNT) && !defined(UPDATER_NO_STRING_GLUE_STL) +#if defined(_WIN32) && !defined(UPDATER_NO_STRING_GLUE_STL) #include #include #include "mozilla/Char16.h" #endif -#ifdef WNT +#ifdef _WIN32 // from Mozilla's nsAlgorithm.h template inline const T& @@ -37,7 +37,7 @@ struct VersionPart char* extraD; // null-terminated }; -#ifdef WNT +#ifdef _WIN32 struct VersionPartW { int32_t numA; @@ -126,7 +126,7 @@ ParseVP(char* aPart, VersionPart& aResult) * * @returns A pointer to the next versionpart, or null if none. */ -#ifdef WNT +#ifdef _WIN32 static wchar_t* ParseVP(wchar_t* aPart, VersionPartW& aResult) { @@ -277,7 +277,7 @@ CompareVP(VersionPart& aVer1, VersionPart& aVer2) /** * Compares two VersionParts */ -#ifdef WNT +#ifdef _WIN32 static int32_t CompareVP(VersionPartW& aVer1, VersionPartW& aVer2) { @@ -310,7 +310,7 @@ CompareVP(VersionPartW& aVer1, VersionPartW& aVer2) namespace mozilla { -#ifdef WNT +#ifdef _WIN32 int32_t CompareVersions(const wchar_t* aStrA, const wchar_t* aStrB) { diff --git a/onlineupdate/source/update/updater/xpcom/glue/nsVersionComparator.h b/onlineupdate/source/update/updater/xpcom/glue/nsVersionComparator.h index 8ece9408abab..c199d214efc1 100644 --- a/onlineupdate/source/update/updater/xpcom/glue/nsVersionComparator.h +++ b/onlineupdate/source/update/updater/xpcom/glue/nsVersionComparator.h @@ -10,7 +10,7 @@ #include #include #include -#if defined(WNT) && !defined(UPDATER_NO_STRING_GLUE_STL) +#if defined(_WIN32) && !defined(UPDATER_NO_STRING_GLUE_STL) #include #include #include "mozilla/Char16.h" @@ -46,7 +46,7 @@ namespace mozilla { int32_t CompareVersions(const char* aStrA, const char* aStrB); -#ifdef WNT +#ifdef _WIN32 int32_t CompareVersions(const wchar_t* aStrA, const wchar_t* aStrB); #endif @@ -120,7 +120,7 @@ private: char* versionContent; }; -#ifdef WNT +#ifdef _WIN32 struct VersionW { explicit VersionW(const wchar_t* aVersionStringW) -- cgit v1.2.3