shithub: libdvdcss

Download patch

ref: 143d07a2b017da4266c84b2c2b694519ab449dc2
parent: 50167f317a6c743cf3a2491835210b1fe2144837
author: Diego Biurrun <[email protected]>
date: Wed Oct 22 08:57:51 EDT 2014

Mark strings as const where appropriate.

--- a/src/css.c
+++ b/src/css.c
@@ -66,7 +66,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-static void PrintKey        ( dvdcss_t, char *, const uint8_t * );
+static void PrintKey        ( dvdcss_t, const char *, const uint8_t * );
 
 static int  GetBusKey       ( dvdcss_t );
 static int  GetASF          ( dvdcss_t );
@@ -725,7 +725,7 @@
 /*****************************************************************************
  * PrintKey : debug function that dumps a key value
  *****************************************************************************/
-static void PrintKey( dvdcss_t dvdcss, char *prefix, const uint8_t *data )
+static void PrintKey( dvdcss_t dvdcss, const char *prefix, const uint8_t *data )
 {
     print_debug( dvdcss, "%s%02x:%02x:%02x:%02x:%02x", prefix,
                  data[0], data[1], data[2], data[3], data[4] );
--- a/src/device.c
+++ b/src/device.c
@@ -185,7 +185,7 @@
 
     int i;
 #else
-    char *ppsz_devices[] = { "/dev/dvd", "/dev/cdrom", "/dev/hdc", NULL };
+    const char *ppsz_devices[] = { "/dev/dvd", "/dev/cdrom", "/dev/hdc", NULL };
     int i, i_fd;
 #endif
 
--- a/src/dvdcss/dvdcss.h
+++ b/src/dvdcss/dvdcss.h
@@ -72,7 +72,7 @@
 /*
  * Exported prototypes.
  */
-LIBDVDCSS_EXPORT dvdcss_t dvdcss_open  ( char *psz_target );
+LIBDVDCSS_EXPORT dvdcss_t dvdcss_open  ( const char *psz_target );
 LIBDVDCSS_EXPORT int      dvdcss_close ( dvdcss_t );
 LIBDVDCSS_EXPORT int      dvdcss_seek  ( dvdcss_t,
                                int i_blocks,
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -148,16 +148,16 @@
  * 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 ( char *psz_target )
+LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
 {
     char psz_buffer[PATH_MAX];
     int i_ret;
 
-    char *psz_method = getenv( "DVDCSS_METHOD" );
-    char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
-    char *psz_cache = getenv( "DVDCSS_CACHE" );
+    const char *psz_method = getenv( "DVDCSS_METHOD" );
+    const char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
+    const char *psz_cache = getenv( "DVDCSS_CACHE" );
 #ifdef DVDCSS_RAW_OPEN
-    char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );
+    const char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );
 #endif
 
     dvdcss_t dvdcss;
@@ -268,7 +268,7 @@
 #ifdef __OS2__
             if( *psz_home == '/' || *psz_home == '\\')
             {
-                char *psz_unixroot = getenv("UNIXROOT");
+                const char *psz_unixroot = getenv("UNIXROOT");
 
                 if( psz_unixroot &&
                     psz_unixroot[0] &&