gnash-commit
[Top][All Lists]
Advanced

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

[Gnash-commit] gnash ChangeLog gui/Player.cpp libbase/zlib_ada...


From: Sandro Santilli
Subject: [Gnash-commit] gnash ChangeLog gui/Player.cpp libbase/zlib_ada...
Date: Wed, 10 Jan 2007 17:28:50 +0000

CVSROOT:        /sources/gnash
Module name:    gnash
Changes by:     Sandro Santilli <strk>  07/01/10 17:28:50

Modified files:
        .              : ChangeLog 
        gui            : Player.cpp 
        libbase        : zlib_adapter.cpp zlib_adapter.h 
        server         : gnash.h impl.cpp 
        server/parser  : movie_def_impl.cpp movie_def_impl.h 
        testsuite      : MovieTester.cpp 
        utilities      : parser.cpp 

Log message:
                * gui/Player.cpp, libbase/zlib_adapter.cpp, 
libbase/zlib_adapter.h,
                  server/gnash.h, server/impl.cpp, 
server/parser/movie_def_impl.cpp,
                  server/parser/movie_def_impl.h, utilities/parser.cpp,
                  testsuite/MovieTester.cpp:
                  Use std::auto_ptr to have input tu_file ownership transferred 
up to
                  the point where it belongs (a parser unit, or an adapter).

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/gnash/ChangeLog?cvsroot=gnash&r1=1.2073&r2=1.2074
http://cvs.savannah.gnu.org/viewcvs/gnash/gui/Player.cpp?cvsroot=gnash&r1=1.38&r2=1.39
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/zlib_adapter.cpp?cvsroot=gnash&r1=1.9&r2=1.10
http://cvs.savannah.gnu.org/viewcvs/gnash/libbase/zlib_adapter.h?cvsroot=gnash&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/gnash/server/gnash.h?cvsroot=gnash&r1=1.81&r2=1.82
http://cvs.savannah.gnu.org/viewcvs/gnash/server/impl.cpp?cvsroot=gnash&r1=1.86&r2=1.87
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.cpp?cvsroot=gnash&r1=1.55&r2=1.56
http://cvs.savannah.gnu.org/viewcvs/gnash/server/parser/movie_def_impl.h?cvsroot=gnash&r1=1.28&r2=1.29
http://cvs.savannah.gnu.org/viewcvs/gnash/testsuite/MovieTester.cpp?cvsroot=gnash&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/gnash/utilities/parser.cpp?cvsroot=gnash&r1=1.32&r2=1.33

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/gnash/gnash/ChangeLog,v
retrieving revision 1.2073
retrieving revision 1.2074
diff -u -b -r1.2073 -r1.2074
--- ChangeLog   10 Jan 2007 14:17:34 -0000      1.2073
+++ ChangeLog   10 Jan 2007 17:28:49 -0000      1.2074
@@ -1,3 +1,12 @@
+2007-01-10 Sandro Santilli <address@hidden>
+
+       * gui/Player.cpp, libbase/zlib_adapter.cpp, libbase/zlib_adapter.h,
+         server/gnash.h, server/impl.cpp, server/parser/movie_def_impl.cpp,
+         server/parser/movie_def_impl.h, utilities/parser.cpp,
+         testsuite/MovieTester.cpp:
+         Use std::auto_ptr to have input tu_file ownership transferred up to
+         the point where it belongs (a parser unit, or an adapter).
+
 2007-01-10 Bastiaan Jacques <address@hidden>
 
        * gui/gtk{.cpp, sup.h}: Reimplement the open file dialog, and

