]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 7.4.1383 v7.4.1383
authorBram Moolenaar <Bram@vim.org>
Sun, 21 Feb 2016 19:30:22 +0000 (20:30 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 21 Feb 2016 19:30:22 +0000 (20:30 +0100)
Problem:    GvimExt only loads the old libintl.dll.
Solution:   Also try loading libint-8.dll. (Ken Takata, closes #608)

src/GvimExt/gvimext.cpp
src/GvimExt/gvimext.h
src/version.c

index e644443c28eefd8d2577ebbacaa60619cc022fe2..b682b7429f97f20fc613d5071766a6f166045ff0 100644 (file)
@@ -158,6 +158,7 @@ HBITMAP IconToBitmap(HICON hIcon, HBRUSH hBackground, int width, int height)
 # define VIMPACKAGE "vim"
 # ifndef GETTEXT_DLL
 #  define GETTEXT_DLL "libintl.dll"
+#  define GETTEXT_DLL_ALT "libintl-8.dll"
 # endif
 
 // Dummy functions
@@ -194,21 +195,36 @@ dyn_libintl_init(char *dir)
        {(char *)"bindtextdomain",      (FARPROC*)&dyn_libintl_bindtextdomain},
        {NULL, NULL}
     };
+    DWORD      len, len2;
+    LPWSTR     buf = NULL;
+    LPWSTR     buf2 = NULL;
 
     // No need to initialize twice.
     if (hLibintlDLL)
        return 1;
 
-    // Load gettext library, first try the Vim runtime directory, then search
-    // the path.
-    strcat(dir, GETTEXT_DLL);
-    hLibintlDLL = LoadLibrary(dir);
-    if (!hLibintlDLL)
+    // Load gettext library from the Vim runtime directory.
+    // Add the directory to $PATH temporarily.
+    len = GetEnvironmentVariableW(L"PATH", NULL, 0);
+    len2 = MAX_PATH + 1 + len;
+    buf = (LPWSTR)malloc(len * sizeof(WCHAR));
+    buf2 = (LPWSTR)malloc(len2 * sizeof(WCHAR));
+    if (buf != NULL && buf2 != NULL)
     {
+       GetEnvironmentVariableW(L"PATH", buf, len);
+       _snwprintf(buf2, len2, L"%S;%s", dir, buf);
+       SetEnvironmentVariableW(L"PATH", buf2);
        hLibintlDLL = LoadLibrary(GETTEXT_DLL);
+#ifdef GETTEXT_DLL_ALT
        if (!hLibintlDLL)
-           return 0;
+           hLibintlDLL = LoadLibrary(GETTEXT_DLL_ALT);
+#endif
+       SetEnvironmentVariableW(L"PATH", buf);
     }
+    free(buf);
+    free(buf2);
+    if (!hLibintlDLL)
+       return 0;
 
     // Get the addresses of the functions we need.
     for (i = 0; libintl_entry[i].name != NULL
index 426cae588d100b5dbcaf527c960d6f41ac653b6d..e17f2ac2c946eeda7d52dca09bc99a8b4a3108ac 100644 (file)
@@ -42,6 +42,7 @@
 #include <windows.h>
 #include <windowsx.h>
 #include <shlobj.h>
+#include <wchar.h>
 
 /* Accommodate old versions of VC that don't have a modern Platform SDK */
 #if (defined(_MSC_VER) && _MSC_VER < 1300) || !defined(MAXULONG_PTR)
index 5e6878f2fc1dd55d58646513d7ef38cf9a953c14..27d8c92cab1baa21bbc6ae9130e5b10b2466f836 100644 (file)
@@ -747,6 +747,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1383,
 /**/
     1382,
 /**/