Changeset 7f42e055f359bbb4d136c1b5c554baa2b23b52a2
- Timestamp:
- 10/21/07 13:06:37
(11 months ago)
- Author:
- Rémi Denis-Courmont <rem@videolan.org>
- git-committer:
- Rémi Denis-Courmont <rem@videolan.org> 1192964797 +0000
- git-parent:
[6ea1a2709641da5ec5c27367ff9110823fc08c82]
- git-author:
- Rémi Denis-Courmont <rem@videolan.org> 1192964797 +0000
- Message:
Changing the order of parameters may be needed, but changing the parameters themselves is definitely not (it would crash in some cases anyway): add some const qualifiers
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r6144922 |
r7f42e05 |
|
| 38 | 38 | /* Global properties */ |
|---|
| 39 | 39 | int i_argc; ///< command line arguments count |
|---|
| 40 | | char ** ppsz_argv; ///< command line arguments |
|---|
| | 40 | const char ** ppsz_argv; ///< command line arguments |
|---|
| 41 | 41 | |
|---|
| 42 | 42 | char * psz_homedir; ///< user's home directory |
|---|
| rf20aa2b |
r7f42e05 |
|
| 251 | 251 | * \return VLC_SUCCESS on success |
|---|
| 252 | 252 | */ |
|---|
| 253 | | VLC_PUBLIC_API int VLC_Init( int, int, char *[] ); |
|---|
| | 253 | VLC_PUBLIC_API int VLC_Init( int, int, const char *[] ); |
|---|
| 254 | 254 | |
|---|
| 255 | 255 | /** |
|---|
| r7d25008 |
r7f42e05 |
|
| 91 | 91 | if( !p_new ) RAISENULL( "Out of memory" ); |
|---|
| 92 | 92 | |
|---|
| | 93 | const char *my_argv[argc + 2]; |
|---|
| | 94 | |
|---|
| | 95 | my_argv[0] = "libvlc"; /* dummy arg0, skipped by getopt() et al */ |
|---|
| | 96 | for( int i = 0; i < argc; i++ ) |
|---|
| | 97 | my_argv[i + 1] = argv[i]; |
|---|
| | 98 | my_argv[argc + 1] = NULL; /* C calling conventions require a NULL */ |
|---|
| | 99 | |
|---|
| 93 | 100 | /** \todo Look for interface settings. If we don't have any, add -I dummy */ |
|---|
| 94 | 101 | /* Because we probably don't want a GUI by default */ |
|---|
| 95 | 102 | |
|---|
| 96 | | if( libvlc_InternalInit( p_libvlc_int, argc, argv ) ) |
|---|
| | 103 | if( libvlc_InternalInit( p_libvlc_int, argc + 1, my_argv ) ) |
|---|
| 97 | 104 | RAISENULL( "VLC initialization failed" ); |
|---|
| 98 | 105 | |
|---|
| r7b32ae1 |
r7f42e05 |
|
| 40 | 40 | ***************************************************************************/ |
|---|
| 41 | 41 | VLC_EXPORT (libvlc_int_t *, libvlc_InternalCreate, ( void ) ); |
|---|
| 42 | | VLC_EXPORT (int, libvlc_InternalInit, ( libvlc_int_t *, int, char *ppsz_argv[] ) ); |
|---|
| | 42 | VLC_EXPORT (int, libvlc_InternalInit, ( libvlc_int_t *, int, const char *ppsz_argv[] ) ); |
|---|
| 43 | 43 | VLC_EXPORT (int, libvlc_InternalCleanup, ( libvlc_int_t * ) ); |
|---|
| 44 | 44 | VLC_EXPORT (int, libvlc_InternalDestroy, ( libvlc_int_t *, vlc_bool_t ) ); |
|---|
| r1995f88 |
r7f42e05 |
|
| 106 | 106 | #endif |
|---|
| 107 | 107 | static inline int LoadMessages (void); |
|---|
| 108 | | static int GetFilenames ( libvlc_int_t *, int, char *[] ); |
|---|
| | 108 | static int GetFilenames ( libvlc_int_t *, int, const char *[] ); |
|---|
| 109 | 109 | static void Help ( libvlc_int_t *, char const *psz_help_name ); |
|---|
| 110 | 110 | static void Usage ( libvlc_int_t *, char const *psz_module_name ); |
|---|
| … | … | |
| 236 | 236 | * - configuration and commandline parsing |
|---|
| 237 | 237 | */ |
|---|
| 238 | | int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, char *ppsz_argv[] ) |
|---|
| | 238 | int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc, |
|---|
| | 239 | const char *ppsz_argv[] ) |
|---|
| 239 | 240 | { |
|---|
| 240 | 241 | char p_capabilities[200]; |
|---|
| … | … | |
| 1239 | 1240 | * An option always follows its associated input and begins with a ":". |
|---|
| 1240 | 1241 | *****************************************************************************/ |
|---|
| 1241 | | static int GetFilenames( libvlc_int_t *p_vlc, int i_argc, char *ppsz_argv[] ) |
|---|
| | 1242 | static int GetFilenames( libvlc_int_t *p_vlc, int i_argc, const char *ppsz_argv[] ) |
|---|
| 1242 | 1243 | { |
|---|
| 1243 | 1244 | int i_opt, i_options; |
|---|
| … | … | |
| 1260 | 1261 | |
|---|
| 1261 | 1262 | VLC_AddTarget( p_vlc->i_object_id, ppsz_argv[i_opt], |
|---|
| 1262 | | (char const **)( i_options ? &ppsz_argv[i_opt + 1] : |
|---|
| | 1263 | ( i_options ? &ppsz_argv[i_opt + 1] : |
|---|
| 1263 | 1264 | NULL ), i_options, |
|---|
| 1264 | 1265 | PLAYLIST_INSERT, 0 ); |
|---|
| r1502ec1 |
r7f42e05 |
|
| 116 | 116 | * - configuration and commandline parsing |
|---|
| 117 | 117 | *****************************************************************************/ |
|---|
| 118 | | int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] ) |
|---|
| | 118 | int VLC_Init( int i_object, int i_argc, const char *ppsz_argv[] ) |
|---|
| 119 | 119 | { |
|---|
| 120 | 120 | int i_ret; |
|---|
| rb3bc5c6 |
r7f42e05 |
|
| 1402 | 1402 | * options used (ie. exported) by each module. |
|---|
| 1403 | 1403 | *****************************************************************************/ |
|---|
| 1404 | | int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, char *ppsz_argv[], |
|---|
| | 1404 | int __config_LoadCmdLine( vlc_object_t *p_this, int *pi_argc, |
|---|
| | 1405 | const char *ppsz_argv[], |
|---|
| 1405 | 1406 | vlc_bool_t b_ignore_errors ) |
|---|
| 1406 | 1407 | { |
|---|
| … | … | |
| 1481 | 1482 | if( b_ignore_errors ) |
|---|
| 1482 | 1483 | { |
|---|
| 1483 | | ppsz_argv = (char**)malloc( *pi_argc * sizeof(char *) ); |
|---|
| | 1484 | ppsz_argv = (const char**)malloc( *pi_argc * sizeof(char *) ); |
|---|
| 1484 | 1485 | if( ppsz_argv == NULL ) |
|---|
| 1485 | 1486 | { |
|---|
| … | … | |
| 1589 | 1590 | opterr = 0; |
|---|
| 1590 | 1591 | optind = 0; /* set to 0 to tell GNU getopt to reinitialize */ |
|---|
| 1591 | | while( ( i_cmd = getopt_long( *pi_argc, ppsz_argv, psz_shortopts, |
|---|
| | 1592 | while( ( i_cmd = getopt_long( *pi_argc, (char **)ppsz_argv, psz_shortopts, |
|---|
| 1592 | 1593 | p_longopts, &i_index ) ) != -1 ) |
|---|
| 1593 | 1594 | { |
|---|
| r62ffefd |
r7f42e05 |
|
| 43 | 43 | #define config_LoadConfigFile(a,b) __config_LoadConfigFile(VLC_OBJECT(a),b) |
|---|
| 44 | 44 | |
|---|
| 45 | | int __config_LoadCmdLine ( vlc_object_t *, int *, char *[], vlc_bool_t ); |
|---|
| | 45 | int __config_LoadCmdLine ( vlc_object_t *, int *, const char *[], vlc_bool_t ); |
|---|
| 46 | 46 | char *config_GetHomeDir ( void ); |
|---|
| 47 | 47 | char *config_GetConfigDir ( libvlc_int_t * ); |
|---|
| r892e5a5 |
r7f42e05 |
|
| 60 | 60 | * main: parse command line, start interface and spawn threads. |
|---|
| 61 | 61 | *****************************************************************************/ |
|---|
| 62 | | int main( int i_argc, char *ppsz_argv[] ) |
|---|
| | 62 | int main( int i_argc, const char *ppsz_argv[] ) |
|---|
| 63 | 63 | { |
|---|
| 64 | 64 | int i_ret; |
|---|