]> git.sesse.net Git - vlc/blobdiff - mozilla/vlcplugin.cpp
Removes trailing spaces. Removes tabs.
[vlc] / mozilla / vlcplugin.cpp
index 71af56480913a4cbfdeda879c8222f5f927d53fc..4af2bffb528744efb85c4dcdf6a1568a8db88cf9 100644 (file)
@@ -48,7 +48,6 @@ VlcPlugin::VlcPlugin( NPP instance, uint16 mode ) :
     libvlc_instance(NULL),
     libvlc_log(NULL),
     p_scriptClass(NULL),
-    p_scriptObject(NULL),
     p_browser(instance),
     psz_baseURL(NULL)
 #if XP_WIN
@@ -63,7 +62,7 @@ VlcPlugin::VlcPlugin( NPP instance, uint16 mode ) :
 }
 
 static bool boolValue(const char *value) {
-    return ( !strcmp(value, "1") || 
+    return ( !strcmp(value, "1") ||
              !strcasecmp(value, "true") ||
              !strcasecmp(value, "yes") );
 }
@@ -91,7 +90,7 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
          {
              if( i_type == REG_SZ )
              {
-                 strcat( p_data, "\\plugins" );
+                 strcat( p_data, "\\plugins000" );
                  ppsz_argv[ppsz_argc++] = "--plugin-path";
                  ppsz_argv[ppsz_argc++] = p_data;
              }
@@ -99,22 +98,8 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
          RegCloseKey( h_key );
     }
     ppsz_argv[ppsz_argc++] = "--no-one-instance";
-    if( IsDebuggerPresent() )
-    {
-        /*
-        ** VLC default threading mechanism is designed to be as compatible
-        ** with POSIX as possible. However when debugged on win32, threads
-        ** lose signals and eventually VLC get stuck during initialization.
-        ** threading support can be configured to be more debugging friendly
-        ** but it will be less compatible with POSIX.
-        ** This is done by initializing with the following options:
-        */
-        ppsz_argv[ppsz_argc++] = "--fast-mutex";
-        ppsz_argv[ppsz_argc++] = "--win9x-cv-method=1";
-    }
 
-
-#if 0
+#if 1
     ppsz_argv[0] = "C:\\Cygwin\\home\\damienf\\vlc-trunk\\vlc";
 #endif
 
@@ -285,8 +270,6 @@ VlcPlugin::~VlcPlugin()
 {
     delete psz_baseURL;
     delete psz_target;
-    if( p_scriptObject )
-        NPN_ReleaseObject(p_scriptObject);
     if( libvlc_log )
         libvlc_log_close(libvlc_log, NULL);
     if( libvlc_instance )
@@ -307,15 +290,26 @@ char *VlcPlugin::getAbsoluteURL(const char *url)
         {
             // validate protocol header
             const char *start = url;
-            while( start != end ) {
-                char c = tolower(*start);
-                if( (c < 'a') || (c > 'z') )
-                    // not valid protocol header, assume relative URL
-                    goto relativeurl;
+            char c = *start;
+            if( isalpha(c) )
+            {
                 ++start;
+                while( start != end )
+                {
+                    c  = *start;
+                    if( ! (isalnum(c)
+                       || ('-' == c)
+                       || ('+' == c)
+                       || ('.' == c)
+                       || ('/' == c)) ) /* VLC uses / to allow user to specify a demuxer */
+                        // not valid protocol header, assume relative URL
+                        goto relativeurl;
+                    ++start;
+                }
+                /* we have a protocol header, therefore URL is absolute */
+                return strdup(url);
             }
-            /* we have a protocol header, therefore URL is absolute */
-            return strdup(url);
+            // not a valid protocol header, assume relative URL
         }
 
 relativeurl:
@@ -382,7 +376,7 @@ relativeurl:
                     return href;
                 }
 
-                /* find last path component and replace it */ 
+                /* find last path component and replace it */
                 while( '/' != *pathend)
                     --pathend;
 
@@ -409,7 +403,7 @@ relativeurl:
                         url = ++p;
                         continue;
                     }
-                    if( '.' != *p ) 
+                    if( '.' != *p )
                         break;
                     ++p;
                     if( '\0' == *p )
@@ -418,7 +412,7 @@ relativeurl:
                     }
                     else
                     {
-                        if( '/' != *p ) 
+                        if( '/' != *p )
                             break;
                         /* relative url starts with '../' */
                         ++p;
@@ -441,15 +435,6 @@ relativeurl:
     return NULL;
 }
 
-NPObject* VlcPlugin::getScriptObject()
-{
-    if( NULL == p_scriptObject )
-    {
-        p_scriptObject = NPN_CreateObject(p_browser, p_scriptClass);
-    }
-    return NPN_RetainObject(p_scriptObject);
-}
-
 #if XP_UNIX
 int  VlcPlugin::setSize(unsigned width, unsigned height)
 {