On Thu, May 11, 2017 at 4:51 AM, Wolfram Sang <w...@the-dreams.de> wrote:
> 'i' was iterating in steps of unitsize. However, the destination array
> was also indexed with it, but it is of u8 type. Let 'i' run bytewise and
> only multiply with unitsize when we need it.
>
> Signed-off-by: Wolfram Sang <w...@the-dreams.de>
> ---
>  src/output/csv.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/output/csv.c b/src/output/csv.c
> index 8d1bcd98..3cf19191 100644
> --- a/src/output/csv.c
> +++ b/src/output/csv.c
> @@ -378,8 +378,8 @@ static void process_logic(struct context *ctx,
>
>         for (j = ch = 0; ch < ctx->num_logic_channels; j++) {
>                 if (ctx->channels[j].ch->type == SR_CHANNEL_LOGIC) {
> -                       for (i = 0; i <= logic->length - logic->unitsize; i 
> += logic->unitsize) {
> -                               sample = logic->data + i;
> +                       for (i = 0; i < num_samples; i++) {
> +                               sample = logic->data + i * logic->unitsize;
>                                 idx = ctx->channels[ch].ch->index;
>                                 if (ctx->label_do && !ctx->label_names)
>                                         ctx->channels[j].label = "logic";
> --
> 2.11.0
>

Tested-by: Maxim Sloyko <m.slo...@gmail.com>

-- 
--
Maxim Sloyko

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
sigrok-devel mailing list
sigrok-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to