[libdvdcss-devel] [PATCH 14/47] indentation cosmetics (for squashing)

Diego Biurrun diego at biurrun.de
Wed Oct 29 21:33:14 CET 2014


---

This is supposed to be squashed into the Windows 9x removal.  Or not,
but it's easier to review without these whitespace changes.

 src/device.c      |  22 ++---
 src/ioctl.c       | 250 +++++++++++++++++++++++++++---------------------------
 test/dvd_region.c |  10 +--
 3 files changed, 141 insertions(+), 141 deletions(-)

diff --git a/src/device.c b/src/device.c
index dce8ce6..514aa1e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -757,17 +757,17 @@ static int win_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )
 
     i_blocks_total /= DVDCSS_BLOCK_SIZE;
 
-        unsigned long int i_bytes;
-        if( !ReadFile( (HANDLE)dvdcss->i_fd, dvdcss->p_readv_buffer,
-                       i_blocks_total * DVDCSS_BLOCK_SIZE, &i_bytes, NULL ) )
-        {
-            /* The read failed... too bad.
-             * As in the POSIX spec the file position is left
-             * unspecified after a failure */
-            dvdcss->i_pos = -1;
-            return -1;
-        }
-        i_blocks_read = i_bytes / DVDCSS_BLOCK_SIZE;
+    unsigned long int i_bytes;
+    if( !ReadFile( (HANDLE)dvdcss->i_fd, dvdcss->p_readv_buffer,
+                   i_blocks_total * DVDCSS_BLOCK_SIZE, &i_bytes, NULL ) )
+    {
+        /* The read failed... too bad.
+         * As in the POSIX spec the file position is left
+         * unspecified after a failure */
+        dvdcss->i_pos = -1;
+        return -1;
+    }
+    i_blocks_read = i_bytes / DVDCSS_BLOCK_SIZE;
 
     /* We just have to copy the content of the temp buffer into the iovecs */
     for( i_index = 0, i_blocks_total = i_blocks_read;
diff --git a/src/ioctl.c b/src/ioctl.c
index cca2924..c33ea66 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -186,23 +186,23 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
     *pi_copyright = dvdbs.copyrightProtectionSystemType;
 
 #elif defined( WIN32 )
-        INIT_SPTD( GPCMD_READ_DVD_STRUCTURE, 8 );
+    INIT_SPTD( GPCMD_READ_DVD_STRUCTURE, 8 );
 
-        /*  When using IOCTL_DVD_READ_STRUCTURE and
-            DVD_COPYRIGHT_DESCRIPTOR, CopyrightProtectionType
-            seems to be always 6 ???
-            To work around this MS bug we try to send a raw SCSI command
-            instead (if we've got enough privileges to do so). */
+    /*  When using IOCTL_DVD_READ_STRUCTURE and
+        DVD_COPYRIGHT_DESCRIPTOR, CopyrightProtectionType
+        seems to be always 6 ???
+        To work around this MS bug we try to send a raw SCSI command
+        instead (if we've got enough privileges to do so). */
 
-        sptd.Cdb[ 6 ] = i_layer;
-        sptd.Cdb[ 7 ] = DVD_STRUCT_COPYRIGHT;
+    sptd.Cdb[ 6 ] = i_layer;
+    sptd.Cdb[ 7 ] = DVD_STRUCT_COPYRIGHT;
 
-        i_ret = SEND_SPTD( i_fd, &sptd, &tmp );
+    i_ret = SEND_SPTD( i_fd, &sptd, &tmp );
 
-        if( i_ret == 0 )
-        {
-            *pi_copyright = p_buffer[ 4 ];
-        }
+    if( i_ret == 0 )
+    {
+        *pi_copyright = p_buffer[ 4 ];
+    }
 
 #elif defined( __QNXNTO__ )
 
@@ -313,24 +313,24 @@ int ioctl_ReadDiscKey( int i_fd, int *pi_agid, uint8_t *p_key )
     memcpy( p_key, dvdbs.discKeyStructures, DVD_DISCKEY_SIZE );
 
 #elif defined( WIN32 )
-        DWORD tmp;
-        uint8_t buffer[DVD_DISK_KEY_LENGTH] = { 0 };
-        PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
+    DWORD tmp;
+    uint8_t buffer[DVD_DISK_KEY_LENGTH] = { 0 };
+    PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
 
-        key->KeyLength  = DVD_DISK_KEY_LENGTH;
-        key->SessionId  = *pi_agid;
-        key->KeyType    = DvdDiskKey;
-        key->KeyFlags   = 0;
+    key->KeyLength  = DVD_DISK_KEY_LENGTH;
+    key->SessionId  = *pi_agid;
+    key->KeyType    = DvdDiskKey;
+    key->KeyFlags   = 0;
 
-        i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
-                key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
+    i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
+            key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
 
-        if( i_ret < 0 )
-        {
-            return i_ret;
-        }
+    if( i_ret < 0 )
+    {
+        return i_ret;
+    }
 
-        memcpy( p_key, key->KeyData, DVD_DISCKEY_SIZE );
+    memcpy( p_key, key->KeyData, DVD_DISCKEY_SIZE );
 
 #elif defined( __QNXNTO__ )
 
@@ -445,21 +445,21 @@ int ioctl_ReadTitleKey( int i_fd, int *pi_agid, int i_pos, uint8_t *p_key )
     memcpy( p_key, dvdbs.titleKeyValue, DVD_KEY_SIZE );
 
 #elif defined( WIN32 )
-        DWORD tmp;
-        uint8_t buffer[DVD_TITLE_KEY_LENGTH] = { 0 };
-        PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
+    DWORD tmp;
+    uint8_t buffer[DVD_TITLE_KEY_LENGTH] = { 0 };
+    PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
 
-        key->KeyLength  = DVD_TITLE_KEY_LENGTH;
-        key->SessionId  = *pi_agid;
-        key->KeyType    = DvdTitleKey;
-        key->KeyFlags   = 0;
-        key->Parameters.TitleOffset.QuadPart = (LONGLONG) i_pos *
-                                                   2048 /*DVDCSS_BLOCK_SIZE*/;
+    key->KeyLength  = DVD_TITLE_KEY_LENGTH;
+    key->SessionId  = *pi_agid;
+    key->KeyType    = DvdTitleKey;
+    key->KeyFlags   = 0;
+    key->Parameters.TitleOffset.QuadPart = (LONGLONG) i_pos *
+                                               2048 /*DVDCSS_BLOCK_SIZE*/;
 
-        i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
-                key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
+    i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
+            key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
 
-        memcpy( p_key, key->KeyData, DVD_KEY_SIZE );
+    memcpy( p_key, key->KeyData, DVD_KEY_SIZE );
 
 #elif defined( __QNXNTO__ )
 
@@ -561,13 +561,13 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
     *pi_agid = dvdbs.grantID;
 
 #elif defined( WIN32 )
-        ULONG id;
-        DWORD tmp;
+    ULONG id;
+    DWORD tmp;
 
-        i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_START_SESSION,
-                        &tmp, 4, &id, sizeof( id ), &tmp, NULL ) ? 0 : -1;
+    i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_START_SESSION,
+                    &tmp, 4, &id, sizeof( id ), &tmp, NULL ) ? 0 : -1;
 
