gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-


From: Bastiaan Jacques
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-1448-g906b0cf
Date: Sun, 25 Mar 2012 22:55:22 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  906b0cf93d4e487b0c3aa193dbd9da8dbc51be15 (commit)
       via  e32d5beb72befd4b4e22f464d8ab6ddbf08b69d2 (commit)
      from  6e41e716f4efa1138d8f5920400bb35bcc43d53b (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=906b0cf93d4e487b0c3aa193dbd9da8dbc51be15


commit 906b0cf93d4e487b0c3aa193dbd9da8dbc51be15
Merge: e32d5be 6e41e71
Author: Bastiaan Jacques <address@hidden>
Date:   Mon Mar 26 00:55:13 2012 +0200

    Merge branch 'master' of git.sv.gnu.org:/srv/git/gnash


http://git.savannah.gnu.org/cgit//commit/?id=e32d5beb72befd4b4e22f464d8ab6ddbf08b69d2


commit e32d5beb72befd4b4e22f464d8ab6ddbf08b69d2
Author: Bastiaan Jacques <address@hidden>
Date:   Mon Mar 26 00:40:10 2012 +0200

    Check that an NPVariant is an NPString before trying to use it as such. Bug 
#36002.

diff --git a/plugin/npapi/GnashNPVariant.h b/plugin/npapi/GnashNPVariant.h
index 6e4b1af..a0d37d4 100644
--- a/plugin/npapi/GnashNPVariant.h
+++ b/plugin/npapi/GnashNPVariant.h
@@ -89,6 +89,19 @@ NPStringToString(const NPString& str)
     return std::string(GetNPStringChars(str), GetNPStringLen(str));
 }
 
+/// Construct a std::string from an NPVariant.
+//
+/// @return a std::string containing the string value of the NPVariant, if it
+///         is an NPString; otherwise an empty string.
+inline std::string
+NPVariantToString(const NPVariant& val)
+{
+    if (!NPVARIANT_IS_STRING(val)) {
+        return std::string();
+    }
+
+    return NPStringToString(NPVARIANT_TO_STRING(val));
+}
 
 /// This class holds ownership of (a copy of) an NPVariant.
 //
diff --git a/plugin/npapi/plugin.cpp b/plugin/npapi/plugin.cpp
index 2cceee8..dc597f1 100644
--- a/plugin/npapi/plugin.cpp
+++ b/plugin/npapi/plugin.cpp
@@ -824,14 +824,12 @@ nsPluginInstance::processPlayerRequest()
             assert(invoke->args.size() > 1);
             
             // The first argument is the URL string.
-            std::string url = NPStringToString(NPVARIANT_TO_STRING(
-                                                   invoke->args[0].get()));
+            std::string url = NPVariantToString(invoke->args[0].get());
 #if 0
             gnash::log_debug("Got a getURL() request: %s", url);
 #endif
             // The second is the method, namely GET or POST.
-            std::string op = NPStringToString(NPVARIANT_TO_STRING(
-                                                  invoke->args[1].get()));
+            std::string op = NPVariantToString(invoke->args[1].get());
             // The third is the optional target, which is something like
             // _blank or _self.
             std::string target;
@@ -841,8 +839,7 @@ nsPluginInstance::processPlayerRequest()
             std::string data;
             
             if (invoke->args.size() >= 3) {
-                target = NPStringToString(NPVARIANT_TO_STRING(
-                                              invoke->args[2].get()));
+                target = NPVariantToString(invoke->args[2].get());
             }
             
             // An empty target defaults to "_self"
@@ -851,8 +848,7 @@ nsPluginInstance::processPlayerRequest()
             if ( target.empty() ) target = "_self";
             
             if (invoke->args.size() == 4) {
-                data = NPStringToString(NPVARIANT_TO_STRING(
-                                            invoke->args[3].get()));
+                data = NPVariantToString(invoke->args[3].get());
             }
             if (op == "GET") {
                 gnash::log_debug("Asked to getURL '%s' in target %s", url,
@@ -871,10 +867,8 @@ nsPluginInstance::processPlayerRequest()
         } else if (invoke->name == "fsCommand") {
             
             assert(invoke->args.size() > 1);
-            std::string command = NPStringToString(NPVARIANT_TO_STRING(
-                                                       invoke->args[0].get()));
-            std::string arg = NPStringToString(NPVARIANT_TO_STRING(
-                                                   invoke->args[1].get()));    
        
+            std::string command = NPVariantToString(invoke->args[0].get());
+            std::string arg = NPVariantToString(invoke->args[1].get());        
    
             std::string name = _name; 
             std::stringstream jsurl;
             jsurl << "javascript:" << name << "_DoFSCommand('" << command
@@ -900,8 +894,7 @@ nsPluginInstance::processPlayerRequest()
             // actual callback lives in libcore/movie_root, but it
             // needs to be on the list of supported remote methods so
             // it can be called by Javascript.
-            std::string method = NPStringToString(NPVARIANT_TO_STRING(
-                                                      invoke->args[0].get()));
+            std::string method = NPVariantToString(invoke->args[0].get());
             NPIdentifier id = NPN_GetStringIdentifier(method.c_str());
             // log_debug("SCRIPT OBJECT addMethod: %x, %s", (void 
*)_scriptObject, method);
             this->getScriptObject()->AddMethod(id, remoteCallback);

-----------------------------------------------------------------------

Summary of changes:


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]