[vlc-devel] [PATCH] jpeg: add a comment and an assertion to explain error handling

Rafaël Carré funman at videolan.org
Tue Jan 28 17:33:53 CET 2014


On 01/28/14 16:50, Maxim Bublis wrote:
> On Tue, Jan 28, 2014 at 7:48 PM, Maxim Bublis <b at codemonkey.ru> wrote:
> 
>>
>>      p_jpeg.err = jpeg_std_error(&p_sys->err);
>>> +    /* XXX: we rely on p_sys->err being the first member of sys_t struct,
>>> +    * so its address is the same than p_sys and we can retrieve p_sys
>>> +    * address in libjpeg error handlers */
>>> +    assert((decoder_sys_t*)p_sys->p_jpeg.err == p_sys);
>>>      p_sys->err.error_exit = user_error_exit;
>>>      p_sys->err.output_message = user_error_message;
>>>
>>
>> I guess it should be p_sys->err after recent changes.
>>
> 
> Or even p_jpeg.err

Yep, and if I enable assertions in my build it will be even better :)



More information about the vlc-devel mailing list