[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/asobj/SharedObject.cpp s...
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] gnash ChangeLog server/asobj/SharedObject.cpp s... |
Date: |
Fri, 23 May 2008 09:23:42 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Benjamin Wolsey <bwy> 08/05/23 09:23:42
Modified files:
. : ChangeLog
server/asobj : SharedObject.cpp
server/vm : ASHandlers.cpp
Log message:
* server/asobj/SharedObject.cpp: restrict using directives, use
a const iterator for vector of Elements, as they shouldn't be
changed while reading. Clean up logging (c_str(),
to_debug_string()).
* server/vm/ASHandlers.cpp: drop to_debug_string().c_str().
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6685&r2=1.6686
http://cvs.savannah.gnu.org/viewcvs/gnash/server/asobj/SharedObject.cpp?cvsroot=gnash&r1=1.39&r2=1.40
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.239&r2=1.240
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6685
retrieving revision 1.6686
diff -u -b -r1.6685 -r1.6686
--- ChangeLog 23 May 2008 07:53:39 -0000 1.6685
+++ ChangeLog 23 May 2008 09:23:40 -0000 1.6686
@@ -1,5 +1,13 @@
2008-05-23 Benjamin Wolsey <address@hidden>
+ * server/asobj/SharedObject.cpp: restrict using directives, use
+ a const iterator for vector of Elements, as they shouldn't be
+ changed while reading. Clean up logging (c_str(),
+ to_debug_string()).
+ * server/vm/ASHandlers.cpp: drop to_debug_string().c_str().
+
+2008-05-23 Benjamin Wolsey <address@hidden>
+
* gui/aqua_ogl_glue.h gui/fltk_glue_agg.h gui/fltk_glue_cairo.h
gui/gtk_glue_gtkglext.h, gui/kde_glue_opengl.h,
gui/sdl_cairo_glue.h, gui/sdl_ogl_glue.h: Do not put
Index: server/asobj/SharedObject.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/asobj/SharedObject.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -b -r1.39 -r1.40
--- server/asobj/SharedObject.cpp 30 Apr 2008 03:58:14 -0000 1.39
+++ server/asobj/SharedObject.cpp 23 May 2008 09:23:41 -0000 1.40
@@ -18,7 +18,7 @@
//
#ifdef HAVE_CONFIG_H
-#include "gnashconfig.h"
+#include "gnashconfig.h" // USE_SOL_READ_ONLY
#endif
#include <unistd.h>
@@ -45,7 +45,7 @@
#include "URL.h"
#include "rc.h" // for use of rcfile
-using namespace std;
+using std::string;
namespace {
gnash::LogFile& dbglogfile = gnash::LogFile::getDefaultInstance();
@@ -53,7 +53,6 @@
}
using namespace amf;
-using namespace boost;
namespace gnash {
@@ -87,7 +86,7 @@
const string& name = _st.string_table::value(key);
-// cerr << "FIXME: yes!!!!! " << name << ": "<< val.to_debug_string()
<< endl;
+// cerr << "FIXME: yes!!!!! " << name << ": "<< val << std::endl;
if (val.is_string()) {
string str;
@@ -133,7 +132,7 @@
// GNASH_REPORT_FUNCTION;
VM& vm = o.getVM();
- int swfVersion = vm.getSWFVersion();
+ const int swfVersion = vm.getSWFVersion();
// clear, flush and getSize not in SWF<6 , it seems
if ( swfVersion < 6 ) return;
@@ -184,11 +183,8 @@
boost::intrusive_ptr<SharedObject> obj =
ensureType<SharedObject>(fn.this_ptr);
UNUSED(obj);
- static bool warned=false;
- if ( ! warned ) {
- log_unimpl (__FUNCTION__);
- warned=true;
- }
+ LOG_ONCE(log_unimpl (__FUNCTION__));
+
return as_value();
}
@@ -199,13 +195,13 @@
boost::intrusive_ptr<SharedObject> obj =
ensureType<SharedObject>(fn.this_ptr);
-// log_debug("Flushing to file %s", obj->getFilespec().c_str());
+// log_debug("Flushing to file %s", obj->getFilespec());
VM& vm = obj->getVM();
#ifndef USE_SOL_READONLY
if (rcfile.getSOLReadOnly() ) {
log_security("Attempting to write object %s when it's SOL Read Only is
set! Refusing...",
- obj->getFilespec().c_str());
+ obj->getFilespec());
return as_value(false);
}
@@ -217,7 +213,7 @@
boost::intrusive_ptr<as_object> ptr = as.to_object();
if ( ! ptr ) {
log_error("'data' member of SharedObject is not an object (%s)",
- as.to_debug_string().c_str());
+ as);
return as_value();
}
@@ -230,10 +226,10 @@
bool ret = sol.writeFile(newspec, obj->getObjectName().c_str());
if ( ! ret )
{
- log_error("writing SharedObject file to %s", newspec.c_str());
+ log_error("writing SharedObject file to %s", newspec);
return as_value(false);
}
- log_security("SharedObject '%s' written to filesystem.", newspec.c_str());
+ log_security("SharedObject '%s' written to filesystem.", newspec);
return as_value(true); // TODO: check expected return type from
SharedObject.flush
#else
return as_value(false);
@@ -292,7 +288,7 @@
struct stat statbuf;
if ( -1 == stat(newspec.c_str(), &statbuf) )
{
- log_error("Invalid SOL safe dir %s: %s", newspec.c_str(),
strerror(errno));
+ log_error("Invalid SOL safe dir %s: %s", newspec, std::strerror(errno));
return as_value(false);
}
@@ -317,7 +313,7 @@
const string& origURL = obj->getVM().getSWFUrl();
URL url(origURL);
-// log_debug(_("BASE URL=%s (%s)"), url.str().c_str(),
url.hostname().c_str());
+// log_debug(_("BASE URL=%s (%s)"), url.str(), url.hostname());
// Get the domain part, or take as 'localhost' if none
// (loaded from filesystem)
@@ -333,7 +329,7 @@
if ( rcfile.getSOLLocalDomain() && domain != "localhost")
{
log_security("Attempting to open non localhost created SOL file!! %s",
- obj->getFilespec().c_str());
+ obj->getFilespec());
return as_value(false);
}
@@ -344,7 +340,7 @@
//
if (fn.nargs > 1) {
rootdir = fn.arg(1).to_string();
- log_debug("The rootdir is: %s", rootdir.c_str());
+ log_debug("The rootdir is: %s", rootdir);
newspec += rootdir;
} else {
newspec += "/";
@@ -354,13 +350,13 @@
newspec += "/";
}
- //log_debug("newspec before adding obj's filespec: %s", newspec.c_str());
+ //log_debug("newspec before adding obj's filespec: %s", newspec);
newspec += obj->getFilespec();
obj->setFilespec(newspec);
if (newspec.find("/", 0) != string::npos) {
- typedef tokenizer<char_separator<char> > Tok;
- char_separator<char> sep("/");
+ typedef boost::tokenizer<boost::char_separator<char> > Tok;
+ boost::char_separator<char> sep("/");
Tok t(newspec, sep);
Tok::iterator tit;
string newdir = "/";
@@ -368,7 +364,7 @@
//cout << *tit << "\n";
newdir += *tit;
if (newdir.find("..", 0) != string::npos) {
- log_error("Invalid SharedObject path (contains '..'): %s",
newspec.c_str());
+ log_error("Invalid SharedObject path (contains '..'): %s",
newspec);
return as_value(false);
}
// Don't try to create a directory of the .sol file name!
@@ -382,33 +378,33 @@
#endif
if ((errno != EEXIST) && (ret != 0)) {
log_error("Couldn't create directory for .sol files:
%s\n\t%s",
- newdir.c_str(), strerror(errno));
+ newdir, std::strerror(errno));
return as_value(false);
}
- } // else log_debug("newdir %s ends with .sol", newdir.c_str());
+ } // else log_debug("newdir %s ends with .sol", newdir);
newdir += "/";
}
- } // else log_debug("no slash in filespec %s", obj->getFilespec().c_str());
+ } // else log_debug("no slash in filespec %s", obj->getFilespec());
SOL sol;
- log_security("Opening SharedObject file: %s", newspec.c_str());
+ log_security("Opening SharedObject file: %s", newspec);
if (sol.readFile(newspec) == false) {
- log_security("empty or non-existing SOL file \"%s\", will be created
on flush/exit", newspec.c_str());
+ log_security("empty or non-existing SOL file \"%s\", will be created
on flush/exit", newspec);
return as_value(obj.get());
}
- vector<Element *>::iterator it;
- vector<Element *> els = sol.getElements();
- log_debug("Read %d AMF objects from %s", els.size(), newspec.c_str());
+ std::vector<Element *>::const_iterator it, e;
+ std::vector<Element *> els = sol.getElements();
+ log_debug("Read %d AMF objects from %s", els.size(), newspec);
string_table& st = obj->getVM().getStringTable();
string_table::key dataKey = obj->getVM().getStringTable().find("data");
as_value as = obj->getMember(dataKey);
boost::intrusive_ptr<as_object> ptr = as.to_object();
- for (it = els.begin(); it != els.end(); it++) {
+ for (it = els.begin(), e = els.end(); it != e; it++) {
Element *el = (*(it));
-// log_debug("Adding \"%s\"", el->name.c_str());
+// log_debug("Adding \"%s\"", el->name);
if (el->getType() == Element::NUMBER_AMF0) {
double dub = *((double *)el->getData());
ptr->set_member(st.string_table::find(el->getName()),
as_value(dub));
Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.239
retrieving revision 1.240
diff -u -b -r1.239 -r1.240
--- server/vm/ASHandlers.cpp 22 May 2008 15:32:53 -0000 1.239
+++ server/vm/ASHandlers.cpp 23 May 2008 09:23:41 -0000 1.240
@@ -1008,7 +1008,7 @@
(
log_action(_("-- get var: %s=%s"),
var_string.c_str(),
- top_value.to_debug_string().c_str());
+ top_value);
);
#ifdef USE_DEBUGGER
debugger.matchWatchPoint(var_string, Debugger::READS);
@@ -1029,7 +1029,7 @@
thread.setVariable(name, env.top(0));
IF_VERBOSE_ACTION (
- log_action(_("-- set var: %s = %s"), name.c_str(),
env.top(0).to_debug_string().c_str());
+ log_action(_("-- set var: %s = %s"), name.c_str(), env.top(0));
);
// TODO: move this to ActionExec::setVariable !
@@ -1101,7 +1101,7 @@
{
target = env.find_target(tgt_str);
}
- unsigned int prop_number = (unsigned int)env.top(0).to_number();
+ unsigned int prop_number = static_cast<unsigned
int>(env.top(0).to_number());
if (target)
{
if ( prop_number < get_property_names().size() )
@@ -1127,7 +1127,7 @@
// ASCODING error ? (well, last time it was a gnash error ;)
IF_VERBOSE_ASCODING_ERRORS (
log_aserror(_("Could not find GetProperty target (%s)"),
- tgt_val.to_debug_string().c_str());
+ tgt_val);
);
env.top(1) = as_value();
}
@@ -1167,7 +1167,7 @@
{
IF_VERBOSE_ASCODING_ERRORS (
log_aserror(_("ActionSetProperty: can't find target %s for setting
property %s"),
- env.top(2).to_debug_string().c_str(),
get_property_names()[prop_number].c_str());
+ env.top(2), get_property_names()[prop_number].c_str());
)
}
@@ -1282,7 +1282,7 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("startDrag: unknown target '%s'"),
- env.top(0).to_debug_string().c_str());
+ env.top(0));
);
}
@@ -1388,8 +1388,8 @@
{
IF_VERBOSE_ASCODING_ERRORS (
log_aserror(_("-- %s cast_to %s (invalid args?)"),
- env.top(1).to_debug_string().c_str(),
- env.top(0).to_debug_string().c_str());
+ env.top(1),
+ env.top(0));
);
env.drop(1);
@@ -1432,7 +1432,7 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("Stack value on IMPLEMENTSOP is not an object:
%s."),
- objval.to_debug_string().c_str());
+ objval);
);
return;
}
@@ -1771,7 +1771,7 @@
as_value& string_val = env.top(2);
IF_VERBOSE_ACTION(
- log_action(" ActionMbSubString(%s, %d, %d)",
string_val.to_debug_string().c_str(), start, size);
+ log_action(" ActionMbSubString(%s, %d, %d)", string_val, start, size);
);
env.drop(2);
@@ -1935,7 +1935,7 @@
log_aserror(_("Frame spec found on stack "
"at ActionWaitForFrame doesn't evaluate "
"to a valid frame: %s"),
- framespec.to_debug_string().c_str());
+ framespec);
);
return;
}
@@ -2154,11 +2154,11 @@
IF_VERBOSE_ACTION (
if ( type == pushDict8 || type == pushDict16 )
{
- log_action(_("\t%d) type=%s (%d), value=%s"), count,
pushType[type], id, env.top(0).to_debug_string().c_str());
+ log_action(_("\t%d) type=%s (%d), value=%s"), count,
pushType[type], id, env.top(0));
}
else
{
- log_action(_("\t%d) type=%s, value=%s"), count,
pushType[type], env.top(0).to_debug_string().c_str());
+ log_action(_("\t%d) type=%s, value=%s"), count,
pushType[type], env.top(0));
}
++count;
);
@@ -2739,8 +2739,8 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("delete %s.%s : first element is not an object",
- env.top(1).to_debug_string().c_str(),
- env.top(0).to_debug_string().c_str());
+ env.top(1),
+ env.top(0));
);
env.top(1).set_bool(false);
env.drop(1);
@@ -2780,7 +2780,7 @@
thread.setLocalVariable(varname.to_string(), value);
IF_VERBOSE_ACTION (
- log_action(_("-- set local var: %s = %s"), varname.to_string().c_str(),
value.to_debug_string().c_str());
+ log_action(_("-- set local var: %s = %s"), varname.to_string().c_str(),
value);
);
env.drop(2);
@@ -2795,7 +2795,7 @@
thread.ensureStack(2); // func name, nargs
- //log_debug("ActionCallFunction: %s",
env.top(0).to_debug_string().c_str());
+ //log_debug("ActionCallFunction: %s", env.top(0));
//cerr << "At ActionCallFunction enter:"<<endl;
//env.dump_stack();
@@ -3104,7 +3104,7 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("Argument to TargetPath(%s) doesn't cast to a
MovieClip"),
- env.top(0).to_debug_string().c_str());
+ env.top(0));
);
env.top(0).set_undefined();
}
@@ -3143,7 +3143,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("Top of stack doesn't evaluate to an object (%s)
at "
"ActionEnumerate execution"),
- var_name.to_debug_string().c_str());
+ var_name);
);
return;
}
@@ -3172,22 +3172,22 @@
catch (ActionTypeError& e)
{
log_debug("%s.to_primitive() threw an error during
ActionNewAdd",
- env.top(0).to_debug_string().c_str());
+ env.top(0));
}
try { v2 = v2.to_primitive(); }
catch (ActionTypeError& e)
{
log_debug("%s.to_primitive() threw an error during
ActionNewAdd",
- env.top(1).to_debug_string().c_str());
+ env.top(1));
}
assert( stackSize == env.stack_size() );
#if GNASH_DEBUG
log_debug(_("ActionNewAdd(%s, %s) [primitive conversion done]"),
- v1.to_debug_string().c_str(),
- v2.to_debug_string().c_str());
+ v1,
+ v2);
#endif
if (v1.is_string() || v2.is_string() )
@@ -3231,14 +3231,14 @@
catch (ActionTypeError& e)
{
log_debug("%s.to_primitive() threw an error during
ActionNewLessThen",
- op1_in.to_debug_string().c_str());
+ op1_in);
}
try { operand2 = op2_in.to_primitive(); }
catch (ActionTypeError& e)
{
log_debug("%s.to_primitive() threw an error during
ActionNewLessThen",
- op2_in.to_debug_string().c_str());
+ op2_in);
}
if ( operand1.is_string() && operand2.is_string() )
@@ -3280,7 +3280,7 @@
catch (ActionTypeError& e)
{
log_debug(_("to_primitive(%s) threw an ActionTypeError %s"),
- op1.to_debug_string().c_str(), e.what());
+ op1, e.what());
}
as_value op2 = env.top(1);
@@ -3288,7 +3288,7 @@
catch (ActionTypeError& e)
{
log_debug(_("to_primitive(%s) threw an ActionTypeError %s"),
- op2.to_debug_string().c_str(), e.what());
+ op2, e.what());
}
env.top(1).set_bool(op1.equals(op2));
@@ -3361,7 +3361,7 @@
log_aserror(_("getMember called against "
"a value that does not cast "
"to an as_object: %s"),
- target.to_debug_string().c_str()));
+ target));
env.top(1).set_undefined();
env.drop(1);
return;
@@ -3369,24 +3369,24 @@
IF_VERBOSE_ACTION (
log_action(_(" ActionGetMember: target: %s (object %p)"),
- target.to_debug_string().c_str(), (void*)obj.get());
+ target, (void*)obj.get());
);
if ( ! thread.getObjectMember(*obj, member_name.to_string(),
env.top(1)) )
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror("Reference to undefined member %s of object %s",
- member_name.to_debug_string().c_str(),
- target.to_debug_string().c_str());
+ member_name,
+ target);
);
env.top(1).set_undefined();
}
IF_VERBOSE_ACTION (
log_action(_("-- get_member %s.%s=%s"),
- target.to_debug_string().c_str(),
- member_name.to_debug_string().c_str(),
- env.top(1).to_debug_string().c_str());
+ target,
+ member_name,
+ env.top(1));
);
env.drop(1);
@@ -3411,9 +3411,9 @@
IF_VERBOSE_ACTION (
log_action(_("-- set_member %s.%s=%s"),
- env.top(2).to_debug_string().c_str(),
+ env.top(2),
member_name.c_str(),
- member_value.to_debug_string().c_str());
+ member_value);
);
}
else
@@ -3423,9 +3423,9 @@
IF_VERBOSE_ASCODING_ERRORS (
// Invalid object, can't set.
log_aserror(_("-- set_member %s.%s=%s on invalid
object!"),
- env.top(2).to_debug_string().c_str(),
+ env.top(2),
member_name.c_str(),
- member_value.to_debug_string().c_str());
+ member_value);
);
}
@@ -3486,8 +3486,8 @@
IF_VERBOSE_ACTION (
- log_action(_(" method name: %s"),
method_name.to_debug_string().c_str());
- log_action(_(" method object/func: %s"),
obj_value.to_debug_string().c_str());
+ log_action(_(" method name: %s"), method_name);
+ log_action(_(" method object/func: %s"), obj_value);
log_action(_(" method nargs: %d"), nargs);
);
@@ -3577,7 +3577,7 @@
log_debug(_("Function object given to ActionCallMethod"
" is not a function (%s), will try to
use"
" its 'constructor' member (but should
instead invoke it's [[Call]] method"),
- obj_value.to_debug_string().c_str());
+ obj_value);
//#endif
// TODO: all this crap should go into an
as_object::getConstructor instead
@@ -3611,7 +3611,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("ActionCallMethod: "
"Tried to invoke method '%s' on non-object
value %s."),
- method_name.to_debug_string().c_str(),
+ method_name,
obj_value.typeOf());
);
env.drop(nargs+2);
@@ -3624,8 +3624,8 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("ActionCallMethod: "
"Can't find method %s of object %s"),
- method_name.to_debug_string().c_str(),
- obj_value.to_debug_string().c_str());
+ method_name,
+ obj_value);
);
env.drop(nargs+2);
env.top(0).set_undefined(); // should we push an object
anyway ?
@@ -3719,7 +3719,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("ActionNewMethod: "
"can't find method %s of object %s"),
- method_string.c_str(),
obj_val.to_debug_string().c_str());
+ method_string.c_str(), obj_val);
);
env.drop(nargs);
env.push(as_value()); // should we push an object
anyway ?
@@ -3771,8 +3771,8 @@
if (!super || ! instance) {
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("-- %s instanceof %s (invalid args?)"),
- env.top(1).to_debug_string().c_str(),
- env.top(0).to_debug_string().c_str());
+ env.top(1),
+ env.top(0));
);
env.drop(1);
@@ -3806,7 +3806,7 @@
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("Top of stack not an object %s at ActionEnum2 "
" execution"),
- obj_val.to_debug_string().c_str());
+ obj_val);
);
return;
}
@@ -3983,12 +3983,12 @@
if ( ! super )
{
log_aserror(_("ActionExtends: Super is not an
as_function (%s)"),
- env.top(0).to_debug_string().c_str());
+ env.top(0));
}
if ( ! sub )
{
log_aserror(_("ActionExtends: Sub is not an
as_function (%s)"),
- env.top(1).to_debug_string().c_str());
+ env.top(1));
}
);
env.drop(2);
@@ -4233,7 +4233,7 @@
{
IF_VERBOSE_ASCODING_ERRORS(
log_aserror(_("with(%s) : first argument doesn't cast to an
object!"),
- with_obj_val.to_debug_string().c_str());
+ with_obj_val);
);
// skip the full block
thread.next_pc += block_length;
@@ -4374,7 +4374,7 @@
IF_VERBOSE_ACTION (
log_action(_("-------------- local register[%d] =
'%s'"),
- reg, env.top(0).to_debug_string().c_str());
+ reg, env.top(0));
);
}
else
@@ -4390,7 +4390,7 @@
IF_VERBOSE_ACTION (
log_action(_("-------------- global register[%d] = '%s'"),
- (unsigned)reg, env.top(0).to_debug_string().c_str() );
+ (unsigned)reg, env.top(0) );
);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/asobj/SharedObject.cpp s...,
Benjamin Wolsey <=