Index: gui/Player.cpp
===================================================================
RCS file: /sources/gnash/gnash/gui/Player.cpp,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -b -r1.38 -r1.39
--- gui/Player.cpp      18 Dec 2006 20:51:02 -0000      1.38
+++ gui/Player.cpp      10 Jan 2007 17:28:49 -0000      1.39
@@ -217,7 +217,7 @@
     try {
        if ( _infile == "-" )
        {
-               tu_file* in = noseek_fd_adapter::make_stream(fileno(stdin));
+               std::auto_ptr<tu_file> in ( 
noseek_fd_adapter::make_stream(fileno(stdin)) );
                md = gnash::create_movie(in, _url, false);
        }
        else

Index: libbase/zlib_adapter.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/zlib_adapter.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -b -r1.9 -r1.10
--- libbase/zlib_adapter.cpp    27 Aug 2006 00:17:38 -0000      1.9
+++ libbase/zlib_adapter.cpp    10 Jan 2007 17:28:49 -0000      1.10
@@ -11,6 +11,8 @@
 #include "tu_file.h"
 #include "utility.h"
 
+#include <memory>
+
 
 #if !TU_CONFIG_LINK_TO_ZLIB
 
@@ -18,7 +20,7 @@
 // Stubs, in case client doesn't want to link to zlib.
 namespace zlib_adapter
 {
-       tu_file*        make_inflater(tu_file* in) { return NULL; }
+       std_auto_ptr<tu_file> make_inflater(std::auto_ptr<tu_file> in) { return 
NULL; }
        tu_file*        make_deflater(tu_file* out) { return NULL; }
 }
 
@@ -36,7 +38,7 @@
        class inflater_impl
        {
        private:
-               tu_file*        m_in;
+               std::auto_ptr<tu_file>  m_in;
                int             m_initial_stream_pos;   // position of the 
input stream where we started inflating.
                unsigned char   m_rawdata[ZBUF_SIZE];
 
@@ -50,16 +52,16 @@
                bool            m_at_eof;
                int             m_error;
                
-               inflater_impl(tu_file* in)
+               inflater_impl(std::auto_ptr<tu_file> in)
                // Constructor.
                        :
                        m_in(in),
-                       m_initial_stream_pos(in->get_position()),
+                       m_initial_stream_pos(m_in->get_position()),
                        m_logical_stream_pos(m_initial_stream_pos),
                        m_at_eof(false),
                        m_error(0)
                {
-                       assert(m_in);
+                       assert(m_in.get());
 
                        m_zstream.zalloc = (alloc_func)0;
                        m_zstream.zfree = (free_func)0;
@@ -298,12 +300,13 @@
        }
 
 
-       tu_file*        make_inflater(tu_file* in)
+       std::auto_ptr<tu_file> make_inflater(std::auto_ptr<tu_file> in)
        {
-               assert(in);
+               assert(in.get());
 
                inflater_impl*  inflater = new inflater_impl(in);
-               return new tu_file(
+               return std::auto_ptr<tu_file> (
+                       new tu_file(
                        inflater,
                        inflate_read,
                        inflate_write,
@@ -311,7 +314,8 @@
                        inflate_seek_to_end,
                        inflate_tell,
                        inflate_get_eof,
-                       inflate_close);
+                               inflate_close)
+                       );
        }
 
 

Index: libbase/zlib_adapter.h
===================================================================
RCS file: /sources/gnash/gnash/libbase/zlib_adapter.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- libbase/zlib_adapter.h      14 Sep 2006 23:54:22 -0000      1.3
+++ libbase/zlib_adapter.h      10 Jan 2007 17:28:49 -0000      1.4
@@ -9,6 +9,9 @@
 
 
 #include "tu_config.h"
+
+#include <memory>
+
 class tu_file;
 
 
@@ -23,15 +26,15 @@
        /// content of the given input stream, as you read data from the
        /// new stream.
        //
-       /// The caller owns the returned tu_file*.  The caller also owns
-       /// the input tu_file*; don't delete it until you've deleted the
-       /// returned tu_file.
-       /// @@ Here's a good case for ref-counting...
-       DSOEXPORT tu_file*      make_inflater(tu_file* in);
+       ///
+       DSOEXPORT std::auto_ptr<tu_file> make_inflater(std::auto_ptr<tu_file> 
in);
 
        /// \brief
        /// Returns a write-only tu_file stream that deflates the remaining
        /// content of the given input stream.
+       //
+       /// TODO: take and return by auto_ptr
+       ///
        DSOEXPORT tu_file*      make_deflater(tu_file* out);
 }
 

Index: server/gnash.h
===================================================================
RCS file: /sources/gnash/gnash/server/gnash.h,v
retrieving revision 1.81
retrieving revision 1.82
diff -u -b -r1.81 -r1.82
--- server/gnash.h      9 Jan 2007 23:18:59 -0000       1.81
+++ server/gnash.h      10 Jan 2007 17:28:49 -0000      1.82
@@ -17,7 +17,7 @@
 // 
 //
 
-/* $Id: gnash.h,v 1.81 2007/01/09 23:18:59 strk Exp $ */
+/* $Id: gnash.h,v 1.82 2007/01/10 17:28:49 strk Exp $ */
 
 /// \mainpage
 ///
@@ -35,7 +35,7 @@
 
 #include <cctype>      // for poxy wchar_t
 #include <cstdarg>     // for va_list arg to 
sprite_instance::call_method_args()
-#include <string>      // for movie_definition* create_movie(tu_file* in, 
const std::string& url);
+#include <string>      // for movie_definition* 
create_movie(std::auto_ptr<tu_file> in, const std::string& url);
 
 #include "as_value.h" // FIXME: for as_c_function_ptr typedef 
