Use libvlc_playlist_add_extended_untrusted in mozilla plugin.
[vlc.git] / projects / mozilla / control / npolibvlc.cpp
index cd3efb3..516bb8b 100644 (file)
@@ -117,11 +117,11 @@ RuntimeNPObject::InvokeResult LibvlcRootNPObject::getProperty(int index, NPVaria
                 return INVOKERESULT_NO_ERROR;
             case ID_root_VersionInfo:
             {
-                int len = strlen(VLC_Version());
+                int len = strlen(libvlc_get_version());
                 NPUTF8 *retval =(NPUTF8*)NPN_MemAlloc(len);
                 if( retval )
                 {
-                    memcpy(retval, VLC_Version(), len);
+                    memcpy(retval, libvlc_get_version(), len);
                     STRINGN_TO_NPVARIANT(retval, len, result);
                 }
                 else
@@ -162,11 +162,11 @@ RuntimeNPObject::InvokeResult LibvlcRootNPObject::invoke(int index, const NPVari
             case ID_root_versionInfo:
                 if( argCount == 0 )
                 {
-                    int len = strlen(VLC_Version());
+                    int len = strlen(libvlc_get_version());
                     NPUTF8 *retval =(NPUTF8*)NPN_MemAlloc(len);
                     if( retval )
                     {
-                        memcpy(retval, VLC_Version(), len);
+                        memcpy(retval, libvlc_get_version(), len);
                         STRINGN_TO_NPVARIANT(retval, len, result);
                     }
                     else
@@ -603,11 +603,11 @@ RuntimeNPObject::InvokeResult LibvlcInputNPObject::setProperty(int index, const
             }
             case ID_input_time:
             {
-                vlc_int64_t val;
+                int64_t val;
                 if( NPVARIANT_IS_INT32(value) )
-                    val = (vlc_int64_t)NPVARIANT_TO_INT32(value);
+                    val = (int64_t)NPVARIANT_TO_INT32(value);
                 else if( NPVARIANT_IS_DOUBLE(value) )
-                    val = (vlc_int64_t)NPVARIANT_TO_DOUBLE(value);
+                    val = (int64_t)NPVARIANT_TO_DOUBLE(value);
                 else
                 {
                     libvlc_media_player_release(p_md);
@@ -1423,7 +1423,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 +1449,7 @@ RuntimeNPObject::InvokeResult LibvlcPlaylistNPObject::invoke(int index, const NP
                     }
                     else
                     {
-                        delete url;
+                       free(url);
                         return INVOKERESULT_INVALID_VALUE;
                     }
                 }
@@ -1475,25 +1475,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 +1695,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 +1713,7 @@ void LibvlcPlaylistNPObject::parseOptions(const NPString &nps, int *i_options, c
                 *i_options = nOptions;
                 *ppsz_options = options;
             }
-            delete s;
+            free(s);
         }
     }
 }
@@ -1985,7 +1985,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 +2032,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) )