sign-dummy: Convert to current code style

This keeps the code style consistent.
This commit is contained in:
Colin Walters 2020-02-14 14:54:00 +00:00 committed by Denis Pynkin
parent 2a0edccbd3
commit e2bd2abc67
1 changed files with 9 additions and 22 deletions

View File

@ -160,25 +160,13 @@ gboolean ostree_sign_dummy_data_verify (OstreeSign *self,
OstreeSignDummy *sign = _ostree_sign_dummy_get_instance_private(OSTREE_SIGN_DUMMY(self)); OstreeSignDummy *sign = _ostree_sign_dummy_get_instance_private(OSTREE_SIGN_DUMMY(self));
gboolean ret = FALSE;
if (signatures == NULL) if (signatures == NULL)
{ return glnx_throw (error, "signature: dummy: commit have no signatures of my type");
g_set_error_literal (error,
G_IO_ERROR, G_IO_ERROR_FAILED,
"signature: dummy: commit have no signatures of my type");
goto err;
}
if (!g_variant_is_of_type (signatures, (GVariantType *) OSTREE_SIGN_METADATA_DUMMY_TYPE)) if (!g_variant_is_of_type (signatures, (GVariantType *) OSTREE_SIGN_METADATA_DUMMY_TYPE))
{ return glnx_throw (error, "signature: dummy: wrong type passed for verification");
g_set_error_literal (error,
G_IO_ERROR, G_IO_ERROR_FAILED,
"signature: dummy: wrong type passed for verification");
goto err;
}
gboolean verified = FALSE;
for (gsize i = 0; i < g_variant_n_children(signatures); i++) for (gsize i = 0; i < g_variant_n_children(signatures); i++)
{ {
g_autoptr (GVariant) child = g_variant_get_child_value (signatures, i); g_autoptr (GVariant) child = g_variant_get_child_value (signatures, i);
@ -191,13 +179,12 @@ gboolean ostree_sign_dummy_data_verify (OstreeSign *self,
g_debug("Stored signature %d: %s", (gint)i, sign->pk_ascii); g_debug("Stored signature %d: %s", (gint)i, sign->pk_ascii);
if (!g_strcmp0(sign_ascii, sign->pk_ascii)) if (!g_strcmp0(sign_ascii, sign->pk_ascii))
ret = TRUE; verified = TRUE;
else
return glnx_throw (error, "signature: dummy: incorrect signature %" G_GSIZE_FORMAT, i);
} }
if (ret == FALSE && *error == NULL) if (!verified)
g_set_error_literal (error, return glnx_throw (error, "signature: dummy: no signatures");
G_IO_ERROR, G_IO_ERROR_FAILED,
"signature: dummy: incorrect signature");
err: return TRUE;
return ret;
} }