diff options
author | Noel Grandin <noel@peralex.com> | 2016-02-16 14:14:43 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-02-17 11:33:57 +0000 |
commit | 2087484c65a3d5e75a9e8ad116d11a4e13366219 (patch) | |
tree | 1f335918a854319df9269329d165a91d711d2108 /onlineupdate/source/libmar | |
parent | d6bf086012343b4a1e27cd4242dced9ee0d73a06 (diff) |
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 <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'onlineupdate/source/libmar')
-rw-r--r-- | onlineupdate/source/libmar/sign/mar_sign.c | 4 | ||||
-rw-r--r-- | onlineupdate/source/libmar/sign/nss_secutil.c | 2 | ||||
-rw-r--r-- | onlineupdate/source/libmar/src/mar.h | 2 | ||||
-rw-r--r-- | onlineupdate/source/libmar/src/mar_create.c | 2 | ||||
-rw-r--r-- | onlineupdate/source/libmar/src/mar_extract.c | 6 | ||||
-rw-r--r-- | onlineupdate/source/libmar/src/mar_private.h | 2 | ||||
-rw-r--r-- | onlineupdate/source/libmar/src/mar_read.c | 4 | ||||
-rw-r--r-- | onlineupdate/source/libmar/tool/mar.c | 20 | ||||
-rw-r--r-- | onlineupdate/source/libmar/verify/cryptox.c | 2 | ||||
-rw-r--r-- | onlineupdate/source/libmar/verify/mar_verify.c | 2 |
10 files changed, 23 insertions, 23 deletions
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 <unistd.h> #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 <io.h> #else #include <unistd.h> 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 <winsock2.h> #else #include <netinet/in.h> 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 <io.h> #include <direct.h> #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 <winsock2.h> #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 <winsock2.h> #else #include <netinet/in.h> @@ -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 <windows.h> #include <direct.h> #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 |