[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10512: More rigorous use of paramet
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10512: More rigorous use of parameters. Cleanups. |
Date: |
Tue, 06 Jan 2009 11:47:43 +0100 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10512
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Tue 2009-01-06 11:47:43 +0100
message:
More rigorous use of parameters. Cleanups.
modified:
libcore/RGBA.cpp
libcore/RGBA.h
libcore/SWFStream.cpp
libcore/SWFStream.h
libcore/fill_style.cpp
libcore/fill_style.h
libcore/impl.cpp
libcore/impl.h
libcore/parser/SWFMovieDefinition.cpp
libcore/parser/action_buffer.cpp
libcore/parser/morph2_character_def.cpp
libcore/parser/morph2_character_def.h
libcore/parser/shape_character_def.cpp
libcore/parser/shape_character_def.h
libcore/parser/sprite_definition.cpp
libcore/styles.cpp
libcore/styles.h
libcore/swf.h
libcore/swf/CSMTextSettingsTag.cpp
libcore/swf/CSMTextSettingsTag.h
libcore/swf/DefineButtonCxformTag.cpp
libcore/swf/DefineButtonCxformTag.h
libcore/swf/DefineButtonSoundTag.cpp
libcore/swf/DefineButtonSoundTag.h
libcore/swf/DefineButtonTag.cpp
libcore/swf/DefineButtonTag.h
libcore/swf/DefineEditTextTag.cpp
libcore/swf/DefineEditTextTag.h
libcore/swf/DefineFontAlignZonesTag.cpp
libcore/swf/DefineFontAlignZonesTag.h
libcore/swf/DefineFontNameTag.h
libcore/swf/DefineFontTag.cpp
libcore/swf/DefineFontTag.h
libcore/swf/DefineTextTag.cpp
libcore/swf/DefineTextTag.h
libcore/swf/DefineVideoStreamTag.cpp
libcore/swf/DefineVideoStreamTag.h
libcore/swf/DisplayListTag.h
libcore/swf/DoActionTag.h
libcore/swf/DoInitActionTag.h
libcore/swf/PlaceObject2Tag.cpp
libcore/swf/PlaceObject2Tag.h
libcore/swf/RemoveObjectTag.cpp
libcore/swf/RemoveObjectTag.h
libcore/swf/ScriptLimitsTag.h
libcore/swf/SetBackgroundColorTag.h
libcore/swf/StartSoundTag.cpp
libcore/swf/StartSoundTag.h
libcore/swf/StreamSoundBlockTag.cpp
libcore/swf/StreamSoundBlockTag.h
libcore/swf/TagLoadersTable.cpp
libcore/swf/TagLoadersTable.h
libcore/swf/TextRecord.cpp
libcore/swf/TextRecord.h
libcore/swf/VideoFrameTag.cpp
libcore/swf/VideoFrameTag.h
libcore/swf/tag_loaders.cpp
libcore/swf/tag_loaders.h
libcore/vm/ASHandlers.cpp
libcore/vm/ASHandlers.h
libcore/vm/ActionExec.cpp
libcore/vm/ActionExec.h
------------------------------------------------------------
revno: 10510.1.1
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-01-05 10:32:03 +0100
message:
Rename tag_type enum to TagType and action_type to ActionType.
Use SWF::TagType everywhere instead of sometimes int.
modified:
libcore/RGBA.cpp
libcore/RGBA.h
libcore/SWFStream.cpp
libcore/SWFStream.h
libcore/fill_style.cpp
libcore/fill_style.h
libcore/impl.cpp
libcore/impl.h
libcore/parser/SWFMovieDefinition.cpp
libcore/parser/action_buffer.cpp
libcore/parser/morph2_character_def.cpp
libcore/parser/morph2_character_def.h
libcore/parser/shape_character_def.cpp
libcore/parser/shape_character_def.h
libcore/parser/sprite_definition.cpp
libcore/styles.cpp
libcore/styles.h
libcore/swf.h
libcore/swf/CSMTextSettingsTag.cpp
libcore/swf/CSMTextSettingsTag.h
libcore/swf/DefineButtonCxformTag.cpp
libcore/swf/DefineButtonCxformTag.h
libcore/swf/DefineButtonSoundTag.cpp
libcore/swf/DefineButtonSoundTag.h
libcore/swf/DefineButtonTag.cpp
libcore/swf/DefineButtonTag.h
libcore/swf/DefineEditTextTag.cpp
libcore/swf/DefineEditTextTag.h
libcore/swf/DefineFontAlignZonesTag.cpp
libcore/swf/DefineFontAlignZonesTag.h
libcore/swf/DefineFontNameTag.h
libcore/swf/DefineFontTag.cpp
libcore/swf/DefineFontTag.h
libcore/swf/DefineTextTag.cpp
libcore/swf/DefineTextTag.h
libcore/swf/DefineVideoStreamTag.cpp
libcore/swf/DefineVideoStreamTag.h
libcore/swf/DisplayListTag.h
libcore/swf/DoActionTag.h
libcore/swf/DoInitActionTag.h
libcore/swf/PlaceObject2Tag.cpp
libcore/swf/PlaceObject2Tag.h
libcore/swf/RemoveObjectTag.cpp
libcore/swf/RemoveObjectTag.h
libcore/swf/ScriptLimitsTag.h
libcore/swf/SetBackgroundColorTag.h
libcore/swf/StartSoundTag.cpp
libcore/swf/StartSoundTag.h
libcore/swf/StreamSoundBlockTag.cpp
libcore/swf/StreamSoundBlockTag.h
libcore/swf/TagLoadersTable.cpp
libcore/swf/TagLoadersTable.h
libcore/swf/TextRecord.cpp
libcore/swf/TextRecord.h
libcore/swf/VideoFrameTag.cpp
libcore/swf/VideoFrameTag.h
libcore/swf/tag_loaders.cpp
libcore/swf/tag_loaders.h
libcore/vm/ASHandlers.cpp
libcore/vm/ASHandlers.h
libcore/vm/ActionExec.cpp
libcore/vm/ActionExec.h
------------------------------------------------------------
revno: 10510.1.2
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Mon 2009-01-05 11:20:39 +0100
message:
Modifications to TagLoadersTable. Use SWF::TagType for the table key,
as that's enforced for the loader_function anyway.
modified:
libcore/swf/TagLoadersTable.cpp
libcore/swf/TagLoadersTable.h
------------------------------------------------------------
revno: 10510.1.3
committer: Benjamin Wolsey <address@hidden>
branch nick: test
timestamp: Tue 2009-01-06 11:04:07 +0100
message:
Minor cleanups.
modified:
libcore/swf/tag_loaders.cpp
=== modified file 'libcore/RGBA.cpp'
--- a/libcore/RGBA.cpp 2008-11-14 00:46:35 +0000
+++ b/libcore/RGBA.cpp 2009-01-05 09:32:03 +0000
@@ -19,9 +19,9 @@
//
/// Can throw ParserException on premature end of input stream
- void rgba::read(SWFStream& in, int tag_type)
+ void rgba::read(SWFStream& in, SWF::TagType tag)
{
- switch (tag_type)
+ switch (tag)
{
case SWF::DEFINESHAPE:
case SWF::DEFINESHAPE2:
=== modified file 'libcore/RGBA.h'
--- a/libcore/RGBA.h 2008-10-20 17:06:14 +0000
+++ b/libcore/RGBA.h 2009-01-05 09:32:03 +0000
@@ -10,6 +10,7 @@
#include <string>
#include <boost/cstdint.hpp> // for boost::?int??_t
+#include "swf.h"
namespace gnash {
class SWFStream; // forward declaration
@@ -71,13 +72,13 @@
return (m_r<<16) + (m_g<<8) + m_b;
}
- /// Initialize from intput stream.
+ /// Initialize from input stream.
//
///
/// @param in
/// The input (SWF) stream
///
- /// @param tag_type
+ /// @param t
/// I don't know by which logic but
/// a value <= 22 makes it read RGB
/// and value > 22 makes it read RGBA
@@ -85,9 +86,9 @@
/// Throw a ParserException if there's no enough bytes in the
/// currently opened tag for reading. See stream::ensureBytes()
///
- void read(SWFStream& in, int tag_type);
+ void read(SWFStream& in, SWF::TagType t);
- /// Initialize from intput stream (reads RGBA)
+ /// Initialize from input stream (reads RGBA)
//
/// Throw a ParserException if there's no enough bytes in the
/// currently opened tag for reading. See stream::ensureBytes()
=== modified file 'libcore/SWFStream.cpp'
--- a/libcore/SWFStream.cpp 2008-12-01 19:24:05 +0000
+++ b/libcore/SWFStream.cpp 2009-01-05 09:32:03 +0000
@@ -520,7 +520,7 @@
}
-SWF::tag_type
+SWF::TagType
SWFStream::open_tag()
{
align();
@@ -593,7 +593,7 @@
tagStart, tagType, tagLength, tagEnd);
);
- return static_cast<SWF::tag_type>(tagType);
+ return static_cast<SWF::TagType>(tagType);
}
=== modified file 'libcore/SWFStream.h'
--- a/libcore/SWFStream.h 2008-11-28 08:23:30 +0000
+++ b/libcore/SWFStream.h 2009-01-05 09:32:03 +0000
@@ -322,7 +322,7 @@
//
/// aligned read
///
- SWF::tag_type open_tag();
+ SWF::TagType open_tag();
/// Seek to the end of the most-recently-opened tag.
void close_tag();
=== modified file 'libcore/fill_style.cpp'
--- a/libcore/fill_style.cpp 2008-12-16 15:48:03 +0000
+++ b/libcore/fill_style.cpp 2009-01-05 09:32:03 +0000
@@ -37,11 +37,11 @@
//
void
-gradient_record::read(SWFStream& in, int tag_type)
+gradient_record::read(SWFStream& in, SWF::TagType tag)
{
in.ensureBytes(1);
m_ratio = in.read_u8();
- m_color.read(in, tag_type);
+ m_color.read(in, tag);
}
//
@@ -60,7 +60,7 @@
void
-fill_style::read(SWFStream& in, int tag_type, movie_definition& md,
+fill_style::read(SWFStream& in, SWF::TagType t, movie_definition& md,
fill_style *pOther)
{
const bool is_morph = (pOther != NULL);
@@ -79,8 +79,8 @@
if (m_type == SWF::FILL_SOLID)
{
// 0x00: solid fill
- if ( tag_type == SWF::DEFINESHAPE3 || tag_type == SWF::DEFINESHAPE4
- || tag_type == SWF::DEFINESHAPE4_ || is_morph)
+ if ( t == SWF::DEFINESHAPE3 || t == SWF::DEFINESHAPE4
+ || t == SWF::DEFINESHAPE4_ || is_morph)
{
m_color.read_rgba(in);
if (is_morph) pOther->m_color.read_rgba(in);
@@ -88,8 +88,8 @@
else
{
// For DefineMorphShape tags we should use morph_fill_style
- assert( tag_type == SWF::DEFINESHAPE ||
- tag_type == SWF::DEFINESHAPE2 );
+ assert( t == SWF::DEFINESHAPE ||
+ t == SWF::DEFINESHAPE2 );
m_color.read_rgb(in);
}
@@ -144,8 +144,8 @@
uint8_t grad_props = in.read_u8();
- if (tag_type == SWF::DEFINESHAPE4 ||
- tag_type == SWF::DEFINESHAPE4_) {
+ if (t == SWF::DEFINESHAPE4 ||
+ t == SWF::DEFINESHAPE4_) {
uint8_t spread_mode = grad_props >> 6;
switch(spread_mode) {
case 0:
@@ -188,8 +188,8 @@
return;
}
- if ( num_gradients > 8 + ((tag_type == SWF::DEFINESHAPE4 ||
- tag_type == SWF::DEFINESHAPE4_) ? 7 : 0))
+ if ( num_gradients > 8 + ((t == SWF::DEFINESHAPE4 ||
+ t == SWF::DEFINESHAPE4_) ? 7 : 0))
{
// see: http://sswf.sourceforge.net/SWFalexref.html#swf_gradient
IF_VERBOSE_MALFORMED_SWF(
@@ -204,9 +204,9 @@
m_gradients.resize(num_gradients);
for (unsigned int i = 0; i < num_gradients; i++) {
- m_gradients[i].read(in, tag_type);
+ m_gradients[i].read(in, t);
if (is_morph) {
- pOther->m_gradients[i].read(in, tag_type);
+ pOther->m_gradients[i].read(in, t);
}
}
=== modified file 'libcore/fill_style.h'
--- a/libcore/fill_style.h 2008-12-16 15:15:55 +0000
+++ b/libcore/fill_style.h 2009-01-05 09:32:03 +0000
@@ -49,7 +49,7 @@
m_color(color)
{}
- void read(SWFStream& in, int tag_type);
+ void read(SWFStream& in, SWF::TagType tag);
//data:
boost::uint8_t m_ratio;
@@ -129,11 +129,11 @@
/// Throw a ParserException if there's no enough bytes in the
/// currently opened tag for reading. See stream::ensureBytes()
///
- void read(SWFStream& in, int tag_type, movie_definition& m,
+ void read(SWFStream& in, SWF::TagType t, movie_definition& m,
fill_style *pOther = NULL);
/// Read the fill style from a stream, morph version.
- void read_morph(SWFStream& in, int tag_type, movie_definition& m,
+ void read_morph(SWFStream& in, SWF::TagType t, movie_definition& m,
fill_style *pOther);
/// \brief
=== modified file 'libcore/impl.cpp'
--- a/libcore/impl.cpp 2009-01-02 12:00:13 +0000
+++ b/libcore/impl.cpp 2009-01-05 09:32:03 +0000
@@ -81,7 +81,7 @@
// Associate the specified tag type with the given tag loader
// function.
void
-register_tag_loader(SWF::tag_type t, SWF::TagLoadersTable::loader_function lf)
+register_tag_loader(SWF::TagType t, SWF::TagLoadersTable::loader_function lf)
{
using SWF::TagLoadersTable;
=== modified file 'libcore/impl.h'
--- a/libcore/impl.h 2008-10-20 17:06:14 +0000
+++ b/libcore/impl.h 2009-01-05 09:32:03 +0000
@@ -35,7 +35,7 @@
// to call this in order to handle special tag types.
/// Register a tag loader for the given tag
-void register_tag_loader(SWF::tag_type t,
+void register_tag_loader(SWF::TagType t,
SWF::TagLoadersTable::loader_function lf);
} // end namespace gnash
=== modified file 'libcore/parser/SWFMovieDefinition.cpp'
--- a/libcore/parser/SWFMovieDefinition.cpp 2008-12-16 15:15:55 +0000
+++ b/libcore/parser/SWFMovieDefinition.cpp 2009-01-05 09:32:03 +0000
@@ -567,11 +567,11 @@
//log_debug(_("Loading thread iteration %u"), it++);
- SWF::tag_type tag_type = str.open_tag();
+ SWF::TagType tag = str.open_tag();
parse_tag:
- if (tag_type == SWF::END)
+ if (tag == SWF::END)
{
if ((unsigned int) str.tell() != _swf_end_pos)
{
@@ -588,7 +588,7 @@
SWF::TagLoadersTable::loader_function lf = NULL;
- if (tag_type == SWF::SHOWFRAME)
+ if (tag == SWF::SHOWFRAME)
{
// show frame tag -- advance to the next frame.
@@ -600,30 +600,30 @@
if ( floaded == m_frame_count )
{
str.close_tag();
- tag_type = str.open_tag();
- if ( tag_type != SWF::END )
+ tag = str.open_tag();
+ if (tag != SWF::END )
{
IF_VERBOSE_MALFORMED_SWF(
log_swferror(_("last expected SHOWFRAME
"
"in SWF stream '%s' isn't "
"followed by an END (%d)."),
- get_url(), tag_type);
+ get_url(), tag);
);
}
goto parse_tag;
}
}
- else if (_tag_loaders.get(tag_type, &lf))
+ else if (_tag_loaders.get(tag, &lf))
{
// call the tag loader. The tag loader should add
// characters or tags to the movie data structure.
- (*lf)(str, tag_type, *this, _runInfo);
+ (*lf)(str, tag, *this, _runInfo);
}
else
{
// no tag loader for this tag type.
- log_error(_("*** no tag loader for type %d (movie)"), tag_type);
+ log_error(_("*** no tag loader for type %d (movie)"), tag);
IF_VERBOSE_PARSE(
std::ostringstream ss;
dumpTagBytes(str, ss);
=== modified file 'libcore/parser/action_buffer.cpp'
--- a/libcore/parser/action_buffer.cpp 2008-11-19 14:25:36 +0000
+++ b/libcore/parser/action_buffer.cpp 2009-01-05 09:32:03 +0000
@@ -175,7 +175,7 @@
assert (maxBufferLength > 0);
as_arg_t fmt = ARG_HEX;
- action_type action_id = static_cast<action_type>(instruction_data[0]);
+ ActionType action_id = static_cast<ActionType>(instruction_data[0]);
std::stringstream ss;
=== modified file 'libcore/parser/morph2_character_def.cpp'
--- a/libcore/parser/morph2_character_def.cpp 2008-12-16 06:45:58 +0000
+++ b/libcore/parser/morph2_character_def.cpp 2009-01-05 09:32:03 +0000
@@ -194,19 +194,19 @@
}
-void morph2_character_def::read(SWFStream& in, int tag_type,
+void morph2_character_def::read(SWFStream& in, SWF::TagType tag,
movie_definition& md)
{
- assert(tag_type == SWF::DEFINEMORPHSHAPE
- || tag_type == SWF::DEFINEMORPHSHAPE2
- || tag_type == SWF::DEFINEMORPHSHAPE2_);
+ assert(tag == SWF::DEFINEMORPHSHAPE
+ || tag == SWF::DEFINEMORPHSHAPE2
+ || tag == SWF::DEFINEMORPHSHAPE2_);
rect bound1, bound2;
bound1.read(in);
bound2.read(in);
- if (tag_type == SWF::DEFINEMORPHSHAPE2 ||
- tag_type == SWF::DEFINEMORPHSHAPE2_)
+ if (tag == SWF::DEFINEMORPHSHAPE2 ||
+ tag == SWF::DEFINEMORPHSHAPE2_)
{
// TODO: Use these values.
rect inner_bound1, inner_bound2;
@@ -229,7 +229,7 @@
fill_style fs1, fs2;
for (i = 0; i < fill_style_count; ++i)
{
- fs1.read(in, tag_type, md, &fs2);
+ fs1.read(in, tag, md, &fs2);
m_shape1->addFillStyle(fs1);
m_shape2->addFillStyle(fs2);
}
@@ -238,14 +238,14 @@
line_style ls1, ls2;
for (i = 0; i < line_style_count; ++i)
{
- ls1.read_morph(in, tag_type, md, &ls2);
+ ls1.read_morph(in, tag, md, &ls2);
m_shape1->addLineStyle(ls1);
m_shape2->addLineStyle(ls2);
}
- m_shape1->read(in, tag_type, false, md);
+ m_shape1->read(in, tag, false, md);
in.align();
- m_shape2->read(in, tag_type, false, md);
+ m_shape2->read(in, tag, false, md);
// Set bounds as read in *this* tags rather then
// the one computed from shape_character_def parser
=== modified file 'libcore/parser/morph2_character_def.h'
--- a/libcore/parser/morph2_character_def.h 2008-11-07 08:37:30 +0000
+++ b/libcore/parser/morph2_character_def.h 2009-01-05 09:32:03 +0000
@@ -8,7 +8,7 @@
#include "smart_ptr.h" // GNASH_USE_GC
#include "shape_character_def.h" // for inheritance of morph2_character_def
-
+#include "swf.h"
namespace gnash {
@@ -30,7 +30,7 @@
/// The stream to read the definition from.
/// Tag type is assumed to have been read already
///
- /// @param tag_type
+ /// @param TagType
/// Type of the tag.
/// Need be SWF::DEFINEMORPHSHAPE or an assertion would fail.
/// TODO: drop ?
@@ -39,7 +39,7 @@
/// Movie definition. Used to resolv character ids for fill styles.
/// Must be not-null or would segfault.
///
- void read(SWFStream& in, int tag_type, movie_definition& m);
+ void read(SWFStream& in, SWF::TagType tag, movie_definition& m);
virtual void display(character* inst);
void lerp_matrix(SWFMatrix& t, const SWFMatrix& m1, const SWFMatrix& m2,
const float ratio);
=== modified file 'libcore/parser/shape_character_def.cpp'
--- a/libcore/parser/shape_character_def.cpp 2008-11-14 10:31:33 +0000
+++ b/libcore/parser/shape_character_def.cpp 2009-01-05 09:32:03 +0000
@@ -44,11 +44,11 @@
// Read fill styles, and push them onto the given style array.
static void
read_fill_styles(std::vector<fill_style>& styles, SWFStream& in,
- int tag_type, movie_definition& m)
+ SWF::TagType tag, movie_definition& m)
{
in.ensureBytes(1);
boost::uint16_t fill_style_count = in.read_u8();
- if (tag_type > 2)
+ if (tag > 2)
{
if (fill_style_count == 0xFF)
{
@@ -67,14 +67,14 @@
{
// TODO: add a fill_style constructor directly reading from stream
fill_style fs;
- fs.read(in, tag_type, m);
+ fs.read(in, tag, m);
styles.push_back(fs);
}
}
// Read line styles and push them onto the back of the given array.
static void
-read_line_styles(std::vector<line_style>& styles, SWFStream& in, int tag_type,
+read_line_styles(std::vector<line_style>& styles, SWFStream& in, SWF::TagType
tag,
movie_definition& md)
{
in.ensureBytes(1);
@@ -97,7 +97,7 @@
for (int i = 0; i < line_style_count; i++)
{
styles.resize(styles.size() + 1);
- styles.back().read(in, tag_type, md);
+ styles.back().read(in, tag, md);
}
}
@@ -125,7 +125,7 @@
}
void
-shape_character_def::read(SWFStream& in, int tag_type, bool with_style,
+shape_character_def::read(SWFStream& in, SWF::TagType tag, bool with_style,
movie_definition& m)
{
if (with_style)
@@ -138,7 +138,7 @@
);
// TODO: Store and use these. Unfinished.
- if (tag_type == SWF::DEFINESHAPE4 || tag_type == SWF::DEFINESHAPE4_)
+ if (tag == SWF::DEFINESHAPE4 || tag == SWF::DEFINESHAPE4_)
{
rect tbound;
tbound.read(in);
@@ -147,8 +147,8 @@
LOG_ONCE(log_unimpl("DEFINESHAPE4 edge boundaries and scales"));
}
- read_fill_styles(m_fill_styles, in, tag_type, m);
- read_line_styles(m_line_styles, in, tag_type, m);
+ read_fill_styles(m_fill_styles, in, tag, m);
+ read_line_styles(m_line_styles, in, tag, m);
}
/// Adding a dummy fill style is just needed to make the
@@ -156,7 +156,7 @@
/// really used, as text rendering will use style information
/// from TEXTRECORD tag instead.
///
- if ( tag_type == SWF::DEFINEFONT || tag_type == SWF::DEFINEFONT2 )
+ if (tag == SWF::DEFINEFONT || tag == SWF::DEFINEFONT2 )
{
assert(!with_style);
}
@@ -188,11 +188,11 @@
/// Pretty ugly... till next bug report.
///
///
- if (tag_type == SWF::DEFINEFONT || tag_type == SWF::DEFINEFONT2 ||
- tag_type == SWF::DEFINEFONT3)
+ if (tag == SWF::DEFINEFONT || tag == SWF::DEFINEFONT2 ||
+ tag == SWF::DEFINEFONT3)
{
log_debug("Skipping glyph read, being fill and line bits zero. "
- "SWF tag is %d.", tag_type);
+ "SWF tag is %d.", tag);
return;
}
}
@@ -275,7 +275,7 @@
style += fill_base;
}
- if (tag_type == SWF::DEFINEFONT || tag_type ==
SWF::DEFINEFONT2)
+ if (tag == SWF::DEFINEFONT || tag == SWF::DEFINEFONT2)
{
if ( style > 1 ) // 0:hide 1:renderer
{
@@ -326,7 +326,7 @@
style += fill_base;
}
- if (tag_type == SWF::DEFINEFONT || tag_type ==
SWF::DEFINEFONT2)
+ if (tag == SWF::DEFINEFONT || tag == SWF::DEFINEFONT2)
{
if ( style > 1 ) // 0:hide 1:renderer
{
@@ -375,7 +375,7 @@
{
style += line_base;
}
- if (tag_type == SWF::DEFINEFONT || tag_type ==
SWF::DEFINEFONT2)
+ if (tag == SWF::DEFINEFONT || tag == SWF::DEFINEFONT2)
{
if ( style > 1 ) // 0:hide 1:renderer
{
@@ -414,7 +414,7 @@
{
IF_VERBOSE_MALFORMED_SWF(
log_swferror("Unexpected HasNewStyle flag in tag "
- "%d shape record", tag_type);
+ "%d shape record", tag);
);
continue;
}
@@ -437,8 +437,8 @@
fill_base = m_fill_styles.size();
line_base = m_line_styles.size();
- read_fill_styles(m_fill_styles, in, tag_type, m);
- read_line_styles(m_line_styles, in, tag_type, m);
+ read_fill_styles(m_fill_styles, in, tag, m);
+ read_line_styles(m_line_styles, in, tag, m);
in.ensureBits(8);
num_fill_bits = in.read_uint(4);
@@ -532,7 +532,7 @@
{
log_debug("Shape character read for tag %d contained embedded "
"bounds %s, while we computed bounds %s",
- tag_type, m_bound, computedBounds);
+ tag, m_bound, computedBounds);
}
}
#endif
=== modified file 'libcore/parser/shape_character_def.h'
--- a/libcore/parser/shape_character_def.h 2008-11-14 10:31:33 +0000
+++ b/libcore/parser/shape_character_def.h 2009-01-05 09:32:03 +0000
@@ -15,6 +15,7 @@
#include "rect.h" // for composition
#include "fill_style.h" // for fill style
#include "styles.h" // for line style
+#include "swf.h"
#include <vector> // for composition
@@ -59,22 +60,22 @@
/// @param in
/// The stream to read the shape from
///
- /// @param tag_type
- /// The SWF::tag_type this shape definition is read for.
- /// TODO: change to an actual SWF::tag_type type
+ /// @param TagType
+ /// The SWF::TagType this shape definition is read for.
+ /// TODO: change to an actual SWF::TagType type
///
/// @param with_style
/// If true, this definition includes bounds, fill styles and line
styles.
/// Tipically, this is only false for DEFINEFONT* tags.
/// NOTE: if with_style is false, bounds of the shape will be
computed
/// rather then read.
- /// TODO: drop this function, set based on tag_type ?
+ /// TODO: drop this function, set based on TagType ?
///
/// @param m
/// The movie definition corresponding to the SWF we/re parsing.
/// This is used to resolve bitmap characters for fill styles, never
/// used if with_style is false.
- void read(SWFStream& in, int tag_type, bool with_style,
+ void read(SWFStream& in, SWF::TagType tag, bool with_style,
movie_definition& m);
void display(const SWFMatrix& mat, const cxform& cx,
=== modified file 'libcore/parser/sprite_definition.cpp'
--- a/libcore/parser/sprite_definition.cpp 2008-10-30 21:35:10 +0000
+++ b/libcore/parser/sprite_definition.cpp 2009-01-05 09:32:03 +0000
@@ -82,11 +82,11 @@
while ( in.tell() < tag_end )
{
- SWF::tag_type tag_type = in.open_tag();
+ SWF::TagType tag = in.open_tag();
SWF::TagLoadersTable::loader_function lf = NULL;
- if (tag_type == SWF::END)
+ if (tag == SWF::END)
{
if (in.tell() != tag_end)
{
@@ -101,7 +101,7 @@
break;
}
}
- else if (tag_type == SWF::SHOWFRAME)
+ else if (tag == SWF::SHOWFRAME)
{
// show frame tag -- advance to the next frame.
++m_loading_frame;
@@ -131,18 +131,18 @@
}
}
}
- else if (_tag_loaders.get(tag_type, &lf))
+ else if (_tag_loaders.get(tag, &lf))
{
// call the tag loader. The tag loader should add
// characters or tags to the movie data structure.
- (*lf)(in, tag_type, *this, runInfo);
+ (*lf)(in, tag, *this, runInfo);
}
else
{
// no tag loader for this tag type.
// FIXME, should this be a log_swferror instead?
log_error(_("*** no tag loader for type %d (sprite)"),
- tag_type);
+ tag);
}
in.close_tag();
=== modified file 'libcore/styles.cpp'
--- a/libcore/styles.cpp 2008-12-16 12:20:22 +0000
+++ b/libcore/styles.cpp 2009-01-05 09:32:03 +0000
@@ -40,16 +40,16 @@
}
void
-line_style::read_morph(SWFStream& in, int tag_type, movie_definition& md,
+line_style::read_morph(SWFStream& in, SWF::TagType t, movie_definition& md,
line_style *pOther)
{
- if (tag_type == SWF::DEFINEMORPHSHAPE)
+ if (t == SWF::DEFINEMORPHSHAPE)
{
in.ensureBytes(2 + 2);
m_width = in.read_u16();
pOther->m_width = in.read_u16();
- m_color.read(in, tag_type);
- pOther->m_color.read(in, tag_type);
+ m_color.read(in, t);
+ pOther->m_color.read(in, t);
return;
}
@@ -80,25 +80,25 @@
// read fill styles for strokes.
// TODO: don't throw away this information, should be passed to
renderer.
fill_style f, g;
- f.read(in, tag_type, md, &g);
+ f.read(in, t, md, &g);
m_color = f.get_color();
pOther->m_color = g.get_color();
}
else
{
- m_color.read(in, tag_type);
- pOther->m_color.read(in, tag_type);
+ m_color.read(in, t);
+ pOther->m_color.read(in, t);
}
}
void
-line_style::read(SWFStream& in, int tag_type, movie_definition& md)
+line_style::read(SWFStream& in, SWF::TagType t, movie_definition& md)
{
- if (!(tag_type == SWF::DEFINESHAPE4 || tag_type == SWF::DEFINESHAPE4_))
+ if (!(t == SWF::DEFINESHAPE4 || t == SWF::DEFINESHAPE4_))
{
in.ensureBytes(2);
m_width = in.read_u16();
- m_color.read(in, tag_type);
+ m_color.read(in, t);
return;
}
@@ -128,12 +128,12 @@
// read fill styles for strokes.
// TODO: don't throw away this information, should be passed to
renderer.
fill_style f;
- f.read(in, tag_type, md);
+ f.read(in, t, md);
m_color = f.get_color();
}
else
{
- m_color.read(in, tag_type);
+ m_color.read(in, t);
}
}
=== modified file 'libcore/styles.h'
--- a/libcore/styles.h 2008-12-16 15:15:55 +0000
+++ b/libcore/styles.h 2009-01-05 09:32:03 +0000
@@ -11,6 +11,7 @@
#include "impl.h"
#include "RGBA.h"
+#include "swf.h"
namespace gnash {
@@ -82,11 +83,11 @@
/// Throw a ParserException if there's no enough bytes in the
/// currently opened tag for reading. See stream::ensureBytes()
///
- void read(SWFStream& in, int tag_type, movie_definition& md);
+ void read(SWFStream& in, SWF::TagType t, movie_definition& md);
/// Read two lines styles from the SWF stream
/// at the same time -- this is used in morphing.
- void read_morph(SWFStream& in, int tag_type, movie_definition& md,
+ void read_morph(SWFStream& in, SWF::TagType t, movie_definition& md,
line_style *pOther);
/// Return thickness of the line, in TWIPS
=== modified file 'libcore/swf.h'
--- a/libcore/swf.h 2008-11-24 16:43:19 +0000
+++ b/libcore/swf.h 2009-01-05 09:32:03 +0000
@@ -18,16 +18,15 @@
#ifndef GNASH_SWF_H
#define GNASH_SWF_H
-//#include <iofwd.h>
-#include <iostream> // for std::ostream
+#include <iostream>
namespace gnash {
/// SWF format parsing classes
-namespace SWF { // gnash::SWF
+namespace SWF {
-/// SWF tag types. Symbolc names copied from Ming
-typedef enum
+/// SWF tag types. Symbolic names copied from Ming
+enum TagType
{
/// end of sprite or movie definition
END = 0,
@@ -176,14 +175,14 @@
REFLEX = 777,
DEFINEBITSPTR = 1023
-} tag_type;
+};
/// SWF action ids. Symbolic names copied from Ming.
//
/// For semantic of each action see:
/// http://sswf.sourceforge.net/SWFalexref.html
///
-typedef enum
+enum ActionType
{
ACTION_END = 0x00,
ACTION_NEXTFRAME = 0x04,
@@ -541,9 +540,9 @@
ACTION_SETREGISTER = 0x87
-} action_type;
+};
-typedef enum
+enum abc_action_type
{
/// AS3 Actions go below here.
ABC_ACTION_END = 0x00,
@@ -1716,7 +1715,7 @@
/// NB: Error to appear in ABC
ABC_ACTION_VERIFYOP = 0xFE
-} abc_action_type;
+};
/// Output operator for abc_action_type
std::ostream& operator<< (std::ostream& os, const abc_action_type& typ);
@@ -1727,7 +1726,7 @@
/// For more info see:
/// http://sswf.sourceforge.net/SWFalexref.html#swf_fill_style
///
-typedef enum {
+enum fill_style_type {
FILL_SOLID = 0x00,
FILL_LINEAR_GRADIENT = 0x10,
FILL_RADIAL_GRADIENT = 0x12,
@@ -1741,18 +1740,18 @@
/// swf7, hard edges
FILL_CLIPPED_BITMAP_HARD = 0x43
-} fill_style_type;
+};
-typedef enum {
+enum gradient_spread_mode {
GRADIENT_SPREAD_PAD,
GRADIENT_SPREAD_REFLECT,
GRADIENT_SPREAD_REPEAT
-} gradient_spread_mode;
+};
-typedef enum {
+enum gradient_interpolation_mode {
GRADIENT_INTERPOL_NORMAL,
GRADIENT_INTERPOL_LINEAR
-} gradient_interpolation_mode;
+};
=== modified file 'libcore/swf/CSMTextSettingsTag.cpp'
--- a/libcore/swf/CSMTextSettingsTag.cpp 2008-10-28 21:17:19 +0000
+++ b/libcore/swf/CSMTextSettingsTag.cpp 2009-01-05 09:32:03 +0000
@@ -31,7 +31,7 @@
}
void
-CSMTextSettingsTag::loader(SWFStream& in, tag_type tag, movie_definition&
/*m*/,
+CSMTextSettingsTag::loader(SWFStream& in, TagType tag, movie_definition& /*m*/,
const RunInfo& /*r*/)
{
assert(tag == SWF::CSMTEXTSETTINGS); // 73
=== modified file 'libcore/swf/CSMTextSettingsTag.h'
--- a/libcore/swf/CSMTextSettingsTag.h 2008-10-28 21:17:19 +0000
+++ b/libcore/swf/CSMTextSettingsTag.h 2009-01-05 09:32:03 +0000
@@ -39,7 +39,7 @@
CSMTextSettingsTag(movie_definition& m, SWFStream& in);
- static void loader(SWFStream& in, tag_type tag, movie_definition& m,
const RunInfo& r);
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r);
private:
=== modified file 'libcore/swf/DefineButtonCxformTag.cpp'
--- a/libcore/swf/DefineButtonCxformTag.cpp 2008-12-29 17:18:53 +0000
+++ b/libcore/swf/DefineButtonCxformTag.cpp 2009-01-05 09:32:03 +0000
@@ -16,7 +16,7 @@
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#include "swf.h" // for tag_type definition
+#include "swf.h" // for TagType definition
#include "SWFStream.h" // for inlines
#include "movie_definition.h"
#include "DefineButtonTag.h"
@@ -27,7 +27,7 @@
namespace SWF {
void
-DefineButtonCxformTag::loader(SWFStream& in, tag_type tag, movie_definition& m,
+DefineButtonCxformTag::loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
=== modified file 'libcore/swf/DefineButtonCxformTag.h'
--- a/libcore/swf/DefineButtonCxformTag.h 2008-11-07 14:50:12 +0000
+++ b/libcore/swf/DefineButtonCxformTag.h 2009-01-05 09:32:03 +0000
@@ -19,7 +19,7 @@
#ifndef GNASH_SWF_DEFINEBUTTONCXFORMTAG_H
#define GNASH_SWF_DEFINEBUTTONCXFORMTAG_H
-#include "swf.h" // for tag_type definition
+#include "swf.h" // for TagType definition
namespace gnash {
class SWFStream;
@@ -38,7 +38,7 @@
{
public:
- static void loader(SWFStream& in, tag_type tag, movie_definition& m,
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/);
};
=== modified file 'libcore/swf/DefineButtonSoundTag.cpp'
--- a/libcore/swf/DefineButtonSoundTag.cpp 2008-12-29 17:18:53 +0000
+++ b/libcore/swf/DefineButtonSoundTag.cpp 2009-01-05 09:32:03 +0000
@@ -36,7 +36,7 @@
}
void
-DefineButtonSoundTag::loader(SWFStream& in, tag_type tag, movie_definition& m,
+DefineButtonSoundTag::loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == SWF::DEFINEBUTTONSOUND);
=== modified file 'libcore/swf/DefineButtonSoundTag.h'
--- a/libcore/swf/DefineButtonSoundTag.h 2008-11-24 08:33:58 +0000
+++ b/libcore/swf/DefineButtonSoundTag.h 2009-01-05 09:32:03 +0000
@@ -68,7 +68,7 @@
typedef std::vector<ButtonSound> Sounds;
- static void loader(SWFStream& in, tag_type tag, movie_definition& m,
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r);
const ButtonSound& getSound(Sounds::size_type index) const
=== modified file 'libcore/swf/DefineButtonTag.cpp'
--- a/libcore/swf/DefineButtonTag.cpp 2008-12-28 10:01:13 +0000
+++ b/libcore/swf/DefineButtonTag.cpp 2009-01-05 09:32:03 +0000
@@ -24,7 +24,7 @@
#include "DefineButtonTag.h"
#include "Button.h" // for create_character_instance()
#include "DefineButtonCxformTag.h"
-
+#include "swf.h"
#include "SWFStream.h" // for read()
#include "movie_definition.h"
#include "action_buffer.h"
@@ -38,19 +38,19 @@
//
-ButtonAction::ButtonAction(SWFStream& in, int tag_type, unsigned long endPos,
+ButtonAction::ButtonAction(SWFStream& in, TagType t, unsigned long endPos,
movie_definition& mdef)
:
m_actions(mdef)
{
// Read condition flags.
- if (tag_type == SWF::DEFINEBUTTON) // 7
+ if (t == SWF::DEFINEBUTTON)
{
m_conditions = OVER_DOWN_TO_OVER_UP;
}
else
{
- assert(tag_type == SWF::DEFINEBUTTON2); // 34
+ assert(t == SWF::DEFINEBUTTON2);
if ( in.tell()+2 > endPos )
{
@@ -117,7 +117,7 @@
}
bool
-ButtonRecord::read(SWFStream& in, int tag_type,
+ButtonRecord::read(SWFStream& in, TagType t,
movie_definition& m, unsigned long endPos)
{
// caller should check this
@@ -192,7 +192,7 @@
// SWFMatrix::read() checks the length of the stream
m_button_matrix.read(in);
- if (tag_type == SWF::DEFINEBUTTON2)
+ if (t == SWF::DEFINEBUTTON2)
{
// cxform::read_rgba() checks the length of the stream.
m_button_cxform.read_rgba(in);
@@ -219,7 +219,7 @@
}
void
-DefineButtonTag::loader(SWFStream& in, tag_type tag, movie_definition& m,
+DefineButtonTag::loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == DEFINEBUTTON);
@@ -236,7 +236,7 @@
}
void
-DefineButton2Tag::loader(SWFStream& in, tag_type tag, movie_definition& m,
+DefineButton2Tag::loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == DEFINEBUTTON2);
@@ -257,7 +257,7 @@
//
DefineButtonTag::DefineButtonTag(SWFStream& in, movie_definition& m,
- tag_type tag)
+ TagType tag)
:
_soundTag(0),
_movieDef(m)
=== modified file 'libcore/swf/DefineButtonTag.h'
--- a/libcore/swf/DefineButtonTag.h 2008-11-08 10:04:43 +0000
+++ b/libcore/swf/DefineButtonTag.h 2009-01-05 09:32:03 +0000
@@ -30,6 +30,7 @@
#include "filter_factory.h" // for Filters (composition of button_record)
#include "sound_handler.h" // for sound_handler::sound_envelope in a vector..
#include "DefineButtonSoundTag.h"
+#include "swf.h"
#include <boost/scoped_ptr.hpp>
#include <boost/cstdint.hpp> // for boost::uint64_t typedef
@@ -99,7 +100,7 @@
/// @param endPos
/// Last stream offset available for a valid read
///
- bool read(SWFStream& in, int tag_type, movie_definition& m,
+ bool read(SWFStream& in, TagType t, movie_definition& m,
unsigned long endPos);
/// Return true if the button_record is valid
@@ -137,7 +138,7 @@
/// The movie_definition this button action was read from
///
///
- ButtonAction(SWFStream& in, int tag_type, unsigned long endPos,
+ ButtonAction(SWFStream& in, TagType t, unsigned long endPos,
movie_definition& mdef);
/// Return true if this action should be triggered by the given event.
@@ -183,7 +184,7 @@
public:
/// Load a DefineButtonTag.
- static void loader(SWFStream& in, tag_type tag, movie_definition& m,
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r);
typedef std::vector<ButtonRecord> ButtonRecords;
@@ -284,7 +285,7 @@
/// Construct a DefineButtonTag (DefinitionTag)
//
/// This can only be constructed using a loader() function.
- DefineButtonTag(SWFStream& in, movie_definition& m, tag_type tag);
+ DefineButtonTag(SWFStream& in, movie_definition& m, TagType tag);
/// Read a DEFINEBUTTON tag
void readDefineButtonTag(SWFStream& in, movie_definition& m);
@@ -312,7 +313,7 @@
{
public:
/// Load a DefineButton2 tag.
- static void loader(SWFStream& in, tag_type tag, movie_definition& m,
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r);
};
=== modified file 'libcore/swf/DefineEditTextTag.cpp'
--- a/libcore/swf/DefineEditTextTag.cpp 2008-11-10 12:31:18 +0000
+++ b/libcore/swf/DefineEditTextTag.cpp 2009-01-05 09:32:03 +0000
@@ -25,7 +25,7 @@
namespace SWF {
void
-DefineEditTextTag::loader(SWFStream& in, tag_type tag, movie_definition& m,
+DefineEditTextTag::loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == SWF::DEFINEEDITTEXT); // 37
=== modified file 'libcore/swf/DefineEditTextTag.h'
--- a/libcore/swf/DefineEditTextTag.h 2008-11-08 18:03:33 +0000
+++ b/libcore/swf/DefineEditTextTag.h 2009-01-05 09:32:03 +0000
@@ -24,7 +24,7 @@
#include "rect.h"
#include "character_def.h"
-#include "swf.h" // for tag_type definition
+#include "swf.h" // for TagType definition
#include "RGBA.h"
#include "TextField.h"
@@ -62,7 +62,7 @@
~DefineEditTextTag() {}
/// Load an SWF::DEFINEEDITTEXT (37) tag.
- static void loader(SWFStream& in, tag_type tag, movie_definition& m,
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r);
const rect& get_bound() const { return _rect; }
=== modified file 'libcore/swf/DefineFontAlignZonesTag.cpp'
--- a/libcore/swf/DefineFontAlignZonesTag.cpp 2008-11-08 18:03:33 +0000
+++ b/libcore/swf/DefineFontAlignZonesTag.cpp 2009-01-05 09:32:03 +0000
@@ -37,7 +37,7 @@
/* public static */
void
-DefineFontAlignZonesTag::loader(SWFStream& in, tag_type tag,
+DefineFontAlignZonesTag::loader(SWFStream& in, TagType tag,
movie_definition& m, const RunInfo& /*r*/)
{
assert(tag == SWF::DEFINEALIGNZONES);
=== modified file 'libcore/swf/DefineFontAlignZonesTag.h'
--- a/libcore/swf/DefineFontAlignZonesTag.h 2008-11-08 10:04:43 +0000
+++ b/libcore/swf/DefineFontAlignZonesTag.h 2009-01-05 09:32:03 +0000
@@ -42,7 +42,7 @@
};
- static void loader(SWFStream& in, tag_type tag, movie_definition& m,
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r);
private:
=== modified file 'libcore/swf/DefineFontNameTag.h'
--- a/libcore/swf/DefineFontNameTag.h 2008-11-08 22:02:22 +0000
+++ b/libcore/swf/DefineFontNameTag.h 2009-01-05 09:32:03 +0000
@@ -38,7 +38,7 @@
public:
// Set font name for a font.
- static void loader(SWFStream& in, tag_type tag, movie_definition& m,
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == SWF::DEFINEFONTNAME);
=== modified file 'libcore/swf/DefineFontTag.cpp'
--- a/libcore/swf/DefineFontTag.cpp 2008-11-08 22:02:22 +0000
+++ b/libcore/swf/DefineFontTag.cpp 2009-01-05 09:32:03 +0000
@@ -31,7 +31,7 @@
namespace SWF {
void
-DefineFontTag::loader(SWFStream& in, tag_type tag, movie_definition& m,
+DefineFontTag::loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == DEFINEFONT || tag == DEFINEFONT2 || tag == DEFINEFONT3);
@@ -94,7 +94,7 @@
#endif
-DefineFontTag::DefineFontTag(SWFStream& in, movie_definition& m, tag_type tag)
+DefineFontTag::DefineFontTag(SWFStream& in, movie_definition& m, TagType tag)
:
_subpixelFont(tag == DEFINEFONT3 ? true : false),
_unicodeChars(false),
@@ -372,7 +372,7 @@
}
void
-DefineFontInfoTag::loader(SWFStream& in, tag_type tag, movie_definition& m,
+DefineFontInfoTag::loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == DEFINEFONTINFO || tag == DEFINEFONTINFO2);
=== modified file 'libcore/swf/DefineFontTag.h'
--- a/libcore/swf/DefineFontTag.h 2008-11-08 22:02:22 +0000
+++ b/libcore/swf/DefineFontTag.h 2009-01-05 09:32:03 +0000
@@ -52,7 +52,7 @@
/// Load a DefineFont tag.
//
/// A corresponding Font is created and added to the movie_definition.
- static void loader(SWFStream& in, tag_type tag, movie_definition& m,
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r);
/// Return the glyphs read from the DefineFont tag.
@@ -103,7 +103,7 @@
private:
- DefineFontTag(SWFStream& in, movie_definition& m, tag_type tag);
+ DefineFontTag(SWFStream& in, movie_definition& m, TagType tag);
/// Read a DefineFont tag.
void readDefineFont(SWFStream& in, movie_definition & m);
@@ -142,7 +142,7 @@
/// Adds a CodeTable and other information to a Font created by a
/// DefineFont tag. The information is already contained in a
/// DefineFont2 or DefineFont3 tag.
- static void loader(SWFStream& in, tag_type tag, movie_definition& m,
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r);
};
=== modified file 'libcore/swf/DefineTextTag.cpp'
--- a/libcore/swf/DefineTextTag.cpp 2008-11-08 11:02:43 +0000
+++ b/libcore/swf/DefineTextTag.cpp 2009-01-05 09:32:03 +0000
@@ -17,7 +17,7 @@
namespace SWF {
void
-DefineTextTag::loader(SWFStream& in, tag_type tag, movie_definition& m,
+DefineTextTag::loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == DEFINETEXT);
@@ -34,7 +34,7 @@
}
void
-DefineText2Tag::loader(SWFStream& in, tag_type tag, movie_definition& m,
+DefineText2Tag::loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == DEFINETEXT2);
@@ -51,7 +51,7 @@
}
void
-DefineTextTag::read(SWFStream& in, movie_definition&m, tag_type tag)
+DefineTextTag::read(SWFStream& in, movie_definition&m, TagType tag)
{
assert(tag == DEFINETEXT || tag == DEFINETEXT2);
=== modified file 'libcore/swf/DefineTextTag.h'
--- a/libcore/swf/DefineTextTag.h 2008-11-08 10:04:43 +0000
+++ b/libcore/swf/DefineTextTag.h 2009-01-05 09:32:03 +0000
@@ -45,7 +45,7 @@
{
public:
- static void loader(SWFStream& in, tag_type tag, movie_definition& m,
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r);
/// Draw the string.
@@ -65,7 +65,7 @@
/// Construct a DefineTextTag.
//
/// This should only be constructed using the loader() functions.
- DefineTextTag(SWFStream& in, movie_definition& m, tag_type tag)
+ DefineTextTag(SWFStream& in, movie_definition& m, TagType tag)
{
read(in, m, tag);
}
@@ -74,7 +74,7 @@
SWFMatrix _matrix;
- void read(SWFStream& in, movie_definition& m, tag_type tag);
+ void read(SWFStream& in, movie_definition& m, TagType tag);
std::vector<TextRecord> _textRecords;
};
@@ -85,7 +85,7 @@
class DefineText2Tag
{
public:
- static void loader(SWFStream& in, tag_type tag, movie_definition& m,
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r);
};
=== modified file 'libcore/swf/DefineVideoStreamTag.cpp'
--- a/libcore/swf/DefineVideoStreamTag.cpp 2008-11-06 23:06:02 +0000
+++ b/libcore/swf/DefineVideoStreamTag.cpp 2009-01-05 09:32:03 +0000
@@ -44,7 +44,7 @@
void
-DefineVideoStreamTag::loader(SWFStream& in, SWF::tag_type tag,
+DefineVideoStreamTag::loader(SWFStream& in, SWF::TagType tag,
movie_definition& m, const RunInfo& /*r*/)
{
assert(tag == SWF::DEFINEVIDEOSTREAM); // 60
=== modified file 'libcore/swf/DefineVideoStreamTag.h'
--- a/libcore/swf/DefineVideoStreamTag.h 2008-11-08 10:04:43 +0000
+++ b/libcore/swf/DefineVideoStreamTag.h 2009-01-05 09:32:03 +0000
@@ -83,7 +83,7 @@
/// This function is allowed to be called only *once* for each
/// instance of this class.
///
- static void loader(SWFStream& in, SWF::tag_type tag, movie_definition&
m,
+ static void loader(SWFStream& in, SWF::TagType tag, movie_definition& m,
const RunInfo& r);
@@ -94,7 +94,7 @@
///
/// This function is allowed to be called zero or more times, as long
/// as readDefineVideoStream was read before.
- void readDefineVideoFrame(SWFStream& in, SWF::tag_type tag,
+ void readDefineVideoFrame(SWFStream& in, SWF::TagType tag,
movie_definition& m);
/// Return local video bounds in twips
=== modified file 'libcore/swf/DisplayListTag.h'
--- a/libcore/swf/DisplayListTag.h 2008-10-25 10:38:32 +0000
+++ b/libcore/swf/DisplayListTag.h 2009-01-05 09:32:03 +0000
@@ -25,7 +25,7 @@
#endif
#include "ControlTag.h" // for inheritance
-//#include "swf.h" // for tag_type definition
+//#include "swf.h" // for TagType definition
// Forward declarations
=== modified file 'libcore/swf/DoActionTag.h'
--- a/libcore/swf/DoActionTag.h 2008-10-30 21:35:10 +0000
+++ b/libcore/swf/DoActionTag.h 2009-01-05 09:32:03 +0000
@@ -19,7 +19,7 @@
#define GNASH_SWF_DOACTIONTAG_H
#include "ControlTag.h" // for inheritance
-#include "swf.h" // for tag_type definition
+#include "swf.h" // for TagType definition
#include "action_buffer.h" // for composition
#include "MovieClip.h" // for inlines
#include "SWFStream.h" // for inlines
@@ -63,7 +63,7 @@
return true;
}
- static void doActionLoader(SWFStream& in, tag_type tag,
+ static void doActionLoader(SWFStream& in, TagType tag,
movie_definition& m, const RunInfo& /*r*/)
{
DoActionTag* da = new DoActionTag(m);
=== modified file 'libcore/swf/DoInitActionTag.h'
--- a/libcore/swf/DoInitActionTag.h 2008-10-30 21:35:10 +0000
+++ b/libcore/swf/DoInitActionTag.h 2009-01-05 09:32:03 +0000
@@ -19,7 +19,7 @@
#define GNASH_SWF_DOINITACTIONTAG_H
#include "ControlTag.h" // for inheritance
-#include "swf.h" // for tag_type definition
+#include "swf.h" // for TagType definition
#include "action_buffer.h" // for composition
#include "MovieClip.h" // for inlines
#include "SWFStream.h" // for inlines
@@ -64,7 +64,7 @@
return true;
}
- static void doInitActionLoader(SWFStream& in, tag_type tag,
+ static void doInitActionLoader(SWFStream& in, TagType tag,
movie_definition& m, const RunInfo& /*r*/)
{
in.ensureBytes(2);
=== modified file 'libcore/swf/PlaceObject2Tag.cpp'
--- a/libcore/swf/PlaceObject2Tag.cpp 2008-12-05 08:57:08 +0000
+++ b/libcore/swf/PlaceObject2Tag.cpp 2009-01-05 09:32:03 +0000
@@ -426,10 +426,10 @@
}
void
-PlaceObject2Tag::read(SWFStream& in, tag_type tag)
+PlaceObject2Tag::read(SWFStream& in, TagType tag)
{
- m_tag_type = tag;
+ m_TagType = tag;
if (tag == SWF::PLACEOBJECT)
{
@@ -489,7 +489,7 @@
/* public static */
void
-PlaceObject2Tag::loader(SWFStream& in, tag_type tag, movie_definition& m,
+PlaceObject2Tag::loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == SWF::PLACEOBJECT || tag == SWF::PLACEOBJECT2 || tag ==
SWF::PLACEOBJECT3);
=== modified file 'libcore/swf/PlaceObject2Tag.h'
--- a/libcore/swf/PlaceObject2Tag.h 2008-12-05 08:57:08 +0000
+++ b/libcore/swf/PlaceObject2Tag.h 2009-01-05 09:32:03 +0000
@@ -24,7 +24,7 @@
#endif
#include "DisplayListTag.h" // for inheritance
-#include "swf.h" // for tag_type definition
+#include "swf.h" // for TagType definition
#include "SWFMatrix.h" // for composition
#include "cxform.h" // for composition
#include "character.h" // BlendMode enum
@@ -95,7 +95,7 @@
PlaceObject2Tag(const movie_definition& def)
:
DisplayListTag(0), // why is it 0 here and -1 for RemoveObjectTag ??
- m_tag_type(0),
+ m_TagType(0),
m_has_flags2(0),
m_has_flags3(0),
m_character_id(0),
@@ -109,12 +109,12 @@
~PlaceObject2Tag();
/// Read SWF::PLACEOBJECT or SWF::PLACEOBJECT2
- void read(SWFStream& in, tag_type tag);
+ void read(SWFStream& in, TagType tag);
/// Place/move/whatever our object in the given movie.
void execute(MovieClip* m, DisplayList& dlist) const;
- static void loader(SWFStream& in, tag_type tag, movie_definition& m,
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r);
int getPlaceType() const {
@@ -163,7 +163,7 @@
}
private:
- int m_tag_type;
+ int m_TagType;
boost::uint8_t m_has_flags2;
boost::uint8_t m_has_flags3;
boost::uint16_t m_character_id;
=== modified file 'libcore/swf/RemoveObjectTag.cpp'
--- a/libcore/swf/RemoveObjectTag.cpp 2008-10-30 21:35:10 +0000
+++ b/libcore/swf/RemoveObjectTag.cpp 2009-01-05 09:32:03 +0000
@@ -20,7 +20,7 @@
#include "RemoveObjectTag.h"
#include "MovieClip.h"
-#include "swf.h" // for tag_type definition
+#include "swf.h" // for TagType definition
#include "log.h"
#include "SWFStream.h"
@@ -28,7 +28,7 @@
namespace SWF {
void
-RemoveObjectTag::read(SWFStream& in, tag_type tag)
+RemoveObjectTag::read(SWFStream& in, TagType tag)
{
assert(tag == SWF::REMOVEOBJECT || tag == SWF::REMOVEOBJECT2);
@@ -54,7 +54,7 @@
/* public static */
void
-RemoveObjectTag::loader(SWFStream& in, tag_type tag, movie_definition& m,
+RemoveObjectTag::loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == SWF::REMOVEOBJECT || tag == SWF::REMOVEOBJECT2);
=== modified file 'libcore/swf/RemoveObjectTag.h'
--- a/libcore/swf/RemoveObjectTag.h 2008-10-28 21:17:19 +0000
+++ b/libcore/swf/RemoveObjectTag.h 2009-01-05 09:32:03 +0000
@@ -25,7 +25,7 @@
#endif
#include "DisplayListTag.h" // for inheritance
-#include "swf.h" // for tag_type definition
+#include "swf.h" // for TagType definition
// Forward declarations
namespace gnash {
@@ -57,12 +57,12 @@
{}
/// Read SWF::REMOVEOBJECT or SWF::REMOVEOBJECT2
- void read(SWFStream& in, tag_type tag);
+ void read(SWFStream& in, TagType tag);
/// Remove object at specified depth from MovieClip DisplayList.
void execute(MovieClip* m, DisplayList& dlist) const;
- static void loader(SWFStream& in, tag_type tag, movie_definition& m,
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r);
private:
=== modified file 'libcore/swf/ScriptLimitsTag.h'
--- a/libcore/swf/ScriptLimitsTag.h 2008-10-28 21:22:15 +0000
+++ b/libcore/swf/ScriptLimitsTag.h 2009-01-05 09:32:03 +0000
@@ -18,7 +18,7 @@
#ifndef GNASH_SWF_SCRIPTLIMITSTAG_H
#define GNASH_SWF_SCRIPTLIMITSTAG_H
-#include "swf.h" // for tag_type definition
+#include "swf.h" // for TagType definition
#include "SWFStream.h" // for inlines
#include "movie_definition.h"
@@ -35,7 +35,7 @@
{
public:
- static void loader(SWFStream& in, tag_type tag, movie_definition& /*m*/,
+ static void loader(SWFStream& in, TagType tag, movie_definition& /*m*/,
const RunInfo& /*r*/)
{
=== modified file 'libcore/swf/SetBackgroundColorTag.h'
--- a/libcore/swf/SetBackgroundColorTag.h 2008-10-30 21:35:10 +0000
+++ b/libcore/swf/SetBackgroundColorTag.h 2009-01-05 09:32:03 +0000
@@ -23,7 +23,7 @@
#endif
#include "ControlTag.h" // for inheritance
-#include "swf.h" // for tag_type definition
+#include "swf.h" // for TagType definition
#include "MovieClip.h" // for inlines (execute)
#include "movie_definition.h" // for inlines (loader)
#include "log.h" // for log_parse
@@ -96,7 +96,7 @@
}
/// Set background color tag loader (SWF::SETBACKGROUNDCOLOR)
- static void loader(SWFStream& in, tag_type tag, movie_definition& m,
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == SWF::SETBACKGROUNDCOLOR); // 9
=== modified file 'libcore/swf/StartSoundTag.cpp'
--- a/libcore/swf/StartSoundTag.cpp 2008-11-24 09:47:16 +0000
+++ b/libcore/swf/StartSoundTag.cpp 2009-01-05 09:32:03 +0000
@@ -31,7 +31,7 @@
void
-StartSoundTag::loader(SWFStream& in, tag_type tag, movie_definition& m,
+StartSoundTag::loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r)
{
assert(tag == STARTSOUND);
@@ -107,7 +107,7 @@
}
void
-StartSound2Tag::loader(SWFStream& in, tag_type tag, movie_definition& /*m*/,
+StartSound2Tag::loader(SWFStream& in, TagType tag, movie_definition& /*m*/,
const RunInfo& /*r*/)
{
assert(tag == STARTSOUND2);
=== modified file 'libcore/swf/StartSoundTag.h'
--- a/libcore/swf/StartSoundTag.h 2008-11-24 08:33:58 +0000
+++ b/libcore/swf/StartSoundTag.h 2009-01-05 09:32:03 +0000
@@ -25,7 +25,7 @@
#include "ControlTag.h" // for inheritance
#include "sound_handler.h" // for sound_envelope (composition)
#include "VM.h" // We only need this to get movie_root
-#include "swf.h" // for tag_type definition
+#include "swf.h" // for TagType definition
#include "SoundInfoRecord.h"
#include <vector> // for composition
@@ -82,7 +82,7 @@
void execute(MovieClip* /* m */, DisplayList& /* dlist */) const;
/// Load a SWF::STARTSOUND tag.
- static void loader(SWFStream& in, tag_type tag, movie_definition& m,
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r);
};
@@ -96,7 +96,7 @@
public:
/// Load a SWF::STARTSOUND2 tag.
- static void loader(SWFStream& in, tag_type tag, movie_definition& m,
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r);
};
=== modified file 'libcore/swf/StreamSoundBlockTag.cpp'
--- a/libcore/swf/StreamSoundBlockTag.cpp 2008-11-24 09:47:16 +0000
+++ b/libcore/swf/StreamSoundBlockTag.cpp 2009-01-05 09:32:03 +0000
@@ -53,7 +53,7 @@
/* public static */
void
-StreamSoundBlockTag::loader(SWFStream& in, tag_type tag, movie_definition& m,
+StreamSoundBlockTag::loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r)
{
assert(tag == SWF::SOUNDSTREAMBLOCK); // 19
=== modified file 'libcore/swf/StreamSoundBlockTag.h'
--- a/libcore/swf/StreamSoundBlockTag.h 2008-11-08 10:04:43 +0000
+++ b/libcore/swf/StreamSoundBlockTag.h 2009-01-05 09:32:03 +0000
@@ -23,7 +23,7 @@
#endif
#include "ControlTag.h" // for inheritance
-#include "swf.h" // for tag_type definition
+#include "swf.h" // for TagType definition
#include <boost/cstdint.hpp> // for boost::uint16_t and friends
@@ -67,7 +67,7 @@
void execute(MovieClip* m, DisplayList& dlist) const;
/// Load an SWF::SOUNDSTREAMBLOCK (19) tag.
- static void loader(SWFStream& in, tag_type tag, movie_definition& m,
+ static void loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r);
/// Not a "state" (DisplayList?) tag, do doesn't need to provide
=== modified file 'libcore/swf/TagLoadersTable.cpp'
--- a/libcore/swf/TagLoadersTable.cpp 2008-01-21 20:55:39 +0000
+++ b/libcore/swf/TagLoadersTable.cpp 2009-01-05 10:20:39 +0000
@@ -29,7 +29,7 @@
namespace SWF {
bool
-TagLoadersTable::get(SWF::tag_type t, loader_function* lf)
+TagLoadersTable::get(SWF::TagType t, loader_function* lf)
{
container::iterator it = _tag_loaders.find(t);
@@ -42,15 +42,10 @@
}
bool
-TagLoadersTable::register_loader(SWF::tag_type t, loader_function lf)
+TagLoadersTable::register_loader(SWF::TagType t, loader_function lf)
{
- assert(lf != NULL);
-
- // loader for given tag already registered
- if (_tag_loaders.find(t) != _tag_loaders.end()) return false;
-
- _tag_loaders[t] = lf;
- return true;
+ assert(lf);
+ return _tag_loaders.insert(std::make_pair(t, lf)).second;
}
TagLoadersTable&
=== modified file 'libcore/swf/TagLoadersTable.h'
--- a/libcore/swf/TagLoadersTable.h 2008-10-28 21:17:19 +0000
+++ b/libcore/swf/TagLoadersTable.h 2009-01-05 10:20:39 +0000
@@ -25,6 +25,7 @@
#include "swf.h"
#include <map>
+#include <boost/noncopyable.hpp>
// Forward declarations
namespace gnash {
@@ -37,7 +38,7 @@
namespace SWF {
/// Table of SWF tags loaders
-class TagLoadersTable
+class TagLoadersTable : boost::noncopyable
{
public:
@@ -48,23 +49,23 @@
/// 'm' a pointer to the movie (or sprite) being read
///
typedef void (*loader_function)(
- SWFStream& input, tag_type type, movie_definition& m, const RunInfo&
r);
+ SWFStream& input, TagType type, movie_definition& m, const RunInfo& r);
/// \brief
/// Get a pointer to the loader_function for the
- /// specified SWF::tag_type.
+ /// specified SWF::TagType.
//
/// @return false if no loader is associated with the tag.
///
- bool get(tag_type t, loader_function* lf);
+ bool get(TagType t, loader_function* lf);
/// \brief
- /// Register a loader for the specified SWF::tag_type.
+ /// Register a loader for the specified SWF::TagType.
//
/// @return false if a loader is already registered
/// for the given tag
///
- bool register_loader(tag_type t, loader_function lf);
+ bool register_loader(TagType t, loader_function lf);
/// \brief
/// Return a reference to the singleton instance
@@ -74,7 +75,7 @@
private:
/// The container being used for the table
- typedef std::map<int, loader_function> container;
+ typedef std::map<SWF::TagType, loader_function> container;
container _tag_loaders;
@@ -86,17 +87,6 @@
~TagLoadersTable() {}
- TagLoadersTable(const TagLoadersTable& tl)
- :
- _tag_loaders(tl._tag_loaders)
- {}
-
- TagLoadersTable& operator=(const TagLoadersTable& tl)
- {
- _tag_loaders = tl._tag_loaders;
- return *this;
- }
-
};
} // namespace gnash::SWF
=== modified file 'libcore/swf/TextRecord.cpp'
--- a/libcore/swf/TextRecord.cpp 2008-12-16 12:20:22 +0000
+++ b/libcore/swf/TextRecord.cpp 2009-01-05 09:32:03 +0000
@@ -34,7 +34,7 @@
bool
TextRecord::read(SWFStream& in, movie_definition& m, int glyphBits,
- int advanceBits, tag_type tag)
+ int advanceBits, TagType tag)
{
_glyphs.clear();
=== modified file 'libcore/swf/TextRecord.h'
--- a/libcore/swf/TextRecord.h 2008-11-09 12:36:27 +0000
+++ b/libcore/swf/TextRecord.h 2009-01-05 09:32:03 +0000
@@ -75,7 +75,7 @@
/// @return False if we have reached the end of the
/// TextRecords, true if there are more to parse.
bool read(SWFStream& in, movie_definition& m, int glyphBits,
- int advanceBits, tag_type tag);
+ int advanceBits, TagType tag);
static void displayRecords(const SWFMatrix& this_mat, character* inst,
const std::vector<SWF::TextRecord>& records, bool useEmbeddedGlyphs);
=== modified file 'libcore/swf/VideoFrameTag.cpp'
--- a/libcore/swf/VideoFrameTag.cpp 2008-11-06 23:21:13 +0000
+++ b/libcore/swf/VideoFrameTag.cpp 2009-01-05 09:32:03 +0000
@@ -30,7 +30,7 @@
void
-VideoFrameTag::loader(SWFStream& in, SWF::tag_type tag, movie_definition& m,
+VideoFrameTag::loader(SWFStream& in, SWF::TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == SWF::VIDEOFRAME);
=== modified file 'libcore/swf/VideoFrameTag.h'
--- a/libcore/swf/VideoFrameTag.h 2008-11-06 22:57:43 +0000
+++ b/libcore/swf/VideoFrameTag.h 2009-01-05 09:32:03 +0000
@@ -52,7 +52,7 @@
///
/// This function is allowed to be called zero or more times, as long
/// as a DefineVideoStreamTag was read before.
- static void loader(SWFStream& in, SWF::tag_type tag, movie_definition&
m,
+ static void loader(SWFStream& in, SWF::TagType tag, movie_definition& m,
const RunInfo& r);
};
=== modified file 'libcore/swf/tag_loaders.cpp'
--- a/libcore/swf/tag_loaders.cpp 2008-12-16 15:15:55 +0000
+++ b/libcore/swf/tag_loaders.cpp 2009-01-06 10:04:07 +0000
@@ -54,6 +54,7 @@
#include "MediaHandler.h"
#include "SimpleBuffer.h"
#include "sound_handler.h"
+#include "ExportableResource.h"
// TODO: pass the render handler with RunInfo and use that.
#include "render.h"
@@ -61,7 +62,7 @@
#ifdef HAVE_ZLIB_H
#include <zlib.h>
#endif
-#include <map>
+#include <set>
#include <limits>
#include <cassert>
#include <utility> // for std::make_pair
@@ -170,14 +171,14 @@
// Silently ignore the contents of this tag.
-void null_loader(SWFStream& /*in*/, tag_type /*tag*/, movie_definition& /*m*/,
+void null_loader(SWFStream& /*in*/, TagType /*tag*/, movie_definition& /*m*/,
const RunInfo& /*r*/)
{
}
// Label the current frame of m with the name from the SWFStream.
void
-frame_label_loader(SWFStream& in, tag_type tag, movie_definition& m,
+frame_label_loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == SWF::FRAMELABEL); // 43
@@ -221,7 +222,7 @@
// Load JPEG compression tables that can be used to load
// images further along in the SWFStream.
void
-jpeg_tables_loader(SWFStream& in, tag_type tag, movie_definition& m,
+jpeg_tables_loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
//GNASH_REPORT_FUNCTION;
@@ -256,7 +257,8 @@
// Anyway the actual reads are limited to currently opened tag as
// of gnash::SWFStream::read(), so this is not a problem.
//
- boost::shared_ptr<IOChannel> ad(StreamAdapter::getFile(in,
std::numeric_limits<unsigned long>::max()).release());
+ boost::shared_ptr<IOChannel> ad(StreamAdapter::getFile(in,
+ std::numeric_limits<unsigned long>::max()).release());
// transfer ownership to the JpegImageInput
input = JpegImageInput::createSWFJpeg2HeaderOnly(ad, jpegHeaderSize);
@@ -278,7 +280,7 @@
// A JPEG image without included tables; those should be in an
// existing JpegImageInput object stored in the movie.
void
-define_bits_jpeg_loader(SWFStream& in, tag_type tag, movie_definition& m,
+define_bits_jpeg_loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == SWF::DEFINEBITS); // 6
@@ -330,13 +332,13 @@
void
-define_bits_jpeg2_loader(SWFStream& in, tag_type tag, movie_definition& m,
+define_bits_jpeg2_loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == SWF::DEFINEBITSJPEG2); // 21
in.ensureBytes(2);
- boost::uint16_t character_id = in.read_u16();
+ boost::uint16_t character_id = in.read_u16();
IF_VERBOSE_PARSE
(
@@ -388,18 +390,19 @@
d_stream.next_in = 0;
d_stream.avail_in = 0;
- d_stream.next_out = (Byte*) buffer;
- d_stream.avail_out = (uInt) buffer_bytes;
+ d_stream.next_out = static_cast<Byte*>(buffer);
+ d_stream.avail_out = static_cast<uInt>(buffer_bytes);
int err = inflateInit(&d_stream);
if (err != Z_OK) {
- IF_VERBOSE_MALFORMED_SWF(
- log_swferror(_("inflate_wrapper() inflateInit() returned %d (%s)"), err,
d_stream.msg);
- );
- return;
+ IF_VERBOSE_MALFORMED_SWF(
+ log_swferror(_("inflate_wrapper() inflateInit() returned %d (%s)"),
+ err, d_stream.msg);
+ );
+ return;
}
-#define CHUNKSIZE 256
+ const size_t CHUNKSIZE = 256;
boost::uint8_t buf[CHUNKSIZE];
unsigned long endTagPos = in.get_tag_end_position();
@@ -415,7 +418,8 @@
{
// nothing more to read
IF_VERBOSE_MALFORMED_SWF(
- log_swferror(_("inflate_wrapper(): no end of zstream found
within swf tag boundaries"));
+ log_swferror(_("inflate_wrapper(): no end of zstream found "
+ "within swf tag boundaries"));
);
break;
}
@@ -425,7 +429,7 @@
BOOST_STATIC_ASSERT(sizeof(char) == sizeof(boost::uint8_t));
// Fill the buffer
- in.read((char*)buf, chunkSize);
+ in.read(reinterpret_cast<char*>(buf), chunkSize);
d_stream.next_in = &buf[0];
d_stream.avail_in = chunkSize;
@@ -439,7 +443,8 @@
if (err != Z_OK)
{
IF_VERBOSE_MALFORMED_SWF(
- log_swferror(_("inflate_wrapper() inflate() returned %d (%s)"),
err, d_stream.msg);
+ log_swferror(_("inflate_wrapper() inflate() returned %d (%s)"),
+ err, d_stream.msg);
);
break;
}
@@ -448,7 +453,8 @@
err = inflateEnd(&d_stream);
if (err != Z_OK)
{
- log_error(_("inflate_wrapper() inflateEnd() return %d (%s)"), err,
d_stream.msg);
+ log_error(_("inflate_wrapper() inflateEnd() return %d (%s)"),
+ err, d_stream.msg);
}
}
#endif // HAVE_ZLIB_H
@@ -457,13 +463,13 @@
// loads a define_bits_jpeg3 tag. This is a jpeg file with an alpha
// channel using zlib compression.
void
-define_bits_jpeg3_loader(SWFStream& in, tag_type tag, movie_definition& m,
+define_bits_jpeg3_loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == SWF::DEFINEBITSJPEG3); // 35
in.ensureBytes(2);
- boost::uint16_t character_id = in.read_u16();
+ boost::uint16_t character_id = in.read_u16();
IF_VERBOSE_PARSE
(
@@ -517,7 +523,7 @@
void
-define_bits_lossless_2_loader(SWFStream& in, tag_type tag, movie_definition& m,
+define_bits_lossless_2_loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
// tags 20 || 36
@@ -705,18 +711,16 @@
// This is like null_loader except it prints a message to nag us to fix it.
void
-fixme_loader(SWFStream& /*in*/, tag_type tag, movie_definition& /*m*/,
+fixme_loader(SWFStream& /*in*/, TagType tag, movie_definition& /*m*/,
const RunInfo& /*r*/)
{
- static std::map<tag_type, bool> warned;
- if ( ! warned[tag] )
- {
+ static std::set<TagType> warned;
+ if (warned.insert(tag).second) {
log_unimpl(_(" FIXME: tagtype = %d"), tag);
- warned[tag] = true;
}
}
-void define_shape_loader(SWFStream& in, tag_type tag, movie_definition& m,
+void define_shape_loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == SWF::DEFINESHAPE
@@ -736,7 +740,7 @@
m.add_character(character_id, ch);
}
-void define_shape_morph_loader(SWFStream& in, tag_type tag, movie_definition&
m,
+void define_shape_morph_loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == SWF::DEFINEMORPHSHAPE
@@ -755,14 +759,9 @@
m.add_character(character_id, morph);
}
-//
-// font loaders
-//
-
-
// Create and initialize a sprite, and add it to the movie.
void
-sprite_loader(SWFStream& in, tag_type tag, movie_definition& m,
+sprite_loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r)
{
assert(tag == SWF::DEFINESPRITE); // 39 - DefineSprite
@@ -807,7 +806,7 @@
//
-void export_loader(SWFStream& in, tag_type tag, movie_definition& m,
+void export_loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
// Load an export tag (for exposing internal resources of m)
{
@@ -838,7 +837,7 @@
for (int i = 0; i < count; i++)
{
in.ensureBytes(2);
- boost::uint16_t id = in.read_u16();
+ boost::uint16_t id = in.read_u16();
std::string symbolName;
in.read_string(symbolName);
@@ -846,29 +845,21 @@
log_parse(_(" export: id = %d, name = %s"), id, symbolName);
);
- if (Font* f = m.get_font(id))
- {
- // Expose this font for export.
+ // Fonts, characters and sounds can be exported.
+ ExportableResource* f;
+ if ((f = m.get_font(id)) ||
+ (f = m.get_character_def(id)) ||
+ (f = m.get_sound_sample(id))) {
+
m.export_resource(symbolName, f);
}
- else if (character_def* ch = m.get_character_def(id))
- {
- // Expose this movie/button/whatever for export.
- m.export_resource(symbolName, ch);
- }
- else if (sound_sample* ch = m.get_sound_sample(id))
- {
- m.export_resource(symbolName, ch);
- }
- else
- {
+ else {
IF_VERBOSE_MALFORMED_SWF(
log_swferror(_("don't know how to export resource '%s' "
"with id %d (can't find that id)"),
- symbolName, id);
- );
+ symbolName, id);
+ );
}
-
}
}
@@ -878,7 +869,7 @@
//
-void import_loader(SWFStream& in, tag_type tag, movie_definition& m,
+void import_loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r)
{
assert(tag == SWF::IMPORTASSETS || tag == SWF::IMPORTASSETS2);
@@ -977,7 +968,7 @@
// Load a DefineSound tag.
void
-define_sound_loader(SWFStream& in, tag_type tag, movie_definition& m,
+define_sound_loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r)
{
assert(tag == SWF::DEFINESOUND); // 14
@@ -1093,7 +1084,7 @@
// Load a SoundStreamHead(2) tag.
void
-sound_stream_head_loader(SWFStream& in, tag_type tag, movie_definition& m,
+sound_stream_head_loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r)
{
@@ -1232,18 +1223,18 @@
void
-file_attributes_loader(SWFStream& in, tag_type tag, movie_definition& /*m*/,
+file_attributes_loader(SWFStream& in, TagType tag, movie_definition& /*m*/,
const RunInfo& /*r*/)
{
assert(tag == SWF::FILEATTRIBUTES); // 69
- typedef struct file_attrs_flags_t {
- unsigned reserved1:3;
- unsigned has_metadata:1;
- unsigned reserved2:3;
- unsigned use_network:1;
- unsigned reserved3:24;
- } file_attrs_flags;
+ struct file_attrs_flags {
+ unsigned reserved1;
+ unsigned has_metadata;
+ unsigned reserved2;
+ unsigned use_network;
+ unsigned reserved3;
+ };
file_attrs_flags flags;
@@ -1279,7 +1270,7 @@
void
-metadata_loader(SWFStream& in, tag_type tag, movie_definition& m,
+metadata_loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& /*r*/)
{
assert(tag == SWF::METADATA); // 77
@@ -1320,7 +1311,7 @@
}
void
-serialnumber_loader(SWFStream& in, tag_type tag, movie_definition& /*m*/,
+serialnumber_loader(SWFStream& in, TagType tag, movie_definition& /*m*/,
const RunInfo& /*r*/)
{
assert(tag == SWF::SERIALNUMBER); // 41
@@ -1354,7 +1345,7 @@
}
void
-reflex_loader(SWFStream& in, tag_type tag, movie_definition& /*m*/,
+reflex_loader(SWFStream& in, TagType tag, movie_definition& /*m*/,
const RunInfo& /*r*/)
{
assert(tag == SWF::REFLEX); // 777
@@ -1374,7 +1365,7 @@
}
void
-abc_loader(SWFStream& in, tag_type tag, movie_definition& /*m*/,
+abc_loader(SWFStream& in, TagType tag, movie_definition& /*m*/,
const RunInfo& /*r*/)
{
assert(tag == SWF::DOABC
@@ -1400,7 +1391,7 @@
}
void
-define_scene_frame_label_loader(SWFStream& /*in*/, tag_type tag,
+define_scene_frame_label_loader(SWFStream& /*in*/, TagType tag,
movie_definition& /*m*/, const RunInfo& /*r*/)
{
assert(tag == SWF::DEFINESCENEANDFRAMELABELDATA); //86
=== modified file 'libcore/swf/tag_loaders.h'
--- a/libcore/swf/tag_loaders.h 2008-11-08 22:02:22 +0000
+++ b/libcore/swf/tag_loaders.h 2009-01-05 09:32:03 +0000
@@ -19,7 +19,7 @@
#ifndef GNASH_SWF_TAG_LOADERS_H
#define GNASH_SWF_TAG_LOADERS_H
-#include "swf.h" // for SWF::tag_type
+#include "swf.h" // for SWF::TagType
#include <cassert>
@@ -36,119 +36,119 @@
namespace tag_loaders {
/// Silently ignore the contents of this tag.
-void null_loader(SWFStream&, tag_type, movie_definition&, const RunInfo&);
+void null_loader(SWFStream&, TagType, movie_definition&, const RunInfo&);
/// This is like null_loader except it prints a message to nag us to fix it.
-void fixme_loader(SWFStream&, tag_type, movie_definition&, const RunInfo&);
+void fixme_loader(SWFStream&, TagType, movie_definition&, const RunInfo&);
/// \brief
/// Load JPEG compression tables that can be used to load
/// images further along in the SWFStream. (SWF::JPEGTABLES)
-void jpeg_tables_loader(SWFStream&, tag_type, movie_definition&,
+void jpeg_tables_loader(SWFStream&, TagType, movie_definition&,
const RunInfo&);
/// \brief
/// A JPEG image without included tables; those should be in an
/// existing jpeg::input object stored in the movie. (SWF::DEFINEBITS)
-void define_bits_jpeg_loader(SWFStream&, tag_type, movie_definition&,
+void define_bits_jpeg_loader(SWFStream&, TagType, movie_definition&,
const RunInfo&);
/// Handler for SWF::DEFINEBITSJPEG2 tag
-void define_bits_jpeg2_loader(SWFStream&, tag_type, movie_definition&,
+void define_bits_jpeg2_loader(SWFStream&, TagType, movie_definition&,
const RunInfo&);
/// \brief
/// Loads a define_bits_jpeg3 tag. This is a jpeg file with an alpha
/// channel using zlib compression. (SWF::DEFINEBITSJPEG3)
-void define_bits_jpeg3_loader(SWFStream&, tag_type, movie_definition&,
- const RunInfo&);
-
-void define_shape_loader(SWFStream&, tag_type, movie_definition&,
- const RunInfo&);
-
-void define_shape_morph_loader(SWFStream&, tag_type, movie_definition&,
+void define_bits_jpeg3_loader(SWFStream&, TagType, movie_definition&,
+ const RunInfo&);
+
+void define_shape_loader(SWFStream&, TagType, movie_definition&,
+ const RunInfo&);
+
+void define_shape_morph_loader(SWFStream&, TagType, movie_definition&,
const RunInfo&);
/// SWF Tags Reflex (777)
//
-void reflex_loader(SWFStream&, tag_type, movie_definition&,
- const RunInfo&);
-
-void place_object_2_loader(SWFStream&, tag_type, movie_definition&,
- const RunInfo&);
-
-void define_bits_lossless_2_loader(SWFStream&, tag_type, movie_definition&,
+void reflex_loader(SWFStream&, TagType, movie_definition&,
+ const RunInfo&);
+
+void place_object_2_loader(SWFStream&, TagType, movie_definition&,
+ const RunInfo&);
+
+void define_bits_lossless_2_loader(SWFStream&, TagType, movie_definition&,
const RunInfo&);
/// Create and initialize a sprite, and add it to the movie.
//
/// Handles a SWF::DEFINESPRITE tag
///
-void sprite_loader(SWFStream&, tag_type, movie_definition&, const RunInfo&);
+void sprite_loader(SWFStream&, TagType, movie_definition&, const RunInfo&);
// end_tag doesn't actually need to exist.
// TODO: drop this loader ?
-void end_loader(SWFStream& in, tag_type tag, movie_definition&, const RunInfo&)
+void end_loader(SWFStream& in, TagType tag, movie_definition&, const RunInfo&)
{
assert(tag == SWF::END); // 0
assert(in.tell() == in.get_tag_end_position());
}
-void remove_object_2_loader(SWFStream&, tag_type, movie_definition&,
+void remove_object_2_loader(SWFStream&, TagType, movie_definition&,
const RunInfo&);
-void do_action_loader(SWFStream&, tag_type, movie_definition&, const RunInfo&);
+void do_action_loader(SWFStream&, TagType, movie_definition&, const RunInfo&);
/// Label the current frame (SWF::FRAMELABEL)
-void frame_label_loader(SWFStream&, tag_type, movie_definition&,
+void frame_label_loader(SWFStream&, TagType, movie_definition&,
const RunInfo&);
-void export_loader(SWFStream&, tag_type, movie_definition&, const RunInfo&);
+void export_loader(SWFStream&, TagType, movie_definition&, const RunInfo&);
/// Load an SWF::IMPORTASSETS or SWF::IMPORTASSETS2 tag (for pulling in
external resources)
-void import_loader(SWFStream&, tag_type, movie_definition&, const RunInfo&);
+void import_loader(SWFStream&, TagType, movie_definition&, const RunInfo&);
/// Load a SWF::DEFINESOUND tag.
-void define_sound_loader(SWFStream&, tag_type, movie_definition&,
+void define_sound_loader(SWFStream&, TagType, movie_definition&,
const RunInfo&);
-void do_init_action_loader(SWFStream&, tag_type, movie_definition&,
+void do_init_action_loader(SWFStream&, TagType, movie_definition&,
const RunInfo&);
/// Load SWF::SOUNDSTREAMHEAD or SWF::SOUNDSTREAMHEAD2 tag.
-void sound_stream_head_loader(SWFStream&, tag_type, movie_definition&,
+void sound_stream_head_loader(SWFStream&, TagType, movie_definition&,
const RunInfo&);
/// Load a SWF::SOUNDSTREAMBLOCK tag.
-void sound_stream_block_loader(SWFStream&, tag_type, movie_definition&,
+void sound_stream_block_loader(SWFStream&, TagType, movie_definition&,
const RunInfo&);
-void abc_loader(SWFStream&, tag_type, movie_definition&, const RunInfo&);
-
-void
-define_video_loader(SWFStream& in, tag_type tag, movie_definition& m,
- const RunInfo& r);
-
-void
-video_loader(SWFStream& in, tag_type tag, movie_definition& m,
- const RunInfo& r);
-
-void
-file_attributes_loader(SWFStream& in, tag_type tag, movie_definition& m,
- const RunInfo& r);
-
-void
-metadata_loader(SWFStream& in, tag_type tag, movie_definition& m,
+void abc_loader(SWFStream&, TagType, movie_definition&, const RunInfo&);
+
+void
+define_video_loader(SWFStream& in, TagType tag, movie_definition& m,
+ const RunInfo& r);
+
+void
+video_loader(SWFStream& in, TagType tag, movie_definition& m,
+ const RunInfo& r);
+
+void
+file_attributes_loader(SWFStream& in, TagType tag, movie_definition& m,
+ const RunInfo& r);
+
+void
+metadata_loader(SWFStream& in, TagType tag, movie_definition& m,
const RunInfo& r);
/// Load a SWF::SERIALNUMBER tag.
void
-serialnumber_loader(SWFStream& in, tag_type tag, movie_definition& /*m*/,
+serialnumber_loader(SWFStream& in, TagType tag, movie_definition& /*m*/,
const RunInfo& /*r*/);
/// Load a SWF::DEFINESCENEANDFRAMELABELDATA tag.
void
-define_scene_frame_label_loader(SWFStream& in, tag_type tag,
+define_scene_frame_label_loader(SWFStream& in, TagType tag,
movie_definition& /*m*/, const RunInfo& /*r*/);
} // namespace gnash::SWF::tag_loaders
=== modified file 'libcore/vm/ASHandlers.cpp'
--- a/libcore/vm/ASHandlers.cpp 2008-12-31 02:19:30 +0000
+++ b/libcore/vm/ASHandlers.cpp 2009-01-05 09:32:03 +0000
@@ -118,7 +118,7 @@
{
}
-ActionHandler::ActionHandler(action_type type, action_callback_t func)
+ActionHandler::ActionHandler(ActionType type, action_callback_t func)
:
_type(type),
_callback(func),
@@ -127,7 +127,7 @@
{
}
-ActionHandler::ActionHandler(action_type type, std::string name,
+ActionHandler::ActionHandler(ActionType type, std::string name,
action_callback_t func)
:
_type(type),
@@ -138,7 +138,7 @@
{
}
-ActionHandler::ActionHandler(action_type type, std::string name,
+ActionHandler::ActionHandler(ActionType type, std::string name,
action_callback_t func, as_arg_t format)
:
_type(type),
@@ -436,7 +436,7 @@
}
void
-SWFHandlers::execute(action_type type, ActionExec& thread) const
+SWFHandlers::execute(ActionType type, ActionExec& thread) const
{
// It is very heavy operation
// if ( _handlers[type].getName() == "unsupported" ) return false;
@@ -4127,7 +4127,7 @@
}
const char*
-SWFHandlers::action_name(action_type x) const
+SWFHandlers::action_name(ActionType x) const
{
if ( static_cast<size_t>(x) > get_handlers().size() )
{
=== modified file 'libcore/vm/ASHandlers.h'
--- a/libcore/vm/ASHandlers.h 2008-11-24 15:06:12 +0000
+++ b/libcore/vm/ASHandlers.h 2009-01-05 09:32:03 +0000
@@ -60,21 +60,21 @@
{
public:
ActionHandler();
- ActionHandler(action_type type, action_callback_t func);
- ActionHandler(action_type type, std::string name,
+ ActionHandler(ActionType type, action_callback_t func);
+ ActionHandler(ActionType type, std::string name,
action_callback_t func);
- ActionHandler(action_type type, std::string name,
+ ActionHandler(ActionType type, std::string name,
action_callback_t func, as_arg_t format);
/// Execute the action
void execute(ActionExec& thread) const;
void toggleDebug(bool state) const { _debug = state; }
- action_type getType() const { return _type; }
+ ActionType getType() const { return _type; }
std::string getName() const { return _name; }
as_arg_t getArgFormat() const { return _arg_format; }
private:
- action_type _type;
+ ActionType _type;
std::string _name;
action_callback_t _callback;
mutable bool _debug;
@@ -89,7 +89,7 @@
/// TODO: use a vector as we can have at most 254 actions
/// (127 w/out length, 127 with length, the high bit is
/// used to distinguish the two types)
- //typedef std::map<action_type, ActionHandler> container_type;
+ //typedef std::map<ActionType, ActionHandler> container_type;
// Indexed by action id
typedef std::vector<ActionHandler> container_type;
@@ -98,23 +98,23 @@
static const SWFHandlers& instance();
/// Execute the action identified by 'type' action type
- void execute(action_type type, ActionExec& thread) const;
+ void execute(ActionType type, ActionExec& thread) const;
void toggleDebug(bool state) { _debug = state; }
size_t size() const { return get_handlers().size(); }
- action_type lastType() const
+ ActionType lastType() const
{
return ACTION_GOTOEXPRESSION;
}
- const ActionHandler &operator[] (action_type x) const
+ const ActionHandler &operator[] (ActionType x) const
{
return get_handlers()[x];
}
- const char* action_name(action_type x) const;
+ const char* action_name(ActionType x) const;
private:
=== modified file 'libcore/vm/ActionExec.cpp'
--- a/libcore/vm/ActionExec.cpp 2008-11-20 18:04:17 +0000
+++ b/libcore/vm/ActionExec.cpp 2009-01-05 09:32:03 +0000
@@ -285,7 +285,7 @@
break;
}
- ash.execute(static_cast<SWF::action_type>(action_id), *this);
+ ash.execute(static_cast<SWF::ActionType>(action_id), *this);
#if 1 // See bugs: #20974, #21069, #20996.
=== modified file 'libcore/vm/ActionExec.h'
--- a/libcore/vm/ActionExec.h 2008-11-20 15:22:13 +0000
+++ b/libcore/vm/ActionExec.h 2009-01-05 09:32:03 +0000
@@ -433,7 +433,7 @@
// TODO: cut down these accessors.
- bool atActionTag(SWF::action_type t) { return code[pc] == t; }
+ bool atActionTag(SWF::ActionType t) { return code[pc] == t; }
size_t getCurrentPC() const { return pc; }
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10512: More rigorous use of parameters. Cleanups.,
Benjamin Wolsey <=