From 8ea0c90268574ccb4ff43344f7bb08f15c776a82 Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Thu, 15 Oct 2015 19:38:02 +0200 Subject: [PATCH] sr_analog_float_to_string(): Make 'digits' argument unsigned. --- include/libsigrok/proto.h | 3 ++- src/analog.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) 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);