From c6e27a74283a1fa31a930f1909dbc46e131f0447 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 20 Apr 2012 16:00:13 +0200 Subject: 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. --- apps/win_main.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) (limited to 'apps/win_main.c') 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)) { -- cgit v1.2.3