(register_component)
 
@@ -170,26 +170,6 @@
 };
 
 
-/// Try to grab movie info from the header of the given .swf file.
-//
-/// Sets *version to 0 if info can't be extracted.
-///
-/// You can pass NULL for any entries you're not interested in.
-/// In particular, using a NULL tag_count will avoid scanning
-/// the whole movie.
-///
-/// FIXME: use a stream here, so we can use an already opened one.
-///
-DSOEXPORT void get_movie_info(
-       const URL&      url,
-       int*            version,
-       int*            width,
-       int*            height,
-       float*          frames_per_second,
-       int*            frame_count,
-       int*            tag_count
-       );
-
 /// Enable/disable attempts to read cache files (.gsc) when loading movies.
 DSOEXPORT void set_use_cache_files(bool use_cache);
        
@@ -245,7 +225,8 @@
 /// by this function.
 ///
 /// @param in
-///    The stream to load the movie from.
+///    The stream to load the movie from. Ownership is transferred
+///    to the returned object.
 ///
 /// @param url
 ///    The url to use as the _url member of the resulting
@@ -259,7 +240,7 @@
 ///    Initializing the VirtualMachine requires a target SWF version, which can
 ///    be found in the SWF header.
 ///
-DSOEXPORT movie_definition* create_movie(tu_file* in, const std::string& url, 
bool startLoaderThread=true);
+DSOEXPORT movie_definition* create_movie(std::auto_ptr<tu_file> in, const 
std::string& url, bool startLoaderThread=true);
 
 /// Creates the movie from the given input stream. 
 //
@@ -289,11 +270,6 @@
        DO_NOT_LOAD_FONT_SHAPES
 };
 
-//movie_definition*    create_movie_no_recurse(
-//     tu_file*                input_stream,
-//     create_bitmaps_flag     cbf,
-//     create_font_shapes_flag cfs);
-
 /// \brief
 /// Create a gnash::movie_definition from the given URL
 //

