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:
@@ -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++;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user