[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/Makefile.am server/impl....
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] gnash ChangeLog server/Makefile.am server/impl.... |
Date: |
Wed, 04 Jun 2008 15:14:47 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Benjamin Wolsey <bwy> 08/06/04 15:14:47
Modified files:
. : ChangeLog
server : Makefile.am impl.cpp
Added files:
server/swf : ScriptLimitsTag.h
Log message:
* server/swf/ScriptLimitsTag.h: parse the ScriptLimits tag (not
a lot to do). Not yet used, but will be passed to movie_root.
* server/impl.cpp: register the ScriptLimits tag loader. Use an
enum for file types rather than a std::string.
* server/Makefile.am: add ScriptLimits header.
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.6813&r2=1.6814
http://cvs.savannah.gnu.org/viewcvs/gnash/server/Makefile.am?cvsroot=gnash&r1=1.143&r2=1.144
http://cvs.savannah.gnu.org/viewcvs/gnash/server/impl.cpp?cvsroot=gnash&r1=1.151&r2=1.152
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/ScriptLimitsTag.h?cvsroot=gnash&rev=1.1
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.6813
retrieving revision 1.6814
diff -u -b -r1.6813 -r1.6814
--- ChangeLog 4 Jun 2008 15:07:39 -0000 1.6813
+++ ChangeLog 4 Jun 2008 15:14:46 -0000 1.6814
@@ -1,5 +1,13 @@
2008-06-04 Benjamin Wolsey <address@hidden>
+ * server/swf/ScriptLimitsTag.h: parse the ScriptLimits tag (not
+ a lot to do). Not yet used, but will be passed to movie_root.
+ * server/impl.cpp: register the ScriptLimits tag loader. Use an
+ enum for file types rather than a std::string.
+ * server/Makefile.am: add ScriptLimits header.
+
+2008-06-04 Benjamin Wolsey <address@hidden>
+
* server/swf/DefineFontAlignZonesTag.cpp: typo.
2008-06-04 Sandro Santilli <address@hidden>
Index: server/Makefile.am
===================================================================
RCS file: /sources/gnash/gnash/server/Makefile.am,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -b -r1.143 -r1.144
--- server/Makefile.am 2 Jun 2008 09:52:52 -0000 1.143
+++ server/Makefile.am 4 Jun 2008 15:14:47 -0000 1.144
@@ -179,6 +179,7 @@
swf/SetBackgroundColorTag.h \
swf/StartSoundTag.h \
swf/StreamSoundBlockTag.h \
+ swf/ScriptLimitsTag.h \
swf_event.h \
swf_function.h \
text.h \
Index: server/impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/impl.cpp,v
retrieving revision 1.151
retrieving revision 1.152
diff -u -b -r1.151 -r1.152
--- server/impl.cpp 4 Jun 2008 13:57:55 -0000 1.151
+++ server/impl.cpp 4 Jun 2008 15:14:47 -0000 1.152
@@ -42,6 +42,7 @@
#include "StreamProvider.h"
#include "sprite_instance.h"
#include "VM.h"
+#include "ScriptLimitsTag.h"
#include "BitmapMovieDefinition.h"
#include "DefineFontAlignZonesTag.h"
#include "PlaceObject2Tag.h"
@@ -218,9 +219,7 @@
// We're not an authoring tool so we don't care.
// (might be nice to dump the password instead..)
register_tag_loader(SWF::ENABLEDEBUGGER2, null_loader); // 64
-
- // TODO: Fix this to load the limits, or decide we will ignore them.
- register_tag_loader(SWF::SCRIPTLIMITS, fixme_loader); //65
+ register_tag_loader(SWF::SCRIPTLIMITS, ScriptLimitsTag::loader); //65
// TODO: Fix this, but probably not critical.
register_tag_loader(SWF::SETTABINDEX, fixme_loader); //66
@@ -303,8 +302,16 @@
// Get type of file looking at first bytes
// return "jpeg", "png", "swf" or "unknown"
//
-static std::string
-get_file_type(tu_file* in)
+
+enum FileType {
+ GNASH_FILETYPE_JPEG,
+ GNASH_FILETYPE_PNG,
+ GNASH_FILETYPE_SWF,
+ GNASH_FILETYPE_UNKNOWN
+};
+
+FileType
+getFileType(tu_file* in)
{
in->set_position(0);
@@ -314,21 +321,21 @@
{
log_error(_("Can't read file header"));
in->set_position(0);
- return "unknown";
+ return GNASH_FILETYPE_UNKNOWN;
}
// This is the magic number for any JPEG format file
if ((buf[0] == 0xff) && (buf[1] == 0xd8) && (buf[2] == 0xff))
{
in->set_position(0);
- return "jpeg";
+ return GNASH_FILETYPE_JPEG;
}
// This is the magic number for any JPEG format file
if ((buf[0] == 137) && (buf[1] == 'P') && (buf[2] == 'N')) // buf[3] == 'G'
(we didn't read so far)
{
in->set_position(0);
- return "png";
+ return GNASH_FILETYPE_PNG;
}
// This is for SWF (FWS or CWS)
@@ -337,7 +344,7 @@
(buf[2] == 'S') )
{
in->set_position(0);
- return "swf";
+ return GNASH_FILETYPE_SWF;
}
// Check if it is an swf embedded in a player (.exe-file)
@@ -346,10 +353,10 @@
if ( 3 < in->read_bytes(buf, 3) )
{
in->set_position(0);
- return "unknown";
+ return GNASH_FILETYPE_UNKNOWN;
}
- while (buf[0]!='F' && buf[0]!='C' || buf[1]!='W' || buf[2]!='S')
+ while ((buf[0]!='F' && buf[0]!='C') || buf[1]!='W' || buf[2]!='S')
{
buf[0] = buf[1];
buf[1] = buf[2];
@@ -357,13 +364,13 @@
if (in->get_eof())
{
in->set_position(0);
- return "unknown";
+ return GNASH_FILETYPE_UNKNOWN;
}
}
in->set_position(in->get_position()-3); // position to start of the swf
itself
- return "swf";
+ return GNASH_FILETYPE_SWF;
}
- return "unknown";
+ return GNASH_FILETYPE_UNKNOWN;
}
// Create a SWFMovieDefinition from an SWF stream
@@ -398,9 +405,9 @@
// see if it's a jpeg or an swf
// TODO: use an integer code rather then a string !
- std::string type = get_file_type(in.get());
+ FileType type = getFileType(in.get());
- if ( type == "jpeg" )
+ if ( type == GNASH_FILETYPE_JPEG )
{
if ( startLoaderThread == false )
{
@@ -408,15 +415,17 @@
}
return create_jpeg_movie(in, url);
}
- else if ( type == "png" )
+ else if ( type == GNASH_FILETYPE_PNG )
{
if ( startLoaderThread == false )
{
- log_unimpl(_("Requested to keep from completely loading a movie, but the
movie in question is a png, for which we don't yet have the concept of a
'loading thread'"));
+ log_unimpl(_("Requested to keep from completely loading a movie, but the"
+ " movie in question is a png, for which we don't yet have the "
+ "concept of a 'loading thread'"));
}
return create_png_movie(in, url);
}
- else if ( type == "swf" )
+ else if ( type == GNASH_FILETYPE_SWF )
{
return create_swf_movie(in, url, startLoaderThread);
}
Index: server/swf/ScriptLimitsTag.h
===================================================================
RCS file: server/swf/ScriptLimitsTag.h
diff -N server/swf/ScriptLimitsTag.h
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ server/swf/ScriptLimitsTag.h 4 Jun 2008 15:14:47 -0000 1.1
@@ -0,0 +1,70 @@
+//
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
+//
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation; either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+#ifndef GNASH_SWF_SCRIPTLIMITSTAG_H
+#define GNASH_SWF_SCRIPTLIMITSTAG_H
+
+#include "swf.h" // for tag_type definition
+#include "stream.h" // for inlines
+#include "movie_definition.h"
+
+namespace gnash {
+namespace SWF {
+
+/// \brief Sets the desired limits for recursion and timeout for AS scripts
+//
+/// A loaded movie containing a ScriptLimits tag should change the *global*
+/// scriptlimits setting, so this is kept in movie_root rather than the
+/// immutable movie_definition. Whenever this tag is parsed, the value in
+/// movie_root is overridden.
+namespace ScriptLimitsTag
+{
+ void loader(stream* in, tag_type tag, movie_definition* /*m*/)
+ {
+
+ assert(VM::isInitialized());
+
+ in->ensureBytes(4); // recursion and timeout.
+
+ // We need to get the root movie or the VM from somewhere
+ // in order to make the VM not a singleton.
+ movie_root& r = VM::get().getRoot();
+
+ const boost::uint16_t recursionLimit = in->read_u16();
+ const boost::uint16_t timeoutLimit = in->read_u16();
+
+ IF_VERBOSE_PARSE (
+ log_parse(_(" ScriptLimits tag(%d): recursion: %d, timeout: %d"),
+ tag, recursionLimit, timeoutLimit);
+ );
+
+// r.setRecursionLimit(recursionLimit);
+// r.setTimeoutLimit(timeoutLimit);
+ }
+}
+
+} // namespace gnash::SWF
+} // namespace gnash
+
+
+#endif // GNASH_SWF_SCRIPTLIMITSTAG_H
+
+
+// Local Variables:
+// mode: C++
+// indent-tabs-mode: t
+// End:
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] gnash ChangeLog server/Makefile.am server/impl....,
Benjamin Wolsey <=