gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog server/stream.cpp server/stream.h


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog server/stream.cpp server/stream.h
Date: Mon, 03 Dec 2007 11:09:27 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/12/03 11:09:27

Modified files:
        .              : ChangeLog 
        server         : stream.cpp stream.h 

Log message:
        drop unused get_tag_length, forbid seek-backs to before any opened tag 
start.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.5063&r2=1.5064
http://cvs.savannah.gnu.org/viewcvs/gnash/server/stream.cpp?cvsroot=gnash&r1=1.33&r2=1.34
http://cvs.savannah.gnu.org/viewcvs/gnash/server/stream.h?cvsroot=gnash&r1=1.32&r2=1.33

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.5063
retrieving revision 1.5064
diff -u -b -r1.5063 -r1.5064
--- ChangeLog   3 Dec 2007 10:53:22 -0000       1.5063
+++ ChangeLog   3 Dec 2007 11:09:27 -0000       1.5064
@@ -1,5 +1,7 @@
 2007-12-03 Sandro Santilli <address@hidden>
 
+       * server/stream.{cpp,h}: drop unused get_tag_length, forbid
+         seek-backs to before any opened tag start.
        * server/parser/movie_def_impl.{cpp,h}: mutex-protect
          characters dictionary. 
        * libbase/BitsReader.h, libmedia/AudioDecoderSimple.cpp: renamed

Index: server/stream.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/stream.cpp,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -b -r1.33 -r1.34
--- server/stream.cpp   18 Oct 2007 11:47:55 -0000      1.33
+++ server/stream.cpp   3 Dec 2007 11:09:27 -0000       1.34
@@ -378,16 +378,25 @@
                align();
 
                // If we're in a tag, make sure we're not seeking outside the 
tag.
-               if (m_tag_stack.size() > 0)
+               if (_tagBoundsStack.size() > 0)
                {
-                       unsigned long end_pos = m_tag_stack.back();
+                       TagBoundaries& tb = _tagBoundsStack.back();
+                       unsigned long end_pos = tb.second;
                        if ( pos > end_pos )
                        {
                                log_error("Attempt to seek past the end of an 
opened tag");
-                               // abort(); ?
+                               // abort(); // ?
+                               // throw ParserException ?
+                               return false;
+                       }
+                       unsigned long start_pos = tb.first;
+                       if ( pos < start_pos )
+                       {
+                               log_error("Attempt to seek before start of an 
opened tag");
+                               // abort(); // ?
+                               // throw ParserException ?
                                return false;
                        }
-                       // @@ check start pos somehow???
                }
 
                // Do the seek.
@@ -406,9 +415,9 @@
 
        unsigned long stream::get_tag_end_position()
        {
-               assert(m_tag_stack.size() > 0);
+               assert(_tagBoundsStack.size() > 0);
 
-               return m_tag_stack.back();
+               return _tagBoundsStack.back().second;
        }
 
 
@@ -416,7 +425,6 @@
        {
                align();
 
-               // for debugging
                unsigned long offset=get_position();
 
                int     tag_header = read_u16();
@@ -426,15 +434,14 @@
                if (tag_length == 0x3F) {
                        tag_length = m_input->read_le32();
                }
-               _current_tag_length = tag_length;
                        
                // Remember where the end of the tag is, so we can
                // fast-forward past it when we're done reading it.
-               m_tag_stack.push_back(get_position() + tag_length);
+               _tagBoundsStack.push_back(std::make_pair(offset, get_position() 
+ tag_length));
 
                IF_VERBOSE_PARSE (
                        log_parse("SWF[%lu]: tag type = %d, tag length = %d, 
end tag = %lu",
-                       offset, tag_type, tag_length, m_tag_stack.back());
+                       offset, tag_type, tag_length, 
_tagBoundsStack.back().second);
                );
 
                return static_cast<SWF::tag_type>(tag_type);
@@ -443,9 +450,9 @@
 
        void    stream::close_tag()
        {
-               assert(m_tag_stack.size() > 0);
-               unsigned long end_pos = m_tag_stack.back();
-               m_tag_stack.pop_back();
+               assert(_tagBoundsStack.size() > 0);
+               unsigned long end_pos = _tagBoundsStack.back().second;
+               _tagBoundsStack.pop_back();
 
                if ( m_input->set_position(end_pos) == TU_FILE_SEEK_ERROR )
                {

Index: server/stream.h
===================================================================
RCS file: /sources/gnash/gnash/server/stream.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- server/stream.h     1 Dec 2007 00:15:00 -0000       1.32
+++ server/stream.h     3 Dec 2007 11:09:27 -0000       1.33
@@ -218,27 +218,19 @@
                //
                ///
                /// If we're scanning a tag, don't allow seeking past
-               /// the tag end. Ideally we shouldn't also allow seeking
-               /// before tag start but this is currently unimplemented.
+               /// the end or before start of it.
                ///
                /// @return true on success, false on failure
                ///     Possible failures:
                ///     - given position is after end of stream.
                ///     - given position is after end of current tag, if any.
+               ///     - given position is before start of current tag, if any.
                ///
                bool set_position(unsigned long pos);
 
                /// Return the file position of the end of the current tag.
                unsigned long get_tag_end_position();
 
-               /// Return the length of the current tag.
-               //
-               /// should return a  'long' ?
-               ///
-               unsigned get_tag_length() {
-                       return _current_tag_length;
-               }
-
                /// Return the tag type.
                SWF::tag_type   open_tag();
 
@@ -294,14 +286,14 @@
                }
 
        private:
-               // should this be long ?
-               unsigned _current_tag_length;
 
                tu_file*        m_input;
                uint8_t m_current_byte;
                uint8_t m_unused_bits;
 
-               std::vector<unsigned long> m_tag_stack; // position of end of 
tag
+               typedef std::pair<unsigned long,unsigned long> TagBoundaries;
+               // position of start and end of tag
+               std::vector<TagBoundaries> _tagBoundsStack;
        };
 
 




reply via email to

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