]> git.sesse.net Git - mlt/commitdiff
Fix undefined bahavior in SDL module (3066195).
authorDan Dennedy <dan@dennedy.org>
Wed, 12 Jan 2011 03:04:11 +0000 (19:04 -0800)
committerDan Dennedy <dan@dennedy.org>
Wed, 12 Jan 2011 03:04:11 +0000 (19:04 -0800)
The standard says the post-increment can have effect at any point
between the previous and the next sequence point (or something similar),
so the behavior of "this->refresh_count = this->refresh_count ++" is
undefined.

Patch by Cristian Morales Vega

src/modules/sdl/consumer_sdl_audio.c
src/modules/sdl/consumer_sdl_preview.c

index 7f1ee64c71dfc2c2e1f0bb17e513fa019c6dff1f..c6103fbb4667dc1a0d20960f4817ddf7d7b4e418 100644 (file)
@@ -143,7 +143,7 @@ static void consumer_refresh_cb( mlt_consumer sdl, mlt_consumer parent, char *na
        {
                consumer_sdl this = parent->child;
                pthread_mutex_lock( &this->refresh_mutex );
-               this->refresh_count = this->refresh_count <= 0 ? 1 : this->refresh_count ++;
+               this->refresh_count = this->refresh_count <= 0 ? 1 : this->refresh_count + 1;
                pthread_cond_broadcast( &this->refresh_cond );
                pthread_mutex_unlock( &this->refresh_mutex );
        }
index f6f08b929075fb1d99c36f44625a143035d35022..94a5598ee1d4aabdba175a256c3ac08b1d8ab945 100644 (file)
@@ -130,7 +130,7 @@ static void consumer_refresh_cb( mlt_consumer sdl, mlt_consumer parent, char *na
        {
                consumer_sdl this = parent->child;
                pthread_mutex_lock( &this->refresh_mutex );
-               this->refresh_count = this->refresh_count <= 0 ? 1 : this->refresh_count ++;
+               this->refresh_count = this->refresh_count <= 0 ? 1 : this->refresh_count + 1;
                pthread_cond_broadcast( &this->refresh_cond );
                pthread_mutex_unlock( &this->refresh_mutex );
        }