Index: server/impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/impl.cpp,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -b -r1.86 -r1.87
--- server/impl.cpp     4 Jan 2007 18:39:25 -0000       1.86
+++ server/impl.cpp     10 Jan 2007 17:28:49 -0000      1.87
@@ -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: impl.cpp,v 1.86 2007/01/04 18:39:25 strk Exp $ */
+/* $Id: impl.cpp,v 1.87 2007/01/10 17:28:49 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -217,6 +217,7 @@
 
 
 
+#if 0 // deprecated
 void   get_movie_info(
     const URL& url,
     int* version,
@@ -236,7 +237,7 @@
     if (in == NULL || in->get_error() != TU_FILE_NO_ERROR) {
        log_error("get_movie_info(): can't open '%s'\n", url.str().c_str());
        if (version) *version = 0;
-       delete in;
+       //delete in;
        return;
     }
     
@@ -251,7 +252,7 @@
        // ERROR
        log_error("get_movie_info(): file '%s' does not start with a SWF 
header!\n", url.str().c_str());
        if (version) *version = 0;
-       delete in;
+       //delete in;
        return;
     }
     bool       compressed = (header & 255) == 'C';
@@ -300,14 +301,15 @@
            *tag_count = local_tag_count;
        }
 
-    delete in;
-    delete original_in;
+    //delete in;
+    //delete original_in;
 }
+#endif
 
 // Create a movie_definition from a jpeg stream
 // NOTE: this method assumes this *is* a jpeg stream
 static movie_definition*
-create_jpeg_movie(tu_file* in, const std::string& /*url*/)
+create_jpeg_movie(std::auto_ptr<tu_file> in, const std::string& /*url*/)
 {
        // FIXME: temporarly disabled
        log_msg("Loading of jpegs unsupported");
@@ -315,7 +317,7 @@
 
 
        bitmap_info* bi = NULL;
-       image::rgb* im = image::read_jpeg(in);
+       image::rgb* im = image::read_jpeg(in.get());
        if (im != NULL) {
                bi = render::create_bitmap_info_rgb(im);
                delete im;
@@ -365,7 +367,7 @@
 // NOTE: this method assumes this *is* an SWF stream
 //
 static movie_def_impl*
-create_swf_movie(tu_file* in, const std::string& url, bool startLoaderThread)
+create_swf_movie(std::auto_ptr<tu_file> in, const std::string& url, bool 
startLoaderThread)
 {
 
        in->set_position(0);
@@ -389,16 +391,15 @@
 }
 
 movie_definition*
-create_movie(tu_file* in, const std::string& url, bool startLoaderThread)
+create_movie(std::auto_ptr<tu_file> in, const std::string& url, bool 
startLoaderThread)
 {
-       assert(in);
+       assert(in.get());
 
        ensure_loaders_registered();
 
        // see if it's a jpeg or an swf
-       std::string type = get_file_type(in);
-
-       movie_definition* ret = NULL;
+       // TODO: use an integer code rather then a string !
+       std::string type = get_file_type(in.get());
 
        if ( type == "jpeg" )
        {
@@ -406,25 +407,15 @@
                {
                        log_warning("Requested to keep from completely loading 
a movie, but the movie in question is a jpeg, for which we don't have the 
concept of a 'loading thread'");
                }
-               ret = create_jpeg_movie(in, url);
+               return create_jpeg_movie(in, url);
        }
        else if ( type == "swf" )
        {
-               ret = create_swf_movie(in, url, startLoaderThread);
-       }
-       else
-       {
-               log_error("unknown file type\n");
-               ret = NULL;
+               return create_swf_movie(in, url, startLoaderThread);
        }
 
-       if ( ! ret )
-       {
-               delete in;
+       log_error("unknown file type (%s)", type.c_str());
                return NULL;
-       }
-
-       return ret;
 }
 
 movie_definition*
@@ -436,15 +427,15 @@
 
 //     printf("%s: url is %s\n",  __PRETTY_FUNCTION__, c_url);
 
-       tu_file* in = globals::streamProvider.getStream(url);
-       if (in == NULL)
+       std::auto_ptr<tu_file> in ( globals::streamProvider.getStream(url) );
+       if ( ! in.get() )
        {
-           log_error("failed to open '%s'; can't create movie.\n", c_url);
+           log_error("failed to open '%s'; can't create movie.", c_url);
            return NULL;
        }
-       else if (in->get_error())
+       else if ( in->get_error() )
        {
-           log_error("streamProvider opener can't open '%s'\n", c_url);
+           log_error("streamProvider opener can't open '%s'", c_url);
            return NULL;
        }
 
@@ -457,8 +448,8 @@
                // WILL NOT WORK FOR NETWORK URLS, would need an hash
                std::string cache_filename(movie_url);
                cache_filename += ".gsc";
-               tu_file* cache_in = new tu_file(cache_filename.c_str(), "rb");
-               if (cache_in == NULL
+               std::auto_ptr<tu_file> cache_in ( new 
tu_file(cache_filename.c_str(), "rb") );
+               if (cache_in.get() == NULL
                        || cache_in->get_error() != TU_FILE_NO_ERROR)
                {
                        // Can't open cache file; don't sweat it.
@@ -473,10 +464,9 @@
                        log_msg("Loading cache file %s",
                                cache_filename.c_str());
                        // Load the cached data.
-                       ret->input_cached_data(cache_in);
+                       ret->input_cached_data(cache_in.get());
                }
 
-               delete cache_in;
        }
 
        return ret;

Index: server/parser/movie_def_impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.cpp,v
retrieving revision 1.55
retrieving revision 1.56
diff -u -b -r1.55 -r1.56
--- server/parser/movie_def_impl.cpp    7 Dec 2006 17:24:40 -0000       1.55
+++ server/parser/movie_def_impl.cpp    10 Jan 2007 17:28:50 -0000      1.56
@@ -36,6 +36,7 @@
 #include "VM.h" // for assertions
 #include "GnashException.h" // for parser exception
 
+#include <memory>
 #include <string>
 #include <unistd.h> 
 
@@ -412,18 +413,20 @@
 
 // Read header and assign url
 bool
-movie_def_impl::readHeader(tu_file* in, const std::string& url)
+movie_def_impl::readHeader(std::auto_ptr<tu_file> in, const std::string& url)
 {
 
+       _in = in;
+
        // we only read a movie once 
        assert(_str.get() == NULL);
 
        if ( url == "" ) _url = "<anonymous>";
        else _url = url;
 
-       uint32_t file_start_pos = in->get_position();
-       uint32_t header = in->read_le32();
-       m_file_length = in->read_le32();
+       uint32_t file_start_pos = _in->get_position();
+       uint32_t header = _in->read_le32();
+       m_file_length = _in->read_le32();
        _swf_end_pos = file_start_pos + m_file_length;
 
        m_version = (header >> 24) & 255;
@@ -448,12 +451,11 @@
                        "but don't expect it to work", m_version);
        }
 
-       tu_file* original_in = NULL;
        if (compressed)
         {
 #if TU_CONFIG_LINK_TO_ZLIB == 0
                log_error("movie_def_impl::read(): unable to read "
-                       "zipped SWF data; TU_CONFIG_LINK_TO_ZLIB is 0\n");
+                       "zipped SWF data; TU_CONFIG_LINK_TO_ZLIB is 0");
                return false;
 #endif
 
@@ -461,16 +463,14 @@
                        log_parse("file is compressed.");
                );
 
-               original_in = in;
-
                // Uncompress the input as we read it.
-               _zlib_file.reset(zlib_adapter::make_inflater(original_in));
-               in = _zlib_file.get();
+               _in = zlib_adapter::make_inflater(_in);
 
         }
 
