shithub: libdvdcss

Download patch

ref: 1487a6073ca8fc2d5a068ebc83a754979057496a
parent: 7a98f74594c310b793d7e855931b5f30ec3cbf58
author: Sam Hocevar <sam@videolan.org>
date: Thu Dec 11 10:12:42 EST 2003

* src/device.c:
    + Store the off_t values for seek and read in a temporary variable to
      work around a strange gentoo gcc behaviour as seen here:
      http://www.via.ecp.fr/via/ml/libdvdcss-devel/200312/msg00000.html


--- a/src/device.c
+++ b/src/device.c
@@ -2,7 +2,7 @@
  * device.h: DVD device access
  *****************************************************************************
  * Copyright (C) 1998-2002 VideoLAN
- * $Id: device.c,v 1.18 2003/09/09 13:17:24 sam Exp $
+ * $Id: device.c,v 1.19 2003/12/11 15:12:42 sam Exp $
  *
  * Authors: St�phane Borel <stef@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -436,8 +436,8 @@
         return i_blocks;
     }
 
-    i_seek = lseek( dvdcss->i_read_fd,
-                    (off_t)i_blocks * (off_t)DVDCSS_BLOCK_SIZE, SEEK_SET );
+    i_seek = (off_t)i_blocks * (off_t)DVDCSS_BLOCK_SIZE;
+    i_seek = lseek( dvdcss->i_read_fd, i_seek, SEEK_SET );
 
     if( i_seek < 0 )
     {
@@ -518,10 +518,10 @@
  *****************************************************************************/
 static int libc_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
 {
-    off_t i_ret;
+    off_t i_size, i_ret;
 
-    i_ret = read( dvdcss->i_read_fd, p_buffer,
-                  (off_t)i_blocks * DVDCSS_BLOCK_SIZE );
+    i_size = (off_t)i_blocks * (off_t)DVDCSS_BLOCK_SIZE;
+    i_ret = read( dvdcss->i_read_fd, p_buffer, i_size );
 
     if( i_ret < 0 )
     {
@@ -531,7 +531,7 @@
     }
 
     /* Handle partial reads */
-    if( i_ret != (off_t)i_blocks * DVDCSS_BLOCK_SIZE )
+    if( i_ret != i_size )
     {
         int i_seek;