[libdvdcss-devel] [PATCH 05/47] Mark strings as const where appropriate.

Diego Biurrun diego at biurrun.de
Wed Oct 29 21:33:05 CET 2014


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

diff --git a/src/device.c b/src/device.c
index 9bfcba9..7a96e9f 100644
--- a/src/device.c
+++ b/src/device.c
@@ -196,7 +196,7 @@ void _dvdcss_check ( 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 9cdf899..03a8a7b 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;
@@ -270,7 +270,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] &&
-- 
1.9.1



More information about the libdvdcss-devel mailing list