From 81c77a6b6464f5af66f851837f85ed6f9724f19e Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Mon, 19 Mar 2018 10:34:30 +0100 Subject: Clean up windows ifdefs. _WIN32 is always defined on windows (it means the WinAPI is available). _WIN64 is also defined on 64-bit targets. This means the test for defined(_WIN32) || defined(_WIN64) is redundant, since if _WIN64 is defined, then _WIN32 is always also defined. MSC_VER is only defined for MSVC, so split the ifdef sections in include/fitz/system.h into separate MSVC and WIN32 parts so that we can build with MinGW and other non-MSVC compilers on windows. --- platform/x11/curl_stream.c | 10 +++++----- platform/x11/pdfapp.c | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'platform/x11') diff --git a/platform/x11/curl_stream.c b/platform/x11/curl_stream.c index 05a9b14a..4c265c01 100644 --- a/platform/x11/curl_stream.c +++ b/platform/x11/curl_stream.c @@ -21,7 +21,7 @@ #define BLOCK_SHIFT 20 #define BLOCK_SIZE (1< #else #include "pthread.h" @@ -53,7 +53,7 @@ struct curl_stream_state_s unsigned char public_buffer[4096]; -#if defined(_WIN32) || defined(_WIN64) +#ifdef _WIN32 void *thread; DWORD thread_id; HANDLE mutex; @@ -65,7 +65,7 @@ struct curl_stream_state_s static void fetcher_thread(curl_stream_state *state); -#if defined(_WIN32) || defined(_WIN64) +#ifdef _WIN32 static void lock(curl_stream_state *state) { @@ -435,7 +435,7 @@ stream_close(fz_context *ctx, void *state_) state->kill_thread = 1; unlock(state); -#if defined(_WIN32) || defined(_WIN64) +#ifdef _WIN32 WaitForSingleObject(state->thread, INFINITE); CloseHandle(state->thread); CloseHandle(state->mutex); @@ -528,7 +528,7 @@ fz_stream *fz_stream_from_curl(fz_context *ctx, char *filename, void (*more_data curl_easy_setopt(handle, CURLOPT_HEADERFUNCTION, header_arrived); -#if defined(_WIN32) || defined(_WIN64) +#ifdef _WIN32 state->mutex = CreateMutex(NULL, FALSE, NULL); if (state->mutex == NULL) fz_throw(ctx, FZ_ERROR_GENERIC, "mutex creation failed"); diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c index d5f70a29..f011b5b0 100644 --- a/platform/x11/pdfapp.c +++ b/platform/x11/pdfapp.c @@ -131,7 +131,7 @@ void pdfapp_init(fz_context *ctx, pdfapp_t *app) app->transition.duration = 0.25f; app->transition.type = FZ_TRANSITION_FADE; -#if defined(_WIN32) || defined(_WIN64) +#ifdef _WIN32 app->colorspace = fz_device_bgr(ctx); #else app->colorspace = fz_device_rgb(ctx); @@ -1951,7 +1951,7 @@ void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen) saw_text = 1; if (need_newline) { -#if defined(_WIN32) || defined(_WIN64) +#ifdef _WIN32 if (p < ucslen - 1) ucsbuf[p++] = '\r'; #endif -- cgit v1.2.3