[vlc-commits] Remove buggy and unused pread()/pwrite()

Rémi Denis-Courmont git at videolan.org
Sat Sep 8 18:14:36 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Sep  8 19:12:21 2012 +0300| [63c78d400b682b650da19a91bf358a1a6e12f8d2] | committer: Rémi Denis-Courmont

Remove buggy and unused pread()/pwrite()

If they are really needed, they should be integrated in compat/.
Declaring standard functions static breaks when the target has stubs.

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

 src/misc/block.c |   22 ----------------------
 1 file changed, 22 deletions(-)

diff --git a/src/misc/block.c b/src/misc/block.c
index 1962ff5..e4850e0 100644
--- a/src/misc/block.c
+++ b/src/misc/block.c
@@ -355,28 +355,6 @@ ssize_t pread (int fd, void *buf, size_t count, off_t offset)
         return written;
     return -1;
 }
-#elif !defined( HAVE_PREAD )
-static
-ssize_t pread(int fd, const void * buf, size_t size, off_t offset) {
-    off_t offs0;
-    ssize_t rd;
-    if ((offs0 = lseek(fd, 0, SEEK_CUR)) == (off_t)-1) return -1;
-    if (lseek(fd, offset, SEEK_SET) == (off_t)-1) return -1;
-    rd = read(fd, (void *)buf, size);
-    if (lseek(fd, offs0, SEEK_SET) == (off_t)-1) return -1;
-    return rd;
-}
-
-static
-ssize_t pwrite(int fd, const void * buf, size_t size, off_t offset) {
-    off_t offs0;
-    ssize_t wr;
-    if ((offs0 = lseek(fd, 0, SEEK_CUR)) == (off_t)-1) return -1;
-    if (lseek(fd, offset, SEEK_SET) == (off_t)-1) return -1;
-    wr = write(fd, (void *)buf, size);
-    if (lseek(fd, offs0, SEEK_SET) == (off_t)-1) return -1;
-    return wr;
-}
 #endif
 
 /**



More information about the vlc-commits mailing list