X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fanalog.c;h=9b2977e9b5d4948696c96afa16ce360d7d330fd0;hb=741bcf503dbfa6c282c17ad1898bcbc74cf63dc6;hp=9fdece5df4a82a31333eb0577155b898e4bbea5d;hpb=f200d59ee21a42998752c4319d4ff48e129c95c5;p=libsigrok.git diff --git a/src/analog.c b/src/analog.c index 9fdece5d..9b2977e9 100644 --- a/src/analog.c +++ b/src/analog.c @@ -174,7 +174,6 @@ SR_PRIV int sr_analog_init(struct sr_datafeed_analog *analog, SR_API int sr_analog_to_float(const struct sr_datafeed_analog *analog, float *outbuf) { - float offset; unsigned int b, i, count; gboolean bigendian; @@ -287,7 +286,7 @@ SR_API int sr_analog_to_float(const struct sr_datafeed_analog *analog, if (analog->encoding->scale.p != 1 || analog->encoding->scale.q != 1) outbuf[i] = (outbuf[i] * analog->encoding->scale.p) / analog->encoding->scale.q; - offset = ((float)analog->encoding->offset.p / (float)analog->encoding->offset.q); + float offset = ((float)analog->encoding->offset.p / (float)analog->encoding->offset.q); outbuf[i] += offset; } } @@ -308,7 +307,7 @@ SR_API int sr_analog_to_float(const struct sr_datafeed_analog *analog, SR_API const char *sr_analog_si_prefix(float *value, int *digits) { /** @cond PRIVATE */ -#define NEG_PREFIX_COUNT 5 /* number of prefixes below unity */ +#define NEG_PREFIX_COUNT 5 /* number of prefixes below unity */ #define POS_PREFIX_COUNT (int)(ARRAY_SIZE(prefixes) - NEG_PREFIX_COUNT - 1) /** @endcond */ static const char *prefixes[] = { "f", "p", "n", "µ", "m", "", "k", "M", "G", "T" }; @@ -555,8 +554,8 @@ SR_API int sr_rational_mult(struct sr_rational *res, const struct sr_rational *a return SR_ERR_ARG; } - res->p = (int64_t)(p); - res->q = (uint64_t)(q); + res->p = (int64_t)p; + res->q = (uint64_t)q; return SR_OK;