From: Florian Forster Date: Wed, 1 Jul 2009 14:59:28 +0000 (+0200) Subject: network plugin: Cast data sources to their respective types. X-Git-Tag: collectd-4.8.0~87 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=b6284281cf7d745bfa87befe08bba8470548f83c;p=collectd.git network plugin: Cast data sources to their respective types. --- diff --git a/src/network.c b/src/network.c index d88f503d..75f52df6 100644 --- a/src/network.c +++ b/src/network.c @@ -733,19 +733,19 @@ static int parse_part_values (void **ret_buffer, size_t *ret_buffer_len, switch (pkg_types[i]) { case DS_TYPE_COUNTER: - pkg_values[i].counter = ntohll (pkg_values[i].counter); + pkg_values[i].counter = (counter_t) ntohll (pkg_values[i].counter); break; case DS_TYPE_GAUGE: - pkg_values[i].gauge = ntohd (pkg_values[i].gauge); + pkg_values[i].gauge = (gauge_t) ntohd (pkg_values[i].gauge); break; case DS_TYPE_DERIVE: - pkg_values[i].derive = ntohll (pkg_values[i].derive); + pkg_values[i].derive = (derive_t) ntohll (pkg_values[i].derive); break; case DS_TYPE_ABSOLUTE: - pkg_values[i].absolute = ntohll (pkg_values[i].absolute); + pkg_values[i].absolute = (absolute_t) ntohll (pkg_values[i].absolute); break; default: @@ -756,11 +756,6 @@ static int parse_part_values (void **ret_buffer, size_t *ret_buffer_len, pkg_types[i]); return (-1); } /* switch (pkg_types[i]) */ - - if (pkg_types[i] == DS_TYPE_COUNTER) - pkg_values[i].counter = ntohll (pkg_values[i].counter); - else if (pkg_types[i] == DS_TYPE_GAUGE) - pkg_values[i].gauge = ntohd (pkg_values[i].gauge); } *ret_buffer = buffer;