From: Martin Ling Date: Thu, 17 Sep 2015 01:04:19 +0000 (+0100) Subject: sr_analog_to_float: Fix byte reordering. X-Git-Tag: libsigrok-0.4.0~267 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=3e27754989f631bd059d2797c61cdf1c884b1f1e;p=libsigrok.git sr_analog_to_float: Fix byte reordering. --- diff --git a/src/analog.c b/src/analog.c index 61f1f733..6266379d 100644 --- a/src/analog.c +++ b/src/analog.c @@ -179,9 +179,11 @@ SR_API int sr_analog_to_float(const struct sr_datafeed_analog2 *analog, for (i = 0; i < analog->num_samples; i += analog->encoding->unitsize) { for (b = 0; b < analog->encoding->unitsize; b++) { if (analog->encoding->is_bigendian == bigendian) - outbuf[i + b] = ((float *)analog->data)[i * analog->encoding->unitsize + b]; + ((uint8_t *)outbuf)[i + b] = + ((uint8_t *)analog->data)[i * analog->encoding->unitsize + b]; else - outbuf[i + (analog->encoding->unitsize - b)] = ((float *)analog->data)[i * analog->encoding->unitsize + b]; + ((uint8_t *)outbuf)[i + (analog->encoding->unitsize - b)] = + ((uint8_t *)analog->data)[i * analog->encoding->unitsize + b]; } if (analog->encoding->scale.p != analog->encoding->scale.q) outbuf[i] = (outbuf[i] * analog->encoding->scale.p) / analog->encoding->scale.q;