Changeset b19b539f6b5b250d79da8c2704a30a1016c0d9c5

Show
Ignore:
Timestamp:
05/23/08 17:43:57 (3 months ago)
Author:
Rémi Denis-Courmont <rem@videolan.org>
git-committer:
Rémi Denis-Courmont <rem@videolan.org> 1211557437 +0300
git-parent:

[ab67a5346fe9ce156eb4fe1e79861e261fde0a0f]

git-author:
Rémi Denis-Courmont <rem@videolan.org> 1211557437 +0300
Message:

VLC: remove win32 stuff

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/vlc.c

    rd6b76f6 rb19b539  
    11/***************************************************************************** 
    2  * vlc.c: the vlc player 
     2 * vlc.c: the VLC player 
    33 ***************************************************************************** 
    4  * Copyright (C) 1998-2004 the VideoLAN team 
     4 * Copyright (C) 1998-2008 the VideoLAN team 
    55 * $Id$ 
    66 * 
     
    4040extern char *FromLocale (const char *); 
    4141 
    42  
    43 /***************************************************************************** 
    44  * Local prototypes. 
    45  *****************************************************************************/ 
    46 #ifdef WIN32 
    47 #include <windows.h> 
    48 extern void __wgetmainargs(int *argc, wchar_t ***wargv, wchar_t ***wenviron, 
    49                            int expand_wildcards, int *startupinfo); 
    50 #else 
    51  
    5242# include <signal.h> 
    5343# include <time.h> 
     
    5545 
    5646static void *SigHandler (void *set); 
    57 #endif 
    5847 
    5948/***************************************************************************** 
     
    8877#endif 
    8978 
    90 #if !defined(WIN32) && !defined(UNDER_CE) 
    9179    /* Synchronously intercepted POSIX signals. 
    9280     * 
     
    131119 
    132120    pthread_create (&sigth, NULL, SigHandler, &set); 
    133 #endif 
    134  
    135 #ifdef WIN32 
    136     /* Replace argv[1..n] with unicode for Windows NT and above */ 
    137     if( GetVersion() < 0x80000000 ) 
    138     { 
    139         wchar_t **wargv, **wenvp; 
    140         int i,i_wargc; 
    141         int si = { 0 }; 
    142         __wgetmainargs(&i_wargc, &wargv, &wenvp, 0, &si); 
    143  
    144         for( i = 0; i < i_wargc; i++ ) 
    145         { 
    146             int len = WideCharToMultiByte(CP_UTF8, 0, wargv[i], -1, NULL, 0, NULL, NULL); 
    147             if( len > 0 ) 
    148             { 
    149                 if( len > 1 ) { 
    150                     char *utf8arg = (char *)malloc(len); 
    151                     if( NULL != utf8arg ) 
    152                     { 
    153                         WideCharToMultiByte(CP_UTF8, 0, wargv[i], -1, utf8arg, len, NULL, NULL); 
    154                         ppsz_argv[i] = utf8arg; 
    155                     } 
    156                     else 
    157                     { 
    158                         /* failed!, quit */ 
    159                         return 1; 
    160                     } 
    161                 } 
    162                 else 
    163                 { 
    164                     ppsz_argv[i] = strdup (""); 
    165                 } 
    166             } 
    167             else 
    168             { 
    169                 /* failed!, quit */ 
    170                 return 1; 
    171             } 
    172         } 
    173     } 
    174     else 
    175 #endif 
    176     { 
    177         /* Note that FromLocale() can be used before libvlc is initialized */ 
    178         for (int i = 0; i < i_argc; i++) 
    179             if ((ppsz_argv[i] = FromLocale (ppsz_argv[i])) == NULL) 
    180                 return 1; // BOOM! 
    181     } 
     121 
     122    /* Note that FromLocale() can be used before libvlc is initialized */ 
     123    for (int i = 0; i < i_argc; i++) 
     124        if ((ppsz_argv[i] = FromLocale (ppsz_argv[i])) == NULL) 
     125            return 1; // BOOM! 
    182126 
    183127    libvlc_exception_t ex; 
     
    200144        LocaleFree (ppsz_argv[i]); 
    201145 
    202 #if !defined(WIN32) && !defined(UNDER_CE) 
    203146    pthread_cancel (sigth); 
    204147# ifdef __APPLE__ 
     
    209152# endif 
    210153    pthread_join (sigth, NULL); 
    211 #endif 
    212154 
    213155    return i_ret; 
    214156} 
    215157 
    216 #if !defined(WIN32) && !defined(UNDER_CE) 
    217158/***************************************************************************** 
    218159 * SigHandler: system signal handler 
     
    278219    /* Never reached */ 
    279220} 
    280 #endif 
    281  
    282 #if defined(UNDER_CE) 
    283 #   if defined( _MSC_VER ) && defined( UNDER_CE ) 
    284 #       include "vlc_common.h" 
    285 #   endif 
    286 /***************************************************************************** 
    287  * WinMain: parse command line, start interface and spawn threads. (WinCE only) 
    288  *****************************************************************************/ 
    289 int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, 
    290                     LPTSTR lpCmdLine, int nCmdShow ) 
    291 { 
    292     char **argv, psz_cmdline[MAX_PATH]; 
    293     int argc, i_ret; 
    294  
    295     WideCharToMultiByte( CP_ACP, 0, lpCmdLine, -1, 
    296                          psz_cmdline, MAX_PATH, NULL, NULL ); 
    297  
    298     argv = vlc_parse_cmdline( psz_cmdline, &argc ); 
    299     argv = realloc( argv, (argc + 1) * sizeof(char *) ); 
    300     if( !argv ) return -1; 
    301  
    302     if( argc ) memmove( argv + 1, argv, argc * sizeof(char *) ); 
    303     argv[0] = ""; /* Fake program path */ 
    304  
    305     i_ret = main( argc + 1, argv ); 
    306  
    307     /* No need to free the argv memory */ 
    308     return i_ret; 
    309 } 
    310 #endif