summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/mupdf/fitz/getopt.h2
-rw-r--r--include/mupdf/fitz/system.h4
-rw-r--r--include/mupdf/helpers/mu-threads.h2
-rw-r--r--platform/x11/curl_stream.c10
-rw-r--r--platform/x11/pdfapp.c4
-rw-r--r--source/fitz/memento.c2
-rw-r--r--source/fitz/memory.c2
-rw-r--r--source/fitz/output.c6
-rw-r--r--source/fitz/stream-open.c10
-rw-r--r--source/fitz/stream-prog.c2
-rw-r--r--source/pdf/pdf-annot.c4
-rw-r--r--source/pdf/pdf-js.c2
12 files changed, 27 insertions, 23 deletions
diff --git a/include/mupdf/fitz/getopt.h b/include/mupdf/fitz/getopt.h
index 3890c618..8f71120b 100644
--- a/include/mupdf/fitz/getopt.h
+++ b/include/mupdf/fitz/getopt.h
@@ -11,7 +11,7 @@ extern char *fz_optarg;
/*
Windows unicode versions.
*/
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _WIN32
extern int fz_getoptw(int nargc, wchar_t * const *nargv, const wchar_t *ostr);
extern int fz_optindw;
extern wchar_t *fz_optargw;
diff --git a/include/mupdf/fitz/system.h b/include/mupdf/fitz/system.h
index 277ec286..136246a7 100644
--- a/include/mupdf/fitz/system.h
+++ b/include/mupdf/fitz/system.h
@@ -123,6 +123,10 @@ static __inline int signbit(double x)
#define hypotf _hypotf
#define atoll _atoi64
+#endif
+
+#ifdef _WIN32
+
char *fz_utf8_from_wchar(const wchar_t *s);
wchar_t *fz_wchar_from_utf8(const char *s);
diff --git a/include/mupdf/helpers/mu-threads.h b/include/mupdf/helpers/mu-threads.h
index d1830a44..ea3dfc3c 100644
--- a/include/mupdf/helpers/mu-threads.h
+++ b/include/mupdf/helpers/mu-threads.h
@@ -23,7 +23,7 @@
*/
#if !defined(DISABLE_MUTHREADS)
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _WIN32
#define MU_THREAD_IMPL_TYPE 1
#elif defined(HAVE_PTHREAD)
#define MU_THREAD_IMPL_TYPE 2
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<<BLOCK_SHIFT)
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _WIN32
#include <windows.h>
#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
diff --git a/source/fitz/memento.c b/source/fitz/memento.c
index a71dce7f..a87b720d 100644
--- a/source/fitz/memento.c
+++ b/source/fitz/memento.c
@@ -143,7 +143,7 @@ android_fprintf(FILE *file, const char *fmt, ...)
#define MEMENTO_STACKTRACE_METHOD 3
#endif
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _WIN32
#include <windows.h>
static int
diff --git a/source/fitz/memory.c b/source/fitz/memory.c
index 1643647d..ad5b69aa 100644
--- a/source/fitz/memory.c
+++ b/source/fitz/memory.c
@@ -284,7 +284,7 @@ int fz_lock_taken[FZ_LOCK_DEBUG_CONTEXT_MAX][FZ_LOCK_MAX] = { { 0 } };
* when threads are involved. */
static int ms_clock(void)
{
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _WIN32
return (int)GetTickCount();
#else
struct timeval tp;
diff --git a/source/fitz/output.c b/source/fitz/output.c
index 32813fd8..4ee0023c 100644
--- a/source/fitz/output.c
+++ b/source/fitz/output.c
@@ -137,7 +137,7 @@ static void
file_seek(fz_context *ctx, void *opaque, int64_t off, int whence)
{
FILE *file = opaque;
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _WIN32
int n = _fseeki64(file, off, whence);
#else
int n = fseeko(file, off, whence);
@@ -150,7 +150,7 @@ static int64_t
file_tell(fz_context *ctx, void *opaque)
{
FILE *file = opaque;
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _WIN32
int64_t off = _ftelli64(file);
#else
int64_t off = ftello(file);
@@ -221,7 +221,7 @@ fz_new_output_with_path(fz_context *ctx, const char *filename, int append)
if (!strcmp(filename, "/dev/null") || !fz_strcasecmp(filename, "nul:"))
return fz_new_output(ctx, 0, NULL, null_write, NULL, NULL);
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _WIN32
/* Ensure we create a brand new file. We don't want to clobber our old file. */
if (!append)
{
diff --git a/source/fitz/stream-open.c b/source/fitz/stream-open.c
index 62e410a4..813b7099 100644
--- a/source/fitz/stream-open.c
+++ b/source/fitz/stream-open.c
@@ -14,7 +14,7 @@ int
fz_file_exists(fz_context *ctx, const char *path)
{
FILE *file;
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _WIN32
file = fz_fopen_utf8(path, "rb");
#else
file = fopen(path, "rb");
@@ -106,14 +106,14 @@ static int next_file(fz_context *ctx, fz_stream *stm, size_t n)
static void seek_file(fz_context *ctx, fz_stream *stm, int64_t offset, int whence)
{
fz_file_stream *state = stm->state;
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _WIN32
int64_t n = _fseeki64(state->file, offset, whence);
#else
int64_t n = fseeko(state->file, offset, whence);
#endif
if (n < 0)
fz_throw(ctx, FZ_ERROR_GENERIC, "cannot seek: %s", strerror(errno));
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _WIN32
stm->pos = _ftelli64(state->file);
#else
stm->pos = ftello(state->file);
@@ -156,7 +156,7 @@ fz_stream *
fz_open_file(fz_context *ctx, const char *name)
{
FILE *file;
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _WIN32
file = fz_fopen_utf8(name, "rb");
#else
file = fopen(name, "rb");
@@ -166,7 +166,7 @@ fz_open_file(fz_context *ctx, const char *name)
return fz_open_file_ptr(ctx, file);
}
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _WIN32
fz_stream *
fz_open_file_w(fz_context *ctx, const wchar_t *name)
{
diff --git a/source/fitz/stream-prog.c b/source/fitz/stream-prog.c
index 89158832..f8fa456c 100644
--- a/source/fitz/stream-prog.c
+++ b/source/fitz/stream-prog.c
@@ -137,7 +137,7 @@ fz_stream *
fz_open_file_progressive(fz_context *ctx, const char *name, int bps)
{
FILE *f;
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _WIN32
f = fz_fopen_utf8(name, "rb");
#else
f = fopen(name, "rb");
diff --git a/source/pdf/pdf-annot.c b/source/pdf/pdf-annot.c
index 56b42e48..314ca092 100644
--- a/source/pdf/pdf-annot.c
+++ b/source/pdf/pdf-annot.c
@@ -119,7 +119,7 @@ pdf_parse_file_spec(fz_context *ctx, pdf_document *doc, pdf_obj *file_spec, pdf_
filename = file_spec;
if (pdf_is_dict(ctx, file_spec)) {
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _WIN32
filename = pdf_dict_get(ctx, file_spec, PDF_NAME_DOS);
#else
filename = pdf_dict_get(ctx, file_spec, PDF_NAME_Unix);
@@ -135,7 +135,7 @@ pdf_parse_file_spec(fz_context *ctx, pdf_document *doc, pdf_obj *file_spec, pdf_
}
path = pdf_to_utf8(ctx, filename);
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _WIN32
if (strcmp(pdf_to_name(ctx, pdf_dict_gets(ctx, file_spec, "FS")), "URL") != 0)
{
/* move the file name into the expected place and use the expected path separator */
diff --git a/source/pdf/pdf-js.c b/source/pdf/pdf-js.c
index 82018065..0024670a 100644
--- a/source/pdf/pdf-js.c
+++ b/source/pdf/pdf-js.c
@@ -510,7 +510,7 @@ static void declare_dom(pdf_js *js)
/* Create the 'app' object */
js_newobject(J);
{
-#if defined(_WIN32) || defined(_WIN64)
+#ifdef _WIN32
js_pushstring(J, "WIN");
#elif defined(__APPLE__)
js_pushstring(J, "MAC");