gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog configure.ac server/sprite_inst...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog configure.ac server/sprite_inst...
Date: Tue, 10 Apr 2007 15:48:39 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/04/10 15:48:39

Modified files:
        .              : ChangeLog configure.ac 
        server         : sprite_instance.cpp sprite_instance.h 
        server/parser  : movie_def_impl.cpp movie_def_impl.h 
                         movie_definition.h sprite_definition.cpp 
                         sprite_definition.h 
        server/swf     : tag_loaders.cpp 

Log message:
                * server/parser/: movie_definition.h, movie_def_impl.{cpp,h},
                  sprite_definition.{cpp,h}: stop using TU legacy hashes
                  and strings: use std::string instead of C strings, use
                  references instead of pointers in a few places.
                * server/sprite_instance.{cpp,h}: use std::string instead
                  of C strings for frame labels, update other uses of changed
                  interfaces of parser.
                * server/swf/tag_loaders.cpp: update uses of changed interfaces
                  of parser.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2825&r2=1.2826
http://cvs.savannah.gnu.org/viewcvs/gnash/configure.ac?cvsroot=gnash&r1=1.288&r2=1.289
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.cpp?cvsroot=gnash&r1=1.228&r2=1.229
http://cvs.savannah.gnu.org/viewcvs/gnash/server/sprite_instance.h?cvsroot=gnash&r1=1.91&r2=1.92
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.cpp?cvsroot=gnash&r1=1.62&r2=1.63
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.h?cvsroot=gnash&r1=1.35&r2=1.36
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_definition.h?cvsroot=gnash&r1=1.19&r2=1.20
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/sprite_definition.cpp?cvsroot=gnash&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/sprite_definition.h?cvsroot=gnash&r1=1.15&r2=1.16
http://cvs.savannah.gnu.org/viewcvs/gnash/server/swf/tag_loaders.cpp?cvsroot=gnash&r1=1.85&r2=1.86

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2825
retrieving revision 1.2826
diff -u -b -r1.2825 -r1.2826
--- ChangeLog   10 Apr 2007 14:41:12 -0000      1.2825
+++ ChangeLog   10 Apr 2007 15:48:39 -0000      1.2826
@@ -1,3 +1,14 @@
+2007-04-10 Sandro Santilli <address@hidden>
+
+       * server/parser/: movie_definition.h, movie_def_impl.{cpp,h},
+         sprite_definition.{cpp,h}: stop using TU legacy hashes
+         and strings: use std::string instead of C strings, use
+         references instead of pointers in a few places.
+       * server/sprite_instance.{cpp,h}: use std::string instead
+         of C strings for frame labels, update other uses of changed
+         interfaces of parser.
+       * server/swf/tag_loaders.cpp: update uses of changed interfaces
+         of parser.
 
 2007-04-10 Sandro Santilli <address@hidden>
 

Index: configure.ac
===================================================================
RCS file: /sources/gnash/gnash/configure.ac,v
retrieving revision 1.288
retrieving revision 1.289
diff -u -b -r1.288 -r1.289
--- configure.ac        8 Apr 2007 23:06:16 -0000       1.288
+++ configure.ac        10 Apr 2007 15:48:39 -0000      1.289
@@ -15,7 +15,7 @@
 dnl  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 dnl  
 
-dnl $Id: configure.ac,v 1.288 2007/04/08 23:06:16 rsavoye Exp $
+dnl $Id: configure.ac,v 1.289 2007/04/10 15:48:39 strk Exp $
 
 AC_PREREQ(2.50)
 AC_INIT(gnash, cvs)
@@ -312,29 +312,29 @@
 dnl we have here now. For some reason on Darwin, we don't get the
 dnl count from grep via stdin correctly. Writing a temp file does the
 dnl trick, so although it's ugly, that's what we gotta do...
