Jean-Baptiste Kempf
2015-01-27 14:15:27 UTC
libdvdcss | branch: master | Jean-Baptiste Kempf <***@videolan.org> | Tue Jan 27 15:15:20 2015 +0100| [b8171911daa0908ebda3a7868a16f9e70fa375f3] | committer: Jean-Baptiste Kempf
Revert "device: Adjust types in offset calculations"
This reverts commit c500fe5227012ac04ec0b91c6c29606bad246839.
src/device.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/device.c b/src/device.c
index 8254028..77c9821 100644
--- a/src/device.c
+++ b/src/device.c
@@ -512,17 +512,17 @@ static int libc_seek( dvdcss_t dvdcss, int i_blocks )
return i_blocks;
}
- i_seek = i_blocks * DVDCSS_BLOCK_SIZE;
+ i_seek = (off_t)i_blocks * (off_t)DVDCSS_BLOCK_SIZE;
i_seek = lseek( dvdcss->i_fd, i_seek, SEEK_SET );
if( i_seek < 0 )
{
print_error( dvdcss, "seek error" );
dvdcss->i_pos = -1;
- return (int) i_seek;
+ return i_seek;
}
- dvdcss->i_pos = (int) (i_seek / DVDCSS_BLOCK_SIZE);
+ dvdcss->i_pos = i_seek / DVDCSS_BLOCK_SIZE;
return dvdcss->i_pos;
}
@@ -550,7 +550,7 @@ static int win2k_seek( dvdcss_t dvdcss, int i_blocks )
return -1;
}
- dvdcss->i_pos = (int) (li_seek.QuadPart / DVDCSS_BLOCK_SIZE);
+ dvdcss->i_pos = li_seek.QuadPart / DVDCSS_BLOCK_SIZE;
return dvdcss->i_pos;
}
@@ -561,9 +561,9 @@ static int win2k_seek( dvdcss_t dvdcss, int i_blocks )
*****************************************************************************/
static int libc_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
{
- ssize_t i_size, i_ret, i_ret_blocks;
+ off_t i_size, i_ret, i_ret_blocks;
- i_size = i_blocks * DVDCSS_BLOCK_SIZE;
+ i_size = (off_t)i_blocks * (off_t)DVDCSS_BLOCK_SIZE;
i_ret = read( dvdcss->i_fd, p_buffer, i_size );
if( i_ret < 0 )
Revert "device: Adjust types in offset calculations"
This reverts commit c500fe5227012ac04ec0b91c6c29606bad246839.
http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=b8171911daa0908ebda3a7868a16f9e70fa375f3
---src/device.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/device.c b/src/device.c
index 8254028..77c9821 100644
--- a/src/device.c
+++ b/src/device.c
@@ -512,17 +512,17 @@ static int libc_seek( dvdcss_t dvdcss, int i_blocks )
return i_blocks;
}
- i_seek = i_blocks * DVDCSS_BLOCK_SIZE;
+ i_seek = (off_t)i_blocks * (off_t)DVDCSS_BLOCK_SIZE;
i_seek = lseek( dvdcss->i_fd, i_seek, SEEK_SET );
if( i_seek < 0 )
{
print_error( dvdcss, "seek error" );
dvdcss->i_pos = -1;
- return (int) i_seek;
+ return i_seek;
}
- dvdcss->i_pos = (int) (i_seek / DVDCSS_BLOCK_SIZE);
+ dvdcss->i_pos = i_seek / DVDCSS_BLOCK_SIZE;
return dvdcss->i_pos;
}
@@ -550,7 +550,7 @@ static int win2k_seek( dvdcss_t dvdcss, int i_blocks )
return -1;
}
- dvdcss->i_pos = (int) (li_seek.QuadPart / DVDCSS_BLOCK_SIZE);
+ dvdcss->i_pos = li_seek.QuadPart / DVDCSS_BLOCK_SIZE;
return dvdcss->i_pos;
}
@@ -561,9 +561,9 @@ static int win2k_seek( dvdcss_t dvdcss, int i_blocks )
*****************************************************************************/
static int libc_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
{
- ssize_t i_size, i_ret, i_ret_blocks;
+ off_t i_size, i_ret, i_ret_blocks;
- i_size = i_blocks * DVDCSS_BLOCK_SIZE;
+ i_size = (off_t)i_blocks * (off_t)DVDCSS_BLOCK_SIZE;
i_ret = read( dvdcss->i_fd, p_buffer, i_size );
if( i_ret < 0 )