[Top][All Lists]
[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-1446-g6e41e71 |
Date: |
Sun, 25 Mar 2012 22:49:31 +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 6e41e716f4efa1138d8f5920400bb35bcc43d53b (commit)
from f12f354a44a462dc870390921b0a16c0314072ec (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=6e41e716f4efa1138d8f5920400bb35bcc43d53b
commit 6e41e716f4efa1138d8f5920400bb35bcc43d53b
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
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:
plugin/npapi/GnashNPVariant.h | 13 +++++++++++++
plugin/npapi/plugin.cpp | 21 +++++++--------------
2 files changed, 20 insertions(+), 14 deletions(-)
hooks/post-receive
--
Gnash
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-1446-g6e41e71,
Bastiaan Jacques <=