From 358e7435138f521912cb12c19a104f927b42f561 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 13 Dec 2019 17:22:26 +0100 Subject: [PATCH] libnm/proxy: use int type for proxy.method property The method field is set from (only) via a GObject property setter, which sets a value of type int. As we afterwards validate that the value is in a valid range, we should use a suitable type to hold the value to begin with. Of course, in almost all cases is the underlying type of the enum already int. --- libnm-core/nm-setting-proxy.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/libnm-core/nm-setting-proxy.c b/libnm-core/nm-setting-proxy.c index 082ac6d0a5..a81b2d0371 100644 --- a/libnm-core/nm-setting-proxy.c +++ b/libnm-core/nm-setting-proxy.c @@ -36,7 +36,7 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE ( typedef struct { char *pac_url; char *pac_script; - NMSettingProxyMethod method; + int method; bool browser_only:1; } NMSettingProxyPrivate; @@ -119,11 +119,8 @@ static gboolean verify (NMSetting *setting, NMConnection *connection, GError **error) { NMSettingProxyPrivate *priv = NM_SETTING_PROXY_GET_PRIVATE (setting); - NMSettingProxyMethod method; - method = priv->method; - - if (!NM_IN_SET (method, + if (!NM_IN_SET (priv->method, NM_SETTING_PROXY_METHOD_NONE, NM_SETTING_PROXY_METHOD_AUTO)) { g_set_error (error, @@ -134,7 +131,7 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) return FALSE; } - if (method != NM_SETTING_PROXY_METHOD_AUTO) { + if (priv->method != NM_SETTING_PROXY_METHOD_AUTO) { if (priv->pac_url) { g_set_error (error, NM_CONNECTION_ERROR,