[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] gnash ChangeLog server/parser/action_buffer.cpp...
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] gnash ChangeLog server/parser/action_buffer.cpp... |
Date: |
Thu, 04 Oct 2007 22:55:54 +0000 |
CVSROOT: /sources/gnash
Module name: gnash
Changes by: Sandro Santilli <strk> 07/10/04 22:55:54
Modified files:
. : ChangeLog
server/parser : action_buffer.cpp action_buffer.h
server/swf : DoActionTag.h
Log message:
* server/parser/action_buffer.{h,cpp}: add readFullTag method
not
bothering to check for an END opcode thus making read faster.
* server/swf/DoActionTag.h (read): use
action_buffer::readFullTag.
(ok, premature optimization, but was too tempted)
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.4528&r2=1.4529
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/action_buffer.cpp?cvsroot=gnash&r1=1.24&r2=1.25
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/action_buffer.h?cvsroot=gnash&r1=1.17&r2=1.18
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/DoActionTag.h?cvsroot=gnash&r1=1.5&r2=1.6
Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.4528
retrieving revision 1.4529
diff -u -b -r1.4528 -r1.4529
--- ChangeLog 4 Oct 2007 22:05:00 -0000 1.4528
+++ ChangeLog 4 Oct 2007 22:55:53 -0000 1.4529
@@ -1,5 +1,11 @@
2007-10-05 Sandro Santilli <address@hidden>
+ * server/parser/action_buffer.{h,cpp}: add readFullTag method not
+ bothering to check for an END opcode thus making read faster.
+ * server/swf/DoActionTag.h (read): use action_buffer::readFullTag.
+
+2007-10-05 Sandro Santilli <address@hidden>
+
* server/parser/action_buffer.cpp (read): don't give up if an END
opcode is not found. You can find real-world cases for a missing
END in swfdec testsuite, tipically generated by swfmill.
Index: server/parser/action_buffer.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/action_buffer.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -b -r1.24 -r1.25
--- server/parser/action_buffer.cpp 4 Oct 2007 22:05:00 -0000 1.24
+++ server/parser/action_buffer.cpp 4 Oct 2007 22:55:53 -0000 1.25
@@ -17,7 +17,7 @@
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
-/* $Id: action_buffer.cpp,v 1.24 2007/10/04 22:05:00 strk Exp $ */
+/* $Id: action_buffer.cpp,v 1.25 2007/10/04 22:55:53 strk Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -55,18 +55,56 @@
// printf("Action buffer %d created\n", ++count);
}
+void
+action_buffer::readFullTag(stream* in)
+{
+ unsigned long endPos = in->get_tag_end_position();
+ unsigned long startPos = in->get_position();
+ unsigned size = endPos-startPos;
+
+ // Allocate the buffer
+ //
+ // NOTE: a .reserve would be fine here, except GLIBCPP_DEBUG will
complain...
+ //
+ m_buffer.resize(size);
+ unsigned char* buf = &m_buffer.front();
+
+ // Read all the bytes in the buffer
+ //
+ // NOTE:
+ // we might be reading more data then we'll actually
+ // use here if the SWF contains Action blocks padded
+ // with data after the terminating END.
+ // This has a cost in memory use, but for the normal
+ // case (non-malformed SWF) not looking for an END
+ // tag should give significant speedup in parsing
+ // large action-based movies.
+ //
+ in->read(reinterpret_cast<char*>(buf), size);
+
+ // Consistency checks here
+ //
+ // NOTE: it is common to find such movies, swfmill is known to write
+ // DoAction w/out the terminating END tag
+ //
+ IF_VERBOSE_MALFORMED_SWF(
+ if ( m_buffer.back() != SWF::ACTION_END )
+ {
+ log_swferror(_("Action buffer starting at offset %lu doesn't
end witn an END tag"),
+ startPos);
+ }
+ );
+}
void
action_buffer::read(stream* in)
{
// NOTE:
- // This method is called for different tags, not only DOACTION.
- // For DoAction we have to read all the tag, in which case we
- // can optimize the read to a single memcpy.
- // For other tags (like button actions) we have to seek for an END
- // tag.
- // TODO: implement two different 'read' flavors to make parsing more
- // performant and SWF consistency checking more effective
+ // This method is called for tags like button actions,
+ // where we don't know the size of the action block in advance
+ // and are thus forced to seek for an END opcode.
+ // For DoAction and DoInitAction you can use the readFullTag method
+ // instead, which is faster.
// Read action bytes.
unsigned long endPos = in->get_tag_end_position();
Index: server/parser/action_buffer.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/action_buffer.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- server/parser/action_buffer.h 16 Sep 2007 16:48:15 -0000 1.17
+++ server/parser/action_buffer.h 4 Oct 2007 22:55:53 -0000 1.18
@@ -59,9 +59,12 @@
action_buffer();
- /// Read action bytes from input stream
+ /// Read action bytes from input stream up to an SWF::ACTION_END or end
of tag
void read(stream* in);
+ /// Read action bytes from input stream up to end of tag
+ void readFullTag(stream* in);
+
#if 0
/// \brief
/// Interpret the actions in this action buffer, and evaluate
Index: server/swf/DoActionTag.h
===================================================================
RCS file: /sources/gnash/gnash/server/swf/DoActionTag.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- server/swf/DoActionTag.h 17 Sep 2007 23:33:18 -0000 1.5
+++ server/swf/DoActionTag.h 4 Oct 2007 22:55:53 -0000 1.6
@@ -19,7 +19,7 @@
//
//
-/* $Id: DoActionTag.h,v 1.5 2007/09/17 23:33:18 strk Exp $ */
+/* $Id: DoActionTag.h,v 1.6 2007/10/04 22:55:53 strk Exp $ */
#ifndef GNASH_SWF_DOACTIONTAG_H
#define GNASH_SWF_DOACTIONTAG_H
@@ -60,7 +60,7 @@
//
void read(stream* in)
{
- m_buf.read(in);
+ m_buf.readFullTag(in);
}
virtual void execute(sprite_instance* m) const