X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=output%2Fcsv.c;h=57cfb821e836b7aec0be00c81112a68381730113;hb=d1056603a00b92d12170e6e7d3da33473147c5f5;hp=0a7c50443efdb6454941375fcdada8443a59e6df;hpb=29a27196a13de2ffd9b671185e4b464b9db9b549;p=libsigrok.git diff --git a/output/csv.c b/output/csv.c index 0a7c5044..57cfb821 100644 --- a/output/csv.c +++ b/output/csv.c @@ -172,8 +172,7 @@ static int data(struct sr_output *o, const uint8_t *data_in, { struct context *ctx; GString *outstr; - uint64_t sample, i; - int j; + uint64_t sample, i, j; if (!o) { sr_err("%s: o was NULL", __func__); @@ -200,7 +199,7 @@ static int data(struct sr_output *o, const uint8_t *data_in, for (i = 0; i <= length_in - ctx->unitsize; i += ctx->unitsize) { memcpy(&sample, data_in + i, ctx->unitsize); - for (j = ctx->num_enabled_probes - 1; j >= 0; j--) { + for (j = 0; j < ctx->num_enabled_probes; j++) { g_string_append_printf(outstr, "%d%c", (int)((sample & (1 << j)) >> j), ctx->separator);