Mercurial > trustbridge
diff common/listutil.c @ 1157:fd7d04bb37cb
(issue36) Add encoding aware port_fopen function and use it
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 18 Sep 2014 15:43:22 +0200 |
parents | edbf5e5e88f4 |
children | 2a1206932f53 |
line wrap: on
line diff
--- a/common/listutil.c Thu Sep 18 12:56:31 2014 +0200 +++ b/common/listutil.c Thu Sep 18 15:43:22 2014 +0200 @@ -22,6 +22,7 @@ #include "strhelp.h" #include "logging.h" +#include "portpath.h" #ifdef RELEASE_BUILD #include "pubkey-release.h" @@ -54,23 +55,8 @@ { return READ_FILE_INVALID_CALL; } -#ifdef WIN32 - { - wchar_t *wFilename = utf8_to_wchar(file_name, strlen(file_name)); - if (!wFilename) - { - return READ_FILE_UNREADABLE; - } - /* We open and write protect the file here so that - as long as the file is open we can be sure that - it was not modified and can use it in subsequent - calls based on the filename. */ - f = _wfsopen(wFilename, L"rb", _SH_DENYWR); - xfree(wFilename); - } -#else - f = fopen(file_name, "rb"); -#endif + + f = port_fopen_rb(file_name, true); if (f == NULL) return READ_FILE_UNREADABLE;