-        *pi_agid = id;
+    *pi_agid = id;
 
 #elif defined( __QNXNTO__ )
 
@@ -658,24 +658,24 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
     memcpy( p_challenge, dvdbs.challengeKeyValue, DVD_CHALLENGE_SIZE );
 
 #elif defined( WIN32 )
-        DWORD tmp;
-        uint8_t buffer[DVD_CHALLENGE_KEY_LENGTH] = { 0 };
-        PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
+    DWORD tmp;
+    uint8_t buffer[DVD_CHALLENGE_KEY_LENGTH] = { 0 };
+    PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
 
-        key->KeyLength  = DVD_CHALLENGE_KEY_LENGTH;
-        key->SessionId  = *pi_agid;
-        key->KeyType    = DvdChallengeKey;
-        key->KeyFlags   = 0;
+    key->KeyLength  = DVD_CHALLENGE_KEY_LENGTH;
+    key->SessionId  = *pi_agid;
+    key->KeyType    = DvdChallengeKey;
+    key->KeyFlags   = 0;
 
-        i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
-                key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
+    i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
+            key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
 
-        if( i_ret < 0 )
-        {
-            return i_ret;
-        }
+    if( i_ret < 0 )
+    {
+        return i_ret;
+    }
 
-        memcpy( p_challenge, key->KeyData, DVD_CHALLENGE_SIZE );
+    memcpy( p_challenge, key->KeyData, DVD_CHALLENGE_SIZE );
 
 #elif defined( __QNXNTO__ )
 
