lq plugins: make the print_cost_float functions behave the same
authorFerry Huberts <ferry.huberts@pelagic.nl>
Sat, 9 Apr 2016 12:33:34 +0000 (14:33 +0200)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Mon, 11 Apr 2016 10:38:29 +0000 (12:38 +0200)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
src/lq_plugin_default_ff.c
src/lq_plugin_default_ffeth.c
src/lq_plugin_default_float.c

index cde7970..84ec27b 100644 (file)
@@ -423,7 +423,7 @@ default_lq_get_cost_scaled(olsr_linkcost cost)
 static const char *
 default_lq_print_cost_ff(olsr_linkcost cost, struct lqtextbuffer *buffer)
 {
-  snprintf(buffer->buf, sizeof(buffer->buf), "%s", fpmtoa(cost));
+  snprintf(buffer->buf, sizeof(buffer->buf), "%.3f", default_lq_get_cost_scaled(cost));
   buffer->buf[sizeof(buffer->buf) - 1] = '\0';
   return buffer->buf;
 }
index d32c05f..4e7cd63 100644 (file)
@@ -473,7 +473,7 @@ default_lq_get_cost_scaled(olsr_linkcost cost)
 static const char *
 default_lq_print_cost_ffeth(olsr_linkcost cost, struct lqtextbuffer *buffer)
 {
-  snprintf(buffer->buf, sizeof(buffer->buf), "%s", fpmtoa(cost));
+  snprintf(buffer->buf, sizeof(buffer->buf), "%.3f", default_lq_get_cost_scaled(cost));
   buffer->buf[sizeof(buffer->buf) - 1] = '\0';
   return buffer->buf;
 }
index fa3f478..419a17b 100644 (file)
@@ -234,7 +234,7 @@ default_lq_get_cost_scaled(olsr_linkcost cost)
 static const char *
 default_lq_print_cost_float(olsr_linkcost cost, struct lqtextbuffer *buffer)
 {
-  snprintf(buffer->buf, sizeof(struct lqtextbuffer), "%2.3f", default_lq_get_cost_scaled(cost));
+  snprintf(buffer->buf, sizeof(buffer->buf), "%.3f", default_lq_get_cost_scaled(cost));
   buffer->buf[sizeof(buffer->buf) - 1] = '\0';
   return buffer->buf;
 }