[libdvdcss-devel] [PATCH 1/2] Replace sizeof(type) by sizeof(*variable).
Jean-Baptiste Kempf
jb at videolan.org
Fri Oct 31 16:31:14 CET 2014
LGTM.
On 31 Oct, Diego Biurrun wrote :
> ---
> 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;
> --
> 1.9.1
>
> _______________________________________________
> libdvdcss-devel mailing list
> libdvdcss-devel at videolan.org
> https://mailman.videolan.org/listinfo/libdvdcss-devel
--
With my kindest regards,
--
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device
More information about the libdvdcss-devel
mailing list