From de09b82310f7b464e4095d1b750d9b968c84b6ed Mon Sep 17 00:00:00 2001 From: Thomas White Date: Fri, 8 Mar 2019 18:43:04 +0100 Subject: Fix variable initialisation and decision about data source --- src/im-sandbox.c | 3 ++- src/process_image.c | 10 +++++----- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/im-sandbox.c b/src/im-sandbox.c index 9c00ad0c..20bd6c94 100644 --- a/src/im-sandbox.c +++ b/src/im-sandbox.c @@ -371,7 +371,7 @@ static int run_work(const struct index_args *iargs, Stream *st, { int allDone = 0; TimeAccounts *taccs; - struct im_zmq *zmqstuff; + struct im_zmq *zmqstuff = NULL; /* Connect via ZMQ */ if ( sb->zmq ) { @@ -453,6 +453,7 @@ static int run_work(const struct index_args *iargs, Stream *st, } else { pargs.msgpack_obj = im_zmq_fetch(zmqstuff); + pargs.filename_p_e = NULL; } diff --git a/src/process_image.c b/src/process_image.c index afd43d3b..3dd02aaa 100644 --- a/src/process_image.c +++ b/src/process_image.c @@ -195,7 +195,7 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs, int serial, struct sb_shm *sb_shared, TimeAccounts *taccs, char *last_task) { - struct imagefile *imfile; + struct imagefile *imfile = NULL; struct image image; int i; int r; @@ -214,15 +214,15 @@ void process_image(const struct index_args *iargs, struct pattern_args *pargs, image.serial = serial; image.indexed_by = INDEXING_NONE; - if ( pargs->filename_p_e != NULL ) { + if ( pargs->msgpack_obj != NULL ) { + STATUS("Msgpack!\n"); + if ( unpack_msgpack_data(pargs->msgpack_obj, &image) ) return; + } else if ( pargs->filename_p_e != NULL ) { image.filename = pargs->filename_p_e->filename; image.event = pargs->filename_p_e->ev; if ( file_wait_open_read(sb_shared, &image, taccs, last_task, iargs->wait_for_file, cookie, &imfile) ) return; - } else if ( pargs->msgpack_obj != NULL ) { - STATUS("Msgpack!\n"); - if ( unpack_msgpack_data(pargs->msgpack_obj, &image) ) return; } /* Take snapshot of image before applying horrible noise filters */ -- cgit v1.2.3