-AC_MSG_CHECKING([Checking which type of library archiver we have])
-rm -f .tmp
-libtool > .tmp 2>&1
-archiver=`grep -c dynamic .tmp 2>&1`
-rm -f .tmp
-if test $archiver -eq 1; then
-  if test "$enable_shared" = no; then
-    AR="libtool -static"
-  else
-    AR="libtool -dynamic"
-    CXXFLAGS="${CXXFLAGS} -dynamic"
-    export MACOSX_DEPLOYMENT_TARGET="10.3"
-  fi
-  AR_FLAGS="-o"
-  darwin=yes
-else
-  AR="ar"
-  AR_FLAGS="cvu"
-  darwin=no
-fi
-AC_MSG_RESULT([${AR}])
-AC_SUBST(AR)
-AC_SUBST(AR_FLAGS)
+dnl BOGUS dnl AC_MSG_CHECKING([Checking which type of library archiver we 
have])
+dnl BOGUS dnl rm -f .tmp
+dnl BOGUS dnl libtool > .tmp 2>&1
+dnl BOGUS dnl archiver=`grep -c dynamic .tmp 2>&1`
+dnl BOGUS dnl rm -f .tmp
+dnl BOGUS dnl if test $archiver -eq 1; then
+dnl BOGUS dnl   if test "$enable_shared" = no; then
+dnl BOGUS dnl     AR="libtool -static"
+dnl BOGUS dnl   else
+dnl BOGUS dnl     AR="libtool -dynamic"
+dnl BOGUS dnl     CXXFLAGS="${CXXFLAGS} -dynamic"
+dnl BOGUS dnl     export MACOSX_DEPLOYMENT_TARGET="10.3"
+dnl BOGUS dnl   fi
+dnl BOGUS dnl   AR_FLAGS="-o"
+dnl BOGUS dnl   darwin=yes
+dnl BOGUS dnl else
+dnl BOGUS dnl   AR="ar"
+dnl BOGUS dnl   AR_FLAGS="cvu"
+dnl BOGUS dnl   darwin=no
+dnl BOGUS dnl fi
+dnl BOGUS dnl AC_MSG_RESULT([${AR}])
+dnl BOGUS dnl AC_SUBST(AR)
+dnl BOGUS dnl AC_SUBST(AR_FLAGS)
 
 dnl When cross compiling, limit the search directories cause otherwise
 dnl we may get the host headers or libraries by accident. These values

Index: server/sprite_instance.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.cpp,v
retrieving revision 1.228
retrieving revision 1.229
diff -u -b -r1.228 -r1.229
--- server/sprite_instance.cpp  8 Apr 2007 08:37:07 -0000       1.228
+++ server/sprite_instance.cpp  10 Apr 2007 15:48:39 -0000      1.229
@@ -1731,7 +1731,7 @@
 
        if ( isnan(num) || isinf(num))
        {
-               return m_def->get_labeled_frame(frame_spec.to_string(env), 
&frameno);
+               return m_def->get_labeled_frame(frame_spec.to_std_string(env), 
frameno);
        }
 
        // TODO: are we sure we shouldn't check for frames labeled with 
negative numbers ?
@@ -1739,7 +1739,7 @@
 
        // all frame numbers >= 0 are valid, but a valid frame number may still
        // reference a non-exist frame(eg. frameno > total_frames).
-       frameno = num - 1;
+       frameno = size_t(num) - 1;
 
        return true;
 }
@@ -2541,22 +2541,20 @@
 
 }
 
-bool sprite_instance::goto_labeled_frame(const char* label)
+bool sprite_instance::goto_labeled_frame(const std::string& label)
 {
        size_t target_frame;
-       if (m_def->get_labeled_frame(label, &target_frame))
+       if (m_def->get_labeled_frame(label, target_frame))
        {
                goto_frame(target_frame);
                return true;
        }
-       else
-       {
+
                IF_VERBOSE_MALFORMED_SWF(
                log_swferror("sprite_instance::goto_labeled_frame('%s') "
-                       "unknown label", label);
+                       "unknown label", label.c_str());
                );
                return false;
-       }
 }
 
 void sprite_instance::display()

Index: server/sprite_instance.h
===================================================================
RCS file: /sources/gnash/gnash/server/sprite_instance.h,v
retrieving revision 1.91
retrieving revision 1.92
diff -u -b -r1.91 -r1.92
--- server/sprite_instance.h    8 Apr 2007 08:37:07 -0000       1.91
+++ server/sprite_instance.h    10 Apr 2007 15:48:39 -0000      1.92
@@ -17,7 +17,7 @@
 // 
 //
 
-/* $Id: sprite_instance.h,v 1.91 2007/04/08 08:37:07 zoulunkai Exp $ */
+/* $Id: sprite_instance.h,v 1.92 2007/04/10 15:48:39 strk Exp $ */
 
 // Stateful live Sprite instance
 
@@ -298,7 +298,7 @@
 
 
        /// Look up the labeled frame, and jump to it.
