]> git.sesse.net Git - vlc/blobdiff - mozilla/vlcplugin.cpp
Qt4 - Getting rid of useless setCheckState( Qt::Checked ) when setChecked is enough...
[vlc] / mozilla / vlcplugin.cpp
index 05e18f9fa69b396ba52beacbce9f55cb1cb5e79a..afa1399b0022740f9afb6a69ac58fabed56a60bc 100644 (file)
@@ -62,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") );
 }
@@ -70,8 +70,8 @@ static bool boolValue(const char *value) {
 NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
 {
     /* prepare VLC command line */
-    char *ppsz_argv[32] = { "vlc" };
-    int ppsz_argc = 1;
+    char *ppsz_argv[32];
+    int ppsz_argc = 0;
 
     /* locate VLC module path */
 #ifdef XP_MACOSX
@@ -99,10 +99,6 @@ NPError VlcPlugin::init(int argc, char* const argn[], char* const argv[])
     }
     ppsz_argv[ppsz_argc++] = "--no-one-instance";
 
-#if 0
-    ppsz_argv[0] = "C:\\Cygwin\\home\\damienf\\vlc-trunk\\vlc";
-#endif
-
 #endif /* XP_MACOSX */
 
     /* common settings */
@@ -273,7 +269,7 @@ VlcPlugin::~VlcPlugin()
     if( libvlc_log )
         libvlc_log_close(libvlc_log, NULL);
     if( libvlc_instance )
-        libvlc_destroy(libvlc_instance, NULL );
+        libvlc_release(libvlc_instance, NULL );
 }
 
 /*****************************************************************************
@@ -290,15 +286,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:
@@ -365,7 +372,7 @@ relativeurl:
                     return href;
                 }
 
-                /* find last path component and replace it */ 
+                /* find last path component and replace it */
                 while( '/' != *pathend)
                     --pathend;
 
@@ -392,7 +399,7 @@ relativeurl:
                         url = ++p;
                         continue;
                     }
-                    if( '.' != *p ) 
+                    if( '.' != *p )
                         break;
                     ++p;
                     if( '\0' == *p )
@@ -401,7 +408,7 @@ relativeurl:
                     }
                     else
                     {
-                        if( '/' != *p ) 
+                        if( '/' != *p )
                             break;
                         /* relative url starts with '../' */
                         ++p;