[vlc-commits] access: dvb: scan: fix unwanted loop

Francois Cartegnie git at videolan.org
Tue Apr 26 20:39:07 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Apr 26 20:06:55 2016 +0200| [7f6f5dcaa1d441ef4a64d0ea5ea9b0d69e1a6155] | committer: Francois Cartegnie

access: dvb: scan: fix unwanted loop

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

 modules/access/dvb/access.c |   19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/modules/access/dvb/access.c b/modules/access/dvb/access.c
index 9b741d7..ff143c5 100644
--- a/modules/access/dvb/access.c
+++ b/modules/access/dvb/access.c
@@ -328,18 +328,15 @@ static int ScanReadCallback( scan_t *p_scan, void *p_privdata,
 
         if ( ufds[0].revents )
         {
-            for( size_t i=0; i<i_packets_max; i++ )
+            ssize_t i_read = read( p_sys->dvb.i_handle, p_packet, TS_PACKET_SIZE * i_packets_max );
+            if( i_read < 0 )
             {
-                ssize_t i_read = read( p_sys->dvb.i_handle, p_packet, TS_PACKET_SIZE * i_packets_max );
-                if( i_read < 0 )
-                {
-                    msg_Warn( p_access, "read failed: %s", vlc_strerror_c(errno) );
-                    break;
-                }
-                else if ( i_read == TS_PACKET_SIZE )
-                {
-                    *pi_count = i_read / TS_PACKET_SIZE;
-                }
+                msg_Warn( p_access, "read failed: %s", vlc_strerror_c(errno) );
+                break;
+            }
+            else
+            {
+                *pi_count = i_read / TS_PACKET_SIZE;
             }
         }
     }



More information about the vlc-commits mailing list