[libdvdcss-devel] [PATCH 3/3] css: Print drive region(s) as debug information

Jean-Baptiste Kempf jb at videolan.org
Tue Nov 18 14:23:47 CET 2014


LGTM.

On 17 Nov, Diego Biurrun wrote :
> ---
> 
> Suggestions for a more elegant way to print this welcome.
> 
>  src/css.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/src/css.c b/src/css.c
> index caad8f0..d361693 100644
> --- a/src/css.c
> +++ b/src/css.c
> @@ -101,7 +101,9 @@ static int  dvdcss_titlekey ( struct dvdcss *, int, dvd_key );
>  int dvdcss_test( struct dvdcss *dvdcss )
>  {
>      const char *psz_type, *psz_rpc;
> -    int i_ret, i_copyright, i_type, i_mask, i_rpc;
> +    char psz_region[16];
> +    char *p_region = psz_region;
> +    int i_ret, i_copyright, i_type, i_mask, i_rpc, i_region;
>  
>      i_ret = ioctl_ReadCopyright( dvdcss->i_fd, 0 /* i_layer */, &i_copyright );
>  
> @@ -159,8 +161,17 @@ int dvdcss_test( struct dvdcss *dvdcss )
>          default: psz_type = "unknown status"; break;
>      }
>  
> -    print_debug( dvdcss, "drive region mask 0x%x, %s, %s",
> -                         i_mask, psz_rpc, psz_type );
> +    for( i_region = 0; i_region < 8; i_region++ )
> +    {
> +        if( !( i_mask & ( 1 << i_region ) ) )
> +        {
> +            sprintf(p_region, " %d", i_region + 1);
> +            p_region += 2;
> +        }
> +    }
> +
> +    print_debug( dvdcss, "drive region(s)%s, region mask 0x%x, %s, %s",
> +                 psz_region, i_mask, psz_rpc, psz_type );
>  
>      if( i_copyright && i_rpc == 1 && i_type == 0 )
>      {
> -- 
> 2.1.0
> 
> _______________________________________________
> 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