[libdvdcss-devel] Improve some comments in dvdcss_open() and fix some typos.

Diego Biurrun git at videolan.org
Fri Oct 31 16:29:17 CET 2014


libdvdcss | branch: master | Diego Biurrun <diego at biurrun.de> | Fri Oct 24 11:11:53 2014 +0200| [f13b902be9a8a91099653e11da61969ea69db3e8] | committer: Diego Biurrun

Improve some comments in dvdcss_open() and fix some typos.

> http://git.videolan.org/gitweb.cgi/libdvdcss.git/?a=commit;h=f13b902be9a8a91099653e11da61969ea69db3e8
---

 src/css.c       |    2 +-
 src/device.c    |    2 +-
 src/ioctl.c     |    2 +-
 src/ioctl.h     |    6 +++---
 src/libdvdcss.c |   38 +++++++++++---------------------------
 5 files changed, 17 insertions(+), 33 deletions(-)

diff --git a/src/css.c b/src/css.c
index c5a16b1..db709c6 100644
--- a/src/css.c
+++ b/src/css.c
@@ -466,7 +466,7 @@ static int dvdcss_titlekey( dvdcss_t dvdcss, int i_pos, dvd_key_t p_title_key )
 
             case 1:
                 /* Drive status is OK. */
-                /* If the title key request failed, but we did not loose ASF,
+                /* If the title key request failed, but we did not lose ASF,
                  * we might still have the AGID.  Other code assumes that we
                  * will not after this so invalidate it(?). */
                 if( i_ret < 0 )
diff --git a/src/device.c b/src/device.c
index 73ace00..fdc1e15 100644
--- a/src/device.c
+++ b/src/device.c
@@ -372,7 +372,7 @@ int dvdcss_open_device ( dvdcss_t dvdcss )
     if( psz_device[0] && psz_device[1] == ':' &&
         ( !psz_device[2] || ( psz_device[2] == '\\' && !psz_device[3] ) ) )
     {
-        print_debug( dvdcss, "using OS2 API for access" );
+        print_debug( dvdcss, "using OS/2 API for access" );
         dvdcss->pf_seek  = os2_seek;
         dvdcss->pf_read  = os2_read;
         dvdcss->pf_readv = os2_readv;
diff --git a/src/ioctl.c b/src/ioctl.c
index d52b32f..9c7c7f7 100644
--- a/src/ioctl.c
+++ b/src/ioctl.c
@@ -1528,7 +1528,7 @@ static void QNXInitCPT( CAM_PASS_THRU * p_cpt, int i_type )
 /*****************************************************************************
  * OS2InitSDC: initialize a SDC structure for the Execute SCSI-command
  *****************************************************************************
- * This function initializes a OS2 'execute SCSI command' structure for
+ * This function initializes an OS/2 'execute SCSI command' structure for
  * future use, either a read command or a write command.
  *****************************************************************************/
 static void OS2InitSDC( struct OS2_ExecSCSICmd *p_sdc, int i_type )
diff --git a/src/ioctl.h b/src/ioctl.h
index 44b3f2e..bbb2bd9 100644
--- a/src/ioctl.h
+++ b/src/ioctl.h
@@ -103,7 +103,7 @@ int ioctl_ReportRPC         ( int, int *, int *, int * );
 #endif
 
 /*****************************************************************************
- * Additional types, OpenBSD specific
+ * Additional types, OpenBSD-specific
  *****************************************************************************/
 #if defined( HAVE_OPENBSD_DVD_STRUCT )
 typedef union dvd_struct dvd_struct;
@@ -137,7 +137,7 @@ typedef union dvd_authinfo dvd_authinfo;
 #define DVDCSS_INVALIDATE_AGID   0x3f
 
 /*****************************************************************************
- * win32 ioctl specific
+ * Win32-ioctl-specific
  *****************************************************************************/
 #if defined( WIN32 )
 
@@ -264,7 +264,7 @@ typedef struct SCSI_PASS_THROUGH_DIRECT
 #endif /* defined( WIN32 ) */
 
 /*****************************************************************************
- * OS2 ioctl specific
+ * OS/2-ioctl-specific
  *****************************************************************************/
 #if defined( __OS2__ )
 
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 6dc2bd8..dc236c0 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -160,20 +160,14 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
     const char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );
 #endif
 
-    dvdcss_t dvdcss;
-
-    /*
-     *  Allocate the library structure
-     */
-    dvdcss = malloc( sizeof( struct dvdcss_s ) );
+    /* Allocate the library structure. */
+    dvdcss_t dvdcss = malloc( sizeof( struct dvdcss_s ) );
     if( dvdcss == NULL )
     {
         return NULL;
     }
 
-    /*
-     *  Initialize structure with default values
-     */
+    /* Initialize structure with default values. */
 #ifdef DVDCSS_RAW_OPEN
     dvdcss->i_raw_fd = -1;
 #endif
@@ -185,9 +179,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
     dvdcss->b_debug = 0;
     dvdcss->b_errors = 0;
 
-    /*
-     *  Find verbosity from DVDCSS_VERBOSE environment variable
-     */
+    /* Set library verbosity from DVDCSS_VERBOSE environment variable. */
     if( psz_verbose != NULL )
     {
         int i = atoi( psz_verbose );
@@ -196,9 +188,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
         if( i >= 1 ) dvdcss->b_errors = 1;
     }
 
-    /*
-     *  Find method from DVDCSS_METHOD environment variable
-     */
+    /* Set DVD access method from DVDCSS_METHOD environment variable. */
     if( psz_method != NULL )
     {
         if( !strncmp( psz_method, "key", 4 ) )
@@ -221,9 +211,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
         }
     }
 
-    /*
-     *  If DVDCSS_CACHE was not set, try to guess a default value
-     */
+    /* Set CSS key cache directory. */
     if( psz_cache == NULL || psz_cache[0] == '\0' )
     {
 #if defined(_WIN32_IE) && _WIN32_IE >= 0x500
@@ -288,9 +276,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
 #endif /* ! defined(_WIN32_IE) && _WIN32_IE >= 0x500 */
     }
 
-    /*
-     *  Find cache dir from the DVDCSS_CACHE environment variable
-     */
+    /* Sanity check psz_cache value. */
     if( psz_cache != NULL )
     {
         if( psz_cache[0] == '\0' || !strcmp( psz_cache, "off" ) )
@@ -306,9 +292,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
         }
     }
 
-    /*
-     *  Open device
-     */
+    /* Open device. */
     dvdcss_check_device( dvdcss );
     i_ret = dvdcss_open_device( dvdcss );
     if( i_ret < 0 )
@@ -464,8 +448,8 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
             }
         }
 
-        /* Get disk key, since some discs have got same title, manufacturing
-         * date and serial number, but different keys */
+        /* Get disk key, since some discs have the same title, manufacturing
+         * date and serial number, but different keys. */
         if( dvdcss->b_scrambled )
         {
              psz_key[0] = '-';
@@ -516,7 +500,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
     }
 #endif /* DVDCSS_RAW_OPEN */
 
-    /* Seek at the beginning, just for safety. */
+    /* Seek to the beginning, just for safety. */
     dvdcss->pf_seek( dvdcss, 0 );
 
     return dvdcss;



More information about the libdvdcss-devel mailing list