diff --git a/lib/c/labcomm.c b/lib/c/labcomm.c index c97a08ddc55336985312b57915732a7ef3edefb6..216ca646e803636c6d6afd1263f801a2cdde5c21 100644 --- a/lib/c/labcomm.c +++ b/lib/c/labcomm.c @@ -364,7 +364,7 @@ struct labcomm_encoder *labcomm_encoder_new( result->lock = lock; result->on_error = on_error_fprintf; result->writer->action->alloc(result->writer,result->writer->context, - LABCOMM_VERSION); + result, LABCOMM_VERSION); } return result; } @@ -572,7 +572,7 @@ struct labcomm_decoder *labcomm_decoder_new( result->on_error = on_error_fprintf; result->on_new_datatype = on_new_datatype; result->reader->action->alloc(result->reader, result->reader->context, - LABCOMM_VERSION); + result, LABCOMM_VERSION); } return result; } @@ -625,7 +625,7 @@ int labcomm_decoder_decode_one(struct labcomm_decoder *d) struct labcomm_sample_entry *entry = NULL; int index, err; - writer.action->alloc(&writer, writer.context, ""); + writer.action->alloc(&writer, writer.context, NULL, ""); writer.action->start(&writer, writer.context, NULL, 0, NULL, NULL); index = labcomm_read_packed32(d->reader); //int signature.name = labcomm_read_string(d->reader); diff --git a/lib/c/labcomm_dynamic_buffer_writer.c b/lib/c/labcomm_dynamic_buffer_writer.c index feb57783b748b7b96a4426c2496297f986340aa6..4a1f3ac16e573d8212b5fdaf978dc7224c92b035 100644 --- a/lib/c/labcomm_dynamic_buffer_writer.c +++ b/lib/c/labcomm_dynamic_buffer_writer.c @@ -7,6 +7,7 @@ #include "labcomm_dynamic_buffer_writer.h" static int dyn_alloc(struct labcomm_writer *w, void *context, + struct labcomm_encoder *encoder, char *labcomm_version) { w->data_size = 1000; diff --git a/lib/c/labcomm_fd_reader.c b/lib/c/labcomm_fd_reader.c index 9975564bbf5acc93f141134da43d0d039f485c95..a9ee68c7c453527c2b48ad67a5c769a9bfc41d21 100644 --- a/lib/c/labcomm_fd_reader.c +++ b/lib/c/labcomm_fd_reader.c @@ -13,7 +13,9 @@ struct labcomm_fd_reader { int close_fd_on_free; }; -static int fd_alloc(struct labcomm_reader *r, void *context, char *version) +static int fd_alloc(struct labcomm_reader *r, void *context, + struct labcomm_decoder *decoder, + char *version) { int result = 0; diff --git a/lib/c/labcomm_fd_writer.c b/lib/c/labcomm_fd_writer.c index 696e6269a9e6c731583a3717a31af9c104191d63..6fadb80c831d60f176b4d7646daadfd6b2b14ff7 100644 --- a/lib/c/labcomm_fd_writer.c +++ b/lib/c/labcomm_fd_writer.c @@ -16,7 +16,9 @@ struct labcomm_fd_writer { static int fd_flush(struct labcomm_writer *w, void *context); -static int fd_alloc(struct labcomm_writer *w, void *context, char *version) +static int fd_alloc(struct labcomm_writer *w, void *context, + struct labcomm_encoder *encoder, + char *version) { w->data = malloc(BUFFER_SIZE); if (! w->data) { diff --git a/lib/c/labcomm_private.h b/lib/c/labcomm_private.h index dfad8697fc54a50c0da598beca9f6f6a7410bdd9..4bd2777e4fe17e8a36113519f6ae9a7b1d2141fd 100644 --- a/lib/c/labcomm_private.h +++ b/lib/c/labcomm_private.h @@ -71,7 +71,8 @@ typedef void (*labcomm_decoder_function)( void *context); struct labcomm_reader_action { - int (*alloc)(struct labcomm_reader *r, void *context, char *labcomm_version); + int (*alloc)(struct labcomm_reader *r, void *context, + struct labcomm_decoder *decoder, char *labcomm_version); int (*free)(struct labcomm_reader *r, void *context); int (*start)(struct labcomm_reader *r, void *context); int (*end)(struct labcomm_reader *r, void *context); @@ -196,7 +197,8 @@ typedef int (*labcomm_encoder_function)( struct labcomm_writer; struct labcomm_writer_action { - int (*alloc)(struct labcomm_writer *w, void *context, char *labcomm_version); + int (*alloc)(struct labcomm_writer *w, void *context, + struct labcomm_encoder *encoder, char *labcomm_version); int (*free)(struct labcomm_writer *w, void *context); int (*start)(struct labcomm_writer *w, void *context, struct labcomm_encoder *encoder, diff --git a/lib/c/test/test_labcomm_generated_encoding.c b/lib/c/test/test_labcomm_generated_encoding.c index 059fe7d22cce8b9b7ea73abbc4f8ed387b3f9156..6cb0d340152718634a2549086af465f7fd91c49f 100644 --- a/lib/c/test/test_labcomm_generated_encoding.c +++ b/lib/c/test/test_labcomm_generated_encoding.c @@ -12,6 +12,7 @@ static unsigned char buffer[128]; struct labcomm_writer *writer; static int buf_writer_alloc(struct labcomm_writer *w, void *context, + struct labcomm_encoder *encoder, char *labcomm_version) { writer = w; /* Hack */