-       bool goto_labeled_frame(const char* label);
+       bool goto_labeled_frame(const std::string& label);
 
                
        /// Display (render?) this Sprite/MovieClip, unless invisible

Index: server/parser/movie_def_impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.cpp,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -b -r1.62 -r1.63
--- server/parser/movie_def_impl.cpp    3 Apr 2007 16:13:07 -0000       1.62
+++ server/parser/movie_def_impl.cpp    10 Apr 2007 15:48:39 -0000      1.63
@@ -1,5 +1,5 @@
 // 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//   Copyright (C) 2005, 200, 2007 Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -267,23 +267,23 @@
     return false;
 }
 
-void movie_def_impl::visit_imported_movies(import_visitor* visitor)
+void movie_def_impl::visit_imported_movies(import_visitor& visitor)
 {
-    stringi_hash<bool> visited;        // ugh!
+    // don't call the visitor twice for a single URL
+    std::set<std::string> visited;
 
     for (size_t i = 0, n = m_imports.size(); i < n; i++)
         {
             const import_info& inf = m_imports[i];
-            if (visited.find(inf.m_source_url) == visited.end())
+        if (visited.insert(inf.m_source_url).second)
                 {
                     // Call back the visitor.
-                    visitor->visit(inf.m_source_url.c_str());
-                    visited[inf.m_source_url] = true;
+            visitor.visit(inf.m_source_url);
                 }
         }
 }
 
