[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] gnash ChangeLog server/vm/ASHandlers.cpp |
Date: |
Fri, 23 May 2008 11:23:31 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Benjamin Wolsey <bwy> 08/05/23 11:23:31
Modified files:
. : ChangeLog
server/vm : ASHandlers.cpp
Log message:
* server/vm/ASHandlers.cpp: drop many dead, old debugging
messages,
drop all to_debug_string() and c_str() in logging (except
log_trace,
comment added). Use to_int() instead of to_number() more.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6687&r2=1.6688
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.240&r2=1.241
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6687
retrieving revision 1.6688
diff -u -b -r1.6687 -r1.6688
--- ChangeLog 23 May 2008 11:00:49 -0000 1.6687
+++ ChangeLog 23 May 2008 11:23:29 -0000 1.6688
@@ -1,3 +1,9 @@
+2008-05-23 Benjamin Wolsey <address@hidden>
+
+ * server/vm/ASHandlers.cpp: drop many dead, old debugging messages,
+ drop all to_debug_string() and c_str() in logging (except log_trace,
+ comment added). Use to_int() instead of to_number() more.
+
2008-05-23 Bastiaan Jacques <address@hidden>
* backend/render_handler_cairo.cpp: Unlike AGG, the Cairo renderer
Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.240
retrieving revision 1.241
diff -u -b -r1.240 -r1.241
--- server/vm/ASHandlers.cpp 23 May 2008 09:23:41 -0000 1.240
+++ server/vm/ASHandlers.cpp 23 May 2008 11:23:30 -0000 1.241
@@ -53,16 +53,15 @@
#include <unistd.h> // For write() on BSD
#include <string>
-#include <map>
-#include <set>
#include <vector>
-#include <utility> // for std::pair
#include <locale>
#include <cerrno>
+#include <cstdlib> // std::mbstowcs
#include <boost/scoped_array.hpp>
#include <boost/random.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <boost/lexical_cast.hpp>
+#include <algorithm> // std::swap
namespace {
#ifdef USE_DEBUGGER
@@ -111,7 +110,7 @@
_stack_args(0),
_arg_format(ARG_NONE)
{
-// GNASH_REPORT_FUNCTION;
+
}
ActionHandler::ActionHandler(action_type type, action_callback_t func)
@@ -122,7 +121,7 @@
_stack_args(0),
_arg_format(ARG_NONE)
{
-// GNASH_REPORT_FUNCTION;
+
}
ActionHandler::ActionHandler(action_type type, std::string name,
@@ -135,14 +134,14 @@
_stack_args(0),
_arg_format(ARG_NONE)
{
-// GNASH_REPORT_FUNCTION;
+
}
ActionHandler::ActionHandler(action_type type, std::string name,
action_callback_t func, as_arg_t format)
: _debug(false), _stack_args(0)
{
-// GNASH_REPORT_FUNCTION;
+
_name = name;
_type = type;
_callback = func;
@@ -153,7 +152,7 @@
action_callback_t func, as_arg_t format, int
nargs)
: _debug(false)
{
-// GNASH_REPORT_FUNCTION;
+
_name = name;
_type = type;
_callback = func;
@@ -169,7 +168,7 @@
SWFHandlers::SWFHandlers()
{
-// GNASH_REPORT_FUNCTION;
+
using std::string;
@@ -415,7 +414,7 @@
SWFHandlers::~SWFHandlers()
{
-// GNASH_REPORT_FUNCTION;
+
}
@@ -444,7 +443,6 @@
void
SWFHandlers::execute(action_type type, ActionExec& thread) const
{
-// GNASH_REPORT_FUNCTION;
// It is very heavy operation
// if ( _handlers[type].getName() == "unsupported" ) return false;
try {
@@ -458,9 +456,7 @@
void
SWFHandlers::ActionEnd(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
- //as_environment& env = thread.env;
#ifndef NDEBUG
const action_buffer& code = thread.code;
assert( code[thread.pc] == SWF::ACTION_END );
@@ -469,10 +465,11 @@
log_error (_("%s: CHECKME: was broken"), __PRETTY_FUNCTION__);
thread.next_pc=thread.stop_pc;
}
+
+
void
SWFHandlers::ActionNextFrame(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
@@ -489,7 +486,6 @@
void
SWFHandlers::ActionPrevFrame(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
@@ -506,7 +502,6 @@
void
SWFHandlers::ActionPlay(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
@@ -523,7 +518,6 @@
void
SWFHandlers::ActionStop(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
@@ -541,9 +535,7 @@
void
SWFHandlers::ActionToggleQuality(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
- //as_environment& env = thread.env;
#ifndef NDEBUG
const action_buffer& code = thread.code;
assert( code[thread.pc] == SWF::ACTION_TOGGLEQUALITY );
@@ -555,9 +547,6 @@
void
SWFHandlers::ActionStopSounds(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
-
- //as_environment& env = thread.env;
#ifndef NDEBUG
const action_buffer& code = thread.code;
@@ -574,7 +563,6 @@
void
SWFHandlers::ActionGotoFrame(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
const action_buffer& code = thread.code;
@@ -593,7 +581,7 @@
void
SWFHandlers::ActionGetUrl(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
const action_buffer& code = thread.code;
@@ -623,7 +611,6 @@
void
SWFHandlers::ActionWaitForFrame(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
const action_buffer& code = thread.code;
@@ -669,15 +656,11 @@
thread.skip_actions(skip);
}
- //log_debug(_("%s: testing"), __PRETTY_FUNCTION__);
}
void
SWFHandlers::ActionSetTarget(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
-
- //as_environment& env = thread.env;
const action_buffer& code = thread.code;
size_t pc = thread.pc;
@@ -693,7 +676,7 @@
void
SWFHandlers::ActionGotoLabel(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
const action_buffer& code = thread.code;
@@ -714,9 +697,6 @@
void
SWFHandlers::ActionAdd(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
-
- //env.top(1) += env.top(0); //original version
as_environment& env = thread.env;
thread.ensureStack(2);
@@ -729,7 +709,6 @@
void
SWFHandlers::ActionSubtract(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
// env.top(1) -= env.top(0); //original version
@@ -744,9 +723,6 @@
void
SWFHandlers::ActionMultiply(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
-
- // env.top(1) *= env.top(0); //original version
as_environment& env = thread.env;
thread.ensureStack(2);
@@ -759,9 +735,6 @@
void
SWFHandlers::ActionDivide(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
-//
- // env.top(1) /= env.top(0); //original version
as_environment& env = thread.env;
thread.ensureStack(2);
@@ -782,7 +755,7 @@
void
SWFHandlers::ActionEqual(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
assert(thread.code[thread.pc] == SWF::ACTION_EQUAL); // 0x0E
@@ -803,7 +776,7 @@
void
SWFHandlers::ActionLessThan(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2);
env.top(1).set_bool(env.top(1).to_number() < env.top(0).to_number());
@@ -817,7 +790,7 @@
void
SWFHandlers::ActionLogicalAnd(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2);
env.top(1).set_bool(env.top(1).to_bool() && env.top(0).to_bool());
@@ -827,7 +800,7 @@
void
SWFHandlers::ActionLogicalOr(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2);
env.top(1).set_bool(env.top(1).to_bool() || env.top(0).to_bool());
@@ -837,7 +810,7 @@
void
SWFHandlers::ActionLogicalNot(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(1);
env.top(0).set_bool(! env.top(0).to_bool());
@@ -849,7 +822,7 @@
void
SWFHandlers::ActionStringEq(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2);
const int version = env.get_version();
@@ -863,7 +836,7 @@
void
SWFHandlers::ActionStringLength(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(1);
const int version = env.get_version();
@@ -970,7 +943,7 @@
void
SWFHandlers::ActionPop(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
// this is an overhead only if SWF is malformed.
thread.ensureStack(1);
@@ -980,7 +953,6 @@
void
SWFHandlers::ActionInt(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
thread.ensureStack(1);
env.top(0).set_int((env.top(0).to_int()));
@@ -989,7 +961,6 @@
void
SWFHandlers::ActionGetVariable(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
thread.ensureStack(1); // variable name
@@ -1007,7 +978,7 @@
IF_VERBOSE_ACTION
(
log_action(_("-- get var: %s=%s"),
- var_string.c_str(),
+ var_string,
top_value);
);
#ifdef USE_DEBUGGER
@@ -1018,7 +989,6 @@
void
SWFHandlers::ActionSetVariable(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
@@ -1029,7 +999,7 @@
thread.setVariable(name, env.top(0));
IF_VERBOSE_ACTION (
- log_action(_("-- set var: %s = %s"), name.c_str(), env.top(0));
+ log_action(_("-- set var: %s = %s"), name, env.top(0));
);
// TODO: move this to ActionExec::setVariable !
@@ -1044,7 +1014,6 @@
void
SWFHandlers::ActionSetTargetExpression(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
@@ -1063,7 +1032,7 @@
void
SWFHandlers::ActionStringConcat(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2); // two strings
@@ -1077,7 +1046,7 @@
void
SWFHandlers::ActionGetProperty(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2); // prop num, target
@@ -1107,11 +1076,9 @@
if ( prop_number < get_property_names().size() )
{
as_value val;
- // TODO: check if get_propery_names() can return a
string
- // directly.
assert( get_property_names().size() );
- std::string propname =
get_property_names()[prop_number].c_str();
- //target->get_member(propname &val);
+ std::string propname = get_property_names()[prop_number];
+
thread.getObjectMember(*target, propname, val);
env.top(1) = val;
}
@@ -1137,7 +1104,7 @@
void
SWFHandlers::ActionSetProperty(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(3); // prop val, prop num, target
@@ -1147,11 +1114,11 @@
as_value prop_val = env.top(0);
if (target) {
-// set_property(target, prop_number, env.top(0));
+
if ( prop_number < get_property_names().size() )
{
// TODO: check if get_property_names() return a string&
- std::string member_name = get_property_names()[prop_number].c_str();
+ std::string member_name = get_property_names()[prop_number];
thread.setObjectMember(*target, member_name, prop_val);
}
else
@@ -1167,7 +1134,7 @@
{
IF_VERBOSE_ASCODING_ERRORS (
log_aserror(_("ActionSetProperty: can't find target %s for setting
property %s"),
- env.top(2), get_property_names()[prop_number].c_str());
+ env.top(2), get_property_names()[prop_number]);
)
}
@@ -1182,7 +1149,7 @@
thread.ensureStack(3);
- int depth = int(env.top(0).to_number())+character::staticDepthOffset;
// TODO: use to_int ?
+ const int depth = env.top(0).to_int() + character::staticDepthOffset;
const std::string& newname = env.top(1).to_string();
const std::string& path = env.top(2).to_string();
@@ -1191,7 +1158,7 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("Path given to duplicateMovieClip(%s) doesn't
point to a character"),
- path.c_str());
+ path);
);
env.drop(3);
return;
@@ -1202,7 +1169,7 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("Path given to duplicateMovieClip(%s) is not a
sprite"),
- path.c_str());
+ path);
);
env.drop(3);
return;
@@ -1215,19 +1182,19 @@
void
SWFHandlers::ActionRemoveClip(ActionExec& thread)
{
- //GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(1);
- std::string path = env.pop().to_string();
+ const std::string path = env.pop().to_string();
character* ch = env.find_target(path);
if ( ! ch )
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("Path given to removeMovieClip(%s) doesn't point
to a character"),
- path.c_str());
+ path);
);
return;
}
@@ -1237,7 +1204,7 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("Path given to removeMovieClip(%s) is not a
sprite"),
- path.c_str());
+ path);
);
return;
}
@@ -1249,20 +1216,23 @@
void
SWFHandlers::ActionTrace(ActionExec& thread)
{
-//// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(1);
- //std::string val =
env.pop().to_string_versioned(VM::get().getSWFVersion(), &env);
- std::string val = env.pop().to_string();
+ const std::string val = env.pop().to_string();
+
+ /// Logging with a std::string here fails the swfdec testsuite, probably
because
+ /// the first 0 character terminates the output with a c_str, whereas a
std::string
+ /// outputs the entire length of the string.
log_trace("%s", val.c_str());
}
void
SWFHandlers::ActionStartDragMovie(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
assert(thread.code[thread.pc] == SWF::ACTION_STARTDRAGMOVIE);
@@ -1337,7 +1307,7 @@
void
SWFHandlers::ActionStopDragMovie(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
sprite_instance *root_movie = env.get_target()->get_root();
assert(root_movie);
@@ -1347,7 +1317,7 @@
void
SWFHandlers::ActionStringCompare(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2);
const int ver = env.get_version();
@@ -1358,7 +1328,7 @@
void
SWFHandlers::ActionThrow(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
// Throw the value on the top of the stack.
@@ -1371,7 +1341,7 @@
void
SWFHandlers::ActionCastOp(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
@@ -1417,7 +1387,7 @@
void
SWFHandlers::ActionImplementsOp(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
// TODO: This doesn't work quite right, yet.
as_environment& env = thread.env;
@@ -1450,7 +1420,7 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("IMPLEMENTSOP target object's prototype is not an
object (%s)"),
- protoval.to_debug_string());
+ protoval);
);
return;
}
@@ -1472,7 +1442,7 @@
if ( ! ctor )
{
IF_VERBOSE_ASCODING_ERRORS(
- log_aserror(_("class found on stack on IMPLEMENTSOP is
not an object: %s"), ctorval.to_debug_string());
+ log_aserror(_("class found on stack on IMPLEMENTSOP is not an
object: %s"), ctorval);
);
continue;
}
@@ -1488,14 +1458,14 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("Prototype of interface object for
IMPLEMENTSOP is not an object (%s)."),
- protoval.to_debug_string());
+ protoval);
);
continue;
}
IF_VERBOSE_ACTION(
log_action("%s (with .prototype %p) implements %s (with
.prototype %p)",
- objval.to_debug_string(), (void*)obj,
ctorval.to_debug_string(),
+ objval, (void*)obj, ctorval,
(void*)inter);
);
obj->add_interface(inter);
@@ -1505,7 +1475,7 @@
void
SWFHandlers::ActionFscommand2(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
assert(thread.code[thread.pc] == SWF::ACTION_FSCOMMAND2); // 0x0E
@@ -1514,17 +1484,17 @@
unsigned int off=0;
thread.ensureStack(1); // nargs
- unsigned int nargs = env.top(off++).to_int();
+ const unsigned int nargs = env.top(off++).to_int();
thread.ensureStack(off+nargs+1); // nargs, cmdname, actual args
std::string cmd = env.top(off++).to_string();
- std::stringstream ss;
+ std::ostringstream ss;
ss << cmd << "(";
- for (unsigned int i=1; i<nargs; ++i)
+ for (unsigned int i = 1; i < nargs; ++i)
{
as_value arg = env.top(off++);
- if ( i>1 ) ss << ", ";
+ if ( i > 1 ) ss << ", ";
ss << arg;
}
ss << ")";
@@ -1540,7 +1510,6 @@
void
SWFHandlers::ActionRandom(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
// Action random(n) should return an integer from 0 up to (not
// including) n.
@@ -1551,7 +1520,7 @@
thread.ensureStack(1); // max
- int max = int(env.top(0).to_number()); // TODO: use to_int ?
+ int max = env.top(0).to_int();
if (max < 1) max = 1;
@@ -1652,7 +1621,7 @@
}
// It's something else.
- length = mbstowcs(NULL, str.c_str(), 0);
+ length = std::mbstowcs(NULL, str.c_str(), 0);
if (length == -1)
{
length = str.length();
@@ -1663,7 +1632,7 @@
void
SWFHandlers::ActionMbLength(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(1);
@@ -1686,7 +1655,7 @@
void
SWFHandlers::ActionOrd(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(1);
@@ -1752,7 +1721,7 @@
void
SWFHandlers::ActionGetTimer(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
env.push(VM::get().getTime());
@@ -1761,7 +1730,7 @@
void
SWFHandlers::ActionMbSubString(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(3);
@@ -1790,7 +1759,7 @@
as_encoding_guess_t encoding = guessEncoding(str, length, offsets);
- //log_debug("Guessed encoding for %s: %d - len:%d, offsets.size:%d",
str.c_str(), encoding, length, offsets.size());
+ //log_debug("Guessed encoding for %s: %d - len:%d, offsets.size:%d", str,
encoding, length, offsets.size());
//for (int i=0; i<offsets.size(); ++i) log_debug(" offsets[%d]: %d", i,
offsets[i]);
if (size < 0)
@@ -1906,7 +1875,7 @@
void
SWFHandlers::ActionWaitForFrameExpression(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
const action_buffer& code = thread.code;
@@ -1959,7 +1928,7 @@
void
SWFHandlers::ActionPushData(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
enum {
@@ -2116,7 +2085,7 @@
{
id = code[3 + i];
i++;
- if ( id < (int) code.dictionary_size() )
+ if ( id < static_cast<int>(code.dictionary_size()) )
{
env.push( code.dictionary_get(id) );
}
@@ -2135,7 +2104,7 @@
{
id = code.read_int16(i+3);
i += 2;
- if ( id < (int) code.dictionary_size() )
+ if ( id < static_cast<int>(code.dictionary_size()) )
{
env.push( code.dictionary_get(id) );
}
@@ -2168,7 +2137,7 @@
void
SWFHandlers::ActionBranchAlways(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
boost::int16_t offset = thread.code.read_int16(thread.pc+3);
thread.next_pc += offset;
@@ -2282,8 +2251,8 @@
const URL& baseurl = get_base_url();
URL url(url_s, baseurl);
- log_debug(_("get url: target=%s, url=%s (%s), method=%x (sendVars:%X,
loadTarget:%d, loadVariable:%d)"), target_string.c_str(),
- url.str().c_str(), url_c, (int)method, sendVarsMethod,
loadTargetFlag, loadVariableFlag);
+ log_debug(_("get url: target=%s, url=%s (%s), method=%x (sendVars:%X,
loadTarget:%d, loadVariable:%d)"), target_string,
+ url.str(), url_c, static_cast<int>(method), sendVarsMethod,
loadTargetFlag, loadVariableFlag);
if ( ! URLAccessManager::allow(url) )
{
@@ -2327,7 +2296,7 @@
if ( ! target_ch )
{
log_error(_("get url: target %s not found"),
- target_string.c_str());
+ target_string);
// might want to invoke the external url opener here...
return;
}
@@ -2335,7 +2304,7 @@
if ( ! target_movie )
{
log_error(_("get url: target %s is not a sprite"),
- target_string.c_str());
+ target_string);
// might want to invoke the external url opener here...
return;
}
@@ -2375,7 +2344,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("Unknown loadMovie target: %s"),
- target_string.c_str());
+ target_string);
);
// TESTED: Even if the target is created right-after
@@ -2390,7 +2359,7 @@
if ( ! target_movie )
{
log_error(_("get url: target %s is not a sprite"),
- target_string.c_str());
+ target_string);
return;
}
@@ -2475,16 +2444,16 @@
boost::replace_all(command, "%u", safeurl);
- log_debug (_("Launching URL... %s"), command.c_str());
+ log_debug (_("Launching URL... %s"), command);
system(command.c_str());
}
else
{
//log_debug("user-provided host requests fd is %d", hostfd);
- std::stringstream request;
+ std::ostringstream request;
- // use the original url, non parsed (the browser will know
better how to resolve relative urls and handle hactionscript)
- //request << "GET " << url << endl;
+ // use the original url, non parsed (the browser will know better how
to resolve
+ // relative urls and handle hactionscript)
request << "GET " << target_string << ":" << url_c << std::endl;
std::string requestString = request.str();
@@ -2533,7 +2502,7 @@
log_aserror(
_("Couldn't find movie \"%s\" to set target to!"
" Resetting to original target..."),
- target_name.c_str());
+ target_name);
);
return;
}
@@ -2546,7 +2515,7 @@
void
SWFHandlers::ActionGetUrl2(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2); // target, url
@@ -2574,7 +2543,6 @@
void
SWFHandlers::ActionBranchIfTrue(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
// Alias these
as_environment& env = thread.env;
@@ -2639,7 +2607,7 @@
log_aserror(_(
"Couldn't find target_sprite \"%s\" in ActionCallFrame!"
" target frame actions will not be called..."),
- target_path.c_str());
+ target_path);
)
}
@@ -2649,7 +2617,7 @@
void
SWFHandlers::ActionGotoExpression(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
@@ -2702,7 +2670,7 @@
log_aserror(_("Frame spec found on stack "
"at ActionGotoExpression doesn't evaluate "
"to a valid frame: %s"),
- target_frame.c_str());
+ target_frame);
);
return;
}
@@ -2715,7 +2683,7 @@
log_aserror(_(
"Couldn't find target sprite \"%s\" in
ActionGotoExpression. "
" Will not go to target frame..."),
- target_frame.c_str());
+ target_frame);
)
}
}
@@ -2771,7 +2739,7 @@
void
SWFHandlers::ActionVarEquals(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2); // value, var
@@ -2780,7 +2748,7 @@
thread.setLocalVariable(varname.to_string(), value);
IF_VERBOSE_ACTION (
- log_action(_("-- set local var: %s = %s"), varname.to_string().c_str(),
value);
+ log_action(_("-- set local var: %s = %s"), varname.to_string(), value);
);
env.drop(2);
@@ -2789,7 +2757,7 @@
void
SWFHandlers::ActionCallFunction(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
std::string function_name;
@@ -2797,7 +2765,6 @@
//log_debug("ActionCallFunction: %s", env.top(0));
- //cerr << "At ActionCallFunction enter:"<<endl;
//env.dump_stack();
// Let's consider it a as a string and lookup the function.
@@ -2812,12 +2779,12 @@
if ( ! function.is_object() )
{
IF_VERBOSE_ASCODING_ERRORS (
- log_aserror(_("ActionCallFunction: %s is not an object"),
env.top(0).to_string().c_str());
+ log_aserror(_("ActionCallFunction: %s is not an object"),
env.top(0).to_string());
)
}
else if ( ! function.is_function() )
{
- log_error("ActionCallFunction: function name %s evaluated to
non-function value %s", funcname, function.to_debug_string());
+ log_error("ActionCallFunction: function name %s evaluated to
non-function value %s", funcname, function);
// Calling super ?
boost::intrusive_ptr<as_object> obj = function.to_object();
this_ptr = thread.getThisPointer();
@@ -2854,7 +2821,6 @@
//log_debug(_("Function's nargs: %d"), nargs);
#ifdef USE_DEBUGGER
-// cerr << "entering function: " << function_name << endl;
debugger.callStackPush(function_name);
debugger.matchBreakPoint(function_name, true);
#endif
@@ -2874,7 +2840,6 @@
thread.next_pc = thread.stop_pc;
}
- //cerr << "After ActionCallFunction:"<<endl;
//env.dump_stack();
}
@@ -2895,7 +2860,6 @@
env.drop(1);
#ifdef USE_DEBUGGER
-// cerr << "Returning from function: " << env.top(0).to_string << endl;
debugger.callStackPop();
#endif
@@ -2910,7 +2874,7 @@
void
SWFHandlers::ActionModulo(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2); // x, ,y
@@ -2930,7 +2894,7 @@
void
SWFHandlers::ActionNew(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2); // classname, nargs
@@ -2940,7 +2904,7 @@
IF_VERBOSE_ACTION (
log_action(_("---new object: %s"),
- classname.c_str());
+ classname);
);
unsigned nargs = unsigned(env.pop().to_number());
@@ -2953,7 +2917,7 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("ActionNew: "
- "'%s' is not a constructor"), classname.c_str());
+ "'%s' is not a constructor"), classname);
);
env.drop(nargs);
env.push(as_value()); // should we push an object anyway ?
@@ -2983,7 +2947,7 @@
void
SWFHandlers::ActionVar(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(1); // var name
const std::string& varname = env.top(0).to_string();
@@ -3003,7 +2967,7 @@
void
SWFHandlers::ActionInitArray(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(1); // array size name
@@ -3027,16 +2991,12 @@
env.push(result);
- //log_debug(_("xxx init array end: top of stack = %d, trace(top(0)) ="),
env.get_top_index());//xxxxxxx
-
- //as_global_trace(fn_call(NULL, NULL, env, 1, env.get_top_index()));
//xxxx
-
}
void
SWFHandlers::ActionInitObject(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(1); // nmembers
@@ -3049,28 +3009,24 @@
// [003] Integer: 1
// SWFACTION_INITOBJECT
- int nmembers = (int) env.pop().to_number();
+ const int nmembers = env.pop().to_int();
thread.ensureStack(nmembers*2); // name, value for each member
boost::intrusive_ptr<as_object>
new_obj_ptr(init_object_instance().release());
// Set provided members
- for (int i=0; i<nmembers; ++i) {
+ for (int i = 0; i < nmembers; ++i) {
as_value member_value = env.top(0);
std::string member_name = env.top(1).to_string();
- //new_obj_ptr->set_member(member_name, member_value);
+
thread.setObjectMember(*new_obj_ptr, member_name, member_value);
env.drop(2);
}
- // @@ TODO
- //log_error(_("checkme opcode: %02X"), action_id);
-
as_value new_obj;
new_obj.set_as_object(new_obj_ptr.get());
- //env.drop(nmembers*2);
env.push(new_obj);
}
@@ -3078,7 +3034,7 @@
void
SWFHandlers::ActionTypeOf(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(1);
@@ -3089,7 +3045,7 @@
void
SWFHandlers::ActionTargetPath(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
@@ -3117,7 +3073,7 @@
static void
enumerateObject(as_environment& env, const as_object& obj)
{
-// GNASH_REPORT_FUNCTION;
+
assert( env.top(0).is_null() );
obj.enumerateProperties(env);
}
@@ -3125,7 +3081,7 @@
void
SWFHandlers::ActionEnumerate(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(1); // var_name
@@ -3304,7 +3260,7 @@
void
SWFHandlers::ActionToNumber(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(1);
env.top(0).convert_to_number();
@@ -3313,7 +3269,7 @@
void
SWFHandlers::ActionToString(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(1);
const int version = env.get_version();
@@ -3323,7 +3279,7 @@
void
SWFHandlers::ActionDup(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(1);
env.push(env.top(0));
@@ -3332,7 +3288,7 @@
void
SWFHandlers::ActionSwap(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2);
as_value temp = env.top(1);
@@ -3343,7 +3299,7 @@
void
SWFHandlers::ActionGetMember(ActionExec& thread)
{
- // GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2); // member name, target
@@ -3396,7 +3352,7 @@
void
SWFHandlers::ActionSetMember(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(3); // value, member, object
@@ -3412,7 +3368,7 @@
IF_VERBOSE_ACTION (
log_action(_("-- set_member %s.%s=%s"),
env.top(2),
- member_name.c_str(),
+ member_name,
member_value);
);
}
@@ -3424,7 +3380,7 @@
// Invalid object, can't set.
log_aserror(_("-- set_member %s.%s=%s on invalid
object!"),
env.top(2),
- member_name.c_str(),
+ member_name,
member_value);
);
}
@@ -3436,7 +3392,7 @@
void
SWFHandlers::ActionIncrement(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(1);
@@ -3447,7 +3403,7 @@
void
SWFHandlers::ActionDecrement(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(1);
env.top(0).set_double(env.top(0).to_number()-1);
@@ -3456,7 +3412,7 @@
void
SWFHandlers::ActionCallMethod(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
@@ -3548,7 +3504,7 @@
}
}
- //log_debug("%p.%s() call", obj.get(),
method_string.c_str());
+ //log_debug("%p.%s() call", obj.get(), method_string);
if ( proto ) super = proto->get_super();
else super = obj->get_super();
}
@@ -3670,7 +3626,7 @@
void
SWFHandlers::ActionNewMethod(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
@@ -3719,7 +3675,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("ActionNewMethod: "
"can't find method %s of object %s"),
- method_string.c_str(), obj_val);
+ method_string, obj_val);
);
env.drop(nargs);
env.push(as_value()); // should we push an object
anyway ?
@@ -3756,7 +3712,7 @@
void
SWFHandlers::ActionInstanceOf(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2); // super, instance
@@ -3787,7 +3743,7 @@
void
SWFHandlers::ActionEnum2(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
@@ -3820,7 +3776,7 @@
void
SWFHandlers::ActionBitwiseAnd(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2);
@@ -3835,7 +3791,7 @@
void
SWFHandlers::ActionBitwiseOr(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2);
@@ -3849,7 +3805,7 @@
void
SWFHandlers::ActionBitwiseXor(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2);
@@ -3914,7 +3870,7 @@
void
SWFHandlers::ActionStrictEq(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2);
env.top(1).set_bool(env.top(1).strictly_equals(env.top(0)));
@@ -3957,7 +3913,7 @@
void
SWFHandlers::ActionStringGreater(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2);
// No need to use to_string_versioned() here, this is a swf7 opcode
@@ -3968,7 +3924,7 @@
void
SWFHandlers::ActionExtends(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
thread.ensureStack(2); // super, sub
@@ -4004,14 +3960,14 @@
void
SWFHandlers::ActionConstantPool(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
thread.code.process_decl_dict(thread.pc, thread.next_pc);
}
void
SWFHandlers::ActionDefineFunction2(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
const action_buffer& code = thread.code;
@@ -4031,20 +3987,14 @@
std::string name = code.read_string(i);
i += name.length() + 1; // add NULL-termination
- //cerr << " name:" << name << endl;
-
// Get number of arguments.
- unsigned nargs = code.read_int16(i);
+ const unsigned nargs = code.read_int16(i);
i += 2;
- //cerr << " nargs:" << nargs << endl;
-
// Get the count of local registers used by this function.
boost::uint8_t register_count = code[i];
i++;
- //cerr << " nregisters:" << nargs << endl;
-
func->set_local_register_count(register_count);
// Flags, for controlling register assignment of implicit args.
@@ -4099,7 +4049,7 @@
if (!name.empty())
{
IF_VERBOSE_ACTION(
- log_action("DefineFunction2: named function '%s' starts at PC
%d", name.c_str(), func->getStartPC());
+ log_action("DefineFunction2: named function '%s' starts at PC %d",
name, func->getStartPC());
);
//env.set_member(name, function_value);
@@ -4131,7 +4081,7 @@
void
SWFHandlers::ActionTry(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
const action_buffer& code = thread.code;
@@ -4192,7 +4142,7 @@
void
SWFHandlers::ActionWith(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;
const action_buffer& code = thread.code;
@@ -4262,7 +4212,6 @@
#ifndef NDEBUG
boost::int16_t length = code.read_int16(thread.pc+1);
assert( length >= 0 );
- //cerr << " length:" << length << endl;
#endif
// Create a new swf_function
@@ -4279,19 +4228,14 @@
std::string name = code.read_string(i);
i += name.length() + 1;
- //cerr << " name:" << name << endl;
-
// Get number of arguments.
unsigned nargs = code.read_int16(i);
i += 2;
- //cerr << " nargs:" << nargs << endl;
-
// Get the names of the arguments.
for (unsigned n = 0; n < nargs; n++)
{
const char* arg = code.read_string(i);
- //cerr << " arg" << n << " : " << arg << endl;
// @@ security: watch out for possible missing terminator here!
func->add_arg(0, arg);
@@ -4302,8 +4246,6 @@
// Get the length of the actual function code.
boost::int16_t code_size = code.read_int16(i);
- //cerr << " code size:" << code_size << endl;
-
func->set_length(code_size);
@@ -4319,7 +4261,7 @@
if (!name.empty())
{
IF_VERBOSE_ACTION(
- log_action("DefineFunction: named function '%s' starts at PC
%d", name.c_str(), func->getStartPC());
+ log_action("DefineFunction: named function '%s' starts at PC %d",
name, func->getStartPC());
);
//env.set_member(name, function_value);
@@ -4348,14 +4290,13 @@
env.push(function_value);
}
- //cerr << "After ActionDefineFunction:"<<endl;
//env.dump_stack();
}
void
SWFHandlers::ActionSetRegister(ActionExec& thread)
{
-// GNASH_REPORT_FUNCTION;
+
as_environment& env = thread.env;