[vlc-devel] commit: mozilla: don't allocate a zero sized array. (Jean-Paul Saman )

git version control git at videolan.org
Fri Jul 24 14:28:34 CEST 2009


vlc | branch: master | Jean-Paul Saman <jpsaman at videolan.org> | Sun Jun 14 00:09:45 2009 +0200| [d145d1c98243320d7b67cb262f36e256fa44b0ea] | committer: Jean-Paul Saman 

mozilla: don't allocate a zero sized array.

(cherry-picked from commit aed48363a478e9767a374154d703d7c84857707b)

Conflict:
	projects/mozilla/control/npolibvlc.cpp

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d145d1c98243320d7b67cb262f36e256fa44b0ea
---

 projects/mozilla/control/npolibvlc.cpp |   28 +++++++++++++++++++++++++++-
 projects/mozilla/control/npolibvlc.h   |    2 ++
 2 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/projects/mozilla/control/npolibvlc.cpp b/projects/mozilla/control/npolibvlc.cpp
index f904509..f92e8c4 100644
--- a/projects/mozilla/control/npolibvlc.cpp
+++ b/projects/mozilla/control/npolibvlc.cpp
@@ -588,10 +588,33 @@ LibvlcInputNPObject::setProperty(int index, const NPVariant &value)
 const NPUTF8 * const LibvlcInputNPObject::methodNames[] =
 {
     /* no methods */
+    "none",
 };
-
 COUNTNAMES(LibvlcInputNPObject,methodCount,methodNames);
 
+enum LibvlcInputNPObjectMethodIds
+{
+    ID_none,
+};
+
+RuntimeNPObject::InvokeResult
+LibvlcInputNPObject::invoke(int index, const NPVariant *args,
+                                    uint32_t argCount, NPVariant &result)
+{
+    /* is plugin still running */
+    if( isPluginRunning() )
+    {
+        switch( index )
+        {
+            case ID_none:
+                return INVOKERESULT_NO_SUCH_METHOD;
+            default:
+                ;
+        }
+    }
+    return INVOKERESULT_GENERIC_ERROR;
+}
+
 /*
 ** implementation of libvlc playlist items object
 */
@@ -803,6 +826,9 @@ LibvlcPlaylistNPObject::invoke(int index, const NPVariant *args,
                     return INVOKERESULT_NO_SUCH_METHOD;
 
                 // grab URL
+                if( NPVARIANT_IS_NULL(args[0]) )
+                    return INVOKERESULT_NO_SUCH_METHOD;
+
                 char *s = stringValue(NPVARIANT_TO_STRING(args[0]));
                 if( !s )
                     return INVOKERESULT_OUT_OF_MEMORY;
diff --git a/projects/mozilla/control/npolibvlc.h b/projects/mozilla/control/npolibvlc.h
index ccd035f..2fc3107 100644
--- a/projects/mozilla/control/npolibvlc.h
+++ b/projects/mozilla/control/npolibvlc.h
@@ -99,6 +99,8 @@ protected:
 
     static const int methodCount;
     static const NPUTF8 * const methodNames[];
+
+    InvokeResult invoke(int index, const NPVariant *args, uint32_t argCount, NPVariant &result);
 };
 
 class LibvlcPlaylistItemsNPObject: public RuntimeNPObject




More information about the vlc-devel mailing list