From: Bert Vermeulen Date: Wed, 23 Jul 2014 17:21:54 +0000 (+0200) Subject: Properly handle saving logic data packets of any size. X-Git-Tag: sigrok-cli-0.6.0~88 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=64c74f2561987c152e3ee3dbf06e20056868ff84;p=sigrok-cli.git Properly handle saving logic data packets of any size. --- diff --git a/session.c b/session.c index 7c66659..5742eed 100644 --- a/session.c +++ b/session.c @@ -589,6 +589,12 @@ void save_chunk_logic(struct sr_session *session, uint8_t *data, if (!buf) buf = g_malloc(SAVE_CHUNK_SIZE); + while (data_len > SAVE_CHUNK_SIZE) { + save_chunk_logic(session, data, SAVE_CHUNK_SIZE, unitsize); + data += SAVE_CHUNK_SIZE; + data_len -= SAVE_CHUNK_SIZE; + } + if (buf_len + data_len > SAVE_CHUNK_SIZE) { max = (SAVE_CHUNK_SIZE - buf_len) / unitsize * unitsize; memcpy(buf + buf_len, data, max);