diff options
author | Mattias Andrée <m@maandree.se> | 2025-02-10 18:28:54 +0100 |
---|---|---|
committer | Mattias Andrée <m@maandree.se> | 2025-02-10 18:28:54 +0100 |
commit | 69e7fdc8f7ed2782e2c73b632c2a7ee7e6b641d5 (patch) | |
tree | 55b05baf81f3b78e80df594f1c082735a03dc654 | |
parent | Minor code improvements and split into multiple c files (diff) | |
download | libcoopgamma-69e7fdc8f7ed2782e2c73b632c2a7ee7e6b641d5.tar.gz libcoopgamma-69e7fdc8f7ed2782e2c73b632c2a7ee7e6b641d5.tar.bz2 libcoopgamma-69e7fdc8f7ed2782e2c73b632c2a7ee7e6b641d5.tar.xz |
Signed-off-by: Mattias Andrée <m@maandree.se>
25 files changed, 153 insertions, 104 deletions
@@ -82,7 +82,9 @@ OBJ =\ libcoopgamma_ramps_unmarshal_.o\ libcoopgamma_send_message__.o -HDR = libcoopgamma.h +HDR =\ + libcoopgamma.h\ + common.h LOBJ = $(OBJ:.o=.lo) @@ -62,19 +62,31 @@ extern const char *argv0; #define UNMARSHAL_EPILOGUE\ return *np = off, LIBCOOPGAMMA_SUCCESS -#define marshal_prim(datum, type)\ - ((buf != NULL ? *(type *)&buf[off] = (datum) : 0), off += sizeof(type)) +#define marshal_prim(datum)\ + do {\ + char *buf__ = (buf);\ + size_t off__ = ((off) += sizeof(datum)) - sizeof(datum);\ + if (buf__)\ + memcpy(&buf__[off__], &(datum), sizeof(datum));\ + } while (0) -#define unmarshal_prim(datum, type)\ - ((datum) = *(const type *)&buf[off], off += sizeof(type)) +#define unmarshal_prim(datum)\ + do {\ + const char *buf__ = (buf);\ + size_t off__ = ((off) += sizeof(datum)) - sizeof(datum);\ + memcpy(&(datum), &buf__[off__], sizeof(datum));\ + } while (0) #define marshal_version(version)\ - marshal_prim(version, int) + do {\ + int version__ = (version);\ + marshal_prim(version__);\ + } while (0) #define unmarshal_version(version)\ do {\ int version__;\ - unmarshal_prim(version__, int);\ + unmarshal_prim(version__);\ if (version__ < (version))\ return LIBCOOPGAMMA_INCOMPATIBLE_DOWNGRADE;\ if (version__ > (version))\ @@ -94,13 +106,17 @@ extern const char *argv0; } while (0) #define marshal_string(datum)\ - (!(datum) ? marshal_prim(0, char) :\ - (marshal_prim(1, char), marshal_buffer((datum), strlen(datum) + 1U))) + do {\ + char nonnull__ = (char)!!(datum);\ + marshal_prim(nonnull__);\ + if (nonnull__)\ + marshal_buffer((datum), strlen(datum) + 1U);\ + } while (0) #define unmarshal_string(datum)\ do {\ char nonnull__;\ - unmarshal_prim(nonnull__, char);\ + unmarshal_prim(nonnull__);\ if (nonnull__)\ unmarshal_buffer((datum), strlen(&buf[off]) + 1U);\ else\ diff --git a/libcoopgamma_async_context_marshal.c b/libcoopgamma_async_context_marshal.c index 6f1b96d..5f7ac57 100644 --- a/libcoopgamma_async_context_marshal.c +++ b/libcoopgamma_async_context_marshal.c @@ -16,7 +16,7 @@ libcoopgamma_async_context_marshal(const libcoopgamma_async_context_t *restrict { MARSHAL_PROLOGUE; marshal_version(LIBCOOPGAMMA_ASYNC_CONTEXT_VERSION); - marshal_prim(this->message_id, uint32_t); - marshal_prim(this->coalesce, int); + marshal_prim(this->message_id); + marshal_prim(this->coalesce); MARSHAL_EPILOGUE; } diff --git a/libcoopgamma_async_context_unmarshal.c b/libcoopgamma_async_context_unmarshal.c index 9530779..a6f3759 100644 --- a/libcoopgamma_async_context_unmarshal.c +++ b/libcoopgamma_async_context_unmarshal.c @@ -16,7 +16,7 @@ libcoopgamma_async_context_unmarshal(libcoopgamma_async_context_t *restrict this { UNMARSHAL_PROLOGUE; unmarshal_version(LIBCOOPGAMMA_ASYNC_CONTEXT_VERSION); - unmarshal_prim(this->message_id, uint32_t); - unmarshal_prim(this->coalesce, int); + unmarshal_prim(this->message_id); + unmarshal_prim(this->coalesce); UNMARSHAL_EPILOGUE; } diff --git a/libcoopgamma_context_initialise.c b/libcoopgamma_context_initialise.c index 5ece7d8..b26a559 100644 --- a/libcoopgamma_context_initialise.c +++ b/libcoopgamma_context_initialise.c @@ -14,5 +14,7 @@ libcoopgamma_context_initialise(libcoopgamma_context_t *restrict this) memset(this, 0, sizeof(*this)); this->fd = -1; this->blocking = 1; + this->outbound = NULL; + this->inbound = NULL; return 0; } diff --git a/libcoopgamma_context_marshal.c b/libcoopgamma_context_marshal.c index 1a7ad88..39ca11e 100644 --- a/libcoopgamma_context_marshal.c +++ b/libcoopgamma_context_marshal.c @@ -14,20 +14,23 @@ size_t libcoopgamma_context_marshal(const libcoopgamma_context_t *restrict this, void *restrict vbuf) { + size_t n; MARSHAL_PROLOGUE; marshal_version(LIBCOOPGAMMA_CONTEXT_VERSION); - marshal_prim(this->fd, int); + marshal_prim(this->fd); off += libcoopgamma_error_marshal(&this->error, SUBBUF); - marshal_prim(this->message_id, uint32_t); - marshal_prim(this->outbound_head - this->outbound_tail, size_t); - marshal_buffer(this->outbound + this->outbound_tail, this->outbound_head - this->outbound_tail); - marshal_prim(this->inbound_head - this->inbound_tail, size_t); - marshal_buffer(this->inbound + this->inbound_tail, this->inbound_head - this->inbound_tail); - marshal_prim(this->length, size_t); - marshal_prim(this->curline, size_t); - marshal_prim(this->in_response_to, uint32_t); - marshal_prim(this->have_all_headers, int); - marshal_prim(this->bad_message, int); - marshal_prim(this->blocking, int); + marshal_prim(this->message_id); + n = this->outbound_head - this->outbound_tail; + marshal_prim(n); + marshal_buffer(&this->outbound[this->outbound_tail], n); + n = this->inbound_head - this->inbound_tail; + marshal_prim(n); + marshal_buffer(&this->inbound[this->inbound_tail], n); + marshal_prim(this->length); + marshal_prim(this->curline); + marshal_prim(this->in_response_to); + marshal_prim(this->have_all_headers); + marshal_prim(this->bad_message); + marshal_prim(this->blocking); MARSHAL_EPILOGUE; } diff --git a/libcoopgamma_context_unmarshal.c b/libcoopgamma_context_unmarshal.c index a96d739..13beda7 100644 --- a/libcoopgamma_context_unmarshal.c +++ b/libcoopgamma_context_unmarshal.c @@ -18,24 +18,26 @@ libcoopgamma_context_unmarshal(libcoopgamma_context_t *restrict this, const void int r; UNMARSHAL_PROLOGUE; memset(this, 0, sizeof(*this)); + this->outbound = NULL; + this->inbound = NULL; unmarshal_version(LIBCOOPGAMMA_CONTEXT_VERSION); - unmarshal_prim(this->fd, int); + unmarshal_prim(this->fd); r = libcoopgamma_error_unmarshal(&this->error, NNSUBBUF, &n); if (r != LIBCOOPGAMMA_SUCCESS) return r; off += n; - unmarshal_prim(this->message_id, uint32_t); - unmarshal_prim(this->outbound_head, size_t); + unmarshal_prim(this->message_id); + unmarshal_prim(this->outbound_head); this->outbound_size = this->outbound_head; unmarshal_buffer(this->outbound, this->outbound_head); - unmarshal_prim(this->inbound_head, size_t); + unmarshal_prim(this->inbound_head); this->inbound_size = this->inbound_head; unmarshal_buffer(this->inbound, this->inbound_head); - unmarshal_prim(this->length, size_t); - unmarshal_prim(this->curline, size_t); - unmarshal_prim(this->in_response_to, uint32_t); - unmarshal_prim(this->have_all_headers, int); - unmarshal_prim(this->bad_message, int); - unmarshal_prim(this->blocking, int); + unmarshal_prim(this->length); + unmarshal_prim(this->curline); + unmarshal_prim(this->in_response_to); + unmarshal_prim(this->have_all_headers); + unmarshal_prim(this->bad_message); + unmarshal_prim(this->blocking); UNMARSHAL_EPILOGUE; } diff --git a/libcoopgamma_crtc_info_marshal.c b/libcoopgamma_crtc_info_marshal.c index 06106ab..ffbd67c 100644 --- a/libcoopgamma_crtc_info_marshal.c +++ b/libcoopgamma_crtc_info_marshal.c @@ -19,21 +19,21 @@ libcoopgamma_crtc_info_marshal(const libcoopgamma_crtc_info_t *restrict this, vo marshal_version(LIBCOOPGAMMA_DEPTH_VERSION); marshal_version(LIBCOOPGAMMA_SUPPORT_VERSION); marshal_version(LIBCOOPGAMMA_COLOURSPACE_VERSION); - marshal_prim(this->cooperative, int); - marshal_prim(this->depth, libcoopgamma_depth_t); - marshal_prim(this->red_size, size_t); - marshal_prim(this->green_size, size_t); - marshal_prim(this->blue_size, size_t); - marshal_prim(this->supported, libcoopgamma_support_t); - marshal_prim(this->colourspace, libcoopgamma_colourspace_t); - marshal_prim(this->have_gamut, int); - marshal_prim(this->red_x, unsigned); - marshal_prim(this->red_y, unsigned); - marshal_prim(this->green_x, unsigned); - marshal_prim(this->green_y, unsigned); - marshal_prim(this->blue_x, unsigned); - marshal_prim(this->blue_y, unsigned); - marshal_prim(this->white_x, unsigned); - marshal_prim(this->white_y, unsigned); + marshal_prim(this->cooperative); + marshal_prim(this->depth); + marshal_prim(this->red_size); + marshal_prim(this->green_size); + marshal_prim(this->blue_size); + marshal_prim(this->supported); + marshal_prim(this->colourspace); + marshal_prim(this->have_gamut); + marshal_prim(this->red_x); + marshal_prim(this->red_y); + marshal_prim(this->green_x); + marshal_prim(this->green_y); + marshal_prim(this->blue_x); + marshal_prim(this->blue_y); + marshal_prim(this->white_x); + marshal_prim(this->white_y); MARSHAL_EPILOGUE; } diff --git a/libcoopgamma_crtc_info_unmarshal.c b/libcoopgamma_crtc_info_unmarshal.c index 0afd77b..8c89d99 100644 --- a/libcoopgamma_crtc_info_unmarshal.c +++ b/libcoopgamma_crtc_info_unmarshal.c @@ -19,21 +19,21 @@ libcoopgamma_crtc_info_unmarshal(libcoopgamma_crtc_info_t *restrict this, const unmarshal_version(LIBCOOPGAMMA_DEPTH_VERSION); unmarshal_version(LIBCOOPGAMMA_SUPPORT_VERSION); unmarshal_version(LIBCOOPGAMMA_COLOURSPACE_VERSION); - unmarshal_prim(this->cooperative, int); - unmarshal_prim(this->depth, libcoopgamma_depth_t); - unmarshal_prim(this->red_size, size_t); - unmarshal_prim(this->green_size, size_t); - unmarshal_prim(this->blue_size, size_t); - unmarshal_prim(this->supported, libcoopgamma_support_t); - unmarshal_prim(this->colourspace, libcoopgamma_colourspace_t); - unmarshal_prim(this->have_gamut, int); - unmarshal_prim(this->red_x, unsigned); - unmarshal_prim(this->red_y, unsigned); - unmarshal_prim(this->green_x, unsigned); - unmarshal_prim(this->green_y, unsigned); - unmarshal_prim(this->blue_x, unsigned); - unmarshal_prim(this->blue_y, unsigned); - unmarshal_prim(this->white_x, unsigned); - unmarshal_prim(this->white_y, unsigned); + unmarshal_prim(this->cooperative); + unmarshal_prim(this->depth); + unmarshal_prim(this->red_size); + unmarshal_prim(this->green_size); + unmarshal_prim(this->blue_size); + unmarshal_prim(this->supported); + unmarshal_prim(this->colourspace); + unmarshal_prim(this->have_gamut); + unmarshal_prim(this->red_x); + unmarshal_prim(this->red_y); + unmarshal_prim(this->green_x); + unmarshal_prim(this->green_y); + unmarshal_prim(this->blue_x); + unmarshal_prim(this->blue_y); + unmarshal_prim(this->white_x); + unmarshal_prim(this->white_y); UNMARSHAL_EPILOGUE; } diff --git a/libcoopgamma_error_marshal.c b/libcoopgamma_error_marshal.c index fcd9e38..adcafa9 100644 --- a/libcoopgamma_error_marshal.c +++ b/libcoopgamma_error_marshal.c @@ -16,9 +16,9 @@ libcoopgamma_error_marshal(const libcoopgamma_error_t *restrict this, void *rest { MARSHAL_PROLOGUE; marshal_version(LIBCOOPGAMMA_ERROR_VERSION); - marshal_prim(this->number, uint64_t); - marshal_prim(this->custom, int); - marshal_prim(this->server_side, int); + marshal_prim(this->number); + marshal_prim(this->custom); + marshal_prim(this->server_side); marshal_string(this->description); MARSHAL_EPILOGUE; } diff --git a/libcoopgamma_error_unmarshal.c b/libcoopgamma_error_unmarshal.c index 489f47d..e95f944 100644 --- a/libcoopgamma_error_unmarshal.c +++ b/libcoopgamma_error_unmarshal.c @@ -17,9 +17,9 @@ libcoopgamma_error_unmarshal(libcoopgamma_error_t *restrict this, const void *re UNMARSHAL_PROLOGUE; this->description = NULL; unmarshal_version(LIBCOOPGAMMA_ERROR_VERSION); - unmarshal_prim(this->number, uint64_t); - unmarshal_prim(this->custom, int); - unmarshal_prim(this->server_side, int); + unmarshal_prim(this->number); + unmarshal_prim(this->custom); + unmarshal_prim(this->server_side); unmarshal_string(this->description); UNMARSHAL_EPILOGUE; } diff --git a/libcoopgamma_filter_destroy.c b/libcoopgamma_filter_destroy.c index 89765ad..84ee4a3 100644 --- a/libcoopgamma_filter_destroy.c +++ b/libcoopgamma_filter_destroy.c @@ -18,4 +18,9 @@ libcoopgamma_filter_destroy(libcoopgamma_filter_t *restrict this) free(this->class); free(this->ramps.u8.red); memset(this, 0, sizeof(*this)); + this->crtc = NULL; + this->class = NULL; + this->ramps.u8.red = NULL; + this->ramps.u8.green = NULL; + this->ramps.u8.blue = NULL; } diff --git a/libcoopgamma_filter_initialise.c b/libcoopgamma_filter_initialise.c index fcf71ce..bf3ec51 100644 --- a/libcoopgamma_filter_initialise.c +++ b/libcoopgamma_filter_initialise.c @@ -12,5 +12,10 @@ int libcoopgamma_filter_initialise(libcoopgamma_filter_t *restrict this) { memset(this, 0, sizeof(*this)); + this->crtc = NULL; + this->class = NULL; + this->ramps.u8.red = NULL; + this->ramps.u8.green = NULL; + this->ramps.u8.blue = NULL; return 0; } diff --git a/libcoopgamma_filter_marshal.c b/libcoopgamma_filter_marshal.c index 8c2723e..b7f49ec 100644 --- a/libcoopgamma_filter_marshal.c +++ b/libcoopgamma_filter_marshal.c @@ -18,11 +18,11 @@ libcoopgamma_filter_marshal(const libcoopgamma_filter_t *restrict this, void *re marshal_version(LIBCOOPGAMMA_FILTER_VERSION); marshal_version(LIBCOOPGAMMA_DEPTH_VERSION); marshal_version(LIBCOOPGAMMA_LIFESPAN_VERSION); - marshal_prim(this->depth, libcoopgamma_depth_t); - marshal_prim(this->priority, int64_t); + marshal_prim(this->depth); + marshal_prim(this->priority); marshal_string(this->crtc); marshal_string(this->class); - marshal_prim(this->lifespan, libcoopgamma_lifespan_t); + marshal_prim(this->lifespan); switch (this->depth) { case LIBCOOPGAMMA_UINT8: off += libcoopgamma_ramps_marshal(&this->ramps.u8, SUBBUF); break; case LIBCOOPGAMMA_UINT16: off += libcoopgamma_ramps_marshal(&this->ramps.u16, SUBBUF); break; diff --git a/libcoopgamma_filter_query_marshal.c b/libcoopgamma_filter_query_marshal.c index 1049623..34835ca 100644 --- a/libcoopgamma_filter_query_marshal.c +++ b/libcoopgamma_filter_query_marshal.c @@ -17,8 +17,8 @@ libcoopgamma_filter_query_marshal(const libcoopgamma_filter_query_t *restrict th MARSHAL_PROLOGUE; marshal_version(LIBCOOPGAMMA_FILTER_QUERY_VERSION); marshal_string(this->crtc); - marshal_prim(this->coalesce, int); - marshal_prim(this->high_priority, int64_t); - marshal_prim(this->low_priority, int64_t); + marshal_prim(this->coalesce); + marshal_prim(this->high_priority); + marshal_prim(this->low_priority); MARSHAL_EPILOGUE; } diff --git a/libcoopgamma_filter_query_unmarshal.c b/libcoopgamma_filter_query_unmarshal.c index ac2aa45..d646bb4 100644 --- a/libcoopgamma_filter_query_unmarshal.c +++ b/libcoopgamma_filter_query_unmarshal.c @@ -18,8 +18,8 @@ libcoopgamma_filter_query_unmarshal(libcoopgamma_filter_query_t *restrict this, this->crtc = NULL; unmarshal_version(LIBCOOPGAMMA_FILTER_QUERY_VERSION); unmarshal_string(this->crtc); - unmarshal_prim(this->coalesce, int); - unmarshal_prim(this->high_priority, int64_t); - unmarshal_prim(this->low_priority, int64_t); + unmarshal_prim(this->coalesce); + unmarshal_prim(this->high_priority); + unmarshal_prim(this->low_priority); UNMARSHAL_EPILOGUE; } diff --git a/libcoopgamma_filter_table_initialise.c b/libcoopgamma_filter_table_initialise.c index c6969b6..64b9e7e 100644 --- a/libcoopgamma_filter_table_initialise.c +++ b/libcoopgamma_filter_table_initialise.c @@ -12,5 +12,6 @@ int libcoopgamma_filter_table_initialise(libcoopgamma_filter_table_t *restrict this) { memset(this, 0, sizeof(*this)); + this->filters = NULL; return 0; } diff --git a/libcoopgamma_filter_table_marshal.c b/libcoopgamma_filter_table_marshal.c index 5a7e6c3..31e24f8 100644 --- a/libcoopgamma_filter_table_marshal.c +++ b/libcoopgamma_filter_table_marshal.c @@ -18,11 +18,11 @@ libcoopgamma_filter_table_marshal(const libcoopgamma_filter_table_t *restrict th MARSHAL_PROLOGUE; marshal_version(LIBCOOPGAMMA_FILTER_TABLE_VERSION); marshal_version(LIBCOOPGAMMA_DEPTH_VERSION); - marshal_prim(this->depth, libcoopgamma_depth_t); - marshal_prim(this->red_size, size_t); - marshal_prim(this->green_size, size_t); - marshal_prim(this->blue_size, size_t); - marshal_prim(this->filter_count, size_t); + marshal_prim(this->depth); + marshal_prim(this->red_size); + marshal_prim(this->green_size); + marshal_prim(this->blue_size); + marshal_prim(this->filter_count); for (i = 0; i < this->filter_count; i++) off += libcoopgamma_queried_filter_marshal(&this->filters[i], SUBBUF, this->depth); MARSHAL_EPILOGUE; diff --git a/libcoopgamma_filter_table_unmarshal.c b/libcoopgamma_filter_table_unmarshal.c index 1059d85..74e54cf 100644 --- a/libcoopgamma_filter_table_unmarshal.c +++ b/libcoopgamma_filter_table_unmarshal.c @@ -21,11 +21,11 @@ libcoopgamma_filter_table_unmarshal(libcoopgamma_filter_table_t *restrict this, this->filters = NULL; unmarshal_version(LIBCOOPGAMMA_FILTER_TABLE_VERSION); unmarshal_version(LIBCOOPGAMMA_DEPTH_VERSION); - unmarshal_prim(this->depth, libcoopgamma_depth_t); - unmarshal_prim(this->red_size, size_t); - unmarshal_prim(this->green_size, size_t); - unmarshal_prim(this->blue_size, size_t); - unmarshal_prim(fn, size_t); + unmarshal_prim(this->depth); + unmarshal_prim(this->red_size); + unmarshal_prim(this->green_size); + unmarshal_prim(this->blue_size); + unmarshal_prim(fn); this->filters = malloc(fn * sizeof(*this->filters)); if (!this->filters) return LIBCOOPGAMMA_ERRNO_SET; diff --git a/libcoopgamma_filter_unmarshal.c b/libcoopgamma_filter_unmarshal.c index 9351215..d6bcc87 100644 --- a/libcoopgamma_filter_unmarshal.c +++ b/libcoopgamma_filter_unmarshal.c @@ -18,14 +18,19 @@ libcoopgamma_filter_unmarshal(libcoopgamma_filter_t *restrict this, const void * size_t n = 0; UNMARSHAL_PROLOGUE; memset(this, 0, sizeof(*this)); + this->crtc = NULL; + this->class = NULL; + this->ramps.u8.red = NULL; + this->ramps.u8.green = NULL; + this->ramps.u8.blue = NULL; unmarshal_version(LIBCOOPGAMMA_FILTER_VERSION); unmarshal_version(LIBCOOPGAMMA_DEPTH_VERSION); unmarshal_version(LIBCOOPGAMMA_LIFESPAN_VERSION); - unmarshal_prim(this->depth, libcoopgamma_depth_t); - unmarshal_prim(this->priority, int64_t); + unmarshal_prim(this->depth); + unmarshal_prim(this->priority); unmarshal_string(this->crtc); unmarshal_string(this->class); - unmarshal_prim(this->lifespan, libcoopgamma_lifespan_t); + unmarshal_prim(this->lifespan); switch (this->depth) { case LIBCOOPGAMMA_UINT8: r = libcoopgamma_ramps_unmarshal(&(this->ramps.u8), NNSUBBUF, &n); break; case LIBCOOPGAMMA_UINT16: r = libcoopgamma_ramps_unmarshal(&(this->ramps.u16), NNSUBBUF, &n); break; diff --git a/libcoopgamma_queried_filter_initialise.c b/libcoopgamma_queried_filter_initialise.c index b289949..6130fcd 100644 --- a/libcoopgamma_queried_filter_initialise.c +++ b/libcoopgamma_queried_filter_initialise.c @@ -12,5 +12,9 @@ int libcoopgamma_queried_filter_initialise(libcoopgamma_queried_filter_t *restrict this) { memset(this, 0, sizeof(*this)); + this->class = NULL; + this->ramps.u8.red = NULL; + this->ramps.u8.green = NULL; + this->ramps.u8.blue = NULL; return 0; } diff --git a/libcoopgamma_queried_filter_marshal.c b/libcoopgamma_queried_filter_marshal.c index 054ebfa..563fe00 100644 --- a/libcoopgamma_queried_filter_marshal.c +++ b/libcoopgamma_queried_filter_marshal.c @@ -18,7 +18,7 @@ libcoopgamma_queried_filter_marshal(const libcoopgamma_queried_filter_t *restric { MARSHAL_PROLOGUE; marshal_version(LIBCOOPGAMMA_QUERIED_FILTER_VERSION); - marshal_prim(this->priority, int64_t); + marshal_prim(this->priority); marshal_string(this->class); switch (depth) { case LIBCOOPGAMMA_UINT8: off += libcoopgamma_ramps_marshal(&this->ramps.u8, SUBBUF); break; diff --git a/libcoopgamma_queried_filter_unmarshal.c b/libcoopgamma_queried_filter_unmarshal.c index 99d6bc3..f8a04ed 100644 --- a/libcoopgamma_queried_filter_unmarshal.c +++ b/libcoopgamma_queried_filter_unmarshal.c @@ -20,8 +20,12 @@ libcoopgamma_queried_filter_unmarshal(libcoopgamma_queried_filter_t *restrict th size_t n = 0; UNMARSHAL_PROLOGUE; memset(this, 0, sizeof(*this)); + this->class = NULL; + this->ramps.u8.red = NULL; + this->ramps.u8.green = NULL; + this->ramps.u8.blue = NULL; unmarshal_version(LIBCOOPGAMMA_QUERIED_FILTER_VERSION); - unmarshal_prim(this->priority, int64_t); + unmarshal_prim(this->priority); unmarshal_string(this->class); switch (depth) { case LIBCOOPGAMMA_UINT8: r = libcoopgamma_ramps_unmarshal(&this->ramps.u8, NNSUBBUF, &n); break; diff --git a/libcoopgamma_ramps_marshal_.c b/libcoopgamma_ramps_marshal_.c index 65b5571..c428cfc 100644 --- a/libcoopgamma_ramps_marshal_.c +++ b/libcoopgamma_ramps_marshal_.c @@ -19,9 +19,9 @@ libcoopgamma_ramps_marshal_(const void *restrict this, void *restrict vbuf, size const libcoopgamma_ramps8_t *restrict this8 = (const libcoopgamma_ramps8_t *restrict)this; MARSHAL_PROLOGUE; marshal_version(LIBCOOPGAMMA_RAMPS_VERSION); - marshal_prim(this8->red_size, size_t); - marshal_prim(this8->green_size, size_t); - marshal_prim(this8->blue_size, size_t); + marshal_prim(this8->red_size); + marshal_prim(this8->green_size); + marshal_prim(this8->blue_size); marshal_buffer(this8->red, (this8->red_size + this8->green_size + this8->blue_size) * width); MARSHAL_EPILOGUE; } diff --git a/libcoopgamma_ramps_unmarshal_.c b/libcoopgamma_ramps_unmarshal_.c index fe07c22..5be456e 100644 --- a/libcoopgamma_ramps_unmarshal_.c +++ b/libcoopgamma_ramps_unmarshal_.c @@ -20,9 +20,9 @@ libcoopgamma_ramps_unmarshal_(void *restrict this, const void *restrict vbuf, libcoopgamma_ramps8_t *restrict this8 = (libcoopgamma_ramps8_t *restrict)this; UNMARSHAL_PROLOGUE; unmarshal_version(LIBCOOPGAMMA_RAMPS_VERSION); - unmarshal_prim(this8->red_size, size_t); - unmarshal_prim(this8->green_size, size_t); - unmarshal_prim(this8->blue_size, size_t); + unmarshal_prim(this8->red_size); + unmarshal_prim(this8->green_size); + unmarshal_prim(this8->blue_size); unmarshal_buffer(this8->red, (this8->red_size + this8->green_size + this8->blue_size) * width); this8->green = this8->red + this8->red_size * width; this8->blue = this8->green + this8->green_size * width; |