-void movie_def_impl::resolve_import(const char* source_url, movie_definition* 
source_movie)
+void movie_def_impl::resolve_import(const std::string& source_url, 
movie_definition* source_movie)
 {
 
     // Iterate in reverse, since we remove stuff along the way.
@@ -298,8 +298,8 @@
 
                     if (res == NULL)
                         {
-                            log_error("import error: resource '%s' is not 
exported from movie '%s'\n",
-                                      inf.m_symbol.c_str(), source_url);
+                            log_error("import error: resource '%s' is not 
exported from movie '%s'",
+                                      inf.m_symbol.c_str(), 
source_url.c_str());
                         }
                     else if (font* f = res->cast_to_font())
                         {
@@ -315,8 +315,8 @@
                         }
                     else
                         {
-                            log_error("import error: resource '%s' from movie 
'%s' has unknown type\n",
-                                      inf.m_symbol.c_str(), source_url);
+                            log_error("import error: resource '%s' from movie 
'%s' has unknown type",
+                                      inf.m_symbol.c_str(), 
source_url.c_str());
                         }
 
                     if (imported)
@@ -344,7 +344,7 @@
     // make sure character_id is resolved
     if (in_import_table(character_id))
         {
-            log_error("get_character_def(): character_id %d is still waiting 
to be imported\n",
+            log_error("get_character_def(): character_id %d is still waiting 
to be imported",
                       character_id);
         }
 #endif // not NDEBUG
@@ -357,7 +357,7 @@
 void movie_def_impl::add_font(int font_id, font* f)
 {
     assert(f);
-    m_fonts.add(font_id, f);
+    m_fonts.insert(make_pair(font_id, boost::intrusive_ptr<font>(f)));
 }
 
 font* movie_def_impl::get_font(int font_id)
@@ -366,23 +366,23 @@
     // make sure font_id is resolved
     if (in_import_table(font_id))
         {
-            log_error("get_font(): font_id %d is still waiting to be 
imported\n",
+            log_error("get_font(): font_id %d is still waiting to be imported",
                       font_id);
         }
 #endif // not NDEBUG
 
-    boost::intrusive_ptr<font> f;
-    m_fonts.get(font_id, &f);
-    assert(f == NULL || f->get_ref_count() > 1);
+    FontMap::iterator it = m_fonts.find(font_id);
+    if ( it == m_fonts.end() ) return NULL;
+    boost::intrusive_ptr<font> f = it->second;
+    assert(f->get_ref_count() > 1);
     return f.get();
 }
 
 bitmap_character_def* movie_def_impl::get_bitmap_character_def(int 
character_id)
 {
-    boost::intrusive_ptr<bitmap_character_def> ch;
-    m_bitmap_characters.get(character_id, &ch);
-    assert(ch == NULL || ch->get_ref_count() > 1);
-    return ch.get();
+    BitmapMap::iterator it = m_bitmap_characters.find(character_id);
+    if ( it == m_bitmap_characters.end() ) return NULL;
+    else return it->second.get(); 
 }
 
 void
@@ -391,7 +391,8 @@
 {
     assert(ch);
     //log_msg("Add bitmap character %d", character_id);
-    m_bitmap_characters.add(character_id, ch);
+    //m_bitmap_characters.add(character_id, ch);
+    m_bitmap_characters.insert(make_pair(character_id, 
boost::intrusive_ptr<bitmap_character_def>(ch)));
 
        // we can *NOT* generate bitmap_info until
        // a renderer is present
@@ -400,9 +401,12 @@
 
 sound_sample* movie_def_impl::get_sound_sample(int character_id)
 {
-    boost::intrusive_ptr<sound_sample> ch;
-    m_sound_samples.get(character_id, &ch);
-    assert(ch == NULL || ch->get_ref_count() > 1);
+    SoundSampleMap::iterator it = m_sound_samples.find(character_id);
+    if ( it == m_sound_samples.end() ) return NULL;
+
+    boost::intrusive_ptr<sound_sample> ch = it->second;
+    assert(ch->get_ref_count() > 1);
+
     return ch.get();
 }
 
@@ -410,7 +414,8 @@
 {
     assert(sam);
        log_msg("Add sound sample %d", character_id);
-    m_sound_samples.add(character_id, sam);
+    m_sound_samples.insert(make_pair(character_id,
+            boost::intrusive_ptr<sound_sample>(sam)));
 }
 
 // Read header and assign url
@@ -582,9 +587,8 @@
 
     std::vector<int>   font_ids;
 
-    for (hash<int, boost::intrusive_ptr<font> >::iterator it = m_fonts.begin();
-         it != m_fonts.end();
-         ++it)
+    for (FontMap::iterator it = m_fonts.begin(), itEnd=m_fonts.end();
+         it != itEnd; ++it)
         {
             font*      f = it->second.get();
             if (f->get_owning_movie() == this)
@@ -977,7 +981,7 @@
 }
 
 void
-movie_def_impl::export_resource(const tu_string& symbol, resource* res)
+movie_def_impl::export_resource(const std::string& symbol, resource* res)
 {
        // FIXME: m_exports access should be protected by a mutex
 
@@ -987,7 +991,7 @@
 
 
 boost::intrusive_ptr<resource>
-movie_def_impl::get_exported_resource(const tu_string& symbol)
+movie_def_impl::get_exported_resource(const std::string& symbol)
 {
        boost::intrusive_ptr<resource> res;
 
@@ -1021,10 +1025,8 @@
        for (;;)
        {
                // FIXME: make m_exports access thread-safe
-               if ( m_exports.get(symbol, &res) )
-               {
-                       return res;
-               }
+        ExportMap::iterator it = m_exports.find(symbol);
+        if ( it != m_exports.end() ) return it->second;
 
                size_t new_loading_frame = get_loading_frame();
 
@@ -1081,17 +1083,20 @@
 }
 
 void
-movie_def_impl::add_frame_name(const char* name)
+movie_def_impl::add_frame_name(const std::string& n)
 {
        //log_msg("labelframe: frame %d, name %s", _frames_loaded, name);
        assert(_frames_loaded < m_frame_count);
+    m_named_frames[n] = _frames_loaded;
+}
 
-    tu_string  n = name;
-
-               if (m_named_frames.get(n, NULL) == false)       // frame should 
not already have a name (?)
-               {
-           m_named_frames.add(n, _frames_loaded);      // stores 0-based frame 
#
-               }
+bool
+movie_def_impl::get_labeled_frame(const std::string& label, size_t& 
frame_number)
+{
+    NamedFrameMap::iterator it = m_named_frames.find(label);
+    if ( it == m_named_frames.end() ) return false;
+    frame_number = it->second;
+    return true;
 }
 
 

Index: server/parser/movie_def_impl.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.h,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -b -r1.35 -r1.36
--- server/parser/movie_def_impl.h      4 Apr 2007 20:30:45 -0000       1.35
+++ server/parser/movie_def_impl.h      10 Apr 2007 15:48:39 -0000      1.36
@@ -1,5 +1,5 @@
 // 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -64,9 +64,9 @@
 private:
     friend class movie_def_impl;
 
-    tu_string  m_source_url;
+    std::string        m_source_url;
     int                m_character_id;
-    tu_string  m_symbol;
+    std::string        m_symbol;
 
     import_info()
        :
@@ -74,7 +74,7 @@
        {
        }
 
-    import_info(const char* source, int id, const char* symbol)
+    import_info(const std::string& source, int id, const std::string& symbol)
        :
        m_source_url(source),
        m_character_id(id),
@@ -134,7 +134,6 @@
        /// It contains pairs of 'int' and 'boost::intrusive_ptr<character_def>'
        ///
        typedef std::map< int, boost::intrusive_ptr<character_def> > container;
-       //typedef hash< int, boost::intrusive_ptr<character_def> >container;
 
        typedef container::iterator iterator;
 
@@ -184,14 +183,18 @@
 private:
        /// Characters Dictionary
        CharacterDictionary     _dictionary;
-       //hash<int, boost::intrusive_ptr<character_def> >               
m_characters;
 
        /// Tags loader table
        SWF::TagLoadersTable& _tag_loaders;
 
-       hash<int, boost::intrusive_ptr<font> >                  m_fonts;
-       hash<int, boost::intrusive_ptr<bitmap_character_def> >  
m_bitmap_characters;
-       hash<int, boost::intrusive_ptr<sound_sample> >          m_sound_samples;
+       typedef std::map<int, boost::intrusive_ptr<font> > FontMap;
+       FontMap m_fonts;
+
+       typedef std::map<int, boost::intrusive_ptr<bitmap_character_def> > 
BitmapMap;
+       BitmapMap m_bitmap_characters;
+
+       typedef std::map<int, boost::intrusive_ptr<sound_sample> > 
SoundSampleMap;
+       SoundSampleMap m_sound_samples;
 
        /// A list of movie control events for each frame.
        std::vector<PlayList> m_playlist;
@@ -200,9 +203,11 @@
        std::vector<PlayList> m_init_action_list;
 
        /// 0-based frame #'s
-       stringi_hash<size_t> m_named_frames;
+       typedef std::map<std::string, size_t> NamedFrameMap;
+       NamedFrameMap m_named_frames;
 
-       stringi_hash<boost::intrusive_ptr<resource> > m_exports;
+       typedef std::map<std::string, boost::intrusive_ptr<resource> > 
ExportMap;
+       ExportMap m_exports;
 
        /// Items we import.
        std::vector<import_info> m_imports;
@@ -379,7 +384,7 @@
        }
 
        // See docs in movie_definition.h
-       virtual void export_resource(const tu_string& symbol,
+       virtual void export_resource(const std::string& symbol,
                        resource* res);
 
        /// Get the named exported resource, if we expose it.
@@ -387,13 +392,12 @@
        /// @return NULL if the label doesn't correspond to an exported
        ///         resource, or if a timeout occurs while scanning the movie.
        ///
-       virtual boost::intrusive_ptr<resource> get_exported_resource(const 
tu_string& symbol);
+       virtual boost::intrusive_ptr<resource> get_exported_resource(const 
std::string& symbol);
 
        // see docs in movie_definition.h
-       virtual void add_import(const char* source_url, int id, const char* 
symbol)
+       virtual void add_import(const std::string& source_url, int id, const 
std::string& symbol)
        {
            assert(in_import_table(id) == false);
-
            m_imports.push_back(import_info(source_url, id, symbol));
        }
 
@@ -401,12 +405,13 @@
        /// character_id is listed in the import table.
        bool in_import_table(int character_id);
 
+       /// \brief
        /// Calls back the visitor for each movie that we
        /// import symbols from.
-       virtual void visit_imported_movies(import_visitor* visitor);
+       virtual void visit_imported_movies(import_visitor& visitor);
 
-       // see docs in movie_definition.h
-       virtual void resolve_import(const char* source_url,
+       // See docs in movie_definition.h
+       virtual void resolve_import(const std::string& source_url,
                movie_definition* source_movie);
 
        void add_character(int character_id, character_def* c);
@@ -419,10 +424,8 @@
        character_def*  get_character_def(int character_id);
 
        // See dox in movie_definition
-       bool get_labeled_frame(const char* label, size_t* frame_number)
-       {
-               return m_named_frames.get(label, frame_number);
-       }
+       //
+       bool get_labeled_frame(const std::string& label, size_t& frame_number);
 
        void    add_font(int font_id, font* f);
 
@@ -465,7 +468,7 @@
        }
 
        // See dox in movie_definition.h
-       void add_frame_name(const char* name);
+       void add_frame_name(const std::string& name);
 
        /// Set an input object for later loading DefineBits
        /// images (JPEG images without the table info).

Index: server/parser/movie_definition.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_definition.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- server/parser/movie_definition.h    5 Mar 2007 10:36:13 -0000       1.19
+++ server/parser/movie_definition.h    10 Apr 2007 15:48:39 -0000      1.20
@@ -1,5 +1,5 @@
 // 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -161,15 +161,16 @@
        /// Call visit_imported_movies() to retrieve a list of
        /// names of movies imported into this movie.
        //
-       /// visitor->visit() will be called back with the name
+       /// visitor.visit() will be called back with the name
        /// of each imported movie.
+       ///
        class import_visitor
        {
        public:
            virtual ~import_visitor() {}
-           virtual void        visit(const char* imported_movie_filename) = 0;
+           virtual void visit(const std::string& imported_movie_filename) = 0;
        };
-       virtual void visit_imported_movies(import_visitor* /*visitor*/) {}
+       virtual void visit_imported_movies(import_visitor& /*visitor*/) {}
        
        /// Call this to resolve an import of the given movie.
        //
@@ -180,7 +181,7 @@
        ///
        /// @see add_import
        ///
-       virtual void resolve_import(const char* /*name*/,
+       virtual void resolve_import(const std::string& /*name*/,
                        movie_definition* /*def*/) {}
        
        //
@@ -249,7 +250,7 @@
        /// @return NULL if the label doesn't correspond to an exported
        ///         resource. This is the default behaviour.
        ///
-       virtual boost::intrusive_ptr<resource>  get_exported_resource(const 
tu_string& /*symbol*/)
+       virtual boost::intrusive_ptr<resource>  get_exported_resource(const 
std::string& /*symbol*/)
        {
                return NULL;
        }
@@ -286,7 +287,7 @@
        ///
        /// @return true if a frame with that label was found, false otherwise
        ///
-       virtual bool get_labeled_frame(const char* /*label*/, size_t* 
/*frame_number*/)
+       virtual bool get_labeled_frame(const std::string& /*label*/, size_t& 
/*frame_number*/)
        {
                return false;
        }
@@ -347,10 +348,12 @@
        /// Labels the frame currently being loaded with the given name. 
        //
        /// A copy of the name string is made and kept in this object.
+    /// In case of multiple frames with the same name, the last added
+    /// will be the one referenced by that name.
        ///
        /// The default implementation is a no-op.
        ///
-       virtual void add_frame_name(const char* /*name*/)
+       virtual void add_frame_name(const std::string& /*name*/)
        {
        }
 
@@ -453,15 +456,16 @@
                return -1;
        }
 
-       /// \brief
-       /// Mark the given resource as "exported" with the given
-       /// linkage name.
+       /// Mark the given resource as "exported" with the given linkage name.
        //
+    /// Note that any previously exported resource with the same linkage 
+    /// name will become unreachable (export override).
+    ///
        /// @see get_exported_resource
        ///
        /// The default implementation is a no-op
        ///
-       virtual void export_resource(const tu_string& /*symbol*/,
+       virtual void export_resource(const std::string& /*symbol*/,
                        resource* /*res*/)
        {
        }
@@ -481,8 +485,8 @@
        ///
        /// The default implementation is a no-op.
        ///
-       virtual void add_import(const char* /*source_url*/,
-                       int /*id*/, const char* /*symbol_name*/)
+       virtual void add_import(const std::string& /*source_url*/,
+                       int /*id*/, const std::string& /*symbol_name*/)
        {
        }
 

Index: server/parser/sprite_definition.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/sprite_definition.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- server/parser/sprite_definition.cpp 26 Feb 2007 22:08:06 -0000      1.10
+++ server/parser/sprite_definition.cpp 10 Apr 2007 15:48:39 -0000      1.11
@@ -1,5 +1,5 @@
 // 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -157,23 +157,20 @@
 
 /*virtual*/
 void
-sprite_definition::add_frame_name(const char* name)
+sprite_definition::add_frame_name(const std::string& name)
 {
        //log_msg("labelframe: frame %d, name %s", m_loading_frame, name);
-       assert((int)m_loading_frame >= 0 && m_loading_frame < m_frame_count);
-
-       tu_string n = name;
-       size_t currently_assigned = 0;
-       if (m_named_frames.get(n, &currently_assigned) == true)
-       {
-               log_error("add_frame_name(" SIZET_FMT ", '%s') -- frame name "
-                       "already assigned to frame " SIZET_FMT "; overriding\n",
-                       m_loading_frame,
-                       name, currently_assigned);
-       }
+       assert(m_loading_frame < m_frame_count);
+    m_named_frames[name] = m_loading_frame;
+}
 
-       // stores 0-based frame #
-       m_named_frames[n] = m_loading_frame;
+bool
+sprite_definition::get_labeled_frame(const std::string& label, size_t& 
frame_number)
+{
+    NamedFrameMap::iterator it = m_named_frames.find(label);
+    if ( it == m_named_frames.end() ) return false;
+    frame_number = it->second;
+    return true;
 }
 
 sprite_definition::sprite_definition(movie_definition* m, stream* in)

Index: server/parser/sprite_definition.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/sprite_definition.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- server/parser/sprite_definition.h   26 Feb 2007 22:20:24 -0000      1.15
+++ server/parser/sprite_definition.h   10 Apr 2007 15:48:39 -0000      1.16
@@ -1,5 +1,5 @@
 // 
-//   Copyright (C) 2005, 2006 Free Software Foundation, Inc.
+//   Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc.
 // 
 // This program is free software; you can redistribute it and/or modify
 // it under the terms of the GNU General Public License as published by
@@ -98,7 +98,8 @@
        std::vector<PlayList> m_playlist;
 
        // stores 0-based frame #'s
-       stringi_hash<size_t> m_named_frames;
+       typedef std::map<std::string, size_t> NamedFrameMap;
+       NamedFrameMap m_named_frames;
 
        size_t m_frame_count;
 
@@ -212,16 +213,16 @@
 
        
        /// Overridden just for complaining  about malformed SWF
-       virtual void export_resource(const tu_string& /*symbol*/,
+       virtual void export_resource(const std::string& /*symbol*/,
                        resource* /*res*/)
        {
                IF_VERBOSE_MALFORMED_SWF (
-               log_warning("can't export from sprite! Malformed SWF?");
+               log_swferror("Can't export from sprite!");
                );
        }
 
        /// Delegate call to associated root movie
-       virtual boost::intrusive_ptr<resource> get_exported_resource(const 
tu_string& sym)
+       virtual boost::intrusive_ptr<resource> get_exported_resource(const 
std::string& sym)
        {
                return m_movie_def->get_exported_resource(sym);
        }
@@ -281,13 +282,10 @@
        }
 
        // See dox in movie_definition.h
-       virtual void    add_frame_name(const char* name);
+       virtual void    add_frame_name(const std::string& name);
 
        // See dox in movie_definition
-       bool    get_labeled_frame(const char* label, size_t* frame_number)
-       {
-           return m_named_frames.get(label, frame_number);
-       }
+       bool get_labeled_frame(const std::string& label, size_t& frame_number);
 
        /// frame_number is 0-based
        const PlayList& get_playlist(size_t frame_number)

Index: server/swf/tag_loaders.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/swf/tag_loaders.cpp,v
retrieving revision 1.85
retrieving revision 1.86
diff -u -b -r1.85 -r1.86
--- server/swf/tag_loaders.cpp  6 Apr 2007 11:43:44 -0000       1.85
+++ server/swf/tag_loaders.cpp  10 Apr 2007 15:48:39 -0000      1.86
@@ -14,7 +14,7 @@
 // along with this program; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-/* $Id: tag_loaders.cpp,v 1.85 2007/04/06 11:43:44 strk Exp $ */
+/* $Id: tag_loaders.cpp,v 1.86 2007/04/10 15:48:39 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -1396,16 +1396,16 @@
            if (font* f = m->get_font(id))
                {
                    // Expose this font for export.
-                   m->export_resource(tu_string(symbol_name), f);
+                   m->export_resource(symbol_name, f);
                }
            else if (character_def* ch = m->get_character_def(id))
                {
                    // Expose this movie/button/whatever for export.
-                   m->export_resource(tu_string(symbol_name), ch);
+                   m->export_resource(symbol_name, ch);
                }
            else if (sound_sample* ch = m->get_sound_sample(id))
                {
-                   m->export_resource(tu_string(symbol_name), ch);
+                   m->export_resource(symbol_name, ch);
                }
            else
                {




reply via email to

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