diff options
author | Thomas Haller <thaller@redhat.com> | 2019-12-13 17:22:26 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2019-12-20 14:09:55 +0100 |
commit | 26ff9befabc8acf116bba8e253d15ab8b80555e5 (patch) | |
tree | be16c47d16e10951b1720be153b40dbfd3ee59d7 | |
parent | 7edc987a69ce67d83855b83988e04acd79c068fb (diff) | |
download | NetworkManager-th/setting-no-construct-property.tar.gz |
libnm/proxy: use int type for proxy.method propertyth/setting-no-construct-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.
-rw-r--r-- | libnm-core/nm-setting-proxy.c | 9 |
1 files 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, |