[libdvdcss-devel] [PATCH 10/47] Drop leading underscore from externally visible function names.

Diego Biurrun <[email protected]>
Newsgroups gmane.comp.video.videolan.libdvdcss,gmane.comp.video.videolan.libdvdcss.devel
Message-ID <[email protected]>
C99 reserves identifier names starting with an underscore at the file level.
---
 src/css.c       | 40 ++++++++++++++++++++--------------------
 src/css.h       |  8 ++++----
 src/device.c    | 10 +++++-----
 src/device.h    | 10 +++++-----
 src/libdvdcss.c | 20 ++++++++++----------
 5 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/src/css.c b/src/css.c
index 68eaf4b..f4f82d1 100644
--- a/src/css.c
+++ b/src/css.c
@@ -88,10 +88,10 @@ static int  AttackPattern   ( uint8_t const[], uint8_t * );
 static int  AttackPadding   ( uint8_t const[] );
 #endif
 
-static int  _dvdcss_titlekey    ( dvdcss_t, int , dvd_key_t );
+static int  dvdcss_titlekey    ( dvdcss_t, int , dvd_key_t );
 
 /*****************************************************************************
- * _dvdcss_test: check if the disc is encrypted or not
+ * dvdcss_test: check if the disc is encrypted or not
  *****************************************************************************
  * Return values:
  *   1: DVD is scrambled but can be read
@@ -101,7 +101,7 @@ static int  _dvdcss_titlekey    ( dvdcss_t, int , dvd_key_t );
  *  -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( dvdcss_t dvdcss )
 {
     const char *psz_type, *psz_rpc;
     int i_ret, i_copyright, i_type, i_mask, i_rpc;
@@ -113,11 +113,11 @@ int _dvdcss_test( dvdcss_t dvdcss )
     {
         /* Maybe we didn't have enough privileges to read the copyright
          * (see ioctl_ReadCopyright comments).
-         * Apparently, on unencrypted DVDs _dvdcss_disckey() always fails, so
+         * Apparently, on unencrypted DVDs dvdcss_disckey() always fails, so
          * we can check this as a workaround. */
         i_ret = 0;
         i_copyright = 1;
-        if( _dvdcss_disckey( dvdcss ) < 0 )
+        if( dvdcss_disckey( dvdcss ) < 0 )
         {
             i_copyright = 0;
         }
@@ -175,12 +175,12 @@ int _dvdcss_test( dvdcss_t dvdcss )
 }
 
 /*****************************************************************************
- * _dvdcss_title: crack or decrypt the current title key if needed
+ * dvdcss_title: crack or decrypt the current title key if needed
  *****************************************************************************
  * 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 ( dvdcss_t dvdcss, int i_block )
 {
     dvd_title_t *p_title;
     dvd_title_t *p_newtitle;
@@ -247,7 +247,7 @@ int _dvdcss_title ( dvdcss_t dvdcss, int i_block )
     /* Crack or decrypt CSS title key for current VTS */
     if( i_ret < 0 )
     {
-        i_ret = _dvdcss_titlekey( dvdcss, i_block, p_title_key );
+        i_ret = dvdcss_titlekey( dvdcss, i_block, p_title_key );
 
         if( i_ret < 0 )
         {
@@ -318,7 +318,7 @@ int _dvdcss_title ( dvdcss_t dvdcss, int i_block )
 }
 
 /*****************************************************************************
- * _dvdcss_disckey: get disc key.
+ * dvdcss_disckey: get disc key.
  *****************************************************************************
  * This function should only be called if DVD ioctls are present.
  * It will set dvdcss->i_method = DVDCSS_METHOD_TITLE if it fails to find
@@ -327,7 +327,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( dvdcss_t dvdcss )
 {
     unsigned char p_buffer[ DVD_DISCKEY_SIZE ];
     dvd_key_t p_disc_key;
@@ -411,9 +411,9 @@ int _dvdcss_disckey( dvdcss_t dvdcss )
 
 
 /*****************************************************************************
- * _dvdcss_titlekey: get title key.
+ * dvdcss_titlekey: get title key.
  *****************************************************************************/
-static int _dvdcss_titlekey( dvdcss_t dvdcss, int i_pos, dvd_key_t p_title_key )
+static int dvdcss_titlekey( dvdcss_t dvdcss, int i_pos, dvd_key_t p_title_key )
 {
     static uint8_t p_garbage[ DVDCSS_BLOCK_SIZE ];  /* we never read it back */
     uint8_t p_key[ KEY_SIZE ];
@@ -508,7 +508,7 @@ static int _dvdcss_titlekey( dvdcss_t dvdcss, int i_pos, dvd_key_t p_title_key )
         dvdcss->pf_seek( dvdcss, 0 );
         dvdcss->pf_read( dvdcss, p_garbage, 1 );
         dvdcss->pf_seek( dvdcss, 0 );
-        _dvdcss_disckey( dvdcss );
+        dvdcss_disckey( dvdcss );
 
         /* Fallback */
     }
@@ -526,12 +526,12 @@ static int _dvdcss_titlekey( dvdcss_t dvdcss, int i_pos, dvd_key_t p_title_key )
 }
 
 /*****************************************************************************
- * _dvdcss_unscramble: does the actual descrambling of data
+ * dvdcss_unscramble: does the actual descrambling of data
  *****************************************************************************
  * sec : sector to unscramble
  * key : title key for this sector
  *****************************************************************************/
