From 21f91fc5f64a378fe26e3382b86fcecdc38e3d3d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A1n=20Tomko?= Date: Fri, 23 Feb 2018 14:41:03 +0100 Subject: [PATCH] vboxDumpNetwork: use a switch for attachmentType MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Ján Tomko --- src/vbox/vbox_common.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 2943c534df..8f5f04efb3 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -3707,11 +3707,13 @@ vboxDumpNetwork(vboxDriverPtr data, INetworkAdapter *adapter) return NULL; gVBoxAPI.UINetworkAdapter.GetAttachmentType(adapter, &attachmentType); - if (attachmentType == NetworkAttachmentType_NAT) { + switch (attachmentType) { + case NetworkAttachmentType_NAT: net->type = VIR_DOMAIN_NET_TYPE_USER; + break; - } else if (attachmentType == NetworkAttachmentType_Bridged) { + case NetworkAttachmentType_Bridged: net->type = VIR_DOMAIN_NET_TYPE_BRIDGE; gVBoxAPI.UINetworkAdapter.GetBridgedInterface(adapter, &utf16); @@ -3721,8 +3723,9 @@ vboxDumpNetwork(vboxDriverPtr data, INetworkAdapter *adapter) VBOX_UTF8_FREE(utf8); VBOX_UTF16_FREE(utf16); + break; - } else if (attachmentType == NetworkAttachmentType_Internal) { + case NetworkAttachmentType_Internal: net->type = VIR_DOMAIN_NET_TYPE_INTERNAL; gVBoxAPI.UINetworkAdapter.GetInternalNetwork(adapter, &utf16); @@ -3732,8 +3735,9 @@ vboxDumpNetwork(vboxDriverPtr data, INetworkAdapter *adapter) VBOX_UTF8_FREE(utf8); VBOX_UTF16_FREE(utf16); + break; - } else if (attachmentType == NetworkAttachmentType_HostOnly) { + case NetworkAttachmentType_HostOnly: net->type = VIR_DOMAIN_NET_TYPE_NETWORK; gVBoxAPI.UINetworkAdapter.GetHostOnlyInterface(adapter, &utf16); @@ -3743,8 +3747,9 @@ vboxDumpNetwork(vboxDriverPtr data, INetworkAdapter *adapter) VBOX_UTF8_FREE(utf8); VBOX_UTF16_FREE(utf16); + break; - } else { + default: /* default to user type i.e. NAT in VirtualBox if this * dump is ever used to create a machine. */ -- 2.47.2