From: Gerhard Sittig Date: Thu, 23 Jul 2020 19:55:30 +0000 (+0200) Subject: input/binary: align sr_session_send() chunks to unit size X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=cb0fedd942ce286eb77de4dd1e3f981566f6ab6d;p=libsigrok.git input/binary: align sr_session_send() chunks to unit size The input/binary module chops raw input data into chunks and sends these to the session feed. The total size of input chunks got aligned to the unit size, the session feed output didn't. Make sure to align session packets with the input data's unit size, too. This fixes bug #1582. --- diff --git a/src/input/binary.c b/src/input/binary.c index da664a85..51a64d09 100644 --- a/src/input/binary.c +++ b/src/input/binary.c @@ -103,6 +103,8 @@ static int process_buffer(struct sr_input *in) for (i = 0; i < chunk_size; i += chunk) { logic.data = in->buf->str + i; chunk = MIN(CHUNK_SIZE, chunk_size - i); + chunk /= logic.unitsize; + chunk *= logic.unitsize; logic.length = chunk; sr_session_send(in->sdi, &packet); }