]> git.sesse.net Git - vlc/blobdiff - projects/mozilla/control/npolibvlc.cpp
macosx-port: removed compatibility code for outdated versions of OS X
[vlc] / projects / mozilla / control / npolibvlc.cpp
index 3084d3e4f296364c35b0dcc84899e0861426ec65..5b2c58cdd6b58255fcd73468a65935412bcd9d0c 100644 (file)
@@ -458,6 +458,7 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::getProperty(int index, NPVari
             {
                 /* for input state, return CLOSED rather than an exception */
                 INT32_TO_NPVARIANT(0, result);
+                libvlc_exception_clear(&ex);
                 return INVOKERESULT_NO_ERROR;
             }
         }
@@ -1130,7 +1131,7 @@ RuntimeNPObject::InvokeResult LibvlcLogNPObject::setProperty(int index, const NP
                     int verbosity = numberValue(value);
                     if( verbosity >= 0 )
                     {
-                        if( ! p_log )
+                        if( !p_log )
                         {
                             p_log = libvlc_log_open(p_libvlc, &ex);
                             if( libvlc_exception_raised(&ex) )
@@ -1207,7 +1208,9 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistItemsNPObject::getProperty(int index
         {
             case ID_playlistitems_count:
             {
+                libvlc_playlist_lock(p_plugin->getVLC());
                 int val = libvlc_playlist_items_count(p_plugin->getVLC(), &ex);
+                libvlc_playlist_unlock(p_plugin->getVLC());
                 if( libvlc_exception_raised(&ex) )
                 {
                     NPN_SetException(this, libvlc_exception_get_message(&ex));
@@ -1332,7 +1335,9 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::getProperty(int index, NPV
         {
             case ID_playlist_itemcount: /* deprecated */
             {
+                libvlc_playlist_lock(p_plugin->getVLC());
                 int val = libvlc_playlist_items_count(p_plugin->getVLC(), &ex);
+                libvlc_playlist_unlock(p_plugin->getVLC());
                 if( libvlc_exception_raised(&ex) )
                 {
                     NPN_SetException(this, libvlc_exception_get_message(&ex));
@@ -1344,7 +1349,9 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::getProperty(int index, NPV
             }
             case ID_playlist_isplaying:
             {
+                libvlc_playlist_lock(p_plugin->getVLC());
                 int val = libvlc_playlist_isplaying(p_plugin->getVLC(), &ex);
+                libvlc_playlist_unlock(p_plugin->getVLC());
                 if( libvlc_exception_raised(&ex) )
                 {
                     NPN_SetException(this, libvlc_exception_get_message(&ex));
@@ -1423,7 +1430,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
                     {
                         url = p_plugin->getAbsoluteURL(s);
                         if( url )
-                            delete s;
+                            free(s);
                         else
                             // problem with combining url, use argument
                             url = s;
@@ -1449,7 +1456,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
                     }
                     else
                     {
-                        delete url;
+                       free(url);
                         return INVOKERESULT_INVALID_VALUE;
                     }
                 }
@@ -1475,25 +1482,25 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
                     }
                     else
                     {
-                        delete url;
-                        delete name;
+                       free(url);
+                        free(name);
                         return INVOKERESULT_INVALID_VALUE;
                     }
                 }
 
-                int item = libvlc_playlist_add_extended(p_plugin->getVLC(),
-                                                        url,
-                                                        name,
-                                                        i_options,
-                                                        const_cast<const char **>(ppsz_options),
-                                                        &ex);
-                delete url;
-                delete name;
+                int item = libvlc_playlist_add_extended_untrusted(p_plugin->getVLC(),
+                                                                  url,
+                                                                  name,
+                                                                  i_options,
+                                                                  const_cast<const char **>(ppsz_options),
+                                                                  &ex);
+                free(url);
+                free(name);
                 for( int i=0; i< i_options; ++i )
                 {
-                    delete ppsz_options[i];
+                    free(ppsz_options[i]);
                 }
-                delete ppsz_options;
+                free(ppsz_options);
 
                 if( libvlc_exception_raised(&ex) )
                 {
@@ -1695,7 +1702,7 @@ void LibvlcPlaylistNPObject::parseOptions(const NPString &nps, int *i_options, c
                             if( ! moreOptions )
                             {
                                 /* failed to allocate more memory */
-                                delete s;
+                               free(s);
                                 /* return what we got so far */
                                 *i_options = nOptions;
                                 *ppsz_options = options;
@@ -1713,7 +1720,7 @@ void LibvlcPlaylistNPObject::parseOptions(const NPString &nps, int *i_options, c
                 *i_options = nOptions;
                 *ppsz_options = options;
             }
-            delete s;
+            free(s);
         }
     }
 }
@@ -1985,7 +1992,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
                 }
 
                 libvlc_video_set_aspect_ratio(p_md, psz_aspect, &ex);
-                delete psz_aspect;
+                free(psz_aspect);
                 libvlc_media_player_release(p_md);
 
                 if( libvlc_exception_raised(&ex) )
@@ -2032,7 +2039,7 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::setProperty(int index, const
                 }
 
                 libvlc_video_set_crop_geometry(p_md, psz_geometry, &ex);
-                delete psz_geometry;
+                free(psz_geometry);
                 libvlc_media_player_release(p_md);
 
                 if( libvlc_exception_raised(&ex) )
@@ -2162,4 +2169,3 @@ RuntimeNPObject::InvokeResult LibvlcVideoNPObject::invoke(int index, const NPVar
     }
     return INVOKERESULT_GENERIC_ERROR;
 }
-