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-1685-ge335377
Date: Thu, 25 Jul 2013 00:31:32 +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  e335377dd71b49f0b649229866713231b443de80 (commit)
       via  90dd2a22fd46b048a0f43b89c3bec61010fbfdf8 (commit)
      from  d1ac254c420d1f10c50b8a96721eaeedd87d8e42 (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=e335377dd71b49f0b649229866713231b443de80


commit e335377dd71b49f0b649229866713231b443de80
Author: Bastiaan Jacques <address@hidden>
Date:   Thu Jul 25 02:27:24 2013 +0200

    Savannah #35545: don't allow infinite looping for dynamic sounds.
    
    This is based on a patch by Karl-Felix Glatzer.

diff --git a/libcore/asobj/Sound_as.cpp b/libcore/asobj/Sound_as.cpp
index 2f67907..ae59c13 100644
--- a/libcore/asobj/Sound_as.cpp
+++ b/libcore/asobj/Sound_as.cpp
@@ -732,7 +732,7 @@ Sound_as::start(double secOff, int loops)
             inPoint = (secOff*44100);
         }
 
-        log_debug("Sound.start: secOff:%d", secOff);
+        log_debug("Sound.start: secOff:%d loops:%d", secOff, loops);
 
         _soundHandler->startSound(
                     soundId,
@@ -1019,9 +1019,8 @@ sound_start(const fn_call& fn)
         if (fn.nargs > 1) {
             loop = (int) toNumber(fn.arg(1), getVM(fn)) - 1;
 
-            // -1 means infinite playing of sound
-            // sanity check
-            loop = loop < 0 ? -1 : loop;
+            // Negative values count as playing once (aka looping 0 times)
+            loop = std::max(0, toInt(fn.arg(1), getVM(fn)) - 1);
         }
     }
     so->start(secondOffset, loop);
diff --git a/libsound/EmbedSound.cpp b/libsound/EmbedSound.cpp
index e115ce1..9f18ba0 100644
--- a/libsound/EmbedSound.cpp
+++ b/libsound/EmbedSound.cpp
@@ -59,7 +59,7 @@ EmbedSound::eraseActiveSound(Instances::iterator i)
 std::auto_ptr<EmbedSoundInst>
 EmbedSound::createInstance(media::MediaHandler& mh, unsigned int inPoint,
         unsigned int outPoint, const SoundEnvelopes* envelopes,
-        unsigned int loopCount)
+        int loopCount)
 {
     std::auto_ptr<EmbedSoundInst> ret(
         new EmbedSoundInst(*this, mh, inPoint, outPoint, envelopes, 
loopCount));
diff --git a/libsound/EmbedSound.h b/libsound/EmbedSound.h
index f1a0975..69c202f 100644
--- a/libsound/EmbedSound.h
+++ b/libsound/EmbedSound.h
@@ -139,7 +139,7 @@ public:
     ///
     std::auto_ptr<EmbedSoundInst> createInstance(media::MediaHandler& mh,
             unsigned int inPoint, unsigned int outPoint,
-            const SoundEnvelopes* envelopes, unsigned int loopCount);
+            const SoundEnvelopes* envelopes, int loopCount);
 
     /// Drop all active sounds
     //

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


commit 90dd2a22fd46b048a0f43b89c3bec61010fbfdf8
Author: Bastiaan Jacques <address@hidden>
Date:   Thu Jul 25 02:19:02 2013 +0200

    Explicitly handle NaN to aid portability and add an early-return 
micro-optimization.

diff --git a/libcore/vm/VM.cpp b/libcore/vm/VM.cpp
index 627b803..4214097 100644
--- a/libcore/vm/VM.cpp
+++ b/libcore/vm/VM.cpp
@@ -464,7 +464,14 @@ toInt(const as_value& v, const VM& vm)
 {
     const double d = v.to_number(vm.getSWFVersion());
 
-    if (!isFinite(d)) return 0;
+    if (!isFinite(d) || isNaN(d)) {
+        return 0;
+    }
+
+    typedef std::numeric_limits<boost::int32_t> limit;
+    if (d >= limit::min() && d <= limit::max()) {
+        return d;
+    }
 
     if (d < 0) {   
         return - static_cast<boost::uint32_t>(std::fmod(-d, 4294967296.0));

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

Summary of changes:
 libcore/asobj/Sound_as.cpp |    7 +++----
 libcore/vm/VM.cpp          |    9 ++++++++-
 libsound/EmbedSound.cpp    |    2 +-
 libsound/EmbedSound.h      |    2 +-
 4 files changed, 13 insertions(+), 7 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

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