From: Uwe Hermann Date: Thu, 15 Oct 2015 17:38:02 +0000 (+0200) Subject: sr_analog_float_to_string(): Make 'digits' argument unsigned. X-Git-Tag: libsigrok-0.4.0~200 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=8ea0c90268574ccb4ff43344f7bb08f15c776a82;p=libsigrok.git sr_analog_float_to_string(): Make 'digits' argument unsigned. --- diff --git a/include/libsigrok/proto.h b/include/libsigrok/proto.h index 1b5eec7a..c0d40b94 100644 --- a/include/libsigrok/proto.h +++ b/include/libsigrok/proto.h @@ -30,7 +30,8 @@ SR_API int sr_analog_to_float(const struct sr_datafeed_analog *analog, float *buf); -SR_API int sr_analog_float_to_string(float value, int digits, char **result); +SR_API int sr_analog_float_to_string(float value, unsigned int digits, + char **result); SR_API int sr_analog_unit_to_string(const struct sr_datafeed_analog *analog, char **result); SR_API void sr_rational_set(struct sr_rational *r, int64_t p, uint64_t q); diff --git a/src/analog.c b/src/analog.c index 39bf2fce..4b7f15e6 100644 --- a/src/analog.c +++ b/src/analog.c @@ -214,9 +214,9 @@ SR_API int sr_analog_to_float(const struct sr_datafeed_analog *analog, * * @since 0.4.0 */ -SR_API int sr_analog_float_to_string(float value, int digits, char **result) +SR_API int sr_analog_float_to_string(float value, unsigned int digits, char **result) { - int cnt, i; + unsigned int cnt, i; /* This produces at least one too many digits */ *result = g_strdup_printf("%.*f", digits, value);