]> git.sesse.net Git - vlc/blobdiff - src/misc/modules.c
* String review, round one
[vlc] / src / misc / modules.c
index 1e9d04f14a73c6dc2ae481ecd0d952b567e33273..5046059eb0a9f038fc0f53e03dcb816238ce7877 100644 (file)
@@ -1,8 +1,8 @@
 /*****************************************************************************
  * modules.c : Builtin and plugin modules management functions
  *****************************************************************************
- * Copyright (C) 2001 VideoLAN
- * $Id: modules.c,v 1.137 2003/10/07 09:32:48 gbazin Exp $
+ * Copyright (C) 2001-2004 VideoLAN
+ * $Id: modules.c,v 1.144 2004/01/25 17:16:06 zorglub Exp $
  *
  * Authors: Sam Hocevar <sam@zoy.org>
  *          Ethan C. Baldridge <BaldridgeE@cadmus.com>
@@ -99,7 +99,6 @@
 #include "aout_internal.h"
 
 #include "stream_output.h"
-/*#include "announce.h"*/
 #include "osd.h"
 
 #include "iso_lang.h"
 #else
 #    include "modules_builtin.h"
 #endif
+#include "network.h"
 
 /*****************************************************************************
  * Local prototypes
@@ -288,7 +288,10 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
     /* Deal with variables */
     if( psz_name && psz_name[0] == '$' )
     {
-        psz_var = config_GetPsz( p_this, psz_name + 1 );
+        vlc_value_t val;
+        var_Create( p_this, psz_name + 1, VLC_VAR_MODULE | VLC_VAR_DOINHERIT );
+        var_Get( p_this, psz_name + 1, &val );
+        psz_var = val.psz_string;
         psz_name = psz_var;
     }
 
@@ -675,7 +678,7 @@ static void AllocatePluginDir( vlc_object_t *p_this, const MYCHAR *psz_dir,
     struct dirent * file;
 #endif
 
-    if( i_maxdepth < 0 )
+    if( p_this->p_vlc->b_die || i_maxdepth < 0 )
     {
         return;
     }
@@ -735,7 +738,7 @@ static void AllocatePluginDir( vlc_object_t *p_this, const MYCHAR *psz_dir,
             AllocatePluginFile( p_this, psz_path );
         }
     }
-    while( FindNextFile( handle, &finddata ) );
+    while( !p_this->p_vlc->b_die && FindNextFile( handle, &finddata ) );
 
     /* Close the directory */
     FindClose( handle );
@@ -750,7 +753,7 @@ static void AllocatePluginDir( vlc_object_t *p_this, const MYCHAR *psz_dir,
     i_dirlen = strlen( psz_dir );
 
     /* Parse the directory and try to load all files it contains. */
-    while( (file = readdir( dir )) )
+    while( !p_this->p_vlc->b_die && (file = readdir( dir )) )
     {
         struct stat statbuf;
         unsigned int i_len;
@@ -859,13 +862,12 @@ static int AllocatePluginFile( vlc_object_t * p_this, MYCHAR * psz_file )
     }
 
 #elif defined(HAVE_DL_WINDOWS) && defined(WIN32)
-    char psz_filename[MAX_PATH];
     handle = LoadLibrary( psz_file );
     if( handle == NULL )
     {
         char *psz_error = GetWindowsError();
         msg_Warn( p_this, "cannot load module `%s' (%s)",
-                          psz_filename, psz_error );
+                          psz_file, psz_error );
         free( psz_error );
     }
 
@@ -1156,6 +1158,7 @@ static int CallEntry( module_t * p_module )
 #else
 #   error "Something is wrong in modules.c"
 #endif
+        return -1;
     }
 
     /* We can now try to call the symbol */