[libdvdcss-devel] [PATCH 2/3] build: Drop unnecessary local SYS_OS2 config.h #define

Diego Biurrun diego at biurrun.de
Wed Feb 13 14:43:51 CET 2013


__OS2__ is always available and can be used instead.

Signed-off-by: Diego Biurrun <diego at biurrun.de>
---
 configure.ac    |    1 -
 src/device.c    |   20 ++++++++++----------
 src/device.h    |    2 +-
 src/ioctl.c     |   30 +++++++++++++++---------------
 src/ioctl.h     |    4 ++--
 src/libdvdcss.c |    8 ++++----
 src/libdvdcss.h |    2 +-
 7 files changed, 33 insertions(+), 34 deletions(-)

diff --git a/configure.ac b/configure.ac
index 11af070..a798ea0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -34,7 +34,6 @@ case x"${target_os}" in
     ;;
   xos2*)
     LDFLAGS="-Zbin-files"
-    AC_DEFINE(SYS_OS2, 1, Have a OS/2 system.)
     ;;
   x*msvc*)
     SYS_MSVC=1
diff --git a/src/device.c b/src/device.c
index 9e55737..e8042f4 100644
--- a/src/device.c
+++ b/src/device.c
@@ -65,7 +65,7 @@
 #   include <IOKit/storage/IODVDMedia.h>
 #endif
 
-#ifdef SYS_OS2
+#ifdef __OS2__
 #   define INCL_DOS
 #   define INCL_DOSDEVIOCTL
 #   include <os2.h>
@@ -99,7 +99,7 @@ static int aspi_read  ( dvdcss_t, void *, int );
 static int win_readv  ( dvdcss_t, struct iovec *, int );
 
 static int aspi_read_internal  ( int, void *, int );
-#elif defined( SYS_OS2 )
+#elif defined( __OS2__ )
 static int os2_open ( dvdcss_t, char const * );
 /* just use macros for libc */
 #   define os2_seek     libc_seek
@@ -124,7 +124,7 @@ int _dvdcss_use_ioctls( dvdcss_t dvdcss )
     {
         return 1;
     }
-#elif defined( SYS_OS2 )
+#elif defined( __OS2__ )
     ULONG ulMode;
 
     if( DosQueryFHState( dvdcss->i_fd, &ulMode ) != 0 )
@@ -181,7 +181,7 @@ void _dvdcss_check ( dvdcss_t dvdcss )
     kern_return_t kern_result;
     io_iterator_t media_iterator;
     CFMutableDictionaryRef classes_to_match;
-#elif defined( SYS_OS2 )
+#elif defined( __OS2__ )
 #pragma pack( 1 )
     struct
     {
@@ -316,7 +316,7 @@ void _dvdcss_check ( dvdcss_t dvdcss )
     }
 
     IOObjectRelease( media_iterator );
-#elif defined( SYS_OS2 )
+#elif defined( __OS2__ )
     for( i = 0; i < 26; i++ )
     {
         param.bCmdInfo = 0;
@@ -394,7 +394,7 @@ int _dvdcss_open ( dvdcss_t dvdcss )
         return aspi_open( dvdcss, psz_device );
     }
     else
-#elif defined( SYS_OS2 )
+#elif defined( __OS2__ )
     /* If device is "X:" or "X:\", we are not actually opening a file. */
     if( psz_device[0] && psz_device[1] == ':' &&
         ( !psz_device[2] || ( psz_device[2] == '\\' && !psz_device[3] ) ) )
@@ -416,7 +416,7 @@ int _dvdcss_open ( dvdcss_t dvdcss )
     }
 }
 
