[libdvdcss-devel] [PATCH 4/7] Replace dvdcss_t typedef by "struct dvdcss *".

Diego Biurrun diego at biurrun.de
Tue Nov 4 20:15:03 CET 2014


The _t namespace is reserved by POSIX, so dvdcss_t invades the POSIX namespace.
Furthermore typedeffing a pointer to a struct makes declaring the structure as
const harder. Structs as parameters allow  for more complete const correctness.
---

Don't like this?  Look at the next patch, which this one makes possible.

 src/css.c           | 33 +++++++++++++++++----------------
 src/css.h           |  6 +++---
 src/device.c        | 42 +++++++++++++++++++++---------------------
 src/device.h        | 10 +++++-----
 src/dvdcss/dvdcss.h | 16 ++++++++--------
 src/error.c         |  2 +-
 src/libdvdcss.c     | 28 ++++++++++++++--------------
 src/libdvdcss.h     | 10 +++++-----
 test/csstest.c      |  2 +-
 test/dvd_region.c   |  2 +-
 10 files changed, 76 insertions(+), 75 deletions(-)

diff --git a/src/css.c b/src/css.c
index f986424..8995de8 100644
--- a/src/css.c
+++ b/src/css.c
@@ -66,29 +66,29 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static void PrintKey        ( dvdcss_t, const char *, const uint8_t * );
+static void PrintKey        ( struct dvdcss *, const char *, const uint8_t * );
 
-static int  GetBusKey       ( dvdcss_t );
-static int  GetASF          ( dvdcss_t );
+static int  GetBusKey       ( struct dvdcss * );
+static int  GetASF          ( struct dvdcss * );
 
 static void CryptKey        ( int, int, const uint8_t *, uint8_t * );
 static void DecryptKey      ( uint8_t,
                               const uint8_t *, const uint8_t *, uint8_t * );
 
-static int  DecryptDiscKey  ( dvdcss_t, const uint8_t *, dvd_key );
-static int  CrackDiscKey    ( dvdcss_t, uint8_t * );
+static int  DecryptDiscKey  ( struct dvdcss *, const uint8_t *, dvd_key );
+static int  CrackDiscKey    ( struct dvdcss *, uint8_t * );
 
 static void DecryptTitleKey ( dvd_key, dvd_key );
 static int  RecoverTitleKey ( int, const uint8_t *,
                               const uint8_t *, const uint8_t *, uint8_t * );
-static int  CrackTitleKey   ( dvdcss_t, int, int, dvd_key );
+static int  CrackTitleKey   ( struct dvdcss *, int, int, dvd_key );
 
 static int  AttackPattern   ( const uint8_t[], uint8_t * );
 #if 0
 static int  AttackPadding   ( const uint8_t[] );
 #endif
 
-static int  dvdcss_titlekey ( dvdcss_t, int, dvd_key );
+static int  dvdcss_titlekey ( struct dvdcss *, int, dvd_key );
 
 /*****************************************************************************
  * dvdcss_test: check if the disc is encrypted or not
@@ -101,7 +101,7 @@ static int  dvdcss_titlekey ( dvdcss_t, int, dvd_key );
  *  -3: drive is RPC-II, region is not set, and DVD is scrambled: the RPC
  *      scheme will prevent us from reading the scrambled data
  *****************************************************************************/
