gioenums: Add G_TLS_CERTIFICATE_FLAGS_NONE

This makes the absence of flags (in other words, a valid certificate)
more self-documenting.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2022-03-31 14:28:56 +01:00
parent 7045260c22
commit f59e02a143
4 changed files with 6 additions and 2 deletions

View File

@ -191,7 +191,7 @@ g_dtls_client_connection_new (GDatagramBased *base_socket,
GTlsCertificateFlags
g_dtls_client_connection_get_validation_flags (GDtlsClientConnection *conn)
{
GTlsCertificateFlags flags = 0;
GTlsCertificateFlags flags = G_TLS_CERTIFICATE_FLAGS_NONE;
g_return_val_if_fail (G_IS_DTLS_CLIENT_CONNECTION (conn), 0);

View File

@ -1578,6 +1578,7 @@ typedef enum {
/**
* GTlsCertificateFlags:
* @G_TLS_CERTIFICATE_FLAGS_NONE: No flags. Since: 2.74
* @G_TLS_CERTIFICATE_UNKNOWN_CA: The signing certificate authority is
* not known.
* @G_TLS_CERTIFICATE_BAD_IDENTITY: The certificate does not match the
@ -1609,6 +1610,7 @@ typedef enum {
* Since: 2.28
*/
typedef enum {
G_TLS_CERTIFICATE_FLAGS_NONE GLIB_AVAILABLE_ENUMERATOR_IN_2_74 = 0,
G_TLS_CERTIFICATE_UNKNOWN_CA = (1 << 0),
G_TLS_CERTIFICATE_BAD_IDENTITY = (1 << 1),
G_TLS_CERTIFICATE_NOT_ACTIVATED = (1 << 2),

View File

@ -1121,6 +1121,8 @@ g_tls_certificate_get_issuer (GTlsCertificate *cert)
* check a certificate against a CA that is not part of the system
* CA database.
*
* If @cert is valid, %G_TLS_CERTIFICATE_FLAGS_NONE is returned.
*
* If @identity is not %NULL, @cert's name(s) will be compared against
* it, and %G_TLS_CERTIFICATE_BAD_IDENTITY will be set in the return
* value if it does not match. If @identity is %NULL, that bit will

View File

@ -213,7 +213,7 @@ g_tls_client_connection_new (GIOStream *base_io_stream,
GTlsCertificateFlags
g_tls_client_connection_get_validation_flags (GTlsClientConnection *conn)
{
GTlsCertificateFlags flags = 0;
GTlsCertificateFlags flags = G_TLS_CERTIFICATE_FLAGS_NONE;
g_return_val_if_fail (G_IS_TLS_CLIENT_CONNECTION (conn), 0);