comparison src/GvimExt/gvimext.cpp @ 8180:1e48ffa2d697 v7.4.1383

commit https://github.com/vim/vim/commit/271273c39f2150ecdaa67fe1a2a8e9cdc63db545 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Feb 21 20:30:22 2016 +0100 patch 7.4.1383 Problem: GvimExt only loads the old libintl.dll. Solution: Also try loading libint-8.dll. (Ken Takata, closes https://github.com/vim/vim/issues/608)
author Christian Brabandt <cb@256bit.org>
date Sun, 21 Feb 2016 20:45:03 +0100
parents 81cb471657e0
children aca41efd888c
comparison
equal deleted inserted replaced
8179:8a2ed4bfe470 8180:1e48ffa2d697
156 #else 156 #else
157 # define _(x) (*dyn_libintl_gettext)(x) 157 # define _(x) (*dyn_libintl_gettext)(x)
158 # define VIMPACKAGE "vim" 158 # define VIMPACKAGE "vim"
159 # ifndef GETTEXT_DLL 159 # ifndef GETTEXT_DLL
160 # define GETTEXT_DLL "libintl.dll" 160 # define GETTEXT_DLL "libintl.dll"
161 # define GETTEXT_DLL_ALT "libintl-8.dll"
161 # endif 162 # endif
162 163
163 // Dummy functions 164 // Dummy functions
164 static char *null_libintl_gettext(const char *); 165 static char *null_libintl_gettext(const char *);
165 static char *null_libintl_textdomain(const char *); 166 static char *null_libintl_textdomain(const char *);
192 {(char *)"gettext", (FARPROC*)&dyn_libintl_gettext}, 193 {(char *)"gettext", (FARPROC*)&dyn_libintl_gettext},
193 {(char *)"textdomain", (FARPROC*)&dyn_libintl_textdomain}, 194 {(char *)"textdomain", (FARPROC*)&dyn_libintl_textdomain},
194 {(char *)"bindtextdomain", (FARPROC*)&dyn_libintl_bindtextdomain}, 195 {(char *)"bindtextdomain", (FARPROC*)&dyn_libintl_bindtextdomain},
195 {NULL, NULL} 196 {NULL, NULL}
196 }; 197 };
198 DWORD len, len2;
199 LPWSTR buf = NULL;
200 LPWSTR buf2 = NULL;
197 201
198 // No need to initialize twice. 202 // No need to initialize twice.
199 if (hLibintlDLL) 203 if (hLibintlDLL)
200 return 1; 204 return 1;
201 205
202 // Load gettext library, first try the Vim runtime directory, then search 206 // Load gettext library from the Vim runtime directory.
203 // the path. 207 // Add the directory to $PATH temporarily.
204 strcat(dir, GETTEXT_DLL); 208 len = GetEnvironmentVariableW(L"PATH", NULL, 0);
205 hLibintlDLL = LoadLibrary(dir); 209 len2 = MAX_PATH + 1 + len;
210 buf = (LPWSTR)malloc(len * sizeof(WCHAR));
211 buf2 = (LPWSTR)malloc(len2 * sizeof(WCHAR));
212 if (buf != NULL && buf2 != NULL)
213 {
214 GetEnvironmentVariableW(L"PATH", buf, len);
215 _snwprintf(buf2, len2, L"%S;%s", dir, buf);
216 SetEnvironmentVariableW(L"PATH", buf2);
217 hLibintlDLL = LoadLibrary(GETTEXT_DLL);
218 #ifdef GETTEXT_DLL_ALT
219 if (!hLibintlDLL)
220 hLibintlDLL = LoadLibrary(GETTEXT_DLL_ALT);
221 #endif
222 SetEnvironmentVariableW(L"PATH", buf);
223 }
224 free(buf);
225 free(buf2);
206 if (!hLibintlDLL) 226 if (!hLibintlDLL)
207 { 227 return 0;
208 hLibintlDLL = LoadLibrary(GETTEXT_DLL);
209 if (!hLibintlDLL)
210 return 0;
211 }
212 228
213 // Get the addresses of the functions we need. 229 // Get the addresses of the functions we need.
214 for (i = 0; libintl_entry[i].name != NULL 230 for (i = 0; libintl_entry[i].name != NULL
215 && libintl_entry[i].ptr != NULL; ++i) 231 && libintl_entry[i].ptr != NULL; ++i)
216 { 232 {