shithub: libdvdcss

Download patch

ref: ce9d6dfbd44915a29f2821adc3400e35cfd1f9ba
parent: 9968f73fc2129873c1d01f6b6ed0b6dc2fcc11a8
author: Sam Hocevar <sam@videolan.org>
date: Thu Jan 16 17:58:29 EST 2003

* ./src/ioctl.c, ./src/ioctl.h: removed minor gcc-isms.


--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -2,7 +2,7 @@
  * ioctl.c: DVD ioctl replacement function
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ioctl.c,v 1.22 2002/12/05 10:24:42 sam Exp $
+ * $Id: ioctl.c,v 1.23 2003/01/16 22:58:29 sam Exp $
  *
  * Authors: Markus Kuespert <ltlBeBoy@beosmail.com>
  *          Samuel Hocevar <sam@zoy.org>
@@ -1258,7 +1258,7 @@
 
     memcpy( auth_info.hsc.chal, p_challenge, DVD_CHALLENGE_SIZE );
 
-    return ioctl( i_fd, DVD_AUTH, &auth_info );
+    i_ret = ioctl( i_fd, DVD_AUTH, &auth_info );
 
 #elif defined( HAVE_BSD_DVD_STRUCT )
     struct dvd_authinfo auth_info;
@@ -1269,7 +1269,7 @@
 
     memcpy( auth_info.keychal, p_challenge, DVD_CHALLENGE_SIZE );
 
-    return ioctl( i_fd, DVDIOCSENDKEY, &auth_info );
+    i_ret = ioctl( i_fd, DVDIOCSENDKEY, &auth_info );
 
 #elif defined( SYS_BEOS )
     INIT_RDC( GPCMD_SEND_KEY, 16 );
@@ -1279,7 +1279,7 @@
     p_buffer[ 1 ] = 0xe;
     memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
 
-    return ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
+    i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
 
 #elif defined( HPUX_SCTL_IO )
     INIT_SCTL_IO( GPCMD_SEND_KEY, 16 );
@@ -1289,7 +1289,7 @@
     p_buffer[ 1 ] = 0xe;
     memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
 
-    return ioctl( i_fd, SIOC_IO, &sctl_io );
+    i_ret = ioctl( i_fd, SIOC_IO, &sctl_io );
 
 #elif defined( SOLARIS_USCSI )
     INIT_USCSI( GPCMD_SEND_KEY, 16 );
@@ -1304,7 +1304,7 @@
         return -1;
     }
 
-    return 0;
+    i_ret = 0;
 
 #elif defined( DARWIN_DVD_IOCTL )
     INIT_DVDIOCTL( dk_dvd_send_key_t, DVDChallengeKeyInfo,
@@ -1334,8 +1334,8 @@
 
         memcpy( key->KeyData, p_challenge, DVD_CHALLENGE_SIZE );
 
-        return DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
-                key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
+        i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
+                 key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
     }
     else
     {
@@ -1346,7 +1346,7 @@
         p_buffer[ 1 ] = 0xe;
         memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
 
-        return WinSendSSC( i_fd, &ssc );
+        i_ret = WinSendSSC( i_fd, &ssc );
     }
 
 #elif defined( __QNXNTO__ )
@@ -1368,9 +1368,9 @@
     p_buffer[ 1 ] = 0xe;
     memcpy( p_buffer + 4, p_challenge, DVD_CHALLENGE_SIZE );
 
-    return DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
-                       &sdc, sizeof(sdc), &ulParamLen,
-                       p_buffer, sizeof(p_buffer), &ulDataLen);
+    i_ret = DosDevIOCtl( i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
+                         &sdc, sizeof(sdc), &ulParamLen,
+                         p_buffer, sizeof(p_buffer), &ulDataLen );
 
 #else
 #   error "DVD ioctls are unavailable on this system"
@@ -1395,7 +1395,7 @@
 
     memcpy( auth_info.hsk.key, p_key, DVD_KEY_SIZE );
 
-    return ioctl( i_fd, DVD_AUTH, &auth_info );
+    i_ret = ioctl( i_fd, DVD_AUTH, &auth_info );
 
 #elif defined( HAVE_BSD_DVD_STRUCT )
     struct dvd_authinfo auth_info;
@@ -1406,7 +1406,7 @@
 
     memcpy( auth_info.keychal, p_key, DVD_KEY_SIZE );
 
-    return ioctl( i_fd, DVDIOCSENDKEY, &auth_info );
+    i_ret = ioctl( i_fd, DVDIOCSENDKEY, &auth_info );
 
 #elif defined( SYS_BEOS )
     INIT_RDC( GPCMD_SEND_KEY, 12 );
