]> sigrok.org Git - sigrok-cli.git/commitdiff
Properly handle saving logic data packets of any size.
authorBert Vermeulen <redacted>
Wed, 23 Jul 2014 17:21:54 +0000 (19:21 +0200)
committerBert Vermeulen <redacted>
Wed, 23 Jul 2014 17:23:08 +0000 (19:23 +0200)
session.c

index 7c66659614d7c7673b41b54af44c8f2c115a2e2d..5742eed1e69857730f51cf2649d59bdedff33676 100644 (file)
--- 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);
 
        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);
        if (buf_len + data_len > SAVE_CHUNK_SIZE) {
                max = (SAVE_CHUNK_SIZE - buf_len) / unitsize * unitsize;
                memcpy(buf + buf_len, data, max);