X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Foutput%2Fcsv.c;h=2be4db372f67101ae3241ede4d7d4c2e9ba3b27c;hb=d05b1a860606e078eed77722d8a0c62850ee39af;hp=dd94f28d694f61a039e95e1114f2cdeea129f5e8;hpb=7e7d7bc074fd92d54c2851ad64ed443fdd58fc28;p=libsigrok.git diff --git a/src/output/csv.c b/src/output/csv.c index dd94f28d..2be4db37 100644 --- a/src/output/csv.c +++ b/src/output/csv.c @@ -260,7 +260,7 @@ static GString *gen_header(const struct sr_output *o, g_string_append_printf(header, "%s Channels (%d/%d):", ctx->comment, ctx->num_analog_channels + ctx->num_logic_channels, num_channels); - for (i = 0, l = o->sdi->channels; l; l = l->next, i++) { + for (l = o->sdi->channels; l; l = l->next) { ch = l->data; if (ch->enabled) g_string_append_printf(header, " %s,", ch->name); @@ -380,7 +380,7 @@ static void process_logic(struct context *ctx, if (ctx->channels[j].ch->type == SR_CHANNEL_LOGIC) { for (i = 0; i < num_samples; i++) { sample = logic->data + i * logic->unitsize; - idx = ctx->channels[ch].ch->index; + idx = ctx->channels[j].ch->index; if (ctx->label_do && !ctx->label_names) ctx->channels[j].label = "logic"; ctx->logic_samples[i * ctx->num_logic_channels + ch] = sample[idx / 8] & (1 << (idx % 8));