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. release_0_8_9_final-


From: Bastiaan Jacques
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-2124-g5540539
Date: Mon, 09 Jun 2014 14:44:46 +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  55405395c26eb7e9c3e1d3ed7d322075b91dd31f (commit)
       via  964caacfd338766749bdd7a7d6e425dfa362cd3b (commit)
       via  bb40987f9759337287c48d69c8834d58c5467a5e (commit)
       via  b9fbb2c4f2cedcde80a3d958218260f9b996231d (commit)
       via  22ce3d1ba4376ce0495701dab0548dc2aff9735e (commit)
       via  dd7eca5fcab9ba37afa73817d29652a63efa0de8 (commit)
       via  45f814188803696750e3daeaa91324cd69bd9594 (commit)
       via  d2a3ba012624c5f8e33e977b99e63c055f4f0bca (commit)
       via  3c9379ee49ec370fa892917fb5843b31445458bc (commit)
       via  71fa2cce458c087b28b23cf22f579cfa4271c2bf (commit)
       via  7eb9408f02abba08a4ca1ea67524d94e70a2717f (commit)
       via  cc34dd5e30087a8e2340d1550789cf3b79c898e1 (commit)
       via  fd1ec3866db38b6d32d3a327da085b4b8accaafa (commit)
       via  910701a6d8b963ec1b52b152b54f50173a62037b (commit)
       via  7ff8c8c647d4480a0298143b5fb5661915ab2061 (commit)
      from  66566a80d1f3a5bfbb5ac914293073230f48a75b (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=55405395c26eb7e9c3e1d3ed7d322075b91dd31f


commit 55405395c26eb7e9c3e1d3ed7d322075b91dd31f
Author: Bastiaan Jacques <address@hidden>
Date:   Mon Jun 9 16:09:03 2014 +0200

    Fix uses-after-free.

diff --git a/testsuite/MovieTester.cpp b/testsuite/MovieTester.cpp
index 6dff002..1da2a0b 100644
--- a/testsuite/MovieTester.cpp
+++ b/testsuite/MovieTester.cpp
@@ -98,30 +98,29 @@ MovieTester::MovieTester(const std::string& url)
     initTestingMediaHandlers();
 #endif
     
-    _runResources.reset(new RunResources());
 #ifdef USE_SOUND
     // Initialize the sound handler(s)
     initTestingSoundHandlers();
-    _runResources->setSoundHandler(_sound_handler);
+    _runResources.setSoundHandler(_sound_handler);
 #endif
 #ifdef USE_MEDIA
-    _runResources->setMediaHandler(_mediaHandler);
+    _runResources.setMediaHandler(_mediaHandler);
 #endif
     
     std::shared_ptr<SWF::TagLoadersTable> loaders(new SWF::TagLoadersTable());
     addDefaultLoaders(*loaders);
     
-    _runResources->setTagLoaders(loaders);
+    _runResources.setTagLoaders(loaders);
     
     std::shared_ptr<StreamProvider> sp(new StreamProvider(url, url));
 
-    _runResources->setStreamProvider(sp);
+    _runResources.setStreamProvider(sp);
 
     if ( url == "-" ) {
        std::unique_ptr<IOChannel> in (
                noseek_fd_adapter::make_stream(fileno(stdin))
                                     );
-               _movie_def = MovieFactory::makeMovie(std::move(in), url, 
*_runResources, false);
+               _movie_def = MovieFactory::makeMovie(std::move(in), url, 
_runResources, false);
        } else {
        URL urlObj(url);
        if ( urlObj.protocol() == "file" ) {
@@ -138,7 +137,7 @@ MovieTester::MovieTester(const std::string& url)
 #endif
        }
        // _url should be always set at this point...
-       _movie_def = MovieFactory::makeMovie(urlObj, *_runResources,
+       _movie_def = MovieFactory::makeMovie(urlObj, _runResources,
                                             NULL, false);
     }
     
@@ -146,7 +145,7 @@ MovieTester::MovieTester(const std::string& url)
        throw GnashException("Could not load movie from "+url);
     }
     
-    _movie_root.reset(new movie_root(_clock, *_runResources));
+    _movie_root.reset(new movie_root(_clock, _runResources));
     
     // Initialize viewport size with the one advertised in the header
     _width = unsigned(_movie_def->get_width_pixels());
@@ -171,6 +170,11 @@ MovieTester::MovieTester(const std::string& url)
     // ... and render it
     render();
 }
