]> git.sesse.net Git - vlc/blobdiff - src/misc/modules.c
More cleanup
[vlc] / src / misc / modules.c
index bea7566a48c74939be88a99ca858d58ff2ec690c..f9cf9be1d96ec80d49d641418da2804b6c28cbb3 100644 (file)
@@ -21,7 +21,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /* Some faulty libcs have a broken struct dirent when _FILE_OFFSET_BITS
@@ -79,6 +79,7 @@
 #include "vlc_error.h"
 
 #include "vlc_interface.h"
+#include "vlc_interaction.h"
 #include "intf_eject.h"
 
 #include "vlc_playlist.h"
 #include "aout_internal.h"
 
 #include "stream_output.h"
-#include "osd.h"
 #include "vlc_httpd.h"
+#include "vlc_acl.h"
 #include "vlc_tls.h"
 #include "vlc_md5.h"
 #include "vlc_xml.h"
+#include "vlc_url.h"
 
 #include "iso_lang.h"
 #include "charset.h"
 #include "vlc_vlm.h"
 
 #include "vlc_image.h"
+#include "vlc_osd.h"
+
+#include "vlc_update.h"
+#include "vlc_strings.h"
 
 #if defined( _MSC_VER ) && defined( UNDER_CE )
 #    include "modules_builtin_evc.h"
@@ -192,7 +198,7 @@ void __module_InitBank( vlc_object_t *p_this )
     /*
      * Store the symbols to be exported
      */
-#ifdef HAVE_DYNAMIC_PLUGINS
+#if defined (HAVE_DYNAMIC_PLUGINS) && !defined (HAVE_SHARED_LIBVLC)
     STORE_SYMBOLS( &p_bank->symbols );
 #endif
 
@@ -676,7 +682,7 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
 
     if( p_module != NULL )
     {
-        msg_Dbg( p_module, "using %s module \"%s\"",
+        msg_Dbg( p_this, "using %s module \"%s\"",
                  psz_capability, p_module->psz_object_name );
     }
     else if( p_first == NULL )
@@ -687,7 +693,7 @@ module_t * __module_Need( vlc_object_t *p_this, const char *psz_capability,
                  psz_capability, (psz_name && *psz_name) ? psz_name : "any" );
         }
         else
-        {  
+        {
             msg_Err( p_this, "no %s module matched \"%s\"",
                  psz_capability, (psz_name && *psz_name) ? psz_name : "any" );
         }
@@ -726,7 +732,7 @@ void __module_Unneed( vlc_object_t * p_this, module_t * p_module )
         p_module->pf_deactivate( p_this );
     }
 
-    msg_Dbg( p_module, "unlocking module \"%s\"", p_module->psz_object_name );
+    msg_Dbg( p_this, "removing module \"%s\"", p_module->psz_object_name );
 
     vlc_object_release( p_module );
 
