3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 21:22:37 +01:00

client: Fix dbms to bar conversion utility

Andrew: Note the values aren't guaranteed to be round 100 multiples, so
-6050 is also possible.

Instead of a switch case, use if statements instead
This commit is contained in:
Denis Kenzior 2017-05-19 19:22:32 -05:00
parent 17cad2777d
commit f64dea81b8

View File

@ -245,18 +245,16 @@ static void ordered_networks_destroy(void *data)
static const char *dbms_tostars(int16_t dbms) static const char *dbms_tostars(int16_t dbms)
{ {
switch (dbms) { if (dbms >= -6000)
case -6000 ... 0:
return "****"; return "****";
case -6700 ... -6100:
if (dbms >= -6700)
return "***" COLOR_BOLDGRAY "*" COLOR_OFF; return "***" COLOR_BOLDGRAY "*" COLOR_OFF;
case -7500 ... -6800:
if (dbms >= -7500)
return "**" COLOR_BOLDGRAY "**" COLOR_OFF; return "**" COLOR_BOLDGRAY "**" COLOR_OFF;
case -10000 ... -7600:
return "*" COLOR_BOLDGRAY "***" COLOR_OFF; return "*" COLOR_BOLDGRAY "***" COLOR_OFF;
default:
return "-";
}
} }
static void ordered_networks_display(struct l_queue *ordered_networks) static void ordered_networks_display(struct l_queue *ordered_networks)