summaryrefslogtreecommitdiff
path: root/apps/win_main.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2012-04-20 16:00:13 +0200
committerRobin Watts <robin.watts@artifex.com>2012-04-20 16:10:02 +0100
commitc6e27a74283a1fa31a930f1909dbc46e131f0447 (patch)
treeb0104b5dd19f07fec8d2c03720c3efc8a8f60166 /apps/win_main.c
parent9fbd2de7411f6c87c6f1ad0d9adfba9fe5164e0f (diff)
downloadmupdf-c6e27a74283a1fa31a930f1909dbc46e131f0447.tar.xz
Pass UTF8 filename to fz_open_document / fz_open_file to remove kludges.
Use _wopen on a UTF8 -> wchar_t decoded filename to support UTF8 filenames for win32.
Diffstat (limited to 'apps/win_main.c')
-rw-r--r--apps/win_main.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/apps/win_main.c b/apps/win_main.c
index cc71a120..358b21bb 100644
--- a/apps/win_main.c
+++ b/apps/win_main.c
@@ -594,15 +594,8 @@ void windocopy(pdfapp_t *app)
void winreloadfile(pdfapp_t *app)
{
- int fd;
-
pdfapp_close(app);
-
- fd = _wopen(wbuf, O_BINARY | O_RDONLY, 0666);
- if (fd < 0)
- winerror(&gapp, "cannot reload file");
-
- pdfapp_open(app, filename, fd, 1);
+ pdfapp_open(app, filename, 1);
}
void winopenuri(pdfapp_t *app, char *buf)
@@ -834,7 +827,6 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShow
LPWSTR *argv = CommandLineToArgvW(GetCommandLineW(), &argc);
char argv0[256];
MSG msg;
- int fd;
int code;
fz_context *ctx;
@@ -861,15 +853,11 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShow
exit(0);
}
- fd = _wopen(wbuf, O_BINARY | O_RDONLY, 0666);
- if (fd < 0)
- winerror(&gapp, "cannot open file");
-
code = WideCharToMultiByte(CP_UTF8, 0, wbuf, -1, filename, sizeof filename, NULL, NULL);
if (code == 0)
winerror(&gapp, "cannot convert filename to utf-8");
- pdfapp_open(&gapp, filename, fd, 0);
+ pdfapp_open(&gapp, filename, 0);
while (GetMessage(&msg, NULL, 0, 0))
{