@@ -1416,7 +1416,7 @@
     p_buffer[ 1 ] = 0xa;
     memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
 
-    return ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
+    i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
 
 #elif defined( HPUX_SCTL_IO )
     INIT_SCTL_IO( GPCMD_SEND_KEY, 12 );
@@ -1426,7 +1426,7 @@
     p_buffer[ 1 ] = 0xa;
     memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
 
-    return ioctl( i_fd, SIOC_IO, &sctl_io );
+    i_ret = ioctl( i_fd, SIOC_IO, &sctl_io );
 
 #elif defined( SOLARIS_USCSI )
     INIT_USCSI( GPCMD_SEND_KEY, 12 );
@@ -1441,7 +1441,7 @@
         return -1;
     }
 
-    return 0;
+    i_ret = 0;
 
 #elif defined( DARWIN_DVD_IOCTL )
     INIT_DVDIOCTL( dk_dvd_send_key_t, DVDKey2Info,
@@ -1471,8 +1471,8 @@
 
         memcpy( key->KeyData, p_key, DVD_KEY_SIZE );
 
-        return DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
-                key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
+        i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_SEND_KEY, key,
+                 key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
     }
     else
     {
@@ -1483,7 +1483,7 @@
         p_buffer[ 1 ] = 0xa;
         memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
 
-        return WinSendSSC( i_fd, &ssc );
+        i_ret = WinSendSSC( i_fd, &ssc );
     }
 
 #elif defined( __QNXNTO__ )
@@ -1505,9 +1505,9 @@
     p_buffer[ 1 ] = 0xa;
     memcpy( p_buffer + 4, p_key, DVD_KEY_SIZE );
 
-    return DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
-                       &sdc, sizeof(sdc), &ulParamLen,
-                       p_buffer, sizeof(p_buffer), &ulDataLen);
+    i_ret = DosDevIOCtl( i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
+                         &sdc, sizeof(sdc), &ulParamLen,
+                         p_buffer, sizeof(p_buffer), &ulDataLen );
 
 #else
 #   error "DVD ioctls are unavailable on this system"
@@ -1685,7 +1685,7 @@
     auth_info.type = DVD_HOST_SEND_RPC_STATE;
     auth_info.hrpcs.pdrc = i_pdrc;
 
-    return ioctl( i_fd, DVD_AUTH, &auth_info );
+    i_ret = ioctl( i_fd, DVD_AUTH, &auth_info );
 
 #elif defined( HAVE_LINUX_DVD_STRUCT )
     /* FIXME: OpenBSD doesn't know this */
@@ -1698,7 +1698,7 @@
     auth_info.format = DVD_SEND_RPC;
     auth_info.region = i_pdrc;
 
-    return ioctl( i_fd, DVDIOCSENDKEY, &auth_info );
+    i_ret = ioctl( i_fd, DVDIOCSENDKEY, &auth_info );
 
 #elif defined( SYS_BEOS )
     INIT_RDC( GPCMD_SEND_KEY, 8 );
@@ -1708,7 +1708,7 @@
     p_buffer[ 1 ] = 6;
     p_buffer[ 4 ] = i_pdrc;
 
-    return ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
+    i_ret = ioctl( i_fd, B_RAW_DEVICE_COMMAND, &rdc, sizeof(rdc) );
 
 #elif defined( HPUX_SCTL_IO )
     INIT_SCTL_IO( GPCMD_SEND_KEY, 8 );
@@ -1718,7 +1718,7 @@
     p_buffer[ 1 ] = 6;
     p_buffer[ 4 ] = i_pdrc;
 
-    return ioctl( i_fd, SIOC_IO, &sctl_io );
+    i_ret = ioctl( i_fd, SIOC_IO, &sctl_io );
 
 #elif defined( SOLARIS_USCSI )
     INIT_USCSI( GPCMD_SEND_KEY, 8 );
@@ -1742,7 +1742,7 @@
     dvd.keyClass = kDVDKeyClassCSS_CPPM_CPRM;
     dvdbs.driveRegion = i_pdrc;
 
-    return ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
+    i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
 
 #elif defined( WIN32 )
     if( WIN2K ) /* NT/2k/XP */
@@ -1754,7 +1754,7 @@
         p_buffer[ 1 ] = 6;
         p_buffer[ 4 ] = i_pdrc;
 
