[libdvdcss-devel] [PATCH 6/7] Directly expose struct iovec in the API instead of hiding it behind void*.

Diego Biurrun diego at biurrun.de
Tue Nov 4 20:15:05 CET 2014


---

The new callback API should get a similar treatment.

 src/dvdcss/dvdcss.h |  3 ++-
 src/libdvdcss.c     | 19 +++++++++----------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/dvdcss/dvdcss.h b/src/dvdcss/dvdcss.h
index a86b57c..db418fc 100644
--- a/src/dvdcss/dvdcss.h
+++ b/src/dvdcss/dvdcss.h
@@ -69,6 +69,7 @@ typedef struct dvdcss* dvdcss_t;
 #endif
 
 
+struct iovec;
 /*
  * Exported prototypes.
  */
@@ -82,7 +83,7 @@ LIBDVDCSS_EXPORT int      dvdcss_read  ( struct dvdcss *,
                                int i_blocks,
                                int i_flags );
 LIBDVDCSS_EXPORT int      dvdcss_readv ( struct dvdcss *,
-                               void *p_iovec,
+                               struct iovec *p_iovec,
                                int i_blocks,
                                int i_flags );
 LIBDVDCSS_EXPORT const char *dvdcss_error ( const struct dvdcss * );
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index 6f5d3af..a72dffb 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -704,16 +704,15 @@ LIBDVDCSS_EXPORT int dvdcss_read ( struct dvdcss *dvdcss, void *p_buffer,
  *          Moreover, all iov_len members of the iovec structures should be
  *          multiples of #DVDCSS_BLOCK_SIZE.
  */
-LIBDVDCSS_EXPORT int dvdcss_readv ( struct dvdcss *dvdcss, void *p_iovec,
-                                           int i_blocks,
-                                           int i_flags )
+LIBDVDCSS_EXPORT int dvdcss_readv ( struct dvdcss *dvdcss,
+                                    struct iovec *p_iovec,
+                                    int i_blocks, int i_flags )
 {
-    struct iovec *_p_iovec = p_iovec;
     int i_ret, i_index;
     void *iov_base;
     size_t iov_len;
 
-    i_ret = dvdcss->pf_readv( dvdcss, _p_iovec, i_blocks );
+    i_ret = dvdcss->pf_readv( dvdcss, p_iovec, i_blocks );
 
     if( i_ret <= 0
          || !dvdcss->b_scrambled
@@ -723,8 +722,8 @@ LIBDVDCSS_EXPORT int dvdcss_readv ( struct dvdcss *dvdcss, void *p_iovec,
     }
 
     /* Initialize loop for decryption */
-    iov_base = _p_iovec->iov_base;
-    iov_len = _p_iovec->iov_len;
+    iov_base = p_iovec->iov_base;
+    iov_len  = p_iovec->iov_len;
 
     /* Decrypt the blocks we managed to read */
     for( i_index = i_ret; i_index; i_index-- )
@@ -737,9 +736,9 @@ LIBDVDCSS_EXPORT int dvdcss_readv ( struct dvdcss *dvdcss, void *p_iovec,
 
         while( iov_len == 0 )
         {
-            _p_iovec++;
-            iov_base = _p_iovec->iov_base;
-            iov_len = _p_iovec->iov_len;
+            p_iovec++;
+            iov_base = p_iovec->iov_base;
+            iov_len  = p_iovec->iov_len;
         }
 
         dvdcss_unscramble( dvdcss->css.p_title_key, iov_base );
-- 
1.9.1



More information about the libdvdcss-devel mailing list