@@ -764,28 +764,28 @@ int ioctl_ReportASF( int i_fd, int *pi_asf )
     *pi_asf = dvdbs.successFlag;
 
 #elif defined( WIN32 )
-        DWORD tmp;
-        uint8_t buffer[DVD_ASF_LENGTH] = { 0 };
-        PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
-        PDVD_ASF keyData;
+    DWORD tmp;
+    uint8_t buffer[DVD_ASF_LENGTH] = { 0 };
+    PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
+    PDVD_ASF keyData;
 
-        key->KeyLength  = DVD_ASF_LENGTH;
-        key->KeyType    = DvdAsf;
-        key->KeyFlags   = 0;
+    key->KeyLength  = DVD_ASF_LENGTH;
+    key->KeyType    = DvdAsf;
+    key->KeyFlags   = 0;
 
-        keyData = (PDVD_ASF)key->KeyData;
-        keyData->SuccessFlag = *pi_asf;
+    keyData = (PDVD_ASF)key->KeyData;
+    keyData->SuccessFlag = *pi_asf;
 
-        i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
-                key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
+    i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
+            key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
 
-        if( i_ret < 0 )
-        {
-            return i_ret;
-        }
+    if( i_ret < 0 )
+    {
+        return i_ret;
+    }
 
-        keyData = (PDVD_ASF)key->KeyData;
-        *pi_asf = keyData->SuccessFlag;
+    keyData = (PDVD_ASF)key->KeyData;
+    *pi_asf = keyData->SuccessFlag;
 
 #elif defined( __QNXNTO__ )
 
@@ -876,19 +876,19 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, uint8_t *p_key )
     memcpy( p_key, dvdbs.key1Value, DVD_KEY_SIZE );
 
 #elif defined( WIN32 )
-        DWORD tmp;
-        uint8_t buffer[DVD_BUS_KEY_LENGTH] = { 0 };
-        PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
+    DWORD tmp;
+    uint8_t buffer[DVD_BUS_KEY_LENGTH] = { 0 };
+    PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
 
-        key->KeyLength  = DVD_BUS_KEY_LENGTH;
-        key->SessionId  = *pi_agid;
-        key->KeyType    = DvdBusKey1;
-        key->KeyFlags   = 0;
+    key->KeyLength  = DVD_BUS_KEY_LENGTH;
+    key->SessionId  = *pi_agid;
+    key->KeyType    = DvdBusKey1;
+    key->KeyFlags   = 0;
 
-        i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
-                key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
+    i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
+            key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
 
-        memcpy( p_key, key->KeyData, DVD_KEY_SIZE );
+    memcpy( p_key, key->KeyData, DVD_KEY_SIZE );
 
 #elif defined( __QNXNTO__ )
 
@@ -969,10 +969,10 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
     i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
 
 #elif defined( WIN32 )
-        DWORD tmp;
+    DWORD tmp;
 
-        i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_END_SESSION,
-                    pi_agid, sizeof( *pi_agid ), NULL, 0, &tmp, NULL ) ? 0 : -1;
+    i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_END_SESSION,
+                pi_agid, sizeof( *pi_agid ), NULL, 0, &tmp, NULL ) ? 0 : -1;
 
 #elif defined( __QNXNTO__ )
 
@@ -1066,19 +1066,19 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
     i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
 
 #elif defined( WIN32 )
-        DWORD tmp;
-        uint8_t buffer[DVD_CHALLENGE_KEY_LENGTH] = { 0 };
-        PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
+    DWORD tmp;
+    uint8_t buffer[DVD_CHALLENGE_KEY_LENGTH] = { 0 };
+    PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
 
-        key->KeyLength  = DVD_CHALLENGE_KEY_LENGTH;
-        key->SessionId  = *pi_agid;
-        key->KeyType    = DvdChallengeKey;
-        key->KeyFlags   = 0;
+    key->KeyLength  = DVD_CHALLENGE_KEY_LENGTH;
+    key->SessionId  = *pi_agid;
+    key->KeyType    = DvdChallengeKey;
+    key->KeyFlags   = 0;
 
-        memcpy( key->KeyData, p_challenge, DVD_CHALLENGE_SIZE );
+    memcpy( key->KeyData, p_challenge, DVD_CHALLENGE_SIZE );
 