-        return SEND_SPTD( i_fd, &sptd, &tmp );
+        i_ret = SEND_SPTD( i_fd, &sptd, &tmp );
     }
     else
     {
@@ -1765,7 +1765,7 @@
         p_buffer[ 1 ] = 6;
         p_buffer[ 4 ] = i_pdrc;
 
-        return WinSendSSC( i_fd, &ssc );
+        i_ret = WinSendSSC( i_fd, &ssc );
     }
 
 #elif defined( __QNXNTO__ )
@@ -1777,7 +1777,7 @@
     p_buffer[ 1 ] = 6;
     p_buffer[ 4 ] = i_pdrc;
 
-    return devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
+    i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
 
 #elif defined( SYS_OS2 )
     INIT_SSC( GPCMD_SEND_KEY, 8 );
@@ -1787,9 +1787,9 @@
     p_buffer[ 1 ] = 6;
     p_buffer[ 4 ] = i_pdrc;
 
-    return DosDevIOCtl(i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
-                       &sdc, sizeof(sdc), &ulParamLen,
-                       p_buffer, sizeof(p_buffer), &ulDataLen);
+    i_ret = DosDevIOCtl( i_fd, IOCTL_CDROMDISK, CDROMDISK_EXECMD,
+                         &sdc, sizeof(sdc), &ulParamLen,
+                         p_buffer, sizeof(p_buffer), &ulDataLen );
 
 #else
 #   error "DVD ioctls are unavailable on this system"
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -2,7 +2,7 @@
  * ioctl.h: DVD ioctl replacement function
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: ioctl.h,v 1.13 2002/12/05 10:24:42 sam Exp $
+ * $Id: ioctl.h,v 1.14 2003/01/16 22:58:29 sam Exp $
  *
  * Authors: Samuel Hocevar <sam@zoy.org>
  *
@@ -44,7 +44,7 @@
 #if defined( SYS_BEOS )
 #define INIT_RDC( TYPE, SIZE ) \
     raw_device_command rdc; \
-    uint8_t p_buffer[ (SIZE) ]; \
+    uint8_t p_buffer[ (SIZE)+1 ]; \
     memset( &rdc, 0, sizeof( raw_device_command ) ); \
     rdc.data = (char *)p_buffer; \
     rdc.data_length = (SIZE); \
@@ -57,7 +57,7 @@
 #if defined( HPUX_SCTL_IO )
 #define INIT_SCTL_IO( TYPE, SIZE ) \
     struct sctl_io sctl_io; \
-    uint8_t p_buffer[ (SIZE) ]; \
+    uint8_t p_buffer[ (SIZE)+1 ]; \
     memset( &sctl_io, 0, sizeof( sctl_io ) ); \
     sctl_io.data = (void *)p_buffer; \
     sctl_io.data_length = (SIZE); \
@@ -73,10 +73,10 @@
 #define INIT_USCSI( TYPE, SIZE ) \
     struct uscsi_cmd sc; \
     union scsi_cdb rs_cdb; \
-    uint8_t p_buffer[ (SIZE) ]; \
+    uint8_t p_buffer[ (SIZE)+1 ]; \
     memset( &sc, 0, sizeof( struct uscsi_cmd ) ); \
     sc.uscsi_cdb = (caddr_t)&rs_cdb; \
-    sc.uscsi_bufaddr = p_buffer; \
+    sc.uscsi_bufaddr = (caddr_t)p_buffer; \
     sc.uscsi_buflen = (SIZE); \
     SolarisInitUSCSI( &sc, (TYPE) );
 #endif
@@ -115,7 +115,7 @@
                       (TMP), NULL ) ? 0 : -1)
 #define INIT_SSC( TYPE, SIZE ) \
     struct SRB_ExecSCSICmd ssc; \
-    uint8_t p_buffer[ (SIZE) ]; \
+    uint8_t p_buffer[ (SIZE)+1 ]; \
     memset( &ssc, 0, sizeof( struct SRB_ExecSCSICmd ) ); \
     ssc.SRB_BufPointer = (char *)p_buffer; \
     ssc.SRB_BufLen = (SIZE); \
@@ -144,7 +144,7 @@
 #if defined( SYS_OS2 )
 #define INIT_SSC( TYPE, SIZE ) \
     struct OS2_ExecSCSICmd sdc; \
-    uint8_t p_buffer[ (SIZE) ]; \
+    uint8_t p_buffer[ (SIZE)+1 ]; \
     unsigned long ulParamLen; \
     unsigned long ulDataLen; \
     memset( &sdc, 0, sizeof( OS2_ExecSCSICmd ) ); \