[libdvdcss-devel] [PATCH 27/47] Remove bogus error checking of dvdcss_close_device()

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


The function does not return any errors.
---

I guess the real solution is to properly check for errors inside of
dvdcss_close_device() - formerly known as _dvdcss_close - instead.

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

diff --git a/src/device.c b/src/device.c
index 81152cb..c91f9a3 100644
--- a/src/device.c
+++ b/src/device.c
@@ -410,7 +410,7 @@ int dvdcss_raw_open ( dvdcss_t dvdcss, const char *psz_device )
 }
 #endif /* DVDCSS_RAW_OPEN */
 
-int dvdcss_close_device ( dvdcss_t dvdcss )
+void dvdcss_close_device ( dvdcss_t dvdcss )
 {
 #if defined( WIN32 )
     if( dvdcss->b_file )
@@ -426,8 +426,6 @@ int dvdcss_close_device ( dvdcss_t dvdcss )
     free( dvdcss->p_readv_buffer );
     dvdcss->p_readv_buffer   = NULL;
     dvdcss->i_readv_buf_size = 0;
-
-    return 0;
 #else
     close( dvdcss->i_fd );
 
@@ -438,8 +436,6 @@ int dvdcss_close_device ( dvdcss_t dvdcss )
         dvdcss->i_raw_fd = -1;
     }
 #endif
-
-    return 0;
 #endif
 }
 
diff --git a/src/device.h b/src/device.h
index ff1e67f..f56489f 100644
--- a/src/device.h
+++ b/src/device.h
@@ -55,7 +55,7 @@ struct iovec
 int  dvdcss_use_ioctls   ( dvdcss_t );
 void dvdcss_check_device ( dvdcss_t );
 int  dvdcss_open_device  ( dvdcss_t );
-int  dvdcss_close_device ( dvdcss_t );
+void dvdcss_close_device ( dvdcss_t );
 
 /*****************************************************************************
  * Device reading prototypes, raw-device specific
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 7bd888b..057c20b 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -737,7 +737,6 @@ LIBDVDCSS_EXPORT int dvdcss_readv ( dvdcss_t dvdcss, void *p_iovec,
 LIBDVDCSS_EXPORT int dvdcss_close ( dvdcss_t dvdcss )
 {
     dvd_title_t *p_title;
-    int i_ret;
 
     /* Free our list of keys */
     p_title = dvdcss->p_titles;
@@ -748,12 +747,7 @@ LIBDVDCSS_EXPORT int dvdcss_close ( dvdcss_t dvdcss )
         p_title = p_tmptitle;
     }
 
-    i_ret = dvdcss_close_device( dvdcss );
-
-    if( i_ret < 0 )
-    {
-        return i_ret;
-    }
+    dvdcss_close_device( dvdcss );
 
     free( dvdcss->psz_device );
     free( dvdcss );
-- 
1.9.1



More information about the libdvdcss-devel mailing list