-int _dvdcss_unscramble( dvd_key_t p_key, uint8_t *p_sec )
+int dvdcss_unscramble( dvd_key_t p_key, uint8_t *p_sec )
 {
     unsigned int    i_t1, i_t2, i_t3, i_t4, i_t5, i_t6;
     uint8_t        *p_end = p_sec + DVDCSS_BLOCK_SIZE;
@@ -961,8 +961,8 @@ static void CryptKey( int i_key_type, int i_variant,
  * DecryptKey: decrypt p_crypted with p_key.
  *****************************************************************************
  * Used to decrypt the disc key, with a player key, after requesting it
- * in _dvdcss_disckey and to decrypt title keys, with a disc key, requested
- * in _dvdcss_titlekey.
+ * in dvdcss_disckey and to decrypt title keys, with a disc key, requested
+ * in dvdcss_titlekey.
  * The player keys and the resulting disc key are only used as KEKs
  * (key encryption keys).
  * Decryption is slightly dependent on the type of key:
@@ -1477,7 +1477,7 @@ static int i_tries = 0, i_success = 0;
 /*****************************************************************************
  * CrackTitleKey: try to crack title key from the contents of a VOB.
  *****************************************************************************
- * This function is called by _dvdcss_titlekey to find a title key, if we've
+ * This function is called by dvdcss_titlekey to find a title key, if we've
  * chosen to crack title key instead of decrypting it with the disc key.
  * 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
@@ -1523,8 +1523,8 @@ static int CrackTitleKey( dvdcss_t dvdcss, int i_pos, int i_len,
                                      "secret arcanes to recover", i_pos );
 
                 /* Reset the drive before trying to continue */
-                _dvdcss_close( dvdcss );
-                _dvdcss_open( dvdcss );
+                dvdcss_close_device( dvdcss );
+                dvdcss_open_device( dvdcss );
 
                 b_read_error = 1;
                 continue;
diff --git a/src/css.h b/src/css.h
index 8b47840..005a26c 100644
--- a/src/css.h
+++ b/src/css.h
@@ -54,9 +54,9 @@ typedef struct css_s
 /*****************************************************************************
  * Prototypes in css.c
  *****************************************************************************/
-int   _dvdcss_test        ( dvdcss_t );
-int   _dvdcss_title       ( dvdcss_t, int );
-int   _dvdcss_disckey     ( dvdcss_t );
-int   _dvdcss_unscramble  ( uint8_t *, uint8_t * );
+int dvdcss_test       ( dvdcss_t );
+int dvdcss_title      ( dvdcss_t, int );
+int dvdcss_disckey    ( dvdcss_t );
+int dvdcss_unscramble ( uint8_t *, uint8_t * );
 
 #endif /* DVDCSS_CSS_H */
diff --git a/src/device.c b/src/device.c
index c7531bf..4dc586e 100644
--- a/src/device.c
+++ b/src/device.c
@@ -100,7 +100,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( dvdcss_t dvdcss )
 {
 #if defined( WIN32 )
     if( dvdcss->b_file )
@@ -162,7 +162,7 @@ int _dvdcss_use_ioctls( dvdcss_t dvdcss )
 #endif
 }
 
-void _dvdcss_check ( dvdcss_t dvdcss )
+void dvdcss_check_device ( dvdcss_t dvdcss )
 {
 #if defined( WIN32 )
     DWORD drives;
@@ -352,7 +352,7 @@ void _dvdcss_check ( dvdcss_t dvdcss )
     print_error( dvdcss, "could not find a suitable default drive" );
 }
 
-int _dvdcss_open ( dvdcss_t dvdcss )
+int dvdcss_open_device ( dvdcss_t dvdcss )
 {
     const char *psz_device = dvdcss->psz_device;
 
@@ -409,7 +409,7 @@ int _dvdcss_open ( dvdcss_t dvdcss )
 }
 
 #ifdef DVDCSS_RAW_OPEN
-int _dvdcss_raw_open ( dvdcss_t dvdcss, const char *psz_device )
+int dvdcss_raw_open ( dvdcss_t dvdcss, const char *psz_device )
 {
     dvdcss->i_raw_fd = open( psz_device, 0 );
 
@@ -429,7 +429,7 @@ int _dvdcss_raw_open ( dvdcss_t dvdcss, const char *psz_device )
 }
 #endif
 
-int _dvdcss_close ( dvdcss_t dvdcss )
+int dvdcss_close_device ( dvdcss_t dvdcss )
 {
 #if defined( WIN32 )
     if( dvdcss->b_file )
diff --git a/src/device.h b/src/device.h
index 4c7f38b..ff1e67f 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      ( dvdcss_t );
-int  _dvdcss_open       ( dvdcss_t );
-int  _dvdcss_close      ( dvdcss_t );
+int  dvdcss_use_ioctls   ( dvdcss_t );
+void dvdcss_check_device ( dvdcss_t );
+int  dvdcss_open_device  ( dvdcss_t );
+int  dvdcss_close_device ( dvdcss_t );
 
 /*****************************************************************************
  * Device reading prototypes, raw-device specific
  *****************************************************************************/
-int _dvdcss_raw_open     ( dvdcss_t, const char * );
+int dvdcss_raw_open      ( dvdcss_t, const char * );
 
 #endif /* DVDCSS_DEVICE_H */
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 03a8a7b..196db68 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -311,8 +311,8 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
     /*
      *  Open device
      */
-    _dvdcss_check( dvdcss );
-    i_ret = _dvdcss_open( dvdcss );
+    dvdcss_check_device( dvdcss );
+    i_ret = dvdcss_open_device( dvdcss );
     if( i_ret < 0 )
     {
         free( dvdcss->psz_device );
@@ -321,11 +321,11 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
     }
 
     dvdcss->b_scrambled = 1; /* Assume the worst */
-    dvdcss->b_ioctls = _dvdcss_use_ioctls( dvdcss );
+    dvdcss->b_ioctls = dvdcss_use_ioctls( dvdcss );
 
     if( dvdcss->b_ioctls )
     {
-        i_ret = _dvdcss_test( dvdcss );
+        i_ret = dvdcss_test( dvdcss );
 
         if( i_ret == -3 )
         {
@@ -352,7 +352,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
     /* If disc is CSS protected and the ioctls work, authenticate the drive */
     if( dvdcss->b_scrambled && dvdcss->b_ioctls )
     {
-        i_ret = _dvdcss_disckey( dvdcss );
+        i_ret = dvdcss_disckey( dvdcss );
 
         if( i_ret < 0 )
         {
@@ -516,7 +516,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
 #ifdef DVDCSS_RAW_OPEN
     if( psz_raw_device != NULL )
     {
-        _dvdcss_raw_open( dvdcss, psz_raw_device );
+        dvdcss_raw_open( dvdcss, psz_raw_device );
     }
 #endif
 
@@ -572,7 +572,7 @@ LIBDVDCSS_EXPORT int dvdcss_seek ( dvdcss_t dvdcss, int i_blocks, int i_flags )
        || ( i_flags & DVDCSS_SEEK_KEY ) )
     {
         /* check the title key */
-        if( _dvdcss_title( dvdcss, i_blocks ) )
+        if( dvdcss_title( dvdcss, i_blocks ) )
         {
             return -1;
         }
@@ -640,7 +640,7 @@ LIBDVDCSS_EXPORT int dvdcss_read ( dvdcss_t dvdcss, void *p_buffer,
         /* Decrypt the blocks we managed to read */
         for( i_index = i_ret; i_index; i_index-- )
         {
-            _dvdcss_unscramble( dvdcss->css.p_title_key, p_buffer );
+            dvdcss_unscramble( dvdcss->css.p_title_key, p_buffer );
             ((uint8_t*)p_buffer)[0x14] &= 0x8f;
             p_buffer = (uint8_t *)p_buffer + DVDCSS_BLOCK_SIZE;
         }
@@ -715,7 +715,7 @@ LIBDVDCSS_EXPORT int dvdcss_readv ( dvdcss_t dvdcss, void *p_iovec,
             iov_len = _p_iovec->iov_len;
         }
 
-        _dvdcss_unscramble( dvdcss->css.p_title_key, iov_base );
+        dvdcss_unscramble( dvdcss->css.p_title_key, iov_base );
         ((uint8_t*)iov_base)[0x14] &= 0x8f;
 
         iov_base = (void *) ((uint8_t*)iov_base + DVDCSS_BLOCK_SIZE);
@@ -748,7 +748,7 @@ LIBDVDCSS_EXPORT int dvdcss_close ( dvdcss_t dvdcss )
         p_title = p_tmptitle;
     }
 
-    i_ret = _dvdcss_close( dvdcss );
+    i_ret = dvdcss_close_device( dvdcss );
 
     if( i_ret < 0 )
     {
-- 
1.9.1

_______________________________________________
libdvdcss-devel mailing list
[email protected]
https://mailman.videolan.org/listinfo/libdvdcss-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.