gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, master, updated. 57c4193691d2313ef621


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. 57c4193691d2313ef6214542c976a2b4dd73fb2b
Date: Wed, 20 Oct 2010 14:02:36 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  57c4193691d2313ef6214542c976a2b4dd73fb2b (commit)
       via  64852234c5b8562a4b977e9beb064626075ac224 (commit)
       via  cdffac9302e64a71fa29ab62ec1c25599b2607a6 (commit)
       via  e4bb683bb45efbba64477845a52308922ee7cc82 (commit)
       via  6bead66eb814a01e41062264e5f5c03e8b8e795e (commit)
       via  eb2c9108ed1b8a7ede2e4cd9ccf916398e0c0978 (commit)
      from  b4a97cdc4096f0aea334234216608b552b635a32 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=57c4193691d2313ef6214542c976a2b4dd73fb2b


commit 57c4193691d2313ef6214542c976a2b4dd73fb2b
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Oct 20 16:01:38 2010 +0200

    Drop a couple of lines.

diff --git a/libcore/swf/tag_loaders.cpp b/libcore/swf/tag_loaders.cpp
index 1b9a852..27ff5df 100644
--- a/libcore/swf/tag_loaders.cpp
+++ b/libcore/swf/tag_loaders.cpp
@@ -725,11 +725,6 @@ sprite_loader(SWFStream& in, TagType tag, 
movie_definition& m,
     m.addDisplayObject(id, ch);
 }
 
-
-//
-// Sound
-//
-
 // Common data
 
 /// Sample rate table for DEFINESOUNDHEAD tags

http://git.savannah.gnu.org/cgit//commit/?id=64852234c5b8562a4b977e9beb064626075ac224


commit 64852234c5b8562a4b977e9beb064626075ac224
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Oct 20 15:49:34 2010 +0200

    Drop dummy loaders from tag_loaders.cpp.

diff --git a/libcore/swf/tag_loaders.cpp b/libcore/swf/tag_loaders.cpp
index ac3ede4..1b9a852 100644
--- a/libcore/swf/tag_loaders.cpp
+++ b/libcore/swf/tag_loaders.cpp
@@ -145,12 +145,6 @@ const boost::uint32_t samplerates[] = { 5512, 11025, 
22050, 44100 };
 
 } // anonymous namespace
 