+
+MovieTester::~MovieTester()
+{
+    MovieFactory::clear();
+}
     
 void
 MovieTester::render(std::shared_ptr<Renderer> h,
@@ -180,7 +184,7 @@ MovieTester::render(std::shared_ptr<Renderer> h,
     // This is a bit dangerous, as there isn't really support for swapping
     // renderers during runtime; though the only problem is likely to be
     // that CachedBitmaps are missing.
-    _runResources->setRenderer(h);
+    _runResources.setRenderer(h);
     
     h->set_invalidated_regions(invalidated_regions);
     
@@ -607,7 +611,7 @@ MovieTester::addTestingRenderer(std::shared_ptr<Renderer> h,
     
     // this will be needed till we allow run-time swapping of renderers,
     // see above UNTESTED message...
-    _runResources->setRenderer(_testingRenderers.back().getRenderer());
+    _runResources.setRenderer(_testingRenderers.back().getRenderer());
 }
     
 bool
diff --git a/testsuite/MovieTester.h b/testsuite/MovieTester.h
index 81a79eb..8d86a07 100644
--- a/testsuite/MovieTester.h
+++ b/testsuite/MovieTester.h
@@ -114,6 +114,8 @@ public:
        ///
        MovieTester(const std::string& filespec);
 
+       ~MovieTester();
+
        /// Advance the movie by one frame
        //
     /// Note that the default testing behaviour does not mirror actual
@@ -355,15 +357,16 @@ private:
        void addTestingRenderer(std::shared_ptr<Renderer> h,
             const std::string& name);
 
-       std::unique_ptr<gnash::movie_root> _movie_root;
-
-       boost::intrusive_ptr<gnash::movie_definition> _movie_def;
+    RunResources _runResources;
 
     std::shared_ptr<sound::sound_handler> _sound_handler;
 
+    boost::intrusive_ptr<gnash::movie_definition> _movie_def;
+
     std::shared_ptr<media::MediaHandler> _mediaHandler;
 
-    std::unique_ptr<RunResources> _runResources;
+    std::unique_ptr<gnash::movie_root> _movie_root;
+
        /// Current pointer position - X ordinate
        int _x;
 

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


commit 964caacfd338766749bdd7a7d6e425dfa362cd3b
Author: Bastiaan Jacques <address@hidden>
Date:   Mon Jun 9 14:59:54 2014 +0200

    Plug memory leaks.

diff --git a/libmedia/ffmpeg/MediaParserFfmpeg.cpp 
b/libmedia/ffmpeg/MediaParserFfmpeg.cpp
index c111cdc..634254e 100644
--- a/libmedia/ffmpeg/MediaParserFfmpeg.cpp
+++ b/libmedia/ffmpeg/MediaParserFfmpeg.cpp
@@ -329,6 +329,7 @@ 
MediaParserFfmpeg::MediaParserFfmpeg(std::unique_ptr<IOChannel> stream)
        _videoStream(nullptr),
        _audioStreamIndex(-1),
        _audioStream(nullptr),
+        _avIOCxt(nullptr),
        _lastParsedPosition(0)
 {
        initializeParser();
@@ -505,12 +506,8 @@ MediaParserFfmpeg::~MediaParserFfmpeg()
 {
        stopParserThread();
 
-       if ( _formatCtx )
-       {
-               // TODO: check if this is correct (should we create RIIA 
classes for ffmpeg stuff?)
-               //av_close_input_file(_formatCtx); // NOTE: this one triggers a 
mismatched free/delete on _byteIOBuffer with libavformat.so.52 !
-               av_free(_formatCtx);
-       }
+
+        avformat_close_input(&_formatCtx);
 
        if ( _inputFmt )
        {
@@ -518,6 +515,7 @@ MediaParserFfmpeg::~MediaParserFfmpeg()
                //av_free(_inputFmt); // it seems this one blows up, could be 
due to av_free(_formatCtx) above
        }
 
+        av_free(_avIOCxt);
 }
 
 // NOTE: as this function is used as a callback from FFMPEG, it should not

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


commit bb40987f9759337287c48d69c8834d58c5467a5e
Author: Bastiaan Jacques <address@hidden>
Date:   Mon Jun 9 14:47:03 2014 +0200

    Drop code supporting now-unsupported ffmpeg/libav versions.

diff --git a/libmedia/ffmpeg/MediaParserFfmpeg.cpp 
b/libmedia/ffmpeg/MediaParserFfmpeg.cpp
index d05184a..c111cdc 100644
--- a/libmedia/ffmpeg/MediaParserFfmpeg.cpp
+++ b/libmedia/ffmpeg/MediaParserFfmpeg.cpp
@@ -342,10 +342,6 @@ MediaParserFfmpeg::initializeParser()
 {
     av_register_all(); // TODO: needs to be invoked only once ?
 
-#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,107,0)
-    _byteIOCxt.buffer = NULL;
-#endif
-
     _inputFmt = probeStream();
 
 #ifdef GNASH_ALLOW_VCODEC_ENV  
@@ -366,11 +362,7 @@ MediaParserFfmpeg::initializeParser()
     // which isn't needed.
     _byteIOBuffer.reset(new unsigned char[byteIOBufferSize]);
 
-#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,107,0)
-    init_put_byte(&_byteIOCxt,
-#else
     _avIOCxt = avio_alloc_context(
-#endif
                  _byteIOBuffer.get(), // buffer
                  byteIOBufferSize, // buffer size
                  0, // write flags
@@ -380,57 +372,29 @@ MediaParserFfmpeg::initializeParser()
                  MediaParserFfmpeg::seekMediaWrapper // seeker callback
                  );
     
-#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,107,0)
-    _byteIOCxt.is_streamed = 1;
-#else
     _avIOCxt->seekable = 0;
-#endif
 
-#if !defined(LIBAVCODEC_VERSION_MAJOR) || LIBAVCODEC_VERSION_MAJOR < 52
-    // Needed for Lenny.
-    _formatCtx = av_alloc_format_context();
-#else
     _formatCtx = avformat_alloc_context();
-#endif
-
     assert(_formatCtx);
 
-#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,107,0)
-    // Otherwise av_open_input_stream will reallocate the context.
-    AVFormatParameters ap = AVFormatParameters();
-    ap.prealloced_context = 1;
-
-    if (av_open_input_stream(&_formatCtx, &_byteIOCxt, "", _inputFmt, &ap) < 0)
-#else
-
     _formatCtx->pb = _avIOCxt;
 
     if (avformat_open_input(&_formatCtx, "", _inputFmt, nullptr) < 0)
-#endif
     {
         throw IOException("MediaParserFfmpeg couldn't open input stream");
     }
 
-#if defined(LIBAVCODEC_VERSION_MAJOR) && LIBAVCODEC_VERSION_MAJOR >= 52
     // Note: in at least some versions of ffmpeg, av_open_input_stream does
     // not parse metadata; not sure why.
-#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51,5,0)
-    AVMetadata* md = _formatCtx->metadata;
-    if (md) {
-        AVMetadataTag* tag = av_metadata_get(md, "album", 0,
-                AV_METADATA_MATCH_CASE);
-#else
     AVDictionary* md = _formatCtx->metadata;
     if (md) {
         AVDictionaryEntry* tag = av_dict_get(md, "album", nullptr,
                 AV_DICT_MATCH_CASE);
-#endif
         if (tag && tag->value) {
             setId3Info(&Id3Info::album, std::string(tag->value),
                     _id3Object);
         }
     }
-#endif
 
     log_debug("Parsing FFMPEG media file: format:%s; nstreams:%d",
         _inputFmt->name, _formatCtx->nb_streams);
@@ -451,11 +415,7 @@ MediaParserFfmpeg::initializeParser()
            }
            
            switch (enc->codec_type) {
-#if LIBAVCODEC_VERSION_MAJOR >= 53
             case AVMEDIA_TYPE_AUDIO:
-#else
-            case CODEC_TYPE_AUDIO:
-#endif
                 if (_audioStreamIndex < 0) {
                     _audioStreamIndex = i;
                     _audioStream = _formatCtx->streams[i];
@@ -466,11 +426,7 @@ MediaParserFfmpeg::initializeParser()
                 }
                 break;
                
-#if LIBAVCODEC_VERSION_MAJOR >= 53
             case AVMEDIA_TYPE_VIDEO:
-#else
-            case CODEC_TYPE_VIDEO:
-#endif
                 if (_videoStreamIndex < 0) {
                     _videoStreamIndex = i;
                     _videoStream = _formatCtx->streams[i];
@@ -643,32 +599,7 @@ MediaParserFfmpeg::seekMedia(std::int64_t offset, int 
whence)
 std::uint16_t
 MediaParserFfmpeg::SampleFormatToSampleSize(AVSampleFormat fmt)
 {
-#if LIBAVUTIL_VERSION_INT > AV_VERSION_INT(51,4,0)
         return av_get_bytes_per_sample(fmt);
-#else
-       switch (fmt)
-       {
-               case AV_SAMPLE_FMT_U8: // unsigned 8 bits
-                       return 1;
-
-               case AV_SAMPLE_FMT_S16: // signed 16 bits
-               case AV_SAMPLE_FMT_FLT: // float
-                       return 2;
-
-#if !defined (LIBAVCODEC_VERSION_MAJOR) || LIBAVCODEC_VERSION_MAJOR < 52
-// Was dropped for version 52.0.0
-               case AV_SAMPLE_FMT_S24: // signed 24 bits
-                       return 3;
-#endif
-
-               case AV_SAMPLE_FMT_S32: // signed 32 bits
-                       return 4;
-
-               case AV_SAMPLE_FMT_NONE:
-               default:
-                       return 8; // arbitrary value
-       }
-#endif
 }
 
 
diff --git a/libmedia/ffmpeg/MediaParserFfmpeg.h 
b/libmedia/ffmpeg/MediaParserFfmpeg.h
index 1b15e38..e9e5fde 100644
--- a/libmedia/ffmpeg/MediaParserFfmpeg.h
+++ b/libmedia/ffmpeg/MediaParserFfmpeg.h
@@ -139,13 +139,7 @@ private:
        AVStream* _audioStream;
 
        /// ?
-#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52,107,0)
-// AVIOContext was introduced a bit earlier but without version bump, so let's
-// be safe
-        ByteIOContext _byteIOCxt;
-#else
         AVIOContext* _avIOCxt;
-#endif
 
        /// Size of the ByteIO context buffer
        //

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


commit b9fbb2c4f2cedcde80a3d958218260f9b996231d
Author: Bastiaan Jacques <address@hidden>
Date:   Mon Jun 9 13:52:20 2014 +0200

    Fix testsuite memory leaks.
    
    This makes it easier to run leak detectors on the testsuite.

diff --git a/testsuite/MovieTester.cpp b/testsuite/MovieTester.cpp
index 8108680..6dff002 100644
--- a/testsuite/MovieTester.cpp
+++ b/testsuite/MovieTester.cpp
@@ -146,7 +146,7 @@ MovieTester::MovieTester(const std::string& url)
        throw GnashException("Could not load movie from "+url);
     }
     
-    _movie_root = new movie_root(_clock, *_runResources);
+    _movie_root.reset(new movie_root(_clock, *_runResources));
     
     // Initialize viewport size with the one advertised in the header
     _width = unsigned(_movie_def->get_width_pixels());
diff --git a/testsuite/MovieTester.h b/testsuite/MovieTester.h
index c240ee4..81a79eb 100644
--- a/testsuite/MovieTester.h
+++ b/testsuite/MovieTester.h
@@ -355,7 +355,7 @@ private:
        void addTestingRenderer(std::shared_ptr<Renderer> h,
             const std::string& name);
 
-       gnash::movie_root* _movie_root;
+       std::unique_ptr<gnash::movie_root> _movie_root;
 
        boost::intrusive_ptr<gnash::movie_definition> _movie_def;
 
diff --git a/testsuite/libbase.all/NoSeekFileTest.cpp 
b/testsuite/libbase.all/NoSeekFileTest.cpp
index cea0d89..c617c67 100644
--- a/testsuite/libbase.all/NoSeekFileTest.cpp
+++ b/testsuite/libbase.all/NoSeekFileTest.cpp
@@ -144,14 +144,14 @@ trymain(int /*argc*/, char** /*argv*/)
        dup2(fd, 0);
        close(fd);
 
-       gnash::IOChannel* reader = gnash::noseek_fd_adapter::make_stream(0, 
cachename);
+       std::unique_ptr<gnash::IOChannel> 
reader(gnash::noseek_fd_adapter::make_stream(0, cachename));
        assert(reader);
 
-       compare_reads(reader, raw, "wrapped", "raw");
+       compare_reads(reader.get(), raw, "wrapped", "raw");
 
        lseek(raw, 0, SEEK_SET);
        reader->seek(0);
-       compare_reads(reader, raw, "wrapped-rewind", "raw-rewind");
+       compare_reads(reader.get(), raw, "wrapped-rewind", "raw-rewind");
 
 
     FILE* f = std::fopen(cachename, "r");

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


commit 22ce3d1ba4376ce0495701dab0548dc2aff9735e
Author: Bastiaan Jacques <address@hidden>
Date:   Mon Jun 9 12:12:28 2014 +0200

    Tidy up.

diff --git a/libcore/as_value.h b/libcore/as_value.h
index 22ac59a..04b338e 100644
--- a/libcore/as_value.h
+++ b/libcore/as_value.h
@@ -115,63 +115,50 @@ public:
         DISPLAYOBJECT,
         DISPLAYOBJECT_EXCEPT
     };
+
+    template <typename T>
+    as_value(AsType type, T&& val)
+        : _type(type),
+          _value(std::forward<T>(val))
+    {}
     
     /// Construct an undefined value
     DSOEXPORT as_value()
-        :
-        _type(UNDEFINED),
-        _value(boost::blank())
-    {
-    }
+        : as_value(UNDEFINED, boost::blank())
+    {}
     
     /// Copy constructor.
     DSOEXPORT as_value(const as_value& v)
-        :
-        _type(v._type),
-        _value(v._value)
-    {
-    }
+        : as_value(v._type, v._value)
+    {}
 
     /// Move constructor.
     DSOEXPORT as_value(as_value&& other)
-        : _type(other._type),
-          _value(std::move(other._value))
+        : as_value(other._type, std::move(other._value))
     {
         other._type = UNDEFINED;
     }
 
-    ~as_value() {}
-    
     /// Construct a primitive String value 
     DSOEXPORT as_value(const char* str)
-        :
-        _type(STRING),
-        _value(std::string(str))
+        : as_value(STRING, std::string(str))
     {}
 
     /// Construct a primitive String value 
     DSOEXPORT as_value(std::string str)
-        :
-        _type(STRING),
-        _value(std::move(str))
+        : as_value(STRING, std::move(str))
     {}
     
     /// Construct a primitive Boolean value
     template <typename T>
     as_value(T val, typename std::enable_if<std::is_same<bool, 
T>::value>::type*
-             dummy = 0)
-        :
-        _type(BOOLEAN),
-        _value(val)
-       {
-        UNUSED(dummy);
-       }
+             = 0)
+        : as_value(BOOLEAN, val)
+    {}
     
     /// Construct a primitive Number value
     as_value(double num)
-        :
-        _type(NUMBER),
-        _value(num)
+        : as_value(NUMBER, num)
     {}
     
     /// Construct a null, Object, or DisplayObject value

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


commit dd7eca5fcab9ba37afa73817d29652a63efa0de8
Author: Bastiaan Jacques <address@hidden>
Date:   Sun Jun 8 23:23:44 2014 +0200

    Attempt to move the string argument passed to the as_value constructor.

diff --git a/libcore/as_value.h b/libcore/as_value.h
index 950b375..22ac59a 100644
--- a/libcore/as_value.h
+++ b/libcore/as_value.h
@@ -150,10 +150,10 @@ public:
     {}
 
     /// Construct a primitive String value 
-    DSOEXPORT as_value(const std::string& str)
+    DSOEXPORT as_value(std::string str)
         :
         _type(STRING),
-        _value(std::string(str))
+        _value(std::move(str))
     {}
     
     /// Construct a primitive Boolean value

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


commit 45f814188803696750e3daeaa91324cd69bd9594
Author: Bastiaan Jacques <address@hidden>
Date:   Sun Jun 8 23:03:34 2014 +0200

    New loop syntax.

diff --git a/utilities/processor.cpp b/utilities/processor.cpp
index 657556e..7ab5ec9 100644
--- a/utilities/processor.cpp
+++ b/utilities/processor.cpp
@@ -355,9 +355,7 @@ main(int argc, char *argv[])
 #endif
 
     // Play through all the movies.
-    for (std::vector<std::string>::const_iterator i = infiles.begin(), 
-            e = infiles.end(); i != e; ++i)
-    {
+    for (const std::string& file : infiles) {
 
         RunResources runResources;
 #if defined(USE_SOUND) && defined(USE_MEDIA)
@@ -368,18 +366,18 @@ main(int argc, char *argv[])
 #endif
         runResources.setTagLoaders(loaders);
         std::shared_ptr<StreamProvider> sp =
-            std::make_shared<StreamProvider>(*i, *i);
+            std::make_shared<StreamProvider>(file, file);
         runResources.setStreamProvider(sp);
 
 #ifdef RENDERER_AGG
         runResources.setRenderer(r);
 #endif
 
-           bool success = play_movie(*i, runResources);
+           bool success = play_movie(file, runResources);
            if (!success) {
                if (s_stop_on_errors) {
                    // Fail.
-                std::cerr << "error playing through movie " << *i << std::endl;
+                std::cerr << "error playing through movie " << file << 
std::endl;
                        return EXIT_FAILURE;
                }
         }

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


commit d2a3ba012624c5f8e33e977b99e63c055f4f0bca
Author: Bastiaan Jacques <address@hidden>
Date:   Sun Jun 8 17:18:14 2014 +0200

    Plug leak.

diff --git a/utilities/processor.cpp b/utilities/processor.cpp
index e182306..657556e 100644
--- a/utilities/processor.cpp
+++ b/utilities/processor.cpp
@@ -348,13 +348,9 @@ main(int argc, char *argv[])
     addDefaultLoaders(*loaders);
 
 #ifdef RENDERER_AGG
+    unsigned char buf[8] = {};
     std::shared_ptr<Renderer_agg_base> r(create_Renderer_agg("RGBA32"));
 
-    // Yes, this leaks. On some systems (e.g. Debian Lenny) the data is
-    // evidently accessed after main() returns. Rather than bothering to
-    // work out why, we let this byte leak, as it's returned to the system on
-    // exit anyway.
-    unsigned char* buf = new unsigned char[8];
     r->init_buffer(buf, 1, 1, 1, 1);
 #endif
 

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


commit 3c9379ee49ec370fa892917fb5843b31445458bc
Author: Bastiaan Jacques <address@hidden>
Date:   Sun Jun 8 14:56:42 2014 +0200

    Use make_shared to create shared_ptrs.

diff --git a/gui/Player.cpp b/gui/Player.cpp
index 6ea934c..8934598 100644
--- a/gui/Player.cpp
+++ b/gui/Player.cpp
@@ -415,14 +415,16 @@ Player::run(int argc, char* argv[], const std::string& 
infile,
     /// The RunResources should be populated before parsing.
     _runResources.reset(new RunResources());
 
-    std::shared_ptr<SWF::TagLoadersTable> loaders(new SWF::TagLoadersTable());
+    std::shared_ptr<SWF::TagLoadersTable> loaders(
+        std::make_shared<SWF::TagLoadersTable>());
     addDefaultLoaders(*loaders);
     _runResources->setTagLoaders(loaders);
 
     std::unique_ptr<NamingPolicy> np(new IncrementalRename(_baseurl));
 
     /// The StreamProvider uses the actual URL of the loaded movie.
-    std::shared_ptr<StreamProvider> sp(new StreamProvider(_url, baseURL, 
std::move(np)));
+    std::shared_ptr<StreamProvider> sp(
+        std::make_shared<StreamProvider>(_url, baseURL, std::move(np)));
     _runResources->setStreamProvider(sp);
 
     // Set the Hardware video decoding resources. none, vaapi, omap
diff --git a/utilities/processor.cpp b/utilities/processor.cpp
index 26571b9..e182306 100644
--- a/utilities/processor.cpp
+++ b/utilities/processor.cpp
@@ -343,7 +343,8 @@ main(int argc, char *argv[])
     soundHandler.reset(new sound::NullSoundHandler(mediaHandler.get()));
 #endif
 
-    std::shared_ptr<SWF::TagLoadersTable> loaders(new SWF::TagLoadersTable());
+    std::shared_ptr<SWF::TagLoadersTable> loaders(
+        std::make_shared<SWF::TagLoadersTable>());
     addDefaultLoaders(*loaders);
 
 #ifdef RENDERER_AGG
@@ -370,7 +371,8 @@ main(int argc, char *argv[])
         runResources.setMediaHandler(mediaHandler);
 #endif
         runResources.setTagLoaders(loaders);
-        std::shared_ptr<StreamProvider> sp(new StreamProvider(*i, *i));
+        std::shared_ptr<StreamProvider> sp =
+            std::make_shared<StreamProvider>(*i, *i);
         runResources.setStreamProvider(sp);
 
 #ifdef RENDERER_AGG

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


commit 71fa2cce458c087b28b23cf22f579cfa4271c2bf
Author: Bastiaan Jacques <address@hidden>
Date:   Sun Jun 8 00:31:16 2014 +0200

    Remove unused include directive.

diff --git a/libmedia/AudioDecoderSpeex.cpp b/libmedia/AudioDecoderSpeex.cpp
index def0c04..ae555a1 100644
--- a/libmedia/AudioDecoderSpeex.cpp
+++ b/libmedia/AudioDecoderSpeex.cpp
@@ -22,7 +22,6 @@
 #include "log.h"
 
 #include <functional>
-#include <boost/checked_delete.hpp>
 #include <boost/utility.hpp> // noncopyable
 #include <cstdint> // For C99 int types
 

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


commit 7eb9408f02abba08a4ca1ea67524d94e70a2717f
Author: Bastiaan Jacques <address@hidden>
Date:   Sat Jun 7 01:19:58 2014 +0200

    Switch shared_ptr to unique_ptr.

diff --git a/librender/agg/Renderer_agg.cpp b/librender/agg/Renderer_agg.cpp
index 474d416..e15ca2d 100644
--- a/librender/agg/Renderer_agg.cpp
+++ b/librender/agg/Renderer_agg.cpp
@@ -156,6 +156,7 @@ AGG resources
 #include "SWFCxForm.h"
 #include "FillStyle.h"
 #include "Transform.h"
+#include "IOChannel.h"
 
 #ifdef HAVE_VA_VA_H
 #include "GnashVaapiImage.h"
@@ -684,7 +685,7 @@ public:
         return new agg_bitmap_info(std::move(im));
     }
 
-    virtual void renderToImage(std::shared_ptr<IOChannel> io,
+    virtual void renderToImage(std::unique_ptr<IOChannel> io,
             FileType type, int quality) const
     {
         image::ImageRGBA im(xres, yres);
@@ -695,7 +696,7 @@ public:
             }
         }
         
-        image::Output::writeImageData(type, io, im, quality);
+        image::Output::writeImageData(type, std::move(io), im, quality);
     }
 
     template<typename SourceFormat, typename Matrix>

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


commit cc34dd5e30087a8e2340d1550789cf3b79c898e1
Author: Bastiaan Jacques <address@hidden>
Date:   Fri Jun 6 18:37:09 2014 +0200

    Avoid a buffer copy.

diff --git a/libcore/movie_root.cpp b/libcore/movie_root.cpp
index a67625e..a2da564 100644
--- a/libcore/movie_root.cpp
+++ b/libcore/movie_root.cpp
@@ -2464,8 +2464,7 @@ movie_root::LoadCallback::processLoad()
     // providing memory release except destruction. Will be
     // destroyed as soon as we return though...
 
-    // NOTE: Another data copy here !
-    callMethod(_obj, NSV::PROP_ON_DATA, dataVal);
+    callMethod(_obj, NSV::PROP_ON_DATA, std::move(dataVal));
 
     return true;
 }

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


commit fd1ec3866db38b6d32d3a327da085b4b8accaafa
Author: Bastiaan Jacques <address@hidden>
Date:   Fri Jun 6 02:36:54 2014 +0200

    Add const.

diff --git a/libbase/utf8.cpp b/libbase/utf8.cpp
index e749ae3..7e4cf7f 100644
--- a/libbase/utf8.cpp
+++ b/libbase/utf8.cpp
@@ -204,14 +204,14 @@ encodeUnicodeCharacter(std::uint32_t ucs_character)
 #define ENC_UTF16BE 2
 #define ENC_UTF16LE 3
 
-char*
-stripBOM(char* in, size_t& size, TextEncoding& encoding)
+const char*
+stripBOM(const char* in, size_t& size, TextEncoding& encoding)
 {
     encoding = encUNSPECIFIED;
     if ( size > 2 )
     {
         // need *ptr to be unsigned or cast all 0xNN
-        unsigned char* ptr = reinterpret_cast<unsigned char*>(in);
+        const unsigned char* ptr = reinterpret_cast<const unsigned char*>(in);
 
         if (*ptr == 0xFF && *(ptr+1) == 0xFE) {
             // Text is UTF-16 LE
diff --git a/libbase/utf8.h b/libbase/utf8.h
index 6305223..34e54eb 100644
--- a/libbase/utf8.h
+++ b/libbase/utf8.h
@@ -148,7 +148,8 @@ namespace utf8 {
     /// @returns
     ///    A pointer either equal to 'in' or some bytes inside it.
     ///
-    DSOEXPORT char* stripBOM(char* in, size_t& size, TextEncoding& encoding);
+    DSOEXPORT const char* stripBOM(const char* in, size_t& size,
+                                   TextEncoding& encoding);
 
     /// Return name of a text encoding
     DSOEXPORT const char* textEncodingName(TextEncoding enc);
diff --git a/libcore/LoadVariablesThread.cpp b/libcore/LoadVariablesThread.cpp
index f01287d..2b1ef3a 100644
--- a/libcore/LoadVariablesThread.cpp
+++ b/libcore/LoadVariablesThread.cpp
@@ -61,7 +61,7 @@ LoadVariablesThread::completeLoad(IOChannel* varstream,
         } else {
             size_t dataSize = bytesRead;
             utf8::TextEncoding encoding;
-            char* ptr = utf8::stripBOM(buf.get(), dataSize,
+            const char* ptr = utf8::stripBOM(buf.get(), dataSize,
                                        encoding);
             if ( encoding != utf8::encUTF8 &&
                     encoding != utf8::encUNSPECIFIED ) {
diff --git a/libcore/movie_root.cpp b/libcore/movie_root.cpp
index 2fc00cd..a67625e 100644
--- a/libcore/movie_root.cpp
+++ b/libcore/movie_root.cpp
@@ -2448,7 +2448,8 @@ movie_root::LoadCallback::processLoad()
     size_t size = _buf.size();
 
     // NOTE: the call below will possibly change 'size' parameter
-    char* bufptr = utf8::stripBOM((char*)_buf.data(), size, encoding);
+    const char* bufptr = utf8::stripBOM(
+        reinterpret_cast<const char*>(_buf.data()), size, encoding);
     if (encoding != utf8::encUTF8 && encoding != utf8::encUNSPECIFIED) {
         log_unimpl(_("%s to UTF8 conversion in LoadableObject input parsing"),
                 utf8::textEncodingName(encoding));

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


commit 910701a6d8b963ec1b52b152b54f50173a62037b
Author: Bastiaan Jacques <address@hidden>
Date:   Thu Jun 5 15:37:59 2014 +0200

    Filters can also use unique_ptr.

diff --git a/libcore/parser/filter_factory.cpp 
b/libcore/parser/filter_factory.cpp
index 83f7e19..b17640c 100644
--- a/libcore/parser/filter_factory.cpp
+++ b/libcore/parser/filter_factory.cpp
@@ -95,7 +95,7 @@ filter_factory::read(SWFStream& in, bool read_multiple, 
Filters* store)
         }
 
         // Protect against exceptions and such by storing before we read.
-        std::shared_ptr<BitmapFilter> p(the_filter);
+        std::unique_ptr<BitmapFilter> p(the_filter);
         if (!p->read(in))
         {
             IF_VERBOSE_MALFORMED_SWF(
@@ -103,7 +103,7 @@ filter_factory::read(SWFStream& in, bool read_multiple, 
Filters* store)
             );
             return i; // We're already broken.
         }
-        store->push_back(p);
+        store->emplace_back(std::move(p));
     }
 
     return count;
diff --git a/libcore/parser/filter_factory.h b/libcore/parser/filter_factory.h
index f3a3bb3..8f777fe 100644
--- a/libcore/parser/filter_factory.h
+++ b/libcore/parser/filter_factory.h
@@ -29,7 +29,7 @@ namespace gnash {
 
 namespace gnash {
 
-typedef std::vector<std::shared_ptr<BitmapFilter> > Filters;
+typedef std::vector<std::unique_ptr<BitmapFilter> > Filters;
 
 class filter_factory
 {
diff --git a/libcore/swf/DefineButtonTag.cpp b/libcore/swf/DefineButtonTag.cpp
index d895a96..ee3eecb 100644
--- a/libcore/swf/DefineButtonTag.cpp
+++ b/libcore/swf/DefineButtonTag.cpp
@@ -125,7 +125,7 @@ DefineButtonTag::readDefineButtonTag(SWFStream& in, 
movie_definition& m)
 
         // SAFETY CHECK:
         // if the ButtonRecord is corrupted, discard it
-        if (r.valid()) _buttonRecords.push_back(r);
+        if (r.valid()) _buttonRecords.push_back(std::move(r));
     }
 
     if (in.tell() >= endTagPos) {
@@ -190,7 +190,7 @@ DefineButtonTag::readDefineButton2Tag(SWFStream& in, 
movie_definition& m)
         // SAFETY CHECK:
         // if the ButtonRecord is corrupted, discard it
         if (r.valid()) {
-            _buttonRecords.push_back(r);
+            _buttonRecords.push_back(std::move(r));
         }
     }
 
diff --git a/libcore/swf/DefineButtonTag.h b/libcore/swf/DefineButtonTag.h
index 8ec4f20..3e00a69 100644
--- a/libcore/swf/DefineButtonTag.h
+++ b/libcore/swf/DefineButtonTag.h
@@ -30,7 +30,8 @@
 #include "SWFMatrix.h" 
 #include "SWFCxForm.h" 
 #include "action_buffer.h" 
-#include "filter_factory.h" 
+#include "filter_factory.h"
+#include "Filters.h"
 #include "TypesParser.h"
 #include "DefineButtonSoundTag.h"
 #include "SWF.h"
diff --git a/libcore/swf/PlaceObject2Tag.cpp b/libcore/swf/PlaceObject2Tag.cpp
index 5e10e44..bc6e0fb 100644
--- a/libcore/swf/PlaceObject2Tag.cpp
+++ b/libcore/swf/PlaceObject2Tag.cpp
@@ -33,6 +33,7 @@
 #include "swf_event.h"
 #include "log.h"
 #include "SWFStream.h"
+#include "Filters.h"
 #include "filter_factory.h"
 #include "GnashAlgorithm.h"
 #include "action_buffer.h"

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


commit 7ff8c8c647d4480a0298143b5fb5661915ab2061
Author: Bastiaan Jacques <address@hidden>
Date:   Thu Jun 5 11:33:36 2014 +0200

    Remove DynamicShape handling code from Shape.
    
    DynamicShape is now a member of MovieClip.

diff --git a/libcore/Shape.cpp b/libcore/Shape.cpp
index 301cd05..cfb1c3b 100644
--- a/libcore/Shape.cpp
+++ b/libcore/Shape.cpp
@@ -41,15 +41,8 @@ Shape::pointInShape(std::int32_t x, std::int32_t y) const
     //       in DrawingApiTest (kind of a fill-leakage making
     //       the collision detection find you inside a self-crossing
     //       shape).
-    if (_def) {
-        if (!_def->bounds().point_test(lp.x, lp.y)) return false;
-        return _def->pointTestLocal(lp.x, lp.y, wm);
-    }
-    assert(_shape.get());
-    
-    if (!_shape->getBounds().point_test(lp.x, lp.y)) return false;
-    return _shape->pointTestLocal(lp.x, lp.y, wm);
-
+    if (!_def->bounds().point_test(lp.x, lp.y)) return false;
+    return _def->pointTestLocal(lp.x, lp.y, wm);
 }
 
 void  
@@ -57,8 +50,7 @@ Shape::display(Renderer& renderer, const Transform& base)
 {
     const Transform xform = base * transform();
 
-    if (_def) _def->display(renderer, xform);
-    else _shape->display(renderer, xform);
+    _def->display(renderer, xform);
     clear_invalidated();
 }
 
diff --git a/libcore/Shape.h b/libcore/Shape.h
index 8631ef8..dfaf84b 100644
--- a/libcore/Shape.h
+++ b/libcore/Shape.h
@@ -36,18 +36,7 @@ namespace gnash {
 /// SWF::DefinitionTag. A dynamic Shape object has a DynamicShape.
 class Shape : public DisplayObject
 {
-
 public:
-
-    Shape(movie_root& mr, as_object* object, std::shared_ptr<DynamicShape> sh,
-            DisplayObject* parent)
-        :
-        DisplayObject(mr, object, parent),
-        _shape(std::move(sh))
-    {
-        assert(_shape.get());
-    }
-
        Shape(movie_root& mr, as_object* object, const SWF::DefineShapeTag* def,
             DisplayObject* parent)
                :
@@ -60,7 +49,7 @@ public:
        virtual void display(Renderer& renderer, const Transform& xform);
 
     virtual SWFRect getBounds() const {
-        return _def ? _def->bounds() : _shape->getBounds();
+        return _def->bounds();
     }
     
     virtual bool pointInShape(std::int32_t x, std::int32_t y) const;
@@ -69,8 +58,6 @@ private:
        
     const boost::intrusive_ptr<const SWF::DefineShapeTag> _def;
 
-    std::shared_ptr<DynamicShape> _shape;
-
 };
 
 

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

Summary of changes:
 gui/Player.cpp                           |    6 ++-
 libbase/utf8.cpp                         |    6 +-
 libbase/utf8.h                           |    3 +-
 libcore/LoadVariablesThread.cpp          |    2 +-
 libcore/Shape.cpp                        |   14 +----
 libcore/Shape.h                          |   15 +-----
 libcore/as_value.h                       |   49 +++++++------------
 libcore/movie_root.cpp                   |    6 +-
 libcore/parser/filter_factory.cpp        |    4 +-
 libcore/parser/filter_factory.h          |    2 +-
 libcore/swf/DefineButtonTag.cpp          |    4 +-
 libcore/swf/DefineButtonTag.h            |    3 +-
 libcore/swf/PlaceObject2Tag.cpp          |    1 +
 libmedia/AudioDecoderSpeex.cpp           |    1 -
 libmedia/ffmpeg/MediaParserFfmpeg.cpp    |   79 ++----------------------------
 libmedia/ffmpeg/MediaParserFfmpeg.h      |    6 --
 librender/agg/Renderer_agg.cpp           |    5 +-
 testsuite/MovieTester.cpp                |   24 +++++----
 testsuite/MovieTester.h                  |   11 +++--
 testsuite/libbase.all/NoSeekFileTest.cpp |    6 +-
 utilities/processor.cpp                  |   20 +++-----
 21 files changed, 82 insertions(+), 185 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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