[libdvdcss-devel] [PATCH 35/47] libdvdcss: Factor out setting library verbosity from dvdcss_open()

Diego Biurrun <[email protected]>
Newsgroups gmane.comp.video.videolan.libdvdcss,gmane.comp.video.videolan.libdvdcss.devel
Message-ID <[email protected]>
---

I set b_debug to '1' instead of 'i', it's supposed to be Boolean after all.

 src/libdvdcss.c | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 839dcb0..aeba15c 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -136,6 +136,24 @@
 #define mkdir(a, b) _mkdir(a)
 #endif
 
+static void set_verbosity( dvdcss_t dvdcss )
+{
+    const char *psz_verbose = getenv( "DVDCSS_VERBOSE" );
+
+    dvdcss->b_debug  = 0;
+    dvdcss->b_errors = 0;
+
+    if( psz_verbose != NULL )
+    {
+        int i = atoi( psz_verbose );
+
+        if( i >= 2 )
+            dvdcss->b_debug  = 1;
+        if( i >= 1 )
+            dvdcss->b_errors = 1;
+    }
+}
+
 /**
  * \brief Open a DVD device or directory and return a dvdcss instance.
  *
@@ -154,7 +172,6 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
     int i_ret;
 
     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
     const char *psz_raw_device = getenv( "DVDCSS_RAW_DEVICE" );
@@ -182,19 +199,11 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
     dvdcss->psz_error = "no error";
     dvdcss->i_method = DVDCSS_METHOD_KEY;
     dvdcss->psz_cachefile[0] = '\0';
-    dvdcss->b_debug = 0;
-    dvdcss->b_errors = 0;
 
     /*
      *  Find verbosity from DVDCSS_VERBOSE environment variable
      */
-    if( psz_verbose != NULL )
-    {
-        int i = atoi( psz_verbose );
-
-        if( i >= 2 ) dvdcss->b_debug = i;
-        if( i >= 1 ) dvdcss->b_errors = 1;
-    }
+    set_verbosity( dvdcss );
 
     /*
      *  Find method from DVDCSS_METHOD environment variable
-- 
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.