[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/as_value.h server/as_val...
From: |
Martin Guy |
Subject: |
[Gnash-commit] gnash ChangeLog server/as_value.h server/as_val... |
Date: |
Thu, 19 Apr 2007 12:06:57 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Martin Guy <martinwguy> 07/04/19 12:06:56
Modified files:
. : ChangeLog
server : as_value.h as_value.cpp edit_text_character.cpp
server/vm : ASHandlers.cpp
Log message:
Always do version-dependent conversion to string, and move version
detection for this to a single point in the lowest level.
This also eliminates all *_versioned() string methods.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2927&r2=1.2928
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.h?cvsroot=gnash&r1=1.47&r2=1.48
http://cvs.savannah.gnu.org/viewcvs/gnash/server/as_value.cpp?cvsroot=gnash&r1=1.40&r2=1.41
http://cvs.savannah.gnu.org/viewcvs/gnash/server/edit_text_character.cpp?cvsroot=gnash&r1=1.58&r2=1.59
http://cvs.savannah.gnu.org/viewcvs/gnash/server/vm/ASHandlers.cpp?cvsroot=gnash&r1=1.97&r2=1.98
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2927
retrieving revision 1.2928
diff -u -b -r1.2927 -r1.2928
--- ChangeLog 19 Apr 2007 10:27:09 -0000 1.2927
+++ ChangeLog 19 Apr 2007 12:06:56 -0000 1.2928
@@ -1,3 +1,10 @@
+2007-04-19 Martin Guy <address@hidden>
+
+ * server/{as_value.{h,cpp},edit_text_character.cpp,{vm/ASHandlers.cpp}:
+ Always do version-dependent conversion to string, and move version
+ detection for this to a single point in the lowest level.
+ This also eliminates all *_versioned() string methods.
+
2007-04-19 Sandro Santilli <address@hidden>
* server/asobj/string.cpp: add valueOf own property to String
Index: server/as_value.h
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -u -b -r1.47 -r1.48
--- server/as_value.h 19 Apr 2007 10:27:09 -0000 1.47
+++ server/as_value.h 19 Apr 2007 12:06:56 -0000 1.48
@@ -14,7 +14,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-/* $Id: as_value.h,v 1.47 2007/04/19 10:27:09 strk Exp $ */
+/* $Id: as_value.h,v 1.48 2007/04/19 12:06:56 martinwguy Exp $ */
#ifndef GNASH_AS_VALUE_H
#define GNASH_AS_VALUE_H
@@ -289,30 +289,6 @@
std::string to_debug_string() const;
- /// Get a version-dependent std::string representation for this value.
- //
- /// @param version
- /// The SWF version to be compatible with.
- ///
- /// @param env
- /// The environment to use for running the toString() method
- /// for object values. If NULL, toString() won't be run.
- ///
- std::string to_std_string_versioned(int version, as_environment*
env=NULL) const;
-
- /// Get a string representation for this value.
- //
- /// This differs from to_string() in that returned
- /// representation will depend on version of the SWF
- /// source.
- /// @@ shouldn't this be the default ?
- ///
- /// @param env
- /// The environment to use for running the toString() method
- /// for object values. If NULL, toString() won't be run.
- ///
- const std::string& to_string_versioned(int version,
as_environment* env=NULL) const;
-
/// Conversion to number
//
/// @param env
@@ -406,19 +382,7 @@
void convert_to_number(as_environment* env);
/// Force type to string.
- void convert_to_string();
-
- /// Force type to string.
- //
- /// uses swf-version-aware converter
- ///
- /// @param env
- /// The environment to use for running the toString() method
- /// for object values. If NULL, toString() won't be run.
- ///
- /// @see to_string_versionioned
- ///
- void convert_to_string_versioned(int version, as_environment*
env=NULL);
+ void convert_to_string(as_environment* env);
// These set_*()'s are more type-safe; should be used
// in preference to generic overloaded set(). You are
Index: server/as_value.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/as_value.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -b -r1.40 -r1.41
--- server/as_value.cpp 19 Apr 2007 10:27:09 -0000 1.40
+++ server/as_value.cpp 19 Apr 2007 12:06:56 -0000 1.41
@@ -67,14 +67,6 @@
}
}
-#if 0
-std::string
-as_value::to_std_string(as_environment* env) const
-{
- return to_string(env);
-}
-#endif
-
// Conversion to const std::string&.
const std::string&
as_value::to_string(as_environment* env) const
@@ -120,16 +112,15 @@
break;
case UNDEFINED:
+ // Behavior depends on file version.
+ // In version 7+, it's "undefined",
+ // in versions 6-, it's "".
- // Behavior depends on file version. In
- // version 7+, it's "undefined", in versions
- // 6-, it's "".
- //
- // We'll go with the v7 behavior by default,
- // and conditionalize via _versioned()
- // functions.
+ if (VM::get().getSWFVersion() <= 6) {
+ m_string_value = "";
+ } else {
m_string_value = "undefined";
-
+ }
break;
case NULLTYPE:
@@ -202,30 +193,6 @@
return m_string_value;
}
-// Conversion to const std::string&.
-const std::string&
-as_value::to_string_versioned(int version, as_environment* env) const
-{
- if (m_type == UNDEFINED) {
- // Version-dependent behavior.
- if (version <= 6) {
- m_string_value = "";
- } else {
- m_string_value = "undefined";
- }
- return m_string_value;
- }
-
- return to_string(env);
-}
-
-// Version-based Conversion to std::string
-std::string
-as_value::to_std_string_versioned(int version, as_environment* env) const
-{
- return to_string_versioned(version, env);
-}
-
// Conversion to primitive value.
as_value
as_value::to_primitive() const
@@ -544,7 +511,6 @@
as_value::to_as_function() const
{
if (m_type == AS_FUNCTION) {
- // OK.
return m_object_value->to_function();
} else {
return NULL;
@@ -560,22 +526,12 @@
// Force type to string.
void
-as_value::convert_to_string()
-{
- to_string(); // init our string data.
- m_type = STRING; // force type.
-}
-
-
-void
-as_value::convert_to_string_versioned(int version, as_environment* env)
- // Force type to string.
+as_value::convert_to_string(as_environment* env)
{
- to_string_versioned(version, env); // init our string data.
+ to_string(env); // init our string data.
m_type = STRING; // force type.
}
-
void
as_value::set_as_object(as_object* obj)
{
Index: server/edit_text_character.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/edit_text_character.cpp,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -b -r1.58 -r1.59
--- server/edit_text_character.cpp 18 Apr 2007 13:24:44 -0000 1.58
+++ server/edit_text_character.cpp 19 Apr 2007 12:06:56 -0000 1.59
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: edit_text_character.cpp,v 1.58 2007/04/18 13:24:44 strk Exp $ */
+/* $Id: edit_text_character.cpp,v 1.59 2007/04/19 12:06:56 martinwguy Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -680,8 +680,7 @@
case M_TEXT:
//if (name == "text")
{
- int version =
get_parent()->get_movie_definition()->get_version();
- set_text_value(val.to_string_versioned(version).c_str());
+ set_text_value(val.to_string().c_str());
return;
}
case M_X:
Index: server/vm/ASHandlers.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/vm/ASHandlers.cpp,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -b -r1.97 -r1.98
--- server/vm/ASHandlers.cpp 18 Apr 2007 14:07:33 -0000 1.97
+++ server/vm/ASHandlers.cpp 19 Apr 2007 12:06:56 -0000 1.98
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: ASHandlers.cpp,v 1.97 2007/04/18 14:07:33 jgilmore Exp $ */
+/* $Id: ASHandlers.cpp,v 1.98 2007/04/19 12:06:56 martinwguy Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -840,8 +840,7 @@
// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
thread.ensureStack(1);
- int version = env.get_version();
- env.top(0).set_int(env.top(0).to_string_versioned(version).size());
+ env.top(0).set_int(env.top(0).to_string().size());
}
void
@@ -868,8 +867,7 @@
int size = unsigned(size_val.to_number(&env));
int base = int(base_val.to_number(&env));
- int version = env.get_version();
- const std::string& str = string_val.to_string_versioned(version);
+ const std::string& str = string_val.to_string();
if ( size < 0 )
{
@@ -1040,9 +1038,8 @@
thread.ensureStack(2); // two strings
- int version = env.get_version();
- env.top(1).convert_to_string_versioned(version);
- env.top(1).string_concat(env.top(0).to_string_versioned(version));
+ env.top(1).convert_to_string(&env);
+ env.top(1).string_concat(env.top(0).to_string());
env.drop(1);
}
@@ -1218,7 +1215,6 @@
thread.ensureStack(1);
- //std::string val =
env.pop().to_string_versioned(VM::get().getSWFVersion(), &env);
std::string val = env.pop().to_string(&env);
log_trace(val.c_str());
}
@@ -2536,13 +2532,11 @@
//log_msg(_("ActionNewAdd(%s, %s) called"), v1.to_debug_string().c_str(),
v2.to_debug_string().c_str());
-
if (v1.is_string() || v2.is_string() )
{
- int version = env.get_version();
// modify env.top(1)
- v2.convert_to_string_versioned(version, &env);
- v2.string_concat(v1.to_string_versioned(version, &env));
+ v2.convert_to_string(&env);
+ v2.string_concat(v1.to_string());
}
else
{
@@ -2620,8 +2614,7 @@
// GNASH_REPORT_FUNCTION;
as_environment& env = thread.env;
thread.ensureStack(1);
- int version = env.get_version();
- env.top(0).convert_to_string_versioned(version);
+ env.top(0).convert_to_string(&env);
}
void
@@ -2652,9 +2645,6 @@
thread.ensureStack(2); // member name, target
- // Some corner case behaviors depend on the SWF file version.
- int version = env.get_version();
-
as_value member_name = env.top(0);
as_value target = env.top(1);
@@ -2675,8 +2665,8 @@
// Special case: String has a member "length"
// @@ FIXME: we shouldn't have all this "special" cases --strk;
- if (target.is_string() && member_name.to_string_versioned(version) ==
"length") {
- int len = target.to_string_versioned(version).size();
+ if (target.is_string() && member_name.to_string() == "length") {
+ int len = target.to_string().size();
env.top(1).set_int(len);
} else {
if ( ! thread.getObjectMember(*obj, member_name.to_string(&env),
env.top(1)) )
@@ -2763,9 +2753,6 @@
thread.ensureStack(3); // method_name, obj, nargs
- // Some corner case behaviors depend on the SWF file version.
- //int version = env.get_version();
-
// Get name function of the method
as_value& method_name = env.top(0);
- [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val...,
Martin Guy <=
- Re: [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val..., strk, 2007/04/19
- Re: [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val..., strk, 2007/04/19
- Re: [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val..., Martin Guy, 2007/04/19
- Re: [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val..., strk, 2007/04/19
- Re: [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val..., strk, 2007/04/19
- Re: [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val..., Martin Guy, 2007/04/19
- Re: [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val..., strk, 2007/04/19
- Re: [Gnash-commit] gnash ChangeLog server/as_value.h server/as_val..., zou lunkai, 2007/04/19