[libdvdcss-devel] Patches for libdvdcss

Diego Biurrun diego at biurrun.de
Mon Nov 17 23:34:08 CET 2014


These are not the type of Git patch we are looking for.  Properly commit
your changes and use git-format-patch or git-send-email please, not just
git-diff.

On Tue, Nov 18, 2014 at 01:22:11AM +0300, Evgeny Grin wrote:
> No problem:
> 
> fix position after partial read in libc_read
> 
> diff --git a/src/device.c b/src/device.c
> index da4ecc4..94f448d 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -570,10 +570,11 @@ static int libc_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
>      /* Handle partial reads */
>      if( i_ret != i_size )
>      {
> -        int i_seek;
> +        int i_seek, i_set_pos;
> 
> +        i_set_pos = dvdcss->i_pos + i_ret_blocks;
>          dvdcss->i_pos = -1;
> -        i_seek = libc_seek( dvdcss, i_ret_blocks );
> +        i_seek = libc_seek( dvdcss, i_set_pos );
>          if( i_seek < 0 )
>          {
>              return i_seek;
> 
> fix position after partial read in libc_read
> 
> diff --git a/src/device.c b/src/device.c
> index 94f448d..ef26768 100644
> --- a/src/device.c
> +++ b/src/device.c
> @@ -556,13 +556,23 @@ static int libc_read ( dvdcss_t dvdcss, void *p_buffer, int i_blocks )
>      ssize_t i_size, i_ret, i_ret_blocks;
> 
>      i_size = i_blocks * DVDCSS_BLOCK_SIZE;
> -    i_ret = read( dvdcss->i_fd, p_buffer, i_size );
> +    i_ret = 0;
> 
> -    if( i_ret < 0 )
> +    while( i_ret < i_size )
>      {
> -        print_error( dvdcss, "read error" );
> -        dvdcss->i_pos = -1;
> -        return i_ret;
> +        ssize_t i_r;
> +
> +        i_r = read( dvdcss->i_read_fd, ((char*)p_buffer) + i_ret, i_size - i_ret );
> +        if( i_r < 0 )
> +        {
> +            print_error( dvdcss, "read error" );
> +            dvdcss->i_pos = -1;
> +            return i_r;
> +        }
> +        if( i_r == 0 )
> +            break;
> +
> +        i_ret += i_r;
>      }
> 
>      i_ret_blocks = i_ret / DVDCSS_BLOCK_SIZE;
> 
> 18.11.2014, 00:04, "Diego Biurrun" <diego at biurrun.de>:
> >  On Mon, Nov 17, 2014 at 11:42:43PM +0300, Evgeny Grin wrote:
> >>   Here are the patches (made for 1.2.13, but applicable for latest git master):
> >  Please use Git to create patches, thank you.
> >
> >  Diego
> >  _______________________________________________
> >  libdvdcss-devel mailing list
> >  libdvdcss-devel at videolan.org
> >  https://mailman.videolan.org/listinfo/libdvdcss-devel
> -------- Завершение пересылаемого сообщения --------
> 
> -- 
> Best Wishes,
> Evgeny Grin
> _______________________________________________
> libdvdcss-devel mailing list
> libdvdcss-devel at videolan.org
> https://mailman.videolan.org/listinfo/libdvdcss-devel


More information about the libdvdcss-devel mailing list