[vlc-devel] commit: Code factorization ( Rémi Denis-Courmont )

git version control git at videolan.org
Tue Sep 30 17:37:28 CEST 2008


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Tue Sep 30 18:39:26 2008 +0300| [eb2ec28e5aee5fc0bff9bb8151d6d04afb42e2c4] | committer: Rémi Denis-Courmont 

Code factorization

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

 modules/access/file.c |   27 +++++++++------------------
 1 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/modules/access/file.c b/modules/access/file.c
index b2b2b23..10dc7a8 100644
--- a/modules/access/file.c
+++ b/modules/access/file.c
@@ -206,33 +206,24 @@ static void Close (vlc_object_t * p_this)
     free (p_sys);
 }
 
+
+#include <vlc_network.h>
+
 /*****************************************************************************
  * Read: standard read on a file descriptor.
  *****************************************************************************/
 static ssize_t Read( access_t *p_access, uint8_t *p_buffer, size_t i_len )
 {
     access_sys_t *p_sys = p_access->p_sys;
-    ssize_t i_ret;
     int fd = p_sys->fd;
+    ssize_t i_ret;
 
-#if !defined(WIN32) && !defined(UNDER_CE)
-    if( !p_sys->b_seekable )
-    {
-        /* Note that POSIX regular files (b_seekable) opened for read are
-         * guaranteed to always set POLLIN immediately, so we can spare
-         * poll()ing them. */
-        /* Wait until some data is available. Impossible on Windows. */
-        struct pollfd ufd[2] = {
-            { .fd = fd, .events = POLLIN, },
-            { .fd = vlc_object_waitpipe (p_access), .events = POLLIN, },
-        };
-
-        if (poll (ufd, 2, -1) < 0 || ufd[1].revents)
-            return -1;
-    }
-#endif /* WIN32 || UNDER_CE */
-
+#ifndef WIN32
+    i_ret = net_Read (p_access, fd, NULL, p_buffer, i_len, false);
+#else
     i_ret = read (fd, p_buffer, i_len);
+#endif
+    
     if( i_ret < 0 )
     {
         switch (errno)




More information about the vlc-devel mailing list