From nobody Wed May 14 18:14:11 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1519146568615655.0183354048065; Tue, 20 Feb 2018 09:09:28 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1375A7EA83; Tue, 20 Feb 2018 17:09:27 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CD6885D996; Tue, 20 Feb 2018 17:09:26 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 98FDC4A479; Tue, 20 Feb 2018 17:09:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w1KH8UHJ009660 for ; Tue, 20 Feb 2018 12:08:30 -0500 Received: by smtp.corp.redhat.com (Postfix) id C4F20AE7BA; Tue, 20 Feb 2018 17:08:30 +0000 (UTC) Received: from t460.redhat.com (unknown [10.33.36.79]) by smtp.corp.redhat.com (Postfix) with ESMTP id 55E54AE7B9; Tue, 20 Feb 2018 17:08:30 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Tue, 20 Feb 2018 17:08:12 +0000 Message-Id: <20180220170822.16462-5-berrange@redhat.com> In-Reply-To: <20180220170822.16462-1-berrange@redhat.com> References: <20180220170822.16462-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 04/14] esx: handle missing switch enum cases X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 20 Feb 2018 17:09:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Ensure all enum cases are listed in switch statements, or explicitly cast away enum type where we don't want to list all cases. Signed-off-by: Daniel P. Berrang=C3=A9 Reviewed-by: John Ferlan --- src/esx/esx_driver.c | 1 + src/esx/esx_vi.c | 11 +++++++---- src/esx/esx_vi_types.c | 9 +++++---- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/esx/esx_driver.c b/src/esx/esx_driver.c index f575362059..c5f04efa81 100644 --- a/src/esx/esx_driver.c +++ b/src/esx/esx_driver.c @@ -3603,6 +3603,7 @@ esxDomainGetSchedulerParametersFlags(virDomainPtr dom= ain, params[i].value.i =3D -3; break; =20 + case esxVI_SharesLevel_Undefined: default: virReportError(VIR_ERR_INTERNAL_ERROR, _("Shares level has unknown value %d"), diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c index edf52ff828..103f726069 100644 --- a/src/esx/esx_vi.c +++ b/src/esx/esx_vi.c @@ -483,7 +483,7 @@ esxVI_SharedCURL_Lock(CURL *handle ATTRIBUTE_UNUSED, cu= rl_lock_data data, size_t i; esxVI_SharedCURL *shared =3D userptr; =20 - switch (data) { + switch ((int)data) { case CURL_LOCK_DATA_SHARE: i =3D 0; break; @@ -511,7 +511,7 @@ esxVI_SharedCURL_Unlock(CURL *handle ATTRIBUTE_UNUSED, = curl_lock_data data, size_t i; esxVI_SharedCURL *shared =3D userptr; =20 - switch (data) { + switch ((int)data) { case CURL_LOCK_DATA_SHARE: i =3D 0; break; @@ -1563,6 +1563,7 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char = *methodName, =20 break; =20 + case esxVI_Occurrence_Undefined: default: virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid argument (occurrence)")); @@ -2280,9 +2281,11 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx, type, root->type); break; =20 + case esxVI_Occurrence_None: + case esxVI_Occurrence_Undefined: default: - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Invalid occurrence value")); + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Invalid occurrence value %d"), occurrence); break; } =20 diff --git a/src/esx/esx_vi_types.c b/src/esx/esx_vi_types.c index be35af861c..74183f8307 100644 --- a/src/esx/esx_vi_types.c +++ b/src/esx/esx_vi_types.c @@ -544,7 +544,7 @@ VIR_LOG_INIT("esx.esx_vi_types"); =20 #define ESX_VI__TEMPLATE__DISPATCH(_actual_type, _actual_type_name, __type= , \ _dispatch, _error_return) \ - switch (_actual_type) { \ + switch ((int)_actual_type) { \ _dispatch \ \ case esxVI_Type_##__type: \ @@ -690,7 +690,7 @@ VIR_LOG_INIT("esx.esx_vi_types"); return -1; \ } \ \ - switch (type) { \ + switch ((int)type) { \ _dispatch \ \ case esxVI_Type_##__type: \ @@ -967,7 +967,7 @@ esxVI_AnyType_DeepCopy(esxVI_AnyType **dest, esxVI_AnyT= ype *src) goto failure; } =20 - switch (src->type) { + switch ((int)src->type) { case esxVI_Type_Boolean: (*dest)->boolean =3D src->boolean; break; @@ -1071,7 +1071,7 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyT= ype **anyType) (*anyType)->_name =3D number; \ } while (0) =20 - switch ((*anyType)->type) { + switch ((int)(*anyType)->type) { case esxVI_Type_Boolean: if (STREQ((*anyType)->value, "true")) { (*anyType)->boolean =3D esxVI_Boolean_True; @@ -1876,6 +1876,7 @@ esxVI_VirtualMachinePowerState_ConvertToLibvirt case esxVI_VirtualMachinePowerState_Suspended: return VIR_DOMAIN_PAUSED; =20 + case esxVI_VirtualMachinePowerState_Undefined: default: return VIR_DOMAIN_NOSTATE; } --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list