[libdvdcss-devel] Replace sizeof(type) by sizeof(*variable).

Diego Biurrun git at videolan.org
Fri Oct 31 16:34:00 CET 2014


libdvdcss | branch: master | Diego Biurrun <diego at biurrun.de> | Fri Oct 31 14:49:05 2014 +0100| [2a2ce58b4cdf7c144b14fcffd4d0a07a5f3b75f2] | committer: Diego Biurrun

Replace sizeof(type) by sizeof(*variable).

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

 src/css.c       |    8 ++++----
 src/libdvdcss.c |    2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/css.c b/src/css.c
index db709c6..b92d4c2 100644
--- a/src/css.c
+++ b/src/css.c
@@ -205,7 +205,7 @@ int dvdcss_title ( dvdcss_t dvdcss, int i_block )
          && p_title->i_startlb == i_block )
     {
         /* We've already cracked this key, nothing to do */
-        memcpy( dvdcss->css.p_title_key, p_title->p_key, sizeof(dvd_key_t) );
+        memcpy( dvdcss->css.p_title_key, p_title->p_key, sizeof(*p_title->p_key) );
         return 0;
     }
 
@@ -296,7 +296,7 @@ int dvdcss_title ( dvdcss_t dvdcss, int i_block )
     p_title = p_newtitle;
 
     /* Write in the new title and its key */
-    p_newtitle = malloc( sizeof( dvd_title_t ) );
+    p_newtitle = malloc( sizeof( *p_newtitle ) );
     if( p_newtitle == NULL )
     {
         return -1;
@@ -1086,7 +1086,7 @@ static int DecryptDiscKey( dvdcss_t dvdcss, const uint8_t *p_struct_disckey,
     unsigned int i, n = 0;
 
     /* Decrypt disc key with the above player keys */
-    for( n = 0; n < sizeof(player_keys) / sizeof(dvd_key_t); n++ )
+    for( n = 0; n < sizeof(player_keys) / sizeof(*player_keys); n++ )
     {
         PrintKey( dvdcss, "trying player key ", player_keys[n] );
 
@@ -1205,7 +1205,7 @@ static int CrackDiscKey( dvdcss_t dvdcss, uint8_t *p_disc_key )
     }
 
     /* Initializing our really big table */
-    BigTable = calloc( 16777216, sizeof(int) );
+    BigTable = calloc( 16777216, sizeof(*BigTable) );
     if( BigTable == NULL )
     {
         free( K1table );
diff --git a/src/libdvdcss.c b/src/libdvdcss.c
index dc236c0..b33ebcf 100644
--- a/src/libdvdcss.c
+++ b/src/libdvdcss.c
@@ -161,7 +161,7 @@ LIBDVDCSS_EXPORT dvdcss_t dvdcss_open ( const char *psz_target )
 #endif
 
     /* Allocate the library structure. */
-    dvdcss_t dvdcss = malloc( sizeof( struct dvdcss_s ) );
+    dvdcss_t dvdcss = malloc( sizeof( *dvdcss ) );
     if( dvdcss == NULL )
     {
         return NULL;



More information about the libdvdcss-devel mailing list