[vlc-devel] commit: Don't write two times when only one is needed. ( Rémi Duraffort )

git version control git at videolan.org
Wed Dec 17 21:51:51 CET 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Wed Dec 17 21:17:49 2008 +0100| [572fdb5cea704150ad2d9c30cffcb24e18a87e10] | committer: Rémi Duraffort 

Don't write two times when only one is needed.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=572fdb5cea704150ad2d9c30cffcb24e18a87e10
---

 modules/demux/real.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/modules/demux/real.c b/modules/demux/real.c
index 7d09aa9..f7e641c 100644
--- a/modules/demux/real.c
+++ b/modules/demux/real.c
@@ -379,10 +379,11 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
                 return VLC_SUCCESS;
             }
 
-            *pf = 0.0;
             i64 = stream_Size( p_demux->s );
             if( i64 > 0 )
                 *pf = (double)1.0*stream_Tell( p_demux->s ) / (double)i64;
+            else
+                *pf = 0.0;
             return VLC_SUCCESS;
 
         case DEMUX_GET_TIME:
@@ -435,9 +436,11 @@ static int Control( demux_t *p_demux, int i_query, va_list args )
         case DEMUX_GET_LENGTH:
             pi64 = (int64_t*)va_arg( args, int64_t * );
  
-            *pi64 = 0;
             if( p_sys->i_our_duration <= 0 )
+            {
+                *pi64 = 0;
                 return VLC_EGENERIC;
+            }
 
             /* our stored duration is in ms, so... */
             *pi64 = INT64_C(1000) * p_sys->i_our_duration;




More information about the vlc-devel mailing list