summaryrefslogtreecommitdiff
path: root/external/hunspell/hunspell-fdo48017-wfopen.patch
blob: 14f1db7260205df0059f0c329e7c4e68116b39a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
diff -ru hunspell/src/hunspell/csutil.cxx build/hunspell/src/hunspell/csutil.cxx
--- hunspell/src/hunspell/csutil.cxx	2011-02-02 11:35:43.000000000 +0100
+++ build/hunspell/src/hunspell/csutil.cxx	2014-04-24 19:42:01.373285409 +0200
@@ -57,9 +57,14 @@
     if (strncmp(path, WIN32_LONG_PATH_PREFIX, 4) == 0) {
         int len = MultiByteToWideChar(CP_UTF8, 0, path, -1, NULL, 0);
         wchar_t *buff = (wchar_t *) malloc(len * sizeof(wchar_t));
+        wchar_t *buff2 = (wchar_t *) malloc(len * sizeof(wchar_t));
+        FILE * f = NULL;
         MultiByteToWideChar(CP_UTF8, 0, path, -1, buff, len);
-        FILE * f = _wfopen(buff, (strcmp(mode, "r") == 0) ? L"r" : L"rb");
+        if (_wfullpath( buff2, buff, len ) != NULL) {
+          f = _wfopen(buff2, (strcmp(mode, "r") == 0) ? L"r" : L"rb");
+        }
         free(buff);
+        free(buff2);
         return f;
     }
 #endif