-       //stream str(in);
-       _str.reset(new stream(in));
+       assert(_in.get());
+
+       _str.reset(new stream(_in.get()));
 
        m_frame_size.read(_str.get());
        m_frame_rate = _str->read_u16() / 256.0f;
@@ -490,7 +490,7 @@
                        m_frame_rate, m_frame_count);
        );
 
-       setBytesLoaded(in->get_position());
+       setBytesLoaded(_str->get_position());
        return true;
 }
 
@@ -531,22 +531,12 @@
        read_all_swf();
 #endif
 
-// Can't delete here as we will keep reading from it while playing
-// FIXME: remove this at end of reading (or in destructor)
-#if 0
-       if (original_in)
-        {
-            // Done with the zlib_adapter.
-            delete in;
-        }
-#endif
-
        return true;
 }
 
 // Read a .SWF movie.
 bool
-movie_def_impl::read(tu_file* in, const std::string& url)
+movie_def_impl::read(std::auto_ptr<tu_file> in, const std::string& url)
 {
 
        if ( ! readHeader(in, url) ) return false;

Index: server/parser/movie_def_impl.h
===================================================================
RCS file: /sources/gnash/gnash/server/parser/movie_def_impl.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -b -r1.28 -r1.29
--- server/parser/movie_def_impl.h      7 Dec 2006 17:24:40 -0000       1.28
+++ server/parser/movie_def_impl.h      10 Jan 2007 17:28:50 -0000      1.29
@@ -268,9 +268,7 @@
 
        std::auto_ptr<stream> _str;
 
-       tu_file* in;
-
-       std::auto_ptr<tu_file> _zlib_file;
+       std::auto_ptr<tu_file> _in;
 
        /// swf end position (as read from header)
        unsigned int _swf_end_pos;
@@ -504,7 +502,7 @@
        ///     see description of readHeader() and completeLoad()
        ///     for possible reasons of failures
        ///
-       bool read(tu_file *in, const std::string& url);
+       bool read(std::auto_ptr<tu_file> in, const std::string& url);
 
        /// Read the header of the SWF file
        //
@@ -517,7 +515,7 @@
        ///
        /// @return false if SWF header could not be parsed
        ///
-       bool readHeader(tu_file *in, const std::string& url);
+       bool readHeader(std::auto_ptr<tu_file> in, const std::string& url);
 
        /// Complete load of the SWF file
        //

Index: testsuite/MovieTester.cpp
===================================================================
RCS file: /sources/gnash/gnash/testsuite/MovieTester.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- testsuite/MovieTester.cpp   8 Dec 2006 14:29:11 -0000       1.16
+++ testsuite/MovieTester.cpp   10 Jan 2007 17:28:50 -0000      1.17
@@ -46,7 +46,9 @@
 {
        if ( url == "-" )
        {
-               tu_file* in = noseek_fd_adapter::make_stream(fileno(stdin));
+               std::auto_ptr<tu_file> in (
+                               noseek_fd_adapter::make_stream(fileno(stdin))
+                               );
                _movie_def = gnash::create_movie(in, url, false);
        }
        else

Index: utilities/parser.cpp
===================================================================
RCS file: /sources/gnash/gnash/utilities/parser.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- utilities/parser.cpp        28 Nov 2006 00:27:03 -0000      1.32
+++ utilities/parser.cpp        10 Jan 2007 17:28:50 -0000      1.33
@@ -16,7 +16,7 @@
 // 
 //
 
-/* $Id: parser.cpp,v 1.32 2006/11/28 00:27:03 nihilus Exp $ */
+/* $Id: parser.cpp,v 1.33 2007/01/10 17:28:50 strk Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -87,7 +87,7 @@
 {
 static int ident = 0;
 static int current_frame = 0;
-tu_file* out;
+//std::auto_ptr<tu_file> out;
 
 typedef void (*loader_function)(stream* input, int tag_type);
 static hash_wrapper<int, loader_function> tag_loaders;
@@ -539,7 +539,7 @@
     register_tag_loader(46,parse_define_shape_morph);  
 }
     
-void parse_swf(tu_file* file)
+void parse_swf(std::auto_ptr<tu_file> file)
 {
     ident = 1;
     
@@ -554,18 +554,15 @@
     
     bool compressed = (header & 255) == 'C';
     
-    tu_file* original_file = NULL;
-    
     log_msg("\nSWF version %i, file length = %i bytes\n", version, 
file_length);
     
     if (compressed) {
        log_msg("file is compressed.\n");
-       original_file = file;
-       file = zlib_adapter::make_inflater(original_file);
+       file = zlib_adapter::make_inflater(file);
        file_length -= 8;
     }
     
-    stream str(file);
+    stream str(file.get());
     
     rect::parse(&str);
     float frame_rate = str.read_u16() / 256.0f;
@@ -600,15 +597,10 @@
        }
     }
     
-    if (out) {
-       delete out;
-    }
-    if (original_file) {
-       delete file;
-    }
-}
 }
 
+} // end of namespace parser
+
 int
 main(int argc, char *argv[])
 {
@@ -676,16 +668,14 @@
 
     parser::register_all_loaders();
     for (int i = 0, n = infiles.size(); i < n; i++) {
-       tu_file*        in = new tu_file(infiles[i], "rb");
+        std::auto_ptr<tu_file> in ( new tu_file(infiles[i], "rb") );
        std::cerr << "Processing file: " << infiles[i] << std::endl;
        if (in->get_error()) {
            log_msg("can't open '%s' for input\n", infiles[i]);
-           delete in;
            exit(1);
        }
     
        parser::parse_swf(in);
-       delete in;
     }
   
     return 0;




reply via email to

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