shithub: libdvdcss

Download patch

ref: b468e1f1ac9c4ec594aedcd68911bd1d2acff929
parent: f25268db2b31006b3aa0ffeb011482328e0a86aa
author: Diego Biurrun <diego@biurrun.de>
date: Wed Feb 13 19:45:18 EST 2013

build: Refactor system-specific ifdeffery around raw device access

Signed-off-by: Diego Biurrun <diego@biurrun.de>
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>

--- a/src/device.c
+++ b/src/device.c
@@ -410,7 +410,7 @@
     }
 }
 
-#if !defined(WIN32) && !defined(__OS2__)
+#ifdef DVDCSS_RAW_OPEN
 int _dvdcss_raw_open ( dvdcss_t dvdcss, char const *psz_device )
 {
     dvdcss->i_raw_fd = open( psz_device, 0 );
@@ -463,7 +463,7 @@
 #else
     close( dvdcss->i_fd );
 
-#ifndef __OS2__
+#ifdef DVDCSS_RAW_OPEN
     if( dvdcss->i_raw_fd >= 0 )
     {
         close( dvdcss->i_raw_fd );
--- a/src/device.h
+++ b/src/device.h
@@ -45,6 +45,11 @@
 
 #include "dvdcss/dvdcss.h"
 
+#if !defined(WIN32) && !defined(__OS2__)
+#   define DVDCSS_RAW_OPEN
+#endif
+
+
 /*****************************************************************************
  * Device reading prototypes
  *****************************************************************************/
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -167,7 +167,7 @@
     char *psz_method = getenv( "DVDCSS_METHOD" );
     char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
     char *psz_cache = getenv( "DVDCSS_CACHE" );
-#if !defined(WIN32) && !defined(__OS2__)
+#ifdef DVDCSS_RAW_OPEN
     char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );
 #endif
 
@@ -185,7 +185,7 @@
     /*
      *  Initialize structure with default values
      */
-#if !defined(WIN32) && !defined(__OS2__)
+#ifdef DVDCSS_RAW_OPEN
     dvdcss->i_raw_fd = -1;
 #endif
     dvdcss->p_titles = NULL;
@@ -549,7 +549,7 @@
     }
     nocache:
 
-#if !defined(WIN32) && !defined(__OS2__)
+#ifdef DVDCSS_RAW_OPEN
     if( psz_raw_device != NULL )
     {
         _dvdcss_raw_open( dvdcss, psz_raw_device );
--- a/src/libdvdcss.h
+++ b/src/libdvdcss.h
@@ -27,9 +27,8 @@
 
 #include "dvdcss/dvdcss.h"
 #include "css.h"
+#include "device.h"
 
-struct iovec;
-
 /*****************************************************************************
  * The libdvdcss structure
  *****************************************************************************/
@@ -68,7 +67,7 @@
     int    i_readv_buf_size;
 #endif
 
-#if !defined(WIN32) && !defined(__OS2__)
+#ifdef DVDCSS_RAW_OPEN
     int    i_raw_fd;
 #endif
 };