summaryrefslogtreecommitdiff
path: root/source/fitz
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-08-19 12:14:52 +0200
committerRobin Watts <robin.watts@artifex.com>2015-08-24 10:32:50 +0100
commitdb3f7ffe32808fde89ce7696066c0b1276756703 (patch)
tree4945d22f62bcd475cf54605b7ad6515e6ae5f50e /source/fitz
parent697f6a7cc3eb4230fcf0825b23125c54cbbe412b (diff)
downloadmupdf-db3f7ffe32808fde89ce7696066c0b1276756703.tar.xz
Revert revert of WinMain utf-8 handling and fix the bugs.
Also fix a few ifdefs in time.c so that it builds on MinGW.
Diffstat (limited to 'source/fitz')
-rw-r--r--source/fitz/getoptw.c72
-rw-r--r--source/fitz/time.c6
2 files changed, 4 insertions, 74 deletions
diff --git a/source/fitz/getoptw.c b/source/fitz/getoptw.c
deleted file mode 100644
index 55b8d015..00000000
--- a/source/fitz/getoptw.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * This is a version of the public domain getopt implementation by
- * Henry Spencer originally posted to net.sources. Adapted to
- * windows wchar's.
- *
- * This file is in the public domain.
- */
-
-#if defined(_WIN64) || defined(_WIN32)
-
-#include <stdio.h>
-#include <string.h>
-#include <windows.h>
-
-#define getoptw fz_getoptw
-#define optargw fz_optargw
-#define optindw fz_optindw
-
-wchar_t *optargw; /* Global argument pointer. */
-int optindw = 0; /* Global argv index. */
-
-static wchar_t *scan = NULL; /* Private scan pointer. */
-
-int
-getoptw(wchar_t argc, wchar_t *argv[], wchar_t *optstring)
-{
- wchar_t c;
- wchar_t *place;
-
- optargw = NULL;
-
- if (!scan || *scan == '\0') {
- if (optindw == 0)
- optindw++;
-
- if (optindw >= argc || argv[optindw][0] != '-' || argv[optindw][1] == '\0')
- return EOF;
- if (argv[optindw][1] == '-' && argv[optindw][2] == '\0') {
- optindw++;
- return EOF;
- }
-
- scan = argv[optindw]+1;
- optindw++;
- }
-
- c = *scan++;
- place = wcschr(optstring, c);
-
- if (!place || c == ':') {
- fprintf(stderr, "%s: unknown option -%C\n", argv[0], c);
- return '?';
- }
-
- place++;
- if (*place == ':') {
- if (*scan != '\0') {
- optargw = scan;
- scan = NULL;
- } else if( optindw < argc ) {
- optargw = argv[optindw];
- optindw++;
- } else {
- fprintf(stderr, "%s: option requires argument -%C\n", argv[0], c);
- return ':';
- }
- }
-
- return c;
-}
-
-#endif
diff --git a/source/fitz/time.c b/source/fitz/time.c
index 6b1d6255..1f45e665 100644
--- a/source/fitz/time.c
+++ b/source/fitz/time.c
@@ -1,10 +1,11 @@
-#ifdef _MSC_VER
+#ifdef _WIN32
#include "mupdf/fitz.h"
#include <time.h>
#include <windows.h>
+#ifdef _MSC_VER
#ifndef _WINRT
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
@@ -33,6 +34,7 @@ int gettimeofday(struct timeval *tv, struct timezone *tz)
}
#endif /* !_WINRT */
+#endif /* _MSC_VER */
char *
fz_utf8_from_wchar(const wchar_t *s)
@@ -138,4 +140,4 @@ fz_free_argv(int argc, char **argv)
free(argv);
}
-#endif /* _MSC_VER */
+#endif /* _WIN32 */