]> git.sesse.net Git - vlc/commitdiff
Remove buggy and unused pread()/pwrite()
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 8 Sep 2012 16:12:21 +0000 (19:12 +0300)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 8 Sep 2012 16:14:32 +0000 (19:14 +0300)
If they are really needed, they should be integrated in compat/.
Declaring standard functions static breaks when the target has stubs.

src/misc/block.c

index 1962ff5eb98a411db304e3557d0a81c64a5c09dc..e4850e0aaf2cf38f0180c9328ac40ceb69e72457 100644 (file)
@@ -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
 
 /**