shithub: libdvdcss

Download patch

ref: c500fe5227012ac04ec0b91c6c29606bad246839
parent: cba944bcb9ddec37b14c1ba6a301cce95575c8d5
author: Diego Biurrun <[email protected]>
date: Thu Oct 16 09:22:20 EDT 2014

device: Adjust types in offset calculations

This fixes all related warnings from MSVC.

--- a/src/device.c
+++ b/src/device.c
@@ -540,7 +540,7 @@
         return i_blocks;
     }
 
-    i_seek = (off_t)i_blocks * (off_t)DVDCSS_BLOCK_SIZE;
+    i_seek = i_blocks * DVDCSS_BLOCK_SIZE;
     i_seek = lseek( dvdcss->i_fd, i_seek, SEEK_SET );
 
     if( i_seek < 0 )
@@ -547,10 +547,10 @@
     {
         print_error( dvdcss, "seek error" );
         dvdcss->i_pos = -1;
-        return i_seek;
+        return (int) i_seek;
     }
 
-    dvdcss->i_pos = i_seek / DVDCSS_BLOCK_SIZE;
+    dvdcss->i_pos = (int) (i_seek / DVDCSS_BLOCK_SIZE);
 
     return dvdcss->i_pos;
 }
@@ -578,7 +578,7 @@
         return -1;
     }
 
-    dvdcss->i_pos = li_seek.QuadPart / DVDCSS_BLOCK_SIZE;
+    dvdcss->i_pos = (int) (li_seek.QuadPart / DVDCSS_BLOCK_SIZE);
 
     return dvdcss->i_pos;
 }
@@ -589,9 +589,9 @@
  *****************************************************************************/
 static int libc_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
 {
-    off_t i_size, i_ret, i_ret_blocks;
+    ssize_t i_size, i_ret, i_ret_blocks;
 
-    i_size = (off_t)i_blocks * (off_t)DVDCSS_BLOCK_SIZE;
+    i_size = i_blocks * DVDCSS_BLOCK_SIZE;
     i_ret = read( dvdcss->i_fd, p_buffer, i_size );
 
     if( i_ret < 0 )