[vlc-devel] commit: Work around the mingw linker ( Rémi Denis-Courmont )

git version control git at videolan.org
Tue May 27 18:35:24 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rem at videolan.org> | Tue May 27 19:36:59 2008 +0300| [73a3e8a92011955d41e7a0858d9fb77d68e6fbb6]

Work around the mingw linker

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=73a3e8a92011955d41e7a0858d9fb77d68e6fbb6
---

 src/winvlc.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/src/winvlc.c b/src/winvlc.c
index 20011cd..6f065a9 100644
--- a/src/winvlc.c
+++ b/src/winvlc.c
@@ -173,12 +173,21 @@ static char **vlc_parse_cmdline( const char *psz_cmdline, int *i_args )
 # define wWinMain WinMain
 #endif
 
+#ifdef IF_MINGW_SUPPORTED_UNICODE
 /*****************************************************************************
  * wWinMain: parse command line, start interface and spawn threads.
  *****************************************************************************/
 int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
                     LPWSTR lpCmdLine, int nCmdShow )
 {
+#else
+int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
+                    LPSTR args, int nCmdShow )
+{
+    /* This makes little sense, but at least it links properly */
+    wchar_t lpCmdLine[strlen(args) * 3];
+    MultiByteToWideChar( CP_ACP, 0, args, -1, lpCmdLine, sizeof(lpCmdLine) );
+#endif
     char **argv, psz_cmdline[wcslen(lpCmdLine) * 4];
     int argc, ret;
 
@@ -187,7 +196,7 @@ int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
     fprintf( stderr, "VLC media player %s\n", libvlc_get_version() );
 
     WideCharToMultiByte( CP_UTF8, 0, lpCmdLine, -1,
-                         psz_cmdline, MAX_PATH, NULL, NULL );
+                         psz_cmdline, sizeof (psz_cmdline), NULL, NULL );
     argv = vlc_parse_cmdline( psz_cmdline, &argc );
 
     libvlc_exception_t ex;




More information about the vlc-devel mailing list