@@ -761,7 +767,7 @@ static void AllocateAllPlugins( vlc_object_t *p_this )
     {
         if( !(*ppsz_path)[0] ) continue;
 
-#if defined( SYS_BEOS ) || defined( SYS_DARWIN ) || defined( WIN32 )
+#if defined( SYS_BEOS ) || defined( __APPLE__ ) || defined( WIN32 )
 
         /* Handle relative as well as absolute paths */
 #ifdef WIN32
@@ -874,8 +880,9 @@ static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir,
         sprintf( psz_path, "%s\\%s", psz_dir, finddata.cFileName );
 #endif
 
-        /* Skip ".", ".." and anything starting with "." */
-        if( !*finddata.cFileName || *finddata.cFileName == '.' )
+        /* Skip ".", ".." */
+        if( !*finddata.cFileName || !strcmp( finddata.cFileName, "." )
+         || !strcmp( finddata.cFileName, ".." ) )
         {
             if( !FindNextFile( handle, &finddata ) ) break;
             continue;
@@ -939,8 +946,9 @@ static void AllocatePluginDir( vlc_object_t *p_this, const char *psz_dir,
         unsigned int i_len;
         int i_stat;
 
-        /* Skip ".", ".." and anything starting with "." */
-        if( !*file->d_name || *file->d_name == '.' )
+        /* Skip ".", ".." */
+        if( !*file->d_name || !strcmp( file->d_name, "." )
+         || !strcmp( file->d_name, ".." ) )
         {
             continue;
         }
@@ -1088,7 +1096,9 @@ static module_t * AllocatePlugin( vlc_object_t * p_this, char * psz_file )
     /* We need to fill these since they may be needed by CallEntry() */
     p_module->psz_filename = psz_file;
     p_module->handle = handle;
+#ifndef HAVE_SHARED_LIBVLC
     p_module->p_symbols = &p_this->p_libvlc->p_module_bank->symbols;
+#endif
     p_module->b_loaded = VLC_TRUE;
 
     /* Initialize the module: fill p_module, default config */
@@ -1298,7 +1308,7 @@ static int CallEntry( module_t * p_module )
     {
         /* With a well-written module we shouldn't have to print an
          * additional error message here, but just make sure. */
-        msg_Err( p_module, "failed calling symbol \"%s\" in file `%s'",
+        msg_Err( p_module, "Failed to call symbol \"%s\" in file `%s'",
                            psz_name, p_module->psz_filename );
         return -1;
     }
@@ -1619,7 +1629,7 @@ static void CacheLoad( vlc_object_t *p_this )
 
     msg_Dbg( p_this, "loading plugins cache file %s", psz_filename );
 
-    file = fopen( psz_filename, "rb" );
+    file = utf8_fopen( psz_filename, "rb" );
     if( !file )
     {
         msg_Warn( p_this, "could not open plugins cache file %s for reading",
@@ -1941,7 +1951,7 @@ static void CacheSave( vlc_object_t *p_this )
 
     strcat( psz_filename, "/CACHEDIR.TAG" );
 
-    file = fopen( psz_filename, "wb" );
+    file = utf8_fopen( psz_filename, "wb" );
     if( file )
     {
         fwrite( psz_tag, 1, strlen(psz_tag), file );
@@ -1953,7 +1963,7 @@ static void CacheSave( vlc_object_t *p_this )
 
     msg_Dbg( p_this, "saving plugins cache file %s", psz_filename );
 
-    file = fopen( psz_filename, "wb" );
+    file = utf8_fopen( psz_filename, "wb" );
     if( !file )
     {
         msg_Warn( p_this, "could not open plugins cache file %s for writing",
@@ -2120,17 +2130,11 @@ void CacheSaveConfig( module_t *p_module, FILE *file )
 static char *CacheName( void )
 {
     static char psz_cachename[32];
-    static vlc_bool_t b_initialised = VLC_FALSE;
-
-    if( !b_initialised )
-    {
-        /* Code int size, pointer size and endianness in the filename */
-        int32_t x = 0xbe00001e;
-        sprintf( psz_cachename, "plugins-%.2x%.2x%.2x.dat", sizeof(int),
-                 sizeof(void *), (unsigned int)((unsigned char *)&x)[0] );
-        b_initialised = VLC_TRUE;
-    }
 
+    /* Code int size, pointer size and endianness in the filename */
+    int32_t x = 0xbe00001e;
+    sprintf( psz_cachename, "plugins-%.2x%.2x%.2x.dat", sizeof(int),
+             sizeof(void *), (unsigned int)((unsigned char *)&x)[0] );
     return psz_cachename;
 }
 
@@ -2144,7 +2148,9 @@ static void CacheMerge( vlc_object_t *p_this, module_t *p_cache,
 
     p_cache->pf_activate = p_module->pf_activate;
     p_cache->pf_deactivate = p_module->pf_deactivate;
+#ifndef HAVE_SHARED_LIBVLC
     p_cache->p_symbols = p_module->p_symbols;
+#endif
     p_cache->handle = p_module->handle;
 
     for( i_submodule = 0; i_submodule < p_module->i_children; i_submodule++ )
@@ -2153,7 +2159,9 @@ static void CacheMerge( vlc_object_t *p_this, module_t *p_cache,
         module_t *p_cchild = (module_t*)p_cache->pp_children[i_submodule];
         p_cchild->pf_activate = p_child->pf_activate;
         p_cchild->pf_deactivate = p_child->pf_deactivate;
+#ifndef HAVE_SHARED_LIBVLC
         p_cchild->p_symbols = p_child->p_symbols;
+#endif
     }
 
     p_cache->b_loaded = VLC_TRUE;