[vlc-commits] Freetype/dwrite: fix compilation with XP SDK

Jean-Baptiste Kempf git at videolan.org
Fri May 18 00:22:40 CEST 2018


vlc/vlc-3.0 | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri May 18 00:22:16 2018 +0200| [2ee8bd694345bcbf21802a3444571d9a4fc07c43] | committer: Jean-Baptiste Kempf

Freetype/dwrite: fix compilation with XP SDK

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=2ee8bd694345bcbf21802a3444571d9a4fc07c43
---

 modules/text_renderer/freetype/fonts/dwrite.cpp | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/modules/text_renderer/freetype/fonts/dwrite.cpp b/modules/text_renderer/freetype/fonts/dwrite.cpp
index 6f30c9ac45..c3dbde56b2 100644
--- a/modules/text_renderer/freetype/fonts/dwrite.cpp
+++ b/modules/text_renderer/freetype/fonts/dwrite.cpp
@@ -359,8 +359,20 @@ static bool DWrite_PartialMatch( filter_t *p_filter, ComPtr< IDWriteLocalizedStr
     wchar_t buff_sys[ LOCALE_NAME_MAX_LENGTH ] = {};
     wchar_t buff_usr[ LOCALE_NAME_MAX_LENGTH ] = {};
 
-    GetSystemDefaultLocaleName( buff_sys, LOCALE_NAME_MAX_LENGTH );
-    GetUserDefaultLocaleName( buff_usr, LOCALE_NAME_MAX_LENGTH );
+    HMODULE h_dll = GetModuleHandle(_T("kernel32.dll"));
+
+    typedef int ( WINAPI *GetUserDefaultLocaleName )( LPWSTR lpLocaleName, int cchLocaleName );
+    GetUserDefaultLocaleName OurGetUserDefaultLocaleName =
+        (GetUserDefaultLocaleName) GetProcAddress( h_dll, "GetUserDefaultLocaleName" );
+
+    typedef int ( WINAPI *GetSystemDefaultLocaleName )( LPWSTR lpLocaleName, int cchLocaleName );
+    GetSystemDefaultLocaleName OurGetSystemDefaultLocaleName =
+        (GetSystemDefaultLocaleName) GetProcAddress( h_dll, "GetSystemDefaultLocaleName" );
+
+    if( OurGetSystemDefaultLocaleName )
+        OurGetSystemDefaultLocaleName( buff_sys, LOCALE_NAME_MAX_LENGTH );
+    if( OurGetUserDefaultLocaleName )
+        OurGetUserDefaultLocaleName( buff_usr, LOCALE_NAME_MAX_LENGTH );
 
     const wchar_t *pp_locales[] = { L"en-US", buff_sys, buff_usr };
 



More information about the vlc-commits mailing list