tpm: Optimize the string parsing and fix the boolean logic

The g_ascii_isgraph() correctly handles NUL so just remove the check rather
than adding brackets around the logic.
This commit is contained in:
Richard Hughes 2020-02-07 13:44:26 +00:00
parent 04fde48e9a
commit b27f0d42f9

View File

@ -75,7 +75,7 @@ fu_tpm_device_get_string (ESYS_CONTEXT *ctx, guint32 query, GError **error)
/* convert non-ASCII into spaces */ /* convert non-ASCII into spaces */
for (guint i = 0; i < 4; i++) { for (guint i = 0; i < 4; i++) {
if (!g_ascii_isgraph (result[i]) && result[i] != '\0') if (!g_ascii_isgraph (result[i]))
result[i] = 0x20; result[i] = 0x20;
} }