-        i_ret = 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;
 
 #elif defined( __QNXNTO__ )
 
@@ -1175,19 +1175,19 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, uint8_t *p_key )
     i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
 
 #elif defined( WIN32 )
-        DWORD tmp;
-        uint8_t buffer[DVD_BUS_KEY_LENGTH] = { 0 };
-        PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
+    DWORD tmp;
+    uint8_t buffer[DVD_BUS_KEY_LENGTH] = { 0 };
+    PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
 
-        key->KeyLength  = DVD_BUS_KEY_LENGTH;
-        key->SessionId  = *pi_agid;
-        key->KeyType    = DvdBusKey2;
-        key->KeyFlags   = 0;
+    key->KeyLength  = DVD_BUS_KEY_LENGTH;
+    key->SessionId  = *pi_agid;
+    key->KeyType    = DvdBusKey2;
+    key->KeyFlags   = 0;
 
-        memcpy( key->KeyData, p_key, DVD_KEY_SIZE );
+    memcpy( key->KeyData, p_key, DVD_KEY_SIZE );
 
-        i_ret = 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;
 
 #elif defined( __QNXNTO__ )
 
@@ -1292,27 +1292,27 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )
     *p_scheme = dvdbs.rpcScheme;
 
 #elif defined( WIN32 )
-        DWORD tmp;
-        uint8_t buffer[DVD_RPC_KEY_LENGTH] = { 0 };
-        PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
-        PDVD_RPC_KEY keyData;
+    DWORD tmp;
+    uint8_t buffer[DVD_RPC_KEY_LENGTH] = { 0 };
+    PDVD_COPY_PROTECT_KEY key = (PDVD_COPY_PROTECT_KEY) &buffer;
+    PDVD_RPC_KEY keyData;
 
-        key->KeyLength  = DVD_RPC_KEY_LENGTH;
-        key->KeyType    = DvdGetRpcKey;
-        key->KeyFlags   = 0;
+    key->KeyLength  = DVD_RPC_KEY_LENGTH;
+    key->KeyType    = DvdGetRpcKey;
+    key->KeyFlags   = 0;
 
-        i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
-                key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
+    i_ret = DeviceIoControl( (HANDLE) i_fd, IOCTL_DVD_READ_KEY, key,
+            key->KeyLength, key, key->KeyLength, &tmp, NULL ) ? 0 : -1;
 
-        if( i_ret < 0 )
-        {
-            return i_ret;
-        }
+    if( i_ret < 0 )
+    {
+        return i_ret;
+    }
 
-        keyData = (PDVD_RPC_KEY)key->KeyData;
-        *p_type = keyData->TypeCode;
-        *p_mask = keyData->RegionMask;
-        *p_scheme = keyData->RpcScheme;
+    keyData = (PDVD_RPC_KEY)key->KeyData;
+    *p_type = keyData->TypeCode;
+    *p_mask = keyData->RegionMask;
+    *p_scheme = keyData->RpcScheme;
 
 #elif defined( __QNXNTO__ )
 
diff --git a/test/dvd_region.c b/test/dvd_region.c
index a41eff1..4b61be5 100644
--- a/test/dvd_region.c
+++ b/test/dvd_region.c
@@ -90,14 +90,14 @@ static int ioctl_SendRPC( int i_fd, int i_pdrc )
     i_ret = ioctl( i_fd, DKIOCDVDSENDKEY, &dvd );
 
 #elif defined( WIN32 )
-        INIT_SPTD( GPCMD_SEND_KEY, 8 );
+    INIT_SPTD( GPCMD_SEND_KEY, 8 );
 
-        sptd.Cdb[ 10 ] = DVD_SEND_RPC;
+    sptd.Cdb[ 10 ] = DVD_SEND_RPC;
 
-        p_buffer[ 1 ] = 6;
-        p_buffer[ 4 ] = i_pdrc;
+    p_buffer[ 1 ] = 6;
+    p_buffer[ 4 ] = i_pdrc;
 
-        i_ret = SEND_SPTD( i_fd, &sptd, &tmp );
+    i_ret = SEND_SPTD( i_fd, &sptd, &tmp );
 
 #elif defined( __QNXNTO__ )
 
-- 
1.9.1



More information about the libdvdcss-devel mailing list