[libdvdcss-devel] Mark strings as const where appropriate.

Diego Biurrun git at videolan.org
Fri Oct 31 15:03:19 CET 2014


libdvdcss | branch: master | Diego Biurrun <diego at biurrun.de> | Wed Oct 22 12:57:51 2014 +0200| [143d07a2b017da4266c84b2c2b694519ab449dc2] | committer: Diego Biurrun

Mark strings as const where appropriate.

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

 src/css.c           |    4 ++--
 src/device.c        |    2 +-
 src/dvdcss/dvdcss.h |    2 +-
 src/libdvdcss.c     |   12 ++++++------
 4 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/css.c b/src/css.c
index 82c121d..9bc137c 100644
--- 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 @@ static int GetBusKey( dvdcss_t dvdcss )
 /*****************************************************************************
  * 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] );
diff --git a/src/device.c b/src/device.c
index 1a060e6..93bccab 100644
--- a/src/device.c
+++ b/src/device.c
@@ -185,7 +185,7 @@ void dvdcss_check_device ( dvdcss_t dvdcss )
 
     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
 
diff --git a/src/dvdcss/dvdcss.h b/src/dvdcss/dvdcss.h
index 035b093..64f95cf 100644
--- a/src/dvdcss/dvdcss.h
+++ b/src/dvdcss/dvdcss.h
@@ -72,7 +72,7 @@ typedef struct dvdcss_s* dvdcss_t;
 /*
  * 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,
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 1438f5c..d6ed21c 100644
--- 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 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( char *psz_target )
 #ifdef __OS2__
             if( *psz_home == '/' || *psz_home == '\\')
             {
-                char *psz_unixroot = getenv("UNIXROOT");
+                const char *psz_unixroot = getenv("UNIXROOT");
 
                 if( psz_unixroot &&
                     psz_unixroot[0] &&



More information about the libdvdcss-devel mailing list