[DVDnav-discuss] Return an error in dvdnav_get_position instead of asserting

Richard Hulme peper03 at yahoo.com
Sun Aug 31 16:50:15 CEST 2014


On 31/08/14 00:52, Jean-Baptiste Kempf wrote:
> libdvdnav | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Aug 31 00:51:40 2014 +0200| [2d73a2b3c6ccd3d45be194d482cfb09f8e5055e2] | committer: Jean-Baptiste Kempf
>
> Return an error in dvdnav_get_position instead of asserting
>
> LP: #1236939
>
>> http://git.videolan.org/gitweb.cgi/libdvdnav.git/?a=commit;h=2d73a2b3c6ccd3d45be194d482cfb09f8e5055e2
> ---
>
>   src/searching.c |    3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/src/searching.c b/src/searching.c
> index f6e497e..74a16ee 100644
> --- a/src/searching.c
> +++ b/src/searching.c
> @@ -563,7 +563,8 @@ dvdnav_status_t dvdnav_get_position(dvdnav_t *this, uint32_t *pos,
>       *len += cell->last_sector - cell->first_sector + 1;
>     }
>
> -  assert((signed)*pos != -1);
> +  if((signed)*pos == -1)
> +    return DVDNAV_STATUS_ERR;
>
>     pthread_mutex_unlock(&this->vm_lock);

Shouldn't the two new lines come *after* the unlock?

Richard.


More information about the DVDnav-discuss mailing list