-// Silently ignore the contents of this tag.
-void null_loader(SWFStream& /*in*/, TagType /*tag*/, movie_definition& /*m*/,
-        const RunResources& /*r*/)
-{
-}
-
 // Label the current frame of m with the name from the SWFStream.
 void
 frame_label_loader(SWFStream& in, TagType tag, movie_definition& m,
@@ -692,17 +686,6 @@ define_bits_lossless_2_loader(SWFStream& in, TagType tag, 
movie_definition& m,
 
 }
 
-// This is like null_loader except it prints a message to nag us to fix it.
-void
-fixme_loader(SWFStream& /*in*/, TagType tag, movie_definition& /*m*/,
-               const RunResources& /*r*/)
-{
-    static std::set<TagType> warned;
-    if (warned.insert(tag).second) {
-        log_unimpl(_("  FIXME: tagtype = %d"), tag);
-    }
-}
-
 // Create and initialize a sprite, and add it to the movie.
 void
 sprite_loader(SWFStream& in, TagType tag, movie_definition& m,
diff --git a/libcore/swf/tag_loaders.h b/libcore/swf/tag_loaders.h
index 9c1f4a7..e6f8b7f 100644
--- a/libcore/swf/tag_loaders.h
+++ b/libcore/swf/tag_loaders.h
@@ -37,9 +37,6 @@ namespace SWF {
 /// Silently ignore the contents of this tag.
 void null_loader(SWFStream&, TagType, movie_definition&, const RunResources&);
 
-/// This is like null_loader except it prints a message to nag us to fix it.
-void fixme_loader(SWFStream&, TagType, movie_definition&, const RunResources&);
-
 /// \brief
 /// Load JPEG compression tables that can be used to load
 /// images further along in the SWFStream. (SWF::JPEGTABLES)
@@ -76,15 +73,6 @@ void define_bits_lossless_2_loader(SWFStream&, TagType, 
movie_definition&,
 ///
 void sprite_loader(SWFStream&, TagType, movie_definition&, const 
RunResources&);
 
-// end_tag doesn't actually need to exist.
-// TODO: drop this loader ?
-inline void end_loader(SWFStream& in, TagType tag, movie_definition&,
-        const RunResources&)
-{
-    assert(tag == SWF::END); // 0
-    assert(in.tell() == in.get_tag_end_position());
-}
-
 void remove_object_2_loader(SWFStream&, TagType, movie_definition&,
                const RunResources&);
 

http://git.savannah.gnu.org/cgit//commit/?id=cdffac9302e64a71fa29ab62ec1c25599b2607a6


commit cdffac9302e64a71fa29ab62ec1c25599b2607a6
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Oct 20 15:48:59 2010 +0200

    Move dummy loaders locally.

diff --git a/libcore/swf/DefaultTagLoaders.cpp 
b/libcore/swf/DefaultTagLoaders.cpp
index f060b51..a084c5f 100644
--- a/libcore/swf/DefaultTagLoaders.cpp
+++ b/libcore/swf/DefaultTagLoaders.cpp
@@ -75,24 +75,47 @@ public:
         _table(table)
     {}
 
-    void operator()(const TagPair& p)
-    {
+    void operator()(const TagPair& p) {
         _table.registerLoader(p.first, p.second);
     }
 private:
     TagLoadersTable& _table;
 };
 
+// This is only for tags mentioned in documentation but thought to to exist.
+void
+unexpected(SWFStream&, TagType tag, movie_definition&, const RunResources&)
+{
+    static std::set<TagType> warned;
+    if (warned.insert(tag).second) {
+        log_unimpl(_("Undocumented tag %s encountered. Please report this to "
+            "the Gnash developers!"), tag);
+    }
+}
+
+// Silently ignore the contents of this tag.
+void
+ignore(SWFStream&, TagType, movie_definition&, const RunResources&)
+{
 }
 
+} // unnamed namespace
+
 void
 addDefaultLoaders(TagLoadersTable& table)
 {
 
+    // Note: all the tags given an 'unexpected' here are
+    // expected not to be used. They are generally documented
+    // by Alexis to exist (without any known structure), but not
+    // by Adobe.
     const std::vector<TagPair> tags = boost::assign::list_of
-        (TagPair(SWF::END, end_loader))
+        // 01: nothing to do for an end tag.
+        (TagPair(SWF::END, ignore))
+        // 02
         (TagPair(SWF::DEFINESHAPE, DefineShapeTag::loader))
-        (TagPair(SWF::FREECHARACTER, fixme_loader)) // 03
+        // 03
+        (TagPair(SWF::FREECHARACTER, unexpected)) 
         (TagPair(SWF::PLACEOBJECT, PlaceObject2Tag::loader))
         (TagPair(SWF::REMOVEOBJECT, RemoveObjectTag::loader)) // 05
         (TagPair(SWF::DEFINEBITS, define_bits_jpeg_loader))
@@ -101,17 +124,11 @@ addDefaultLoaders(TagLoadersTable& table)
         (TagPair(SWF::SETBACKGROUNDCOLOR, SetBackgroundColorTag::loader))
         (TagPair(SWF::DEFINEFONT, DefineFontTag::loader))
         (TagPair(SWF::DEFINETEXT, DefineTextTag::loader))
-        (TagPair(SWF::DOACTION,  DoActionTag::loader))
+        (TagPair(SWF::DOACTION, DoActionTag::loader))
         (TagPair(SWF::DEFINEFONTINFO, DefineFontInfoTag::loader))
-        // 62
-        (TagPair(SWF::DEFINEFONTINFO2, DefineFontInfoTag::loader))
         (TagPair(SWF::DEFINESOUND, define_sound_loader))
         (TagPair(SWF::STARTSOUND, StartSoundTag::loader))
-        // 89
-        (TagPair(SWF::STARTSOUND2, StartSound2Tag::loader))
-
-        (TagPair(SWF::STOPSOUND, fixme_loader)) // 16 
-
+        (TagPair(SWF::STOPSOUND, unexpected)) // 16 
         // 17
         (TagPair(SWF::DEFINEBUTTONSOUND, DefineButtonSoundTag::loader))
         // 18
@@ -120,77 +137,61 @@ addDefaultLoaders(TagLoadersTable& table)
         (TagPair(SWF::SOUNDSTREAMBLOCK, StreamSoundBlockTag::loader))
         (TagPair(SWF::DEFINELOSSLESS, define_bits_lossless_2_loader))
         (TagPair(SWF::DEFINEBITSJPEG2, define_bits_jpeg2_loader))
-        (TagPair(SWF::DEFINESHAPE2,  DefineShapeTag::loader))
+        (TagPair(SWF::DEFINESHAPE2, DefineShapeTag::loader))
         (TagPair(SWF::DEFINEBUTTONCXFORM, DefineButtonCxformTag::loader)) // 23
-        // "protect" tag; we're not an authoring tool so we don't care.
-        // (might be nice to dump the password instead..)
-        (TagPair(SWF::PROTECT, null_loader))
-        (TagPair(SWF::PATHSAREPOSTSCRIPT, fixme_loader)) // 25
-        (TagPair(SWF::PLACEOBJECT2,  PlaceObject2Tag::loader))
-        // 27 - _UNKNOWN_ unimplemented
-        (TagPair(SWF::REMOVEOBJECT2, RemoveObjectTag::loader)) // 28
-        (TagPair(SWF::SYNCFRAME, fixme_loader)) // 29
-        // 30 - _UNKNOWN_ unimplemented
-        (TagPair(SWF::FREEALL, fixme_loader)) // 31
-        (TagPair(SWF::DEFINESHAPE3,  DefineShapeTag::loader))
+        (TagPair(SWF::PROTECT, ignore))
+        (TagPair(SWF::PATHSAREPOSTSCRIPT, unexpected)) // 25
+        (TagPair(SWF::PLACEOBJECT2, PlaceObject2Tag::loader))
+        // 28
+        (TagPair(SWF::REMOVEOBJECT2, RemoveObjectTag::loader)) 
+        (TagPair(SWF::SYNCFRAME, unexpected)) // 29
+        (TagPair(SWF::FREEALL, unexpected)) // 31
+        (TagPair(SWF::DEFINESHAPE3, DefineShapeTag::loader))
         (TagPair(SWF::DEFINETEXT2, DefineText2Tag::loader))
         // 37
         (TagPair(SWF::DEFINEBUTTON2, DefineButton2Tag::loader))
         (TagPair(SWF::DEFINEBITSJPEG3, define_bits_jpeg3_loader))
         (TagPair(SWF::DEFINELOSSLESS2, define_bits_lossless_2_loader))
         (TagPair(SWF::DEFINEEDITTEXT, DefineEditTextTag::loader))
-        (TagPair(SWF::DEFINEVIDEO, fixme_loader)) // 38
-        (TagPair(SWF::DEFINESPRITE,  sprite_loader))
-        (TagPair(SWF::NAMECHARACTER, fixme_loader)) // 40
-        (TagPair(SWF::SERIALNUMBER,  serialnumber_loader)) // 41
-        (TagPair(SWF::DEFINETEXTFORMAT, fixme_loader)) // 42
-        (TagPair(SWF::FRAMELABEL,  frame_label_loader)) // 43
-
-        // TODO: Implement, but fixme_loader breaks tests.
-        (TagPair(SWF::DEFINEBEHAVIOR, fixme_loader)) // 44
-
-        (TagPair(SWF::SOUNDSTREAMHEAD2, sound_stream_head_loader)) // 45
+        (TagPair(SWF::DEFINEVIDEO, unexpected)) // 38
+        (TagPair(SWF::DEFINESPRITE, sprite_loader))
+        (TagPair(SWF::NAMECHARACTER, unexpected)) // 40
+        (TagPair(SWF::SERIALNUMBER, serialnumber_loader)) // 41
+        (TagPair(SWF::DEFINETEXTFORMAT, unexpected)) // 42
+        (TagPair(SWF::FRAMELABEL, frame_label_loader)) // 43
+        (TagPair(SWF::DEFINEBEHAVIOR, unexpected)) // 44
+        // 45
+        (TagPair(SWF::SOUNDSTREAMHEAD2, sound_stream_head_loader))
         // 46
         (TagPair(SWF::DEFINEMORPHSHAPE, DefineMorphShapeTag::loader))
-        (TagPair(SWF::FRAMETAG,  fixme_loader)) // 47
+        // 47
+        (TagPair(SWF::FRAMETAG, unexpected))
         // 48
         (TagPair(SWF::DEFINEFONT2, DefineFontTag::loader))
-        (TagPair(SWF::GENCOMMAND,  fixme_loader)) // 49
-        (TagPair(SWF::DEFINECOMMANDOBJ, fixme_loader)) // 50
-        (TagPair(SWF::CHARACTERSET,  fixme_loader)) // 51
-        (TagPair(SWF::FONTREF, fixme_loader)) // 52
-
-        // TODO: Implement, but fixme_loader breaks tests.
-        (TagPair(SWF::DEFINEFUNCTION, fixme_loader)) // 53 
-        (TagPair(SWF::PLACEFUNCTION, fixme_loader)) // 54 
-        (TagPair(SWF::GENTAGOBJECT, fixme_loader)) // 55 
-
+        (TagPair(SWF::GENCOMMAND, unexpected)) // 49
+        (TagPair(SWF::DEFINECOMMANDOBJ, unexpected)) // 50
+        (TagPair(SWF::CHARACTERSET, unexpected)) // 51
+        (TagPair(SWF::FONTREF, unexpected)) // 52
+        (TagPair(SWF::DEFINEFUNCTION, unexpected)) // 53 
+        (TagPair(SWF::PLACEFUNCTION, unexpected)) // 54 
+        (TagPair(SWF::GENTAGOBJECT, unexpected)) // 55 
         (TagPair(SWF::EXPORTASSETS, ExportAssetsTag::loader)) // 56
         (TagPair(SWF::IMPORTASSETS, ImportAssetsTag::loader)) // 57
-
-        //  We're not an authoring tool so we don't care.
-        // (might be nice to dump the password instead..)
-        (TagPair(SWF::ENABLEDEBUGGER, null_loader))    // 58
-
+        (TagPair(SWF::ENABLEDEBUGGER, ignore))    // 58
         // 59
         (TagPair(SWF::INITACTION, DoInitActionTag::loader)) 
         // 60
         (TagPair(SWF::DEFINEVIDEOSTREAM, DefineVideoStreamTag::loader))
         // 61
         (TagPair(SWF::VIDEOFRAME, VideoFrameTag::loader))
-
-        // 62, DEFINEFONTINFO2 is done above.
-        // We're not an authoring tool.
-        (TagPair(SWF::DEBUGID, null_loader)) // 63
-
-        //  We're not an authoring tool so we don't care.
-        // (might be nice to dump the password instead..)
-        (TagPair(SWF::ENABLEDEBUGGER2, null_loader))    // 64
+        // 62
+        (TagPair(SWF::DEFINEFONTINFO2, DefineFontInfoTag::loader))
+        // 63
+        (TagPair(SWF::DEBUGID, ignore))
+        // 64
+        (TagPair(SWF::ENABLEDEBUGGER2, ignore))
         (TagPair(SWF::SCRIPTLIMITS, ScriptLimitsTag::loader)) //65
-
-        // TODO: Fix this, but probably not critical.
         (TagPair(SWF::SETTABINDEX, SetTabIndexTag::loader)) //66 
-
         // TODO: Alexis reference says these are 83, 84. The 67, 68 comes from
         // Tamarin. Figure out which one is correct (possibly both are).
         // 67
@@ -219,9 +220,10 @@ addDefaultLoaders(TagLoadersTable& table)
         (TagPair(SWF::DEFINEMORPHSHAPE2, DefineMorphShapeTag::loader))
         // 88
         (TagPair(SWF::DEFINEFONTNAME, DefineFontNameTag::loader))
+        // 89
+        (TagPair(SWF::STARTSOUND2, StartSound2Tag::loader))
         // 777
         (TagPair(SWF::REFLEX, reflex_loader))
-
 #ifdef ENABLE_AVM2
         // The following tags are AVM2 only.
         // 72 -- AS3 codeblock.

http://git.savannah.gnu.org/cgit//commit/?id=e4bb683bb45efbba64477845a52308922ee7cc82


commit e4bb683bb45efbba64477845a52308922ee7cc82
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Oct 20 15:48:33 2010 +0200

    Explain missing tag better.

diff --git a/libcore/parser/SWFParser.cpp b/libcore/parser/SWFParser.cpp
index 63d7485..b35bca1 100644
--- a/libcore/parser/SWFParser.cpp
+++ b/libcore/parser/SWFParser.cpp
@@ -98,7 +98,8 @@ SWFParser::read(std::streamsize bytes)
             }
             else {
                 // no tag loader for this tag type.
-                log_error(_("*** no tag loader for type %d (movie)"), _tag);
+                log_error(_("Encountered unknown tag %d. These usually store "
+                        "creation tool data and do not affect playback"), 
_tag);
                 IF_VERBOSE_PARSE(
                     std::ostringstream ss;
                     dumpTagBytes(_stream, ss);

http://git.savannah.gnu.org/cgit//commit/?id=6bead66eb814a01e41062264e5f5c03e8b8e795e


commit 6bead66eb814a01e41062264e5f5c03e8b8e795e
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Oct 20 15:48:16 2010 +0200

    Drop stars.

diff --git a/libcore/swf/DefineFontAlignZonesTag.cpp 
b/libcore/swf/DefineFontAlignZonesTag.cpp
index bdb8975..328f1e7 100644
--- a/libcore/swf/DefineFontAlignZonesTag.cpp
+++ b/libcore/swf/DefineFontAlignZonesTag.cpp
@@ -107,7 +107,7 @@ DefineFontAlignZonesTag::loader(SWFStream& in, TagType tag,
                        
     }
        in.skip_to_tag_end();
-       LOG_ONCE(log_unimpl(_("*** DefineFontAlignZoneTag")));
+       LOG_ONCE(log_unimpl(_("DefineFontAlignZoneTag")));
 
 }
 

http://git.savannah.gnu.org/cgit//commit/?id=eb2c9108ed1b8a7ede2e4cd9ccf916398e0c0978


commit eb2c9108ed1b8a7ede2e4cd9ccf916398e0c0978
Author: Benjamin Wolsey <address@hidden>
Date:   Wed Oct 20 15:28:31 2010 +0200

    Clean up, const correct.

diff --git a/libcore/swf/tag_loaders.cpp b/libcore/swf/tag_loaders.cpp
index da823ef..ac3ede4 100644
--- a/libcore/swf/tag_loaders.cpp
+++ b/libcore/swf/tag_loaders.cpp
@@ -44,7 +44,6 @@
 #include "swf/TagLoadersTable.h"
 #include "URL.h"
 #include "GnashException.h"
-#include "swf/DefineVideoStreamTag.h"
 #include "sound_definition.h"
 #include "SoundInfo.h"
 #include "MediaHandler.h"
@@ -65,7 +64,6 @@ namespace gnash {
 
 namespace SWF {
 
-
 /// Anonymous namespace
 namespace {
 
@@ -88,16 +86,12 @@ class StreamAdapter : public IOChannel
         assert(endPos > startPos);
     }
 
-    virtual ~StreamAdapter()
-    {
-    }
+    virtual ~StreamAdapter() {}
 
-    virtual std::streamsize read(void* dst, std::streamsize bytes) 
-    {
+    virtual std::streamsize read(void* dst, std::streamsize bytes) {
         std::streamsize bytesLeft = endPos - currPos;
-        if ( bytesLeft < bytes )
-        {
-            if ( ! bytesLeft ) return 0;
+        if (bytesLeft < bytes) {
+            if (!bytesLeft) return 0;
             //log_debug("Requested to read past end of stream range");
             bytes = bytesLeft;
         }
@@ -106,40 +100,33 @@ class StreamAdapter : public IOChannel
         return actuallyRead;
     }
 
-    virtual void go_to_end()
-    {
+    virtual void go_to_end() {
         s.seek(endPos);
     }
 
-    virtual bool eof() const
-    {
+    virtual bool eof() const {
         return (currPos == endPos);
     }
 
     // Return false on failure, true on success
-    virtual bool seek(std::streampos pos)
-    {
+    virtual bool seek(std::streampos pos) {
         // SWFStream::seek() returns true on success
-        if (s.seek(pos))
-        {
+        if (s.seek(pos)) {
             currPos = pos;
             return true;
         }
         return false;
     }
 
-    virtual size_t size() const
-    {
+    virtual size_t size() const {
         return (endPos - startPos);
     }
 
-    virtual std::streampos tell() const
-    {
+    virtual std::streampos tell() const {
         return currPos;
     }
     
-    virtual bool bad() const
-    {
+    virtual bool bad() const {
         // Is there any point in this?
         return false;
     }
@@ -148,20 +135,15 @@ public:
 
     /// Get an IOChannel from a gnash::SWFStream
     static std::auto_ptr<IOChannel> getFile(SWFStream& str,
-            unsigned long endPos)
-    {
+            unsigned long endPos) {
         std::auto_ptr<IOChannel> ret (new StreamAdapter(str, endPos));
         return ret;
     }
 };
 
-} // anonymous namespace
-
-
-//
-// Tag loaders
-//
+const boost::uint32_t samplerates[] = { 5512, 11025, 22050, 44100 };
 
+} // anonymous namespace
 
 // Silently ignore the contents of this tag.
 void null_loader(SWFStream& /*in*/, TagType /*tag*/, movie_definition& /*m*/,
@@ -195,20 +177,17 @@ frame_label_loader(SWFStream& in, TagType tag, 
movie_definition& m,
     //
     size_t end_tag = in.get_tag_end_position();
     size_t curr_pos = in.tell();
-    if ( end_tag != curr_pos )
-    {
-    if ( end_tag == curr_pos + 1 )
-    {
-        log_unimpl(_("anchor-labeled frame not supported"));
-    }
-    else
-    {
-        IF_VERBOSE_MALFORMED_SWF(
-        log_swferror(_("frame_label_loader end position %d, "
-                   "read up to %d"),
-                 end_tag, curr_pos);
-        );
-    }
+    if (end_tag != curr_pos) {
+        if (end_tag == curr_pos + 1) {
+            log_unimpl(_("anchor-labeled frame not supported"));
+        }
+        else {
+            IF_VERBOSE_MALFORMED_SWF(
+            log_swferror(_("frame_label_loader end position %d, "
+                       "read up to %d"),
+                     end_tag, curr_pos);
+            );
+        }
     }
 }
 
@@ -218,11 +197,9 @@ void
 jpeg_tables_loader(SWFStream& in, TagType tag, movie_definition& m,
                const RunResources& /*r*/)
 {
-    //GNASH_REPORT_FUNCTION;
     assert(tag == SWF::JPEGTABLES);
 
-    IF_VERBOSE_PARSE
-    (
+    IF_VERBOSE_PARSE(
         log_parse(_("  jpeg_tables_loader"));
     );
 
@@ -233,31 +210,28 @@ jpeg_tables_loader(SWFStream& in, TagType tag, 
movie_definition& m,
 
     const unsigned long jpegHeaderSize = endPos - currPos;
 
-    if ( ! jpegHeaderSize )
-    {
+    if (!jpegHeaderSize) {
         log_debug(_("No bytes to read in JPEGTABLES tag at offset %d"),
                 currPos);
     }
 
     std::auto_ptr<image::JpegInput> input;
 
-    try
-    {
-    // NOTE: we cannot limit input SWFStream here as the same jpeg::input
-    // instance will be used for reading subsequent DEFINEBITS and similar
-    // tags, which are *different* tags, so have different boundaries !!
-    //
-    // Anyway the actual reads are limited to currently opened tag as 
-    // of gnash::SWFStream::read(), so this is not a problem.
-    //
+    try {
+        // NOTE: we cannot limit input SWFStream here as the same jpeg::input
+        // instance will be used for reading subsequent DEFINEBITS and similar
+        // tags, which are *different* tags, so have different boundaries !!
+        //
+        // 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<std::streamsize>::max()).release());
         //  transfer ownership to the image::JpegInput
         input = image::JpegInput::createSWFJpeg2HeaderOnly(ad, jpegHeaderSize);
 
     }
-    catch (std::exception& e)
-    {
+    catch (const std::exception& e) {
         IF_VERBOSE_MALFORMED_SWF(
             log_swferror("Error creating header-only jpeg2 input: %s",
                 e.what());
@@ -281,22 +255,20 @@ define_bits_jpeg_loader(SWFStream& in, TagType tag, 
movie_definition& m,
     in.ensureBytes(2);
     boost::uint16_t id = in.read_u16();
 
-    if (m.getBitmap(id))
-    {
+    if (m.getBitmap(id)) {
         IF_VERBOSE_MALFORMED_SWF(
-        log_swferror(_("DEFINEBITS: Duplicate id (%d) for bitmap DisplayObject 
"
-                "- discarding it"), id);
+            log_swferror(_("DEFINEBITS: Duplicate id (%d) for bitmap "
+                    "DisplayObject - discarding it"), id);
         );
         return;
     }
 
     // Read the image data.
     image::JpegInput* j_in = m.get_jpeg_loader();
-    if ( ! j_in )
-    {
+    if (!j_in) {
         IF_VERBOSE_MALFORMED_SWF(
-        log_swferror(_("DEFINEBITS: No jpeg loader registered in movie "
-                "definition - discarding bitmap DisplayObject %d"), id);
+            log_swferror(_("DEFINEBITS: No jpeg loader registered in movie "
+                    "definition - discarding bitmap DisplayObject %d"), id);
         );
         return;
     }
@@ -307,10 +279,10 @@ define_bits_jpeg_loader(SWFStream& in, TagType tag, 
movie_definition& m,
     try {
         im = image::JpegInput::readSWFJpeg2WithTables(*j_in);
     }
-    catch (std::exception& e) {
+    catch (const std::exception& e) {
         IF_VERBOSE_MALFORMED_SWF(
-        log_swferror("Error reading jpeg2 with headers for DisplayObject "
-            "id %d: %s", id, e.what());
+            log_swferror("Error reading jpeg2 with headers for DisplayObject "
+                "id %d: %s", id, e.what());
         );
         return;
     }
@@ -336,18 +308,15 @@ define_bits_jpeg2_loader(SWFStream& in, TagType tag, 
movie_definition& m,
     in.ensureBytes(2);
     boost::uint16_t id = in.read_u16();
 
-    IF_VERBOSE_PARSE
-    (
-    log_parse(_("  define_bits_jpeg2_loader: charid = %d pos = %ld"),
-          id, in.tell());
+    IF_VERBOSE_PARSE(
+        log_parse(_("  define_bits_jpeg2_loader: charid = %d pos = %ld"),
+              id, in.tell());
     );
-
     
-    if ( m.getBitmap(id) )
-    {
+    if (m.getBitmap(id)) {
         IF_VERBOSE_MALFORMED_SWF(
-        log_swferror(_("DEFINEBITSJPEG2: Duplicate id (%d) for bitmap "
-                "DisplayObject - discarding it"), id);
+            log_swferror(_("DEFINEBITSJPEG2: Duplicate id (%d) for bitmap "
+                    "DisplayObject - discarding it"), id);
         );
         return;
     }
@@ -373,9 +342,9 @@ define_bits_jpeg2_loader(SWFStream& in, TagType tag, 
movie_definition& m,
 
     // Read the image data.
     boost::shared_ptr<IOChannel> ad(StreamAdapter::getFile(in,
-                in.get_tag_end_position()).release() );
+                in.get_tag_end_position()).release());
 
-    std::auto_ptr<image::GnashImage> im (image::Input::readImageData(ad, ft));
+    std::auto_ptr<image::GnashImage> im(image::Input::readImageData(ad, ft));
 
     Renderer* renderer = r.renderer();
     if (!renderer) {
@@ -425,19 +394,16 @@ void inflate_wrapper(SWFStream& in, void* buffer, int 
buffer_bytes)
     boost::uint8_t buf[CHUNKSIZE];
     unsigned long endTagPos = in.get_tag_end_position();
 
-    for (;;)
-    {
+    for (;;) {
         unsigned int chunkSize = CHUNKSIZE;
         assert(in.tell() <= endTagPos);
         unsigned int availableBytes =  endTagPos - in.tell();
-        if ( availableBytes < chunkSize )
-        {
-            if ( ! availableBytes )
-            {
+        if (availableBytes < chunkSize) {
+            if (!availableBytes) {
                 // 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;
             }
@@ -452,25 +418,22 @@ void inflate_wrapper(SWFStream& in, void* buffer, int 
buffer_bytes)
         d_stream.avail_in = chunkSize;
 
         err = inflate(&d_stream, Z_SYNC_FLUSH);
-        if (err == Z_STREAM_END)
-        {
+        if (err == Z_STREAM_END) {
             // correct end
             break;
         }
 
-        if (err != Z_OK)
-        {
+        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;
         }
     }
 
     err = inflateEnd(&d_stream);
-    if (err != Z_OK)
-    {
+    if (err != Z_OK) {
         log_error(_("inflate_wrapper() inflateEnd() return %d (%s)"),
                 err, d_stream.msg);
     }
@@ -487,25 +450,21 @@ define_bits_jpeg3_loader(SWFStream& in, TagType tag, 
movie_definition& m,
     assert(tag == SWF::DEFINEBITSJPEG3); // 35
 
     in.ensureBytes(2);
-    boost::uint16_t id = in.read_u16();
+    const boost::uint16_t id = in.read_u16();
 
-    IF_VERBOSE_PARSE
-    (
-    log_parse(_("  define_bits_jpeg3_loader: charid = %d pos = %lx"),
-          id, in.tell());
+    IF_VERBOSE_PARSE(
+        log_parse(_("  define_bits_jpeg3_loader: charid = %d pos = %lx"),
+              id, in.tell());
     );
 
     in.ensureBytes(4);
-    boost::uint32_t    jpeg_size = in.read_u32();
-    boost::uint32_t    alpha_position = in.tell() + jpeg_size;
+    const boost::uint32_t jpeg_size = in.read_u32();
+    const boost::uint32_t alpha_position = in.tell() + jpeg_size;
 
 #ifndef HAVE_ZLIB_H
     log_error(_("gnash is not linked to zlib -- can't load jpeg3 image data"));
     return;
 #else
-    //
-    // Read the image data.
-    //
 
     // Read rgb data.
     boost::shared_ptr<IOChannel> ad(StreamAdapter::getFile(in,
@@ -522,7 +481,7 @@ define_bits_jpeg3_loader(SWFStream& in, TagType tag, 
movie_definition& m,
     const size_t imHeight = im->height();
     const size_t bufferLength = imWidth * imHeight;
 
-    boost::scoped_array<boost::uint8_t> buffer (new 
boost::uint8_t[bufferLength]);
+    boost::scoped_array<boost::uint8_t> buffer(new 
boost::uint8_t[bufferLength]);
 
     inflate_wrapper(in, buffer.get(), bufferLength);
 
@@ -549,22 +508,19 @@ void
 define_bits_lossless_2_loader(SWFStream& in, TagType tag, movie_definition& m,
                const RunResources& r)
 {
-    // tags 20 || 36
     assert(tag == SWF::DEFINELOSSLESS || tag == SWF::DEFINELOSSLESS2);
+    in.ensureBytes(2 + 2 + 2 + 1); // the initial header 
 
-    in.ensureBytes(2+2+2+1); // the initial header 
-
-    boost::uint16_t id = in.read_u16();
+    const boost::uint16_t id = in.read_u16();
 
     // 3 == 8 bit, 4 == 16 bit, 5 == 32 bit
-    boost::uint8_t bitmap_format = in.read_u8();
-    boost::uint16_t width = in.read_u16();
-    boost::uint16_t height = in.read_u16();
+    const boost::uint8_t bitmap_format = in.read_u8();
+    const boost::uint16_t width = in.read_u16();
+    const boost::uint16_t height = in.read_u16();
 
     IF_VERBOSE_PARSE(
-        log_parse(_("  defbitslossless2: tag = %d, id = %d, "
-            "fmt = %d, w = %d, h = %d"),
-            tag, id, bitmap_format, width, height);
+        log_parse(_("  defbitslossless2: tag = %d, id = %d, fmt = %d, "
+                "w = %d, h = %d"), tag, id, bitmap_format, width, height);
     );
 
     if (!width || !height) {
@@ -594,7 +550,6 @@ define_bits_lossless_2_loader(SWFStream& in, TagType tag, 
movie_definition& m,
     bool alpha = false;
 
     try {
-
         switch (tag) {
             case SWF::DEFINELOSSLESS:
                 image.reset(new image::ImageRGB(width, height));
@@ -621,8 +576,7 @@ define_bits_lossless_2_loader(SWFStream& in, TagType tag, 
movie_definition& m,
     unsigned short bytes_per_pixel;
     int colorTableSize = 0;
 
-    switch (bitmap_format)
-    {
+    switch (bitmap_format) {
         case 3:
             bytes_per_pixel = 1;
             in.ensureBytes(1);
@@ -657,14 +611,12 @@ define_bits_lossless_2_loader(SWFStream& in, TagType tag, 
movie_definition& m,
             // 8-bit data, preceded by a palette.
             boost::uint8_t* colorTable = buffer.get();
 
-            for (int j = 0; j < height; j++)
-            {
+            for (size_t j = 0; j < height; ++j) {
                 boost::uint8_t* inRow = buffer.get() + 
                     colorTableSize * channels + j * pitch;
 
                 boost::uint8_t* outRow = scanline(*image, j);
-                for (int i = 0; i < width; i++)
-                {
+                for (size_t i = 0; i < width; ++i) {
                     boost::uint8_t pixel = inRow[i * bytes_per_pixel];
                     outRow[i * channels + 0] = colorTable[pixel * channels + 
0];
                     outRow[i * channels + 1] = colorTable[pixel * channels + 
1];
@@ -681,13 +633,12 @@ define_bits_lossless_2_loader(SWFStream& in, TagType tag, 
movie_definition& m,
         case 4:
             // 16 bits / pixel
 
-            for (int j = 0; j < height; j++)
-            {
+            for (size_t j = 0; j < height; ++j) {
+
                 boost::uint8_t* inRow = buffer.get() + j * pitch;
                 boost::uint8_t* outRow = scanline(*image, j);
-                for (int i = 0; i < width; i++)
-                {
-                    boost::uint16_t pixel = inRow[i * 2] |
+                for (size_t i = 0; i < width; ++i) {
+                    const boost::uint16_t pixel = inRow[i * 2] |
                         (inRow[i * 2 + 1] << 8);
 
                     // How is the data packed??? Whoever wrote this was
@@ -708,14 +659,12 @@ define_bits_lossless_2_loader(SWFStream& in, TagType tag, 
movie_definition& m,
 
         case 5:
             // Need to re-arrange ARGB into RGB or RGBA.
-            for (int j = 0; j < height; j++)
-            {
+            for (size_t j = 0; j < height; ++j) {
                 boost::uint8_t* inRow = buffer.get() + j * pitch;
                 boost::uint8_t* outRow = scanline(*image, j);
                 const int inChannels = 4;
 
-                for (int i = 0; i < width; ++i)
-                {
+                for (size_t i = 0; i < width; ++i) {
                     // Copy pixels 1-3.
                     std::copy(&inRow[i * inChannels + 1],
                             &inRow[i * inChannels + 4], &outRow[i * channels]);
@@ -764,9 +713,8 @@ sprite_loader(SWFStream& in, TagType tag, movie_definition& 
m,
     in.ensureBytes(2);
     const boost::uint16_t id = in.read_u16();
 
-    IF_VERBOSE_PARSE
-    (
-    log_parse(_("  sprite:  char id = %d"), id);
+    IF_VERBOSE_PARSE(
+        log_parse(_("  sprite:  char id = %d"), id);
     );
 
     // A DEFINESPRITE tag as part of a DEFINESPRITE
@@ -776,7 +724,7 @@ sprite_loader(SWFStream& in, TagType tag, movie_definition& 
m,
         try {
             dynamic_cast<SWFMovieDefinition&>(m);
         }
-        catch (std::bad_cast& e) {
+        catch (const std::bad_cast&) {
             log_swferror(_("Nested DEFINESPRITE tags. Will add to "
                            "top-level DisplayObjects dictionary."));
         }
@@ -791,7 +739,6 @@ sprite_loader(SWFStream& in, TagType tag, movie_definition& 
m,
         }
     );
 
-
     m.addDisplayObject(id, ch);
 }
 
@@ -809,9 +756,6 @@ sprite_loader(SWFStream& in, TagType tag, movie_definition& 
m,
 /// NOTE that the first element of this table lacks the .5
 /// portion of the actual value. Dunno what consequences 
 /// it could have...
-///
-static int s_sample_rate_table[] = { 5512, 11025, 22050, 44100 };
-static unsigned int s_sample_rate_table_len = 4;
 
 // @@ There are two sets of code to decode/expand/byteswap audio here.
 // @@ There should be one (search for ADPCM).
@@ -827,27 +771,26 @@ define_sound_loader(SWFStream& in, TagType tag, 
movie_definition& m,
 
     in.ensureBytes(2+4+1+4); // DisplayObject id + flags + sample count
 
-    boost::uint16_t    id = in.read_u16();
+    const boost::uint16_t id = in.read_u16();
 
     media::audioCodecType format = static_cast<media::audioCodecType>(
             in.read_uint(4));
-    unsigned sample_rate_in = in.read_uint(2); // see s_sample_rate_table
-    if ( sample_rate_in >= s_sample_rate_table_len ) 
-    {
+
+    boost::uint8_t sample_rate_in = in.read_uint(2);
+
+    if (sample_rate_in >= arraySize(samplerates)) {
         IF_VERBOSE_MALFORMED_SWF(
-        log_swferror(_("DEFINESOUNDLOADER: sound sample rate %d (expected "
-                "0 to %u"), 
-            sample_rate_in, s_sample_rate_table_len);
+            log_swferror(_("DEFINESOUNDLOADER: sound sample rate %d (expected "
+                    "0 to %u"), +sample_rate_in, arraySize(samplerates));
         );
         sample_rate_in = 0;
     }
-    int sample_rate = s_sample_rate_table[sample_rate_in];
-
+    const boost::uint32_t sample_rate = samplerates[sample_rate_in];
 
-    bool    sample_16bit = in.read_bit(); 
-    bool    stereo = in.read_bit(); 
+    const bool sample_16bit = in.read_bit(); 
+    const bool stereo = in.read_bit(); 
 
-    unsigned int    sample_count = in.read_u32();
+    const boost::uint32_t sample_count = in.read_u32();
 
     boost::int16_t delaySeek = 0;
 
@@ -856,18 +799,15 @@ define_sound_loader(SWFStream& in, TagType tag, 
movie_definition& m,
         delaySeek = in.read_s16();
     }
 
-    IF_VERBOSE_PARSE
-    (
-        log_parse(_("define sound: ch=%d, format=%s, "
-            "rate=%d, 16=%d, stereo=%d, ct=%d, delay=%d"),
-              id, format, sample_rate,
-              int(sample_16bit), int(stereo), sample_count, delaySeek);
+    IF_VERBOSE_PARSE(
+        log_parse(_("define sound: ch=%d, format=%s, rate=%d, 16=%d, "
+            "stereo=%d, ct=%d, delay=%d"), id, format, sample_rate,
+            sample_16bit, stereo, sample_count, delaySeek);
     );
 
     // If we have a sound_handler, ask it to init this sound.
 
-    if (handler)
-    {
+    if (handler) {
         // First it is the amount of data from file,
         // then the amount allocated at *data (it may grow)
         const unsigned dataLength = in.get_tag_end_position() - in.tell();
@@ -878,7 +818,7 @@ define_sound_loader(SWFStream& in, TagType tag, 
movie_definition& m,
         media::MediaHandler* mh = r.mediaHandler();
         if (mh) allocSize += mh->getInputPaddingSize();
 
-        std::auto_ptr<SimpleBuffer> data( new SimpleBuffer(allocSize) );
+        std::auto_ptr<SimpleBuffer> data(new SimpleBuffer(allocSize));
 
         // dataLength is already calculated from the end of the tag, which
         // should be inside the end of the file. TODO: check that this is 
@@ -886,8 +826,8 @@ define_sound_loader(SWFStream& in, TagType tag, 
movie_definition& m,
         const unsigned int bytesRead = in.read(
                 reinterpret_cast<char*>(data->data()), dataLength);
         data->resize(bytesRead); // in case it's shorter...
-        if (bytesRead < dataLength)
-        {
+
+        if (bytesRead < dataLength) {
             throw ParserException(_("Tag boundary reported past end of "
                         "SWFStream!"));
         }
@@ -899,22 +839,19 @@ define_sound_loader(SWFStream& in, TagType tag, 
movie_definition& m,
 
         // Stores the sounddata in the soundhandler, and the ID returned
         // can be used to starting, stopping and deleting that sound
-        int    handler_id = handler->create_sound(data, sinfo);
+        const int handler_id = handler->create_sound(data, sinfo);
 
-        if (handler_id >= 0)
-        {
-        sound_sample* sam = new sound_sample(handler_id, r);
-        m.add_sound_sample(id, sam);
+        if (handler_id >= 0) {
+            sound_sample* sam = new sound_sample(handler_id, r);
+            m.add_sound_sample(id, sam);
         }
 
     }
-    else
-    {
+    else {
         // is this nice to do?
         log_error(_("There is no sound handler currently active, "
             "so DisplayObject with id %d will not be added to "
-            "the dictionary"),
-              id);
+            "the dictionary"), id);
     }
 }
 
@@ -923,7 +860,6 @@ void
 sound_stream_head_loader(SWFStream& in, TagType tag, movie_definition& m,
                const RunResources& r)
 {
-
     // 18 || 45
     assert(tag == SWF::SOUNDSTREAMHEAD || tag == SWF::SOUNDSTREAMHEAD2);
 
@@ -944,87 +880,80 @@ sound_stream_head_loader(SWFStream& in, TagType tag, 
movie_definition& m,
     // These are all unused by current implementation
     int reserved = in.read_uint(4); UNUSED(reserved);
 
-    unsigned int pbSoundRate = in.read_uint(2);
-    if ( pbSoundRate >= s_sample_rate_table_len )
-    {
+    boost::uint8_t pbSoundRate = in.read_uint(2);
+    if (pbSoundRate >= arraySize(samplerates)) {
         IF_VERBOSE_MALFORMED_SWF(
-        log_swferror("SOUNDSTREAMHEAD: playback sound rate %d (expected 0 to 
%d)",
-            pbSoundRate, s_sample_rate_table_len);
+            log_swferror("SOUNDSTREAMHEAD: playback sound rate %d (expected "
+                "0 to %d)", +pbSoundRate, arraySize(samplerates));
         );
         pbSoundRate=0;
     }
-    int playbackSoundRate = s_sample_rate_table[pbSoundRate];
-    bool playbackSound16bit = in.read_bit();
-    bool playbackSoundStereo = in.read_bit();
+    const boost::uint32_t playbackSoundRate = samplerates[pbSoundRate];
+    const bool playbackSound16bit = in.read_bit();
+    const bool playbackSoundStereo = in.read_bit();
 
     // These are the used ones
-    media::audioCodecType format = 
static_cast<media::audioCodecType>(in.read_uint(4)); // TODO: check input !
-    unsigned int stSoundRate = in.read_uint(2);
-    if ( stSoundRate >= s_sample_rate_table_len )
-    {
+    media::audioCodecType format =
+        static_cast<media::audioCodecType>(in.read_uint(4)); // TODO: check 
input !
+    boost::uint8_t stSoundRate = in.read_uint(2);
+
+    if (stSoundRate >= arraySize(samplerates)) {
         IF_VERBOSE_MALFORMED_SWF(
-        log_swferror(_("SOUNDSTREAMHEAD: stream sample rate %d (expected 0 to 
%u)"),
-            stSoundRate, s_sample_rate_table_len);
+            log_swferror(_("SOUNDSTREAMHEAD: stream sample rate %d (expected "
+                "0 to %u)"), +stSoundRate, arraySize(samplerates));
         );
         stSoundRate=0;
     }
-    int streamSoundRate = s_sample_rate_table[stSoundRate];
-    bool streamSound16bit = in.read_bit(); 
-    bool streamSoundStereo = in.read_bit(); 
+    const boost::uint32_t streamSoundRate = samplerates[stSoundRate];
+    const bool streamSound16bit = in.read_bit(); 
+    const bool streamSoundStereo = in.read_bit(); 
 
-    if ( playbackSoundRate != streamSoundRate )
-    {
-        LOG_ONCE(
-            log_unimpl(_("Different stream/playback sound rate (%d/%d). "
+    if (playbackSoundRate != streamSoundRate) {
+        LOG_ONCE(log_unimpl(_("Different stream/playback sound rate (%d/%d). "
                 "This seems common in SWF files, so we'll warn only once."),
-                streamSoundRate,playbackSoundRate)
+                streamSoundRate, playbackSoundRate)
         );
     }
 
-    if ( playbackSound16bit != streamSound16bit )
-    {
-        LOG_ONCE(
-            log_unimpl(_("Different stream/playback sample size (%d/%d). "
+    if (playbackSound16bit != streamSound16bit) {
+        LOG_ONCE(log_unimpl(_("Different stream/playback sample size (%d/%d). "
             "This seems common in SWF files, so we'll warn only once."),
-            streamSound16bit ? 16 : 32,
-            playbackSound16bit ? 16 : 32 )
+            streamSound16bit ? 16 : 32, playbackSound16bit ? 16 : 32 )
         );
     }
-    if ( playbackSoundStereo != streamSoundStereo )
-    {
-        LOG_ONCE(
-            log_unimpl(_("Different stream/playback channels (%s/%s). "
+    if (playbackSoundStereo != streamSoundStereo) {
+        LOG_ONCE(log_unimpl(_("Different stream/playback channels (%s/%s). "
             "This seems common in SWF files, so we'll warn only once."),
-                streamSoundStereo ? "stereo" : "mono",
-                playbackSoundStereo ? "stereo":"mono")
+            streamSoundStereo ? "stereo" : "mono",
+            playbackSoundStereo ? "stereo" : "mono")
         );
     }
 
     // checks if this is a new streams header or just one in the row
-    if (format == 0 && streamSoundRate == 0 && !streamSound16bit && 
!streamSoundStereo) return;
+    if (format == 0 && streamSoundRate == 0 &&
+            !streamSound16bit && !streamSoundStereo) {
+        return;
+    }
 
     // 2 bytes here
-    unsigned int sampleCount = in.read_u16();
+    const boost::uint16_t sampleCount = in.read_u16();
 
-    if ( ! sampleCount )
-    {
-    // this seems common too, we'd need to reproduce with a custom
-    // testcase to really tell if it's a problem or not...
-    IF_VERBOSE_MALFORMED_SWF(
-        LOG_ONCE( log_swferror(_("No samples advertised for sound stream, 
pretty common so will warn only once")) );
-    );
+    if (!sampleCount) {
+        // this seems common too, we'd need to reproduce with a custom
+        // testcase to really tell if it's a problem or not...
+        IF_VERBOSE_MALFORMED_SWF(
+            LOG_ONCE(log_swferror(_("No samples advertised for sound stream, "
+                        "pretty common so will warn only once")));
+        );
     }
 
-    int latency = 0;
-    if (format == media::AUDIO_CODEC_MP3)
-    {
-        try
-        {
+    boost::int16_t latency = 0;
+    if (format == media::AUDIO_CODEC_MP3) {
+        try {
             in.ensureBytes(2);
             latency = in.read_s16(); 
         }
-        catch (ParserException& ex)
-        {
+        catch (const ParserException&) {
             // See https://savannah.gnu.org/bugs/?21729 for an example 
             // triggering this.
             IF_VERBOSE_MALFORMED_SWF(
@@ -1034,24 +963,26 @@ sound_stream_head_loader(SWFStream& in, TagType tag, 
movie_definition& m,
     }
 
     // Check if we did read everything in this tag...
-    unsigned long curPos=in.tell(), endTag=in.get_tag_end_position();
-    if ( curPos < endTag ) {
+    unsigned long curPos = in.tell(), endTag=in.get_tag_end_position();
+    if (curPos < endTag) {
         log_unimpl("SOUNDSTREAMHEAD contains %d unparsed bytes", 
endTag-curPos);
     }
 
-
     IF_VERBOSE_PARSE(
-        log_parse(_("sound stream head: format=%s, rate=%d, 16=%d, stereo=%d, 
ct=%d, latency=%d"),
-          format, streamSoundRate, int(streamSound16bit), 
int(streamSoundStereo), sampleCount, latency);
+        log_parse(_("sound stream head: format=%s, rate=%d, 16=%d, "
+            "stereo=%d, ct=%d, latency=%d"), format, streamSoundRate,
+            +streamSound16bit, +streamSoundStereo, +sampleCount, +latency);
     );
 
     // Store all the data in a SoundInfo object
     std::auto_ptr<media::SoundInfo> sinfo;
-    sinfo.reset(new media::SoundInfo(format, streamSoundStereo, 
streamSoundRate, sampleCount, streamSound16bit, latency));
+    sinfo.reset(new media::SoundInfo(format, streamSoundStereo,
+                streamSoundRate, sampleCount, streamSound16bit, latency));
 
     // Stores the sounddata in the soundhandler, and the ID returned
     // can be used to starting, stopping and deleting that sound
-    int handler_id = handler->create_sound(std::auto_ptr<SimpleBuffer>(0), 
sinfo);
+    const int handler_id =
+        handler->create_sound(std::auto_ptr<SimpleBuffer>(0), sinfo);
 
     m.set_loading_sound_stream_id(handler_id);
 }
@@ -1082,8 +1013,7 @@ file_attributes_loader(SWFStream& in, TagType tag, 
movie_definition& m,
     flags.network = in.read_bit(); 
     flags.reserved3 = in.read_uint(24);
 
-    IF_VERBOSE_PARSE
-    (
+    IF_VERBOSE_PARSE(
         log_parse(_("File attributes: metadata=%s network=%s"),
               flags.metadata ? _("true") : _("false"),
               flags.network ? _("true") : _("false"))
@@ -1126,7 +1056,7 @@ metadata_loader(SWFStream& in, TagType tag, 
movie_definition& m,
     std::string metadata;
     in.read_string(metadata);
 
-    IF_VERBOSE_PARSE (
+    IF_VERBOSE_PARSE(
         log_parse(_("  RDF metadata (information only): [[\n%s\n]]"),
             metadata);
     );
@@ -1166,24 +1096,25 @@ serialnumber_loader(SWFStream& in, TagType tag, 
movie_definition& /*m*/,
 
     in.ensureBytes(26);
 
-    double id = in.read_u32();
-    double edition = in.read_u32();
-    int major = in.read_u8();
-    int minor = in.read_u8();
+    const boost::uint32_t id = in.read_u32();
+    const boost::uint32_t edition = in.read_u32();
+    const boost::uint8_t major = in.read_u8();
+    const boost::uint8_t minor = in.read_u8();
 
-    boost::uint32_t buildL = in.read_u32();
-    boost::uint32_t buildH = in.read_u32();
-    boost::uint64_t build = (((boost::uint64_t)buildH) << 32) + buildL;
+    const boost::uint32_t buildL = in.read_u32();
+    const boost::uint32_t buildH = in.read_u32();
+    const boost::uint64_t build =
+        (static_cast<boost::uint64_t>(buildH) << 32) + buildL;
 
-    boost::uint32_t timestampL = in.read_u32();
-    boost::uint32_t timestampH = in.read_u32();
+    const boost::uint32_t timestampL = in.read_u32();
+    const boost::uint32_t timestampH = in.read_u32();
     // This timestamp is number of milliseconds since 1 Jan 1970 (epoch)
-    boost::uint64_t timestamp = (((boost::uint64_t)timestampH) << 32)
-        + timestampL;
+    boost::uint64_t timestamp = 
+        (static_cast<boost::uint64_t>(timestampH) << 32) + timestampL;
 
     std::stringstream ss;
     ss << "SERIALNUMBER: Version " << id << "." << edition 
-        << "." << major << "." << minor;
+        << "." << +major << "." << +minor;
     ss << " - Build " << build;
     ss << " - Timestamp " << timestamp;
 
@@ -1199,17 +1130,13 @@ reflex_loader(SWFStream& in, TagType tag, 
movie_definition& /*m*/,
     assert(tag == SWF::REFLEX); // 777
 
     in.ensureBytes(3);
-    boost::uint8_t first = in.read_u8();
-    boost::uint8_t second = in.read_u8();
-    boost::uint8_t third = in.read_u8();
+    const boost::uint8_t first = in.read_u8();
+    const boost::uint8_t second = in.read_u8();
+    const boost::uint8_t third = in.read_u8();
 
-    IF_VERBOSE_PARSE (
-    log_parse(_("  reflex = \"%c%c%c\""), first, second, third);
+    IF_VERBOSE_PARSE(
+        log_parse(_("  reflex = \"%c%c%c\""), first, second, third);
     );
-
-    log_unimpl(_("REFLEX tag parsed (\"%c%c%c\") but unused"),
-            first, second, third);
-
 }
 
 } // namespace gnash::SWF

-----------------------------------------------------------------------

Summary of changes:
 libcore/parser/SWFParser.cpp            |    3 +-
 libcore/swf/DefaultTagLoaders.cpp       |  128 +++++----
 libcore/swf/DefineFontAlignZonesTag.cpp |    2 +-
 libcore/swf/tag_loaders.cpp             |  467 ++++++++++++-------------------
 libcore/swf/tag_loaders.h               |   12 -
 5 files changed, 254 insertions(+), 358 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]