-int dvdcss_test( dvdcss_t dvdcss )
+int dvdcss_test( struct dvdcss *dvdcss )
 {
     const char *psz_type, *psz_rpc;
     int i_ret, i_copyright, i_type, i_mask, i_rpc;
@@ -180,7 +180,7 @@ int dvdcss_test( dvdcss_t dvdcss )
  * This function should only be called by dvdcss->pf_seek and should eventually
  * not be external if possible.
  *****************************************************************************/
-int dvdcss_title ( dvdcss_t dvdcss, int i_block )
+int dvdcss_title ( struct dvdcss *dvdcss, int i_block )
 {
     struct dvd_title *p_title;
     struct dvd_title *p_newtitle;
@@ -332,7 +332,7 @@ int dvdcss_title ( dvdcss_t dvdcss, int i_block )
  *  -disc key hash crack,
  *  -decryption with player keys if they are available.
  *****************************************************************************/
-int dvdcss_disckey( dvdcss_t dvdcss )
+int dvdcss_disckey( struct dvdcss *dvdcss )
 {
     unsigned char p_buffer[ DVD_DISCKEY_SIZE ];
     dvd_key p_disc_key;
@@ -418,7 +418,7 @@ int dvdcss_disckey( dvdcss_t dvdcss )
 /*****************************************************************************
  * dvdcss_titlekey: get title key.
  *****************************************************************************/
-static int dvdcss_titlekey( dvdcss_t dvdcss, int i_pos, dvd_key p_title_key )
+static int dvdcss_titlekey( struct dvdcss *dvdcss, int i_pos, dvd_key p_title_key )
 {
     static uint8_t p_garbage[ DVDCSS_BLOCK_SIZE ];  /* we never read it back */
     uint8_t p_key[ KEY_SIZE ];
@@ -588,7 +588,7 @@ int dvdcss_unscramble( dvd_key p_key, uint8_t *p_sec )
  * that ASF=1 from the start and then later fail with a 'read of scrambled
  * block without authentication' error.
  *****************************************************************************/
-static int GetBusKey( dvdcss_t dvdcss )
+static int GetBusKey( struct dvdcss *dvdcss )
 {
     uint8_t   p_buffer[10];
     uint8_t   p_challenge[2*KEY_SIZE];
@@ -740,7 +740,7 @@ static void PrintKey( dvdcss_t dvdcss, const char *prefix, const uint8_t *data )
  *  0 if the device needs to be authenticated,
  *  1 either.
  *****************************************************************************/
-static int GetASF( dvdcss_t dvdcss )
+static int GetASF( struct dvdcss *dvdcss )
 {
     int i_asf = 0;
 
@@ -1080,7 +1080,8 @@ static const dvd_key player_keys[] =
  * p_struct_disckey: the 2048 byte DVD_STRUCT_DISCKEY data
  * p_disc_key: result, the 5 byte disc key
  *****************************************************************************/
-static int DecryptDiscKey( dvdcss_t dvdcss, const uint8_t *p_struct_disckey,
+static int DecryptDiscKey( struct dvdcss *dvdcss,
+                           const uint8_t *p_struct_disckey,
                            dvd_key p_disc_key )
 {
     uint8_t p_verify[KEY_SIZE];
@@ -1149,7 +1150,7 @@ static int investigate( unsigned char *hash, unsigned char *ckey )
     return memcmp( key, ckey, KEY_SIZE );
 }
 
-static int CrackDiscKey( dvdcss_t dvdcss, uint8_t *p_disc_key )
+static int CrackDiscKey( struct dvdcss *dvdcss, uint8_t *p_disc_key )
 {
     unsigned char B[5] = { 0,0,0,0,0 }; /* Second Stage of mangle cipher */
     unsigned char C[5] = { 0,0,0,0,0 }; /* Output Stage of mangle cipher
@@ -1487,7 +1488,7 @@ static int i_tries = 0, i_success = 0;
  * The DVD should have been opened and be in an authenticated state.
  * i_pos is the starting sector, i_len is the maximum number of sectors to read
  *****************************************************************************/
-static int CrackTitleKey( dvdcss_t dvdcss, int i_pos, int i_len,
+static int CrackTitleKey( struct dvdcss *dvdcss, int i_pos, int i_len,
                           dvd_key p_titlekey )
 {
     uint8_t       p_buf[ DVDCSS_BLOCK_SIZE ];
diff --git a/src/css.h b/src/css.h
index f576e63..bd6a804 100644
--- a/src/css.h
+++ b/src/css.h
@@ -57,9 +57,9 @@ typedef struct css
 /*****************************************************************************
  * Prototypes in css.c
  *****************************************************************************/
-int dvdcss_test       ( dvdcss_t );
-int dvdcss_title      ( dvdcss_t, int );
-int dvdcss_disckey    ( dvdcss_t );
+int dvdcss_test       ( struct dvdcss * );
+int dvdcss_title      ( struct dvdcss *, int );
+int dvdcss_disckey    ( struct dvdcss * );
 int dvdcss_unscramble ( uint8_t *, uint8_t * );
 
 #endif /* DVDCSS_CSS_H */
diff --git a/src/device.c b/src/device.c
index aeafe31..5735d8b 100644
--- a/src/device.c
+++ b/src/device.c
@@ -77,16 +77,16 @@
 /*****************************************************************************
  * Device reading prototypes
  *****************************************************************************/
-static int libc_open  ( dvdcss_t, const char * );
-static int libc_seek  ( dvdcss_t, int );
-static int libc_read  ( dvdcss_t, void *, int );
-static int libc_readv ( dvdcss_t, struct iovec *, int );
+static int libc_open  ( struct dvdcss *, const char * );
+static int libc_seek  ( struct dvdcss *, int );
+static int libc_read  ( struct dvdcss *, void *, int );
+static int libc_readv ( struct dvdcss *, struct iovec *, int );
 
 #ifdef WIN32
-static int win2k_open  ( dvdcss_t, const char * );
-static int win2k_seek  ( dvdcss_t, int );
-static int win2k_read  ( dvdcss_t, void *, int );
-static int win2k_readv ( dvdcss_t, struct iovec *, int );
+static int win2k_open  ( struct dvdcss *, const char * );
+static int win2k_seek  ( struct dvdcss *, int );
+static int win2k_read  ( struct dvdcss *, void *, int );
+static int win2k_readv ( struct dvdcss *, struct iovec *, int );
 
 #elif defined( __OS2__ )
 static int os2_open ( dvdcss_t, const char * );
@@ -96,7 +96,7 @@ static int os2_open ( dvdcss_t, const char * );
 #   define os2_readv    libc_readv
 #endif
 
-int dvdcss_use_ioctls( dvdcss_t dvdcss )
+int dvdcss_use_ioctls( struct dvdcss *dvdcss )
 {
 #if defined( WIN32 )
     if( dvdcss->b_file )
@@ -151,7 +151,7 @@ int dvdcss_use_ioctls( dvdcss_t dvdcss )
 #endif
 }
 
-void dvdcss_check_device ( dvdcss_t dvdcss )
+void dvdcss_check_device ( struct dvdcss *dvdcss )
 {
 #if defined( WIN32 )
     DWORD drives;
@@ -341,7 +341,7 @@ void dvdcss_check_device ( dvdcss_t dvdcss )
     print_error( dvdcss, "could not find a suitable default drive" );
 }
 
-int dvdcss_open_device ( dvdcss_t dvdcss )
+int dvdcss_open_device ( struct dvdcss *dvdcss )
 {
     const char *psz_device = dvdcss->psz_device;
 
@@ -390,7 +390,7 @@ int dvdcss_open_device ( dvdcss_t dvdcss )
 }
 
 #ifdef DVDCSS_RAW_OPEN
-int dvdcss_raw_open ( dvdcss_t dvdcss, const char *psz_device )
+int dvdcss_raw_open ( struct dvdcss *dvdcss, const char *psz_device )
 {
     dvdcss->i_raw_fd = open( psz_device, 0 );
 
@@ -410,7 +410,7 @@ int dvdcss_raw_open ( dvdcss_t dvdcss, const char *psz_device )
 }
 #endif /* DVDCSS_RAW_OPEN */
 
-void dvdcss_close_device ( dvdcss_t dvdcss )
+void dvdcss_close_device ( struct dvdcss *dvdcss )
 {
 #if defined( WIN32 )
     if( dvdcss->b_file )
@@ -444,7 +444,7 @@ void dvdcss_close_device ( dvdcss_t dvdcss )
 /*****************************************************************************
  * Open commands.
  *****************************************************************************/
-static int libc_open ( dvdcss_t dvdcss, const char *psz_device )
+static int libc_open ( struct dvdcss *dvdcss, const char *psz_device )
 {
     dvdcss->i_fd = dvdcss->i_read_fd = open( psz_device, O_BINARY );
 
@@ -462,7 +462,7 @@ static int libc_open ( dvdcss_t dvdcss, const char *psz_device )
 }
 
 #if defined( WIN32 )
-static int win2k_open ( dvdcss_t dvdcss, const char *psz_device )
+static int win2k_open ( struct dvdcss *dvdcss, const char *psz_device )
 {
     char psz_dvd[7] = "\\\\.\\\0:";
     psz_dvd[4] = psz_device[0];
@@ -533,7 +533,7 @@ static int os2_open ( dvdcss_t dvdcss, const char *psz_device )
 /*****************************************************************************
  * Seek commands.
  *****************************************************************************/
-static int libc_seek( dvdcss_t dvdcss, int i_blocks )
+static int libc_seek( struct dvdcss *dvdcss, int i_blocks )
 {
     off_t   i_seek;
 
@@ -559,7 +559,7 @@ static int libc_seek( dvdcss_t dvdcss, int i_blocks )
 }
 
 #if defined( WIN32 )
-static int win2k_seek( dvdcss_t dvdcss, int i_blocks )
+static int win2k_seek( struct dvdcss *dvdcss, int i_blocks )
 {
     LARGE_INTEGER li_seek;
 
@@ -590,7 +590,7 @@ static int win2k_seek( dvdcss_t dvdcss, int i_blocks )
 /*****************************************************************************
  * Read commands.
  *****************************************************************************/
-static int libc_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
+static int libc_read ( struct dvdcss *dvdcss, void *p_buffer, int i_blocks )
 {
     off_t i_size, i_ret, i_ret_blocks;
 
@@ -627,7 +627,7 @@ static int libc_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
 }
 
 #if defined( WIN32 )
-static int win2k_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
+static int win2k_read ( struct dvdcss *dvdcss, void *p_buffer, int i_blocks )
 {
     DWORD i_bytes;
 
@@ -648,7 +648,7 @@ static int win2k_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
 /*****************************************************************************
  * Readv commands.
  *****************************************************************************/
-static int libc_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )
+static int libc_readv ( struct dvdcss *dvdcss, struct iovec *p_iovec, int i_blocks )
 {
 #if defined( WIN32 )
     int i_index, i_len, i_total = 0;
@@ -721,7 +721,7 @@ static int libc_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )
 /*****************************************************************************
  * win2k_readv: vectored read using ReadFile for Win2K
  *****************************************************************************/
-static int win2k_readv ( dvdcss_t dvdcss, struct iovec *p_iovec, int i_blocks )
+static int win2k_readv ( struct dvdcss *dvdcss, struct iovec *p_iovec, int i_blocks )
 {
     int i_index;
     int i_blocks_read, i_blocks_total = 0;
diff --git a/src/device.h b/src/device.h
index f56489f..a7ea982 100644
--- a/src/device.h
+++ b/src/device.h
@@ -52,14 +52,14 @@ struct iovec
 /*****************************************************************************
  * Device reading prototypes
  *****************************************************************************/
-int  dvdcss_use_ioctls   ( dvdcss_t );
-void dvdcss_check_device ( dvdcss_t );
-int  dvdcss_open_device  ( dvdcss_t );
-void dvdcss_close_device ( dvdcss_t );
+int  dvdcss_use_ioctls   ( struct dvdcss * );
+void dvdcss_check_device ( struct dvdcss * );
+int  dvdcss_open_device  ( struct dvdcss * );
+void dvdcss_close_device ( struct dvdcss * );
 
 /*****************************************************************************
  * Device reading prototypes, raw-device specific
  *****************************************************************************/
-int dvdcss_raw_open      ( dvdcss_t, const char * );
+int dvdcss_raw_open      ( struct dvdcss *, const char * );
 
 #endif /* DVDCSS_DEVICE_H */
diff --git a/src/dvdcss/dvdcss.h b/src/dvdcss/dvdcss.h
index ea62b8b..f7c6e71 100644
--- a/src/dvdcss/dvdcss.h
+++ b/src/dvdcss/dvdcss.h
@@ -36,7 +36,7 @@ extern "C" {
 #endif
 
 /** Library instance handle, to be used for each library call. */
-typedef struct dvdcss_s* dvdcss_t;
+typedef struct dvdcss* dvdcss_t;
 
 
 /** The block size of a DVD. */
@@ -72,22 +72,22 @@ typedef struct dvdcss_s* dvdcss_t;
 /*
  * Exported prototypes.
  */
-LIBDVDCSS_EXPORT dvdcss_t dvdcss_open  ( const char *psz_target );
-LIBDVDCSS_EXPORT int      dvdcss_close ( dvdcss_t );
-LIBDVDCSS_EXPORT int      dvdcss_seek  ( dvdcss_t,
+LIBDVDCSS_EXPORT struct dvdcss *dvdcss_open  ( const char *psz_target );
+LIBDVDCSS_EXPORT int      dvdcss_close ( struct dvdcss * );
+LIBDVDCSS_EXPORT int      dvdcss_seek  ( struct dvdcss *,
                                int i_blocks,
                                int i_flags );
-LIBDVDCSS_EXPORT int      dvdcss_read  ( dvdcss_t,
+LIBDVDCSS_EXPORT int      dvdcss_read  ( struct dvdcss *,
                                void *p_buffer,
                                int i_blocks,
                                int i_flags );
-LIBDVDCSS_EXPORT int      dvdcss_readv ( dvdcss_t,
+LIBDVDCSS_EXPORT int      dvdcss_readv ( struct dvdcss *,
                                void *p_iovec,
                                int i_blocks,
                                int i_flags );
-LIBDVDCSS_EXPORT const char *dvdcss_error ( const dvdcss_t );
+LIBDVDCSS_EXPORT const char *dvdcss_error ( const struct dvdcss * );
 
-LIBDVDCSS_EXPORT int      dvdcss_is_scrambled ( dvdcss_t );
+LIBDVDCSS_EXPORT int      dvdcss_is_scrambled ( struct dvdcss * );
 
 #ifdef __cplusplus
 }
diff --git a/src/error.c b/src/error.c
index 00aee4a..560fb5c 100644
--- a/src/error.c
+++ b/src/error.c
@@ -29,7 +29,7 @@
 /*****************************************************************************
  * Error messages
  *****************************************************************************/
-void print_error( dvdcss_t dvdcss, const char *psz_string )
+void print_error( struct dvdcss *dvdcss, const char *psz_string )
 {
     if( dvdcss->b_errors )
     {
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 00aa4bd..98c18dc 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -145,7 +145,7 @@
 #define MANUFACTURING_DATE_LENGTH  16
 
 
-static void set_verbosity( dvdcss_t dvdcss )
+static void set_verbosity( struct dvdcss *dvdcss )
 {
     const char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
 
@@ -163,7 +163,7 @@ static void set_verbosity( dvdcss_t dvdcss )
     }
 }
 
-static int set_access_method( dvdcss_t dvdcss )
+static int set_access_method( struct dvdcss *dvdcss )
 {
     const char *psz_method = getenv( "DVDCSS_METHOD" );
 
@@ -191,7 +191,7 @@ static int set_access_method( dvdcss_t dvdcss )
     return 0;
 }
 
-static char *set_cache_directory( dvdcss_t dvdcss )
+static char *set_cache_directory( struct dvdcss *dvdcss )
 {
     char *psz_cache = getenv( "DVDCSS_CACHE" );
 
@@ -272,7 +272,7 @@ static char *set_cache_directory( dvdcss_t dvdcss )
     return psz_cache;
 }
 
-static void init_cache_dir( dvdcss_t dvdcss, const char *psz_cache )
+static void init_cache_dir( struct dvdcss *dvdcss, const char *psz_cache )
 {
     static const char psz_tag[] =
         "Signature: 8a477f597d28d172789f06886806bc55\r\n"
@@ -304,7 +304,7 @@ static void init_cache_dir( dvdcss_t dvdcss, const char *psz_cache )
     }
 }
 
-static void create_cache_subdir( dvdcss_t dvdcss, const char *psz_cache )
+static void create_cache_subdir( struct dvdcss *dvdcss, const char *psz_cache )
 {
     uint8_t p_sector[DVDCSS_BLOCK_SIZE];
     char psz_key[STRING_KEY_SIZE + 1];
@@ -420,7 +420,7 @@ static void create_cache_subdir( dvdcss_t dvdcss, const char *psz_cache )
                  dvdcss->psz_cachefile );
 }
 
-static void init_cache( dvdcss_t dvdcss )
+static void init_cache( struct dvdcss *dvdcss )
 {
     /* Set CSS key cache directory. */
     const char *psz_cache = set_cache_directory( dvdcss );
@@ -450,7 +450,7 @@ static void init_cache( dvdcss_t dvdcss )
  * calls. \e libdvdcss checks whether ioctls can be performed on the disc,
  * and when possible, the disc key is retrieved.
  */
-LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
+LIBDVDCSS_EXPORT struct dvdcss *dvdcss_open ( const char *psz_target )
 {
     int i_ret;
 
@@ -459,7 +459,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
 #endif
 
     /* Allocate the library structure. */
-    dvdcss_t dvdcss = malloc( sizeof( *dvdcss ) );
+    struct dvdcss *dvdcss = malloc( sizeof( *dvdcss ) );
     if( dvdcss == NULL )
     {
         return NULL;
@@ -562,7 +562,7 @@ error:
  * Return a string with the last error message produced by \e libdvdcss.
  * Useful to conveniently format error messages in external applications.
  */
-LIBDVDCSS_EXPORT const char * dvdcss_error ( const dvdcss_t dvdcss )
+LIBDVDCSS_EXPORT const char *dvdcss_error ( const struct dvdcss *dvdcss )
 {
     return dvdcss->psz_error;
 }
@@ -590,7 +590,7 @@ LIBDVDCSS_EXPORT const char * dvdcss_error ( const dvdcss_t dvdcss )
  * even with the "title" method. This flag is typically used when seeking
  * in a new title.
  */
-LIBDVDCSS_EXPORT int dvdcss_seek ( dvdcss_t dvdcss, int i_blocks, int i_flags )
+LIBDVDCSS_EXPORT int dvdcss_seek ( struct dvdcss *dvdcss, int i_blocks, int i_flags )
 {
     /* title cracking method is too slow to be used at each seek */
     if( ( ( i_flags & DVDCSS_SEEK_MPEG )
@@ -630,7 +630,7 @@ LIBDVDCSS_EXPORT int dvdcss_seek ( dvdcss_t dvdcss, int i_blocks, int i_flags )
  * \warning dvdcss_read() expects to be able to write \p i_blocks *
  *          #DVDCSS_BLOCK_SIZE bytes into \p p_buffer.
  */
-LIBDVDCSS_EXPORT int dvdcss_read ( dvdcss_t dvdcss, void *p_buffer,
+LIBDVDCSS_EXPORT int dvdcss_read ( struct dvdcss *dvdcss, void *p_buffer,
                                           int i_blocks,
                                           int i_flags )
 {
@@ -704,7 +704,7 @@ LIBDVDCSS_EXPORT int dvdcss_read ( dvdcss_t dvdcss, void *p_buffer,
  *          Moreover, all iov_len members of the iovec structures should be
  *          multiples of #DVDCSS_BLOCK_SIZE.
  */
-LIBDVDCSS_EXPORT int dvdcss_readv ( dvdcss_t dvdcss, void *p_iovec,
+LIBDVDCSS_EXPORT int dvdcss_readv ( struct dvdcss *dvdcss, void *p_iovec,
                                            int i_blocks,
                                            int i_flags )
 {
@@ -761,7 +761,7 @@ LIBDVDCSS_EXPORT int dvdcss_readv ( dvdcss_t dvdcss, void *p_iovec,
  * Close the DVD device and free all the memory allocated by \e libdvdcss.
  * On return, the #dvdcss_t is invalidated and may not be used again.
  */
-LIBDVDCSS_EXPORT int dvdcss_close ( dvdcss_t dvdcss )
+LIBDVDCSS_EXPORT int dvdcss_close ( struct dvdcss *dvdcss )
 {
     struct dvd_title *p_title;
 
@@ -788,7 +788,7 @@ LIBDVDCSS_EXPORT int dvdcss_close ( dvdcss_t dvdcss )
  * \param dvdcss a \e libdvdcss instance.
  * \return 1 if the DVD is scrambled, 0 otherwise.
  */
-LIBDVDCSS_EXPORT int dvdcss_is_scrambled ( dvdcss_t dvdcss )
+LIBDVDCSS_EXPORT int dvdcss_is_scrambled ( struct dvdcss *dvdcss )
 {
     return dvdcss->b_scrambled;
 }
diff --git a/src/libdvdcss.h b/src/libdvdcss.h
index 9750c37..752a764 100644
--- a/src/libdvdcss.h
+++ b/src/libdvdcss.h
@@ -45,7 +45,7 @@ enum dvdcss_method {
 /*****************************************************************************
  * The libdvdcss structure
  *****************************************************************************/
-struct dvdcss_s
+struct dvdcss
 {
     /* File descriptor */
     char * psz_device;
@@ -54,9 +54,9 @@ struct dvdcss_s
     int    i_pos;
 
     /* File handling */
-    int ( * pf_seek )  ( dvdcss_t, int );
-    int ( * pf_read )  ( dvdcss_t, void *, int );
-    int ( * pf_readv ) ( dvdcss_t, struct iovec *, int );
+    int ( * pf_seek )  ( struct dvdcss *, int );
+    int ( * pf_read )  ( struct dvdcss *, void *, int );
+    int ( * pf_readv ) ( struct dvdcss *, struct iovec *, int );
 
     /* Decryption stuff */
     enum dvdcss_method i_method;
@@ -96,6 +96,6 @@ struct dvdcss_s
         fprintf( stderr, "\n" ); \
     }
 
-void print_error ( dvdcss_t, const char * );
+void print_error ( struct dvdcss *, const char * );
 
 #endif /* DVDCSS_LIBDVDCSS_H */
diff --git a/test/csstest.c b/test/csstest.c
index d09565a..e0f9651 100644
--- a/test/csstest.c
+++ b/test/csstest.c
@@ -17,7 +17,7 @@ static void dumpsector ( unsigned char * );
 
 int main( int i_argc, char *ppsz_argv[] )
 {
-    dvdcss_t       dvdcss;
+    struct dvdcss *dvdcss;
     unsigned char  p_data[ DVDCSS_BLOCK_SIZE * 2 ];
     unsigned char *p_buffer;
     unsigned int   i_sector;
diff --git a/test/dvd_region.c b/test/dvd_region.c
index 52fcc9d..53d4693 100644
--- a/test/dvd_region.c
+++ b/test/dvd_region.c
@@ -230,7 +230,7 @@ int main(int argc, char *argv[])
 {
   char device_name[FILENAME_MAX], c, set, region = 0;
   int ret;
-  dvdcss_t dvdcss;
+  struct dvdcss *dvdcss;
 
   strcpy(device_name, DEFAULT_DEVICE);
   set = 0;
-- 
1.9.1



More information about the libdvdcss-devel mailing list