cli,output: fix truncated array output when == 10 elements

The extra character size was only being applied when > 10 elements,
leaving the == 10 case out of it, so the output was being truncated.
Fix it, by using a more generic way to computing how many extra
characters we need in the size.

Fixes https://gitlab.freedesktop.org/mobile-broadband/ModemManager/issues/151
This commit is contained in:
Aleksander Morgado
2019-10-27 15:52:37 +01:00
parent 1576c7d800
commit f9ea0c1d9c

View File

@@ -964,8 +964,10 @@ dump_output_keyvalue (void)
n = multiple->values ? g_strv_length (multiple->values) : 0;
if (n > 0) {
guint aux = n;
key_length += ((strlen (KEY_ARRAY_VALUE_SUFFIX)) + 3);
if (n > 10)
while ((aux /= 10) > 0)
key_length++;
}
}