[vlc-commits] [Git][videolan/vlc][master] 4 commits: winvlc: avoid FromWide conversion on static strings

Steve Lhomme (@robUx4) gitlab at videolan.org
Thu Dec 7 10:18:46 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
53d8a81b by Steve Lhomme at 2023-12-07T09:51:33+00:00
winvlc: avoid FromWide conversion on static strings

- - - - -
8c250b6f by Steve Lhomme at 2023-12-07T09:51:33+00:00
winvlc: avoid FromWide conversion for the language

We can keep the original wide char and use %ls to generate the LANG environment.

- - - - -
b10437cb by Steve Lhomme at 2023-12-07T09:51:33+00:00
winvlc: don't define locally HeapEnableTerminationOnCorruption

It's supported in all the mingw-w64 version we support:
https://github.com/mingw-w64/mingw-w64/commit/92a31baf45409a783d8dc2e6a7609982c9e86fcf

- - - - -
6e87bfd4 by Steve Lhomme at 2023-12-07T09:51:33+00:00
winvlc: use the enum policy when it's known

At some point HAVE_PROCESS_MITIGATION_IMAGE_LOAD_POLICY will go away
since we will only support mingw-w64 versions that have it.

https://github.com/mingw-w64/mingw-w64/commit/36d7b92bbcec1e72d3ce24013b01f7acc34be3b0

- - - - -


1 changed file:

- bin/winvlc.c


Changes:

=====================================
bin/winvlc.c
=====================================
@@ -39,7 +39,6 @@
 #include <fcntl.h>
 #include <io.h>
 #include <shlobj.h>
-#define HeapEnableTerminationOnCorruption (HEAP_INFORMATION_CLASS)1
 
 #ifdef HAVE_BREAKPAD
 void CheckCrashDump( const wchar_t* crashdump_path );
@@ -105,7 +104,11 @@ static void PrioritizeSystem32(void)
 #endif
     PROCESS_MITIGATION_IMAGE_LOAD_POLICY m = { .Flags = 0 };
     m.PreferSystem32Images = 1;
-    SetProcessMitigationPolicy( 10 /* ProcessImageLoadPolicy */, &m, sizeof( m ) );
+#if defined(__MINGW64_VERSION_MAJOR) && __MINGW64_VERSION_MAJOR < 6
+    SetProcessMitigationPolicy( (PROCESS_MITIGATION_POLICY)10, &m, sizeof( m ) );
+#else
+    SetProcessMitigationPolicy( ProcessImageLoadPolicy, &m, sizeof( m ) );
+#endif
 }
 
 static void vlc_kill(void *data)
@@ -165,10 +168,10 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
     char *argv[argc + 3];
     BOOL crash_handling = TRUE;
     int j = 0;
-    char *lang = NULL;
+    WCHAR *lang = NULL;
 
-    argv[j++] = FromWide( L"--media-library" );
-    argv[j++] = FromWide( L"--no-ignore-config" );
+    argv[j++] = strdup("--media-library");
+    argv[j++] = strdup("--no-ignore-config");
     for (int i = 1; i < argc; i++)
     {
         if(!wcscmp(wargv[i], L"--no-crashdump"))
@@ -179,7 +182,7 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
         if (!wcsncmp(wargv[i], L"--language", 10) )
         {
             if (i < argc - 1 && wcsncmp( wargv[i + 1], L"--", 2 ))
-                lang = FromWide (wargv[++i]);
+                lang = _wcsdup (wargv[++i]);
             continue;
         }
 
@@ -220,14 +223,14 @@ int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
             WCHAR szData[256];
             DWORD len = 256;
             if( RegQueryValueEx( h_key, TEXT("Lang"), NULL, NULL, (LPBYTE) &szData, &len ) == ERROR_SUCCESS )
-                lang = FromWide( szData );
+                lang = _wcsdup( szData );
         }
     }
 
-    if (lang && strncmp( lang, "auto", 4 ) )
+    if (lang && wcsncmp( lang, L"auto", 4 ) )
     {
         char tmp[11];
-        snprintf(tmp, 11, "LANG=%s", lang);
+        snprintf(tmp, 11, "LANG=%ls", lang);
         putenv(tmp);
     }
     free(lang);



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fe1c5da7bf9154afca6f2f6feba075e9c33c3ee4...6e87bfd484e28d50dd694e87786de35dafe29d33

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fe1c5da7bf9154afca6f2f6feba075e9c33c3ee4...6e87bfd484e28d50dd694e87786de35dafe29d33
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list