[vlc-devel] [PATCH] jpeg: add a comment and an assertion to explain error handling
Rafaël Carré
funman at videolan.org
Tue Jan 28 15:56:46 CET 2014
---
modules/codec/jpeg.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/modules/codec/jpeg.c b/modules/codec/jpeg.c
index b03ca78..acc49aa 100644
--- a/modules/codec/jpeg.c
+++ b/modules/codec/jpeg.c
@@ -29,6 +29,7 @@
#include <vlc_codec.h>
#include <jpeglib.h>
#include <setjmp.h>
+#include <assert.h>
/*
* jpeg decoder descriptor
@@ -140,6 +141,10 @@ static picture_t *DecodeBlock(decoder_t *p_dec, block_t **pp_block)
}
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;
--
1.8.5.3
More information about the vlc-devel
mailing list