diff --git a/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 b/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 index a9c9c85f..0f2faf44 100644 --- a/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 +++ b/other/bootstrap_daemon/docker/tox-bootstrapd.sha256 @@ -1 +1 @@ -48ed699a0da0282b7e12142648a322198a2f2af791df3fb49bbe3f7e41afadc4 /usr/local/bin/tox-bootstrapd +7dfcf534fb80fbd8337337f5aa9eaa120febc72386046c7ab0d5c7545e900657 /usr/local/bin/tox-bootstrapd diff --git a/toxcore/tox_event.c b/toxcore/tox_event.c index dd54fa97..edade65b 100644 --- a/toxcore/tox_event.c +++ b/toxcore/tox_event.c @@ -940,7 +940,7 @@ static bool tox_event_type_from_int(uint32_t value, Tox_Event_Type *out) } non_null() -static bool tox_event_type_unpack(Bin_Unpack *bu, Tox_Event_Type *val) +static bool tox_event_type_unpack(Tox_Event_Type *val, Bin_Unpack *bu) { uint32_t u32; return bin_unpack_u32(bu, &u32) @@ -1080,21 +1080,7 @@ static bool tox_event_data_unpack(Tox_Event_Type type, Tox_Event_Data *data, Bin bool tox_event_unpack_into(Tox_Event *event, Bin_Unpack *bu, const Memory *mem) { - uint32_t size; - if (!bin_unpack_array(bu, &size)) { - return false; - } - - if (size != 2) { - return false; - } - - Tox_Event_Type type; - if (!tox_event_type_unpack(bu, &type)) { - return false; - } - - event->type = type; - - return tox_event_data_unpack(event->type, &event->data, bu, mem); + return bin_unpack_array_fixed(bu, 2, nullptr) // + && tox_event_type_unpack(&event->type, bu) // + && tox_event_data_unpack(event->type, &event->data, bu, mem); } diff --git a/toxcore/tox_events.c b/toxcore/tox_events.c index fe930a37..d8f22d9f 100644 --- a/toxcore/tox_events.c +++ b/toxcore/tox_events.c @@ -134,7 +134,7 @@ bool tox_events_get_bytes(const Tox_Events *events, uint8_t *bytes) } non_null() -static bool tox_events_unpack(void *obj, Bin_Unpack *bu) +static bool tox_events_unpack_handler(void *obj, Bin_Unpack *bu) { Tox_Events *events = (Tox_Events *)obj; @@ -174,7 +174,7 @@ Tox_Events *tox_events_load(const Tox_System *sys, const uint8_t *bytes, uint32_ }; events->mem = sys->mem; - if (!bin_unpack_obj(tox_events_unpack, events, bytes, bytes_size)) { + if (!bin_unpack_obj(tox_events_unpack_handler, events, bytes, bytes_size)) { tox_events_free(events); return nullptr; }