-#if !defined(WIN32) && !defined(SYS_OS2)
+#if !defined(WIN32) && !defined(__OS2__)
 int _dvdcss_raw_open ( dvdcss_t dvdcss, char const *psz_device )
 {
     dvdcss->i_raw_fd = open( psz_device, 0 );
@@ -469,7 +469,7 @@ int _dvdcss_close ( dvdcss_t dvdcss )
 #else
     close( dvdcss->i_fd );
 
-#ifndef SYS_OS2
+#ifndef __OS2__
     if( dvdcss->i_raw_fd >= 0 )
     {
         close( dvdcss->i_raw_fd );
@@ -488,7 +488,7 @@ int _dvdcss_close ( dvdcss_t dvdcss )
  *****************************************************************************/
 static int libc_open ( dvdcss_t dvdcss, char const *psz_device )
 {
-#if !defined( WIN32 ) && !defined( SYS_OS2 )
+#if !defined( WIN32 ) && !defined( __OS2__ )
     dvdcss->i_fd = dvdcss->i_read_fd = open( psz_device, 0 );
 #else
     dvdcss->i_fd = dvdcss->i_read_fd = open( psz_device, O_BINARY );
@@ -664,7 +664,7 @@ static int aspi_open( dvdcss_t dvdcss, char const * psz_device )
 }
 #endif
 
-#ifdef SYS_OS2
+#ifdef __OS2__
 static int os2_open ( dvdcss_t dvdcss, char const *psz_device )
 {
     char  psz_dvd[] = "X:";
diff --git a/src/device.h b/src/device.h
index ed701b1..e5524eb 100644
--- a/src/device.h
+++ b/src/device.h
@@ -57,7 +57,7 @@ int  _dvdcss_close      ( dvdcss_t );
 /*****************************************************************************
  * Device reading prototypes, raw-device specific
  *****************************************************************************/
-#if !defined(WIN32) && !defined(SYS_OS2)
+#if !defined(WIN32) && !defined(__OS2__)
 int _dvdcss_raw_open     ( dvdcss_t, char const * );
 #endif
 
diff --git a/src/ioctl.c b/src/ioctl.c
index 5c7e615..c571027 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -41,7 +41,7 @@
 #if defined( WIN32 )
 #   include <windows.h>
 #   include <winioctl.h>
-#elif defined ( SYS_OS2 )
+#elif defined ( __OS2__ )
 #   define INCL_DOSFILEMGR
 #   define INCL_DOSDEVICES
 #   define INCL_DOSDEVIOCTL
@@ -135,7 +135,7 @@ static void QNXInitCPT ( CAM_PASS_THRU *, int );
 /*****************************************************************************
  * Local prototypes, OS2 specific
  *****************************************************************************/
-#if defined( SYS_OS2 )
+#if defined( __OS2__ )
 static void OS2InitSDC( struct OS2_ExecSCSICmd *, int );
 #endif
 
@@ -257,7 +257,7 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright )
 
     *pi_copyright = p_buffer[4];
 
-#elif defined( SYS_OS2 )
+#elif defined( __OS2__ )
     INIT_SSC( GPCMD_READ_DVD_STRUCTURE, 8 );
 
     sdc.command[ 6 ] = i_layer;
@@ -425,7 +425,7 @@ int ioctl_ReadDiscKey( int i_fd, int *pi_agid, uint8_t *p_key )
 
     memcpy( p_key, p_buffer + 4, DVD_DISCKEY_SIZE );
 
-#elif defined ( SYS_OS2 )
+#elif defined ( __OS2__ )
     INIT_SSC( GPCMD_READ_DVD_STRUCTURE, DVD_DISCKEY_SIZE + 4 );
 
     sdc.command[ 7 ]  = DVD_STRUCT_DISCKEY;
@@ -591,7 +591,7 @@ int ioctl_ReadTitleKey( int i_fd, int *pi_agid, int i_pos, uint8_t *p_key )
 
     memcpy( p_key, p_buffer + 5, DVD_KEY_SIZE );
 
-#elif defined( SYS_OS2 )
+#elif defined( __OS2__ )
     INIT_SSC( GPCMD_REPORT_KEY, 12 );
 
     sdc.command[ 2 ] = ( i_pos >> 24 ) & 0xff;
@@ -719,7 +719,7 @@ int ioctl_ReportAgid( int i_fd, int *pi_agid )
 
     *pi_agid = p_buffer[ 7 ] >> 6;
 
-#elif defined( SYS_OS2 )
+#elif defined( __OS2__ )
     INIT_SSC( GPCMD_REPORT_KEY, 8 );
 
     sdc.command[ 10 ] = DVD_REPORT_AGID | (*pi_agid << 6);
@@ -853,7 +853,7 @@ int ioctl_ReportChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
 
     memcpy( p_challenge, p_buffer + 4, DVD_CHALLENGE_SIZE );
 
-#elif defined( SYS_OS2 )
+#elif defined( __OS2__ )
     INIT_SSC( GPCMD_REPORT_KEY, 16 );
 
     sdc.command[ 10 ] = DVD_REPORT_CHALLENGE | (*pi_agid << 6);
@@ -986,7 +986,7 @@ int ioctl_ReportASF( int i_fd, int *pi_remove_me, int *pi_asf )
 
     *pi_asf = p_buffer[ 7 ] & 1;
 
-#elif defined( SYS_OS2 )
+#elif defined( __OS2__ )
     INIT_SSC( GPCMD_REPORT_KEY, 8 );
 
     sdc.command[ 10 ] = DVD_REPORT_ASF;
@@ -1115,7 +1115,7 @@ int ioctl_ReportKey1( int i_fd, int *pi_agid, uint8_t *p_key )
 
     memcpy( p_key, p_buffer + 4, DVD_KEY_SIZE );
 
-#elif defined( SYS_OS2 )
+#elif defined( __OS2__ )
     INIT_SSC( GPCMD_REPORT_KEY, 12 );
 
     sdc.command[ 10 ] = DVD_REPORT_KEY1 | (*pi_agid << 6);
@@ -1225,7 +1225,7 @@ int ioctl_InvalidateAgid( int i_fd, int *pi_agid )
 
     i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
 
-#elif defined( SYS_OS2 )
+#elif defined( __OS2__ )
     INIT_SSC( GPCMD_REPORT_KEY, 1 );
 
     sdc.data_length = 0;
@@ -1362,7 +1362,7 @@ int ioctl_SendChallenge( int i_fd, int *pi_agid, uint8_t *p_challenge )
 
     i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
 
-#elif defined( SYS_OS2 )
+#elif defined( __OS2__ )
     INIT_SSC( GPCMD_SEND_KEY, 16 );
 
     sdc.command[ 10 ] = DVD_SEND_CHALLENGE | (*pi_agid << 6);
@@ -1499,7 +1499,7 @@ int ioctl_SendKey2( int i_fd, int *pi_agid, uint8_t *p_key )
 
     i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
 
-#elif defined( SYS_OS2 )
+#elif defined( __OS2__ )
     INIT_SSC( GPCMD_SEND_KEY, 12 );
 
     sdc.command[ 10 ] = DVD_SEND_KEY2 | (*pi_agid << 6);
@@ -1653,7 +1653,7 @@ int ioctl_ReportRPC( int i_fd, int *p_type, int *p_mask, int *p_scheme )
     *p_mask = p_buffer[ 5 ];
     *p_scheme = p_buffer[ 6 ];
 
-#elif defined( SYS_OS2 )
+#elif defined( __OS2__ )
     INIT_SSC( GPCMD_REPORT_KEY, 8 );
 
     sdc.command[ 10 ] = DVD_REPORT_RPC;
@@ -1781,7 +1781,7 @@ int ioctl_SendRPC( int i_fd, int i_pdrc )
 
     i_ret = devctl(i_fd, DCMD_CAM_PASS_THRU, p_cpt, structSize, NULL);
 
-#elif defined( SYS_OS2 )
+#elif defined( __OS2__ )
     INIT_SSC( GPCMD_SEND_KEY, 8 );
 
     sdc.command[ 10 ] = DVD_SEND_RPC;
@@ -2093,7 +2093,7 @@ static void QNXInitCPT( CAM_PASS_THRU * p_cpt, int i_type )
 }
 #endif
 
-#if defined( SYS_OS2 )
+#if defined( __OS2__ )
 /*****************************************************************************
  * OS2InitSDC: initialize a SDC structure for the Execute SCSI-command
  *****************************************************************************
diff --git a/src/ioctl.h b/src/ioctl.h
index c0bc7d5..81c660a 100644
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -144,7 +144,7 @@ int ioctl_SendRPC           ( int, int );
 /*****************************************************************************
  * Common macro, OS2 specific
  *****************************************************************************/
-#if defined( SYS_OS2 )
+#if defined( __OS2__ )
 #define INIT_SSC( TYPE, SIZE ) \
     struct OS2_ExecSCSICmd sdc; \
     uint8_t p_buffer[ (SIZE)+1 ]; \
@@ -406,7 +406,7 @@ struct SRB_ExecSCSICmd
 /*****************************************************************************
  * OS2 ioctl specific
  *****************************************************************************/
-#if defined( SYS_OS2 )
+#if defined( __OS2__ )
 
 #define CDROMDISK_EXECMD      0x7A
 
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 4a09084..b10f598 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -170,7 +170,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
     char *psz_method = getenv( "DVDCSS_METHOD" );
     char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
     char *psz_cache = getenv( "DVDCSS_CACHE" );
-#if !defined(WIN32) && !defined(SYS_OS2)
+#if !defined(WIN32) && !defined(__OS2__)
     char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );
 #endif
 
