Skip to content

Commit 271273c

Browse files
committed
patch 7.4.1383
Problem: GvimExt only loads the old libintl.dll. Solution: Also try loading libint-8.dll. (Ken Takata, closes #608)
1 parent 02e83b4 commit 271273c

File tree

3 files changed

+25
-6
lines changed

3 files changed

+25
-6
lines changed

src/GvimExt/gvimext.cpp

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ HBITMAP IconToBitmap(HICON hIcon, HBRUSH hBackground, int width, int height)
158158
# define VIMPACKAGE "vim"
159159
# ifndef GETTEXT_DLL
160160
# define GETTEXT_DLL "libintl.dll"
161+
# define GETTEXT_DLL_ALT "libintl-8.dll"
161162
# endif
162163

163164
// Dummy functions
@@ -194,21 +195,36 @@ dyn_libintl_init(char *dir)
194195
{(char *)"bindtextdomain", (FARPROC*)&dyn_libintl_bindtextdomain},
195196
{NULL, NULL}
196197
};
198+
DWORD len, len2;
199+
LPWSTR buf = NULL;
200+
LPWSTR buf2 = NULL;
197201

198202
// No need to initialize twice.
199203
if (hLibintlDLL)
200204
return 1;
201205

202-
// Load gettext library, first try the Vim runtime directory, then search
203-
// the path.
204-
strcat(dir, GETTEXT_DLL);
205-
hLibintlDLL = LoadLibrary(dir);
206-
if (!hLibintlDLL)
206+
// Load gettext library from the Vim runtime directory.
207+
// Add the directory to $PATH temporarily.
208+
len = GetEnvironmentVariableW(L"PATH", NULL, 0);
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)
207213
{
214+
GetEnvironmentVariableW(L"PATH", buf, len);
215+
_snwprintf(buf2, len2, L"%S;%s", dir, buf);
216+
SetEnvironmentVariableW(L"PATH", buf2);
208217
hLibintlDLL = LoadLibrary(GETTEXT_DLL);
218+
#ifdef GETTEXT_DLL_ALT
209219
if (!hLibintlDLL)
210-
return 0;
220+
hLibintlDLL = LoadLibrary(GETTEXT_DLL_ALT);
221+
#endif
222+
SetEnvironmentVariableW(L"PATH", buf);
211223
}
224+
free(buf);
225+
free(buf2);
226+
if (!hLibintlDLL)
227+
return 0;
212228

213229
// Get the addresses of the functions we need.
214230
for (i = 0; libintl_entry[i].name != NULL

src/GvimExt/gvimext.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include <windows.h>
4343
#include <windowsx.h>
4444
#include <shlobj.h>
45+
#include <wchar.h>
4546

4647
/* Accommodate old versions of VC that don't have a modern Platform SDK */
4748
#if (defined(_MSC_VER) && _MSC_VER < 1300) || !defined(MAXULONG_PTR)

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,8 @@ static char *(features[]) =
747747

748748
static int included_patches[] =
749749
{ /* Add new patch number below this line */
750+
/**/
751+
1383,
750752
/**/
751753
1382,
752754
/**/

0 commit comments

Comments
 (0)