@@ -188,7 +188,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
     /*
      *  Initialize structure with default values
      */
-#if !defined(WIN32) && !defined(SYS_OS2)
+#if !defined(WIN32) && !defined(__OS2__)
     dvdcss->i_raw_fd = -1;
 #endif
     dvdcss->p_titles = NULL;
@@ -312,7 +312,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
         {
             int home_pos = 0;
 
-#ifdef SYS_OS2
+#ifdef __OS2__
             if( *psz_home == '/' || *psz_home == '\\')
             {
                 char *psz_unixroot = getenv("UNIXROOT");
@@ -552,7 +552,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
     }
     nocache:
 
-#if !defined(WIN32) && !defined(SYS_OS2)
+#if !defined(WIN32) && !defined(__OS2__)
     if( psz_raw_device != NULL )
     {
         _dvdcss_raw_open( dvdcss, psz_raw_device );
diff --git a/src/libdvdcss.h b/src/libdvdcss.h
index 3dcbedb..6be963c 100644
--- a/src/libdvdcss.h
+++ b/src/libdvdcss.h
@@ -68,7 +68,7 @@ struct dvdcss_s
     int    i_readv_buf_size;
 #endif
 
-#if !defined(WIN32) && !defined(SYS_OS2)
+#if !defined(WIN32) && !defined(__OS2__)
     int    i_raw_fd;
 #endif
 };
-- 
1.7.9.5



More information about the libdvdcss-devel mailing list