mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 18:03:32 +00:00
esx: handle missing switch enum cases
Ensure all enum cases are listed in switch statements, or explicitly cast away enum type where we don't want to list all cases. Reviewed-by: John Ferlan <jferlan@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
05b39a6843
commit
7c8f1436d0
@ -3603,10 +3603,9 @@ esxDomainGetSchedulerParametersFlags(virDomainPtr domain,
|
||||
params[i].value.i = -3;
|
||||
break;
|
||||
|
||||
case esxVI_SharesLevel_Undefined:
|
||||
default:
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||
_("Shares level has unknown value %d"),
|
||||
(int)sharesInfo->level);
|
||||
virReportEnumRangeError(esxVI_SharesLevel, sharesInfo->level);
|
||||
esxVI_SharesInfo_Free(&sharesInfo);
|
||||
goto cleanup;
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ esxVI_SharedCURL_Lock(CURL *handle ATTRIBUTE_UNUSED, curl_lock_data data,
|
||||
size_t i;
|
||||
esxVI_SharedCURL *shared = userptr;
|
||||
|
||||
switch (data) {
|
||||
switch ((int)data) {
|
||||
case CURL_LOCK_DATA_SHARE:
|
||||
i = 0;
|
||||
break;
|
||||
@ -511,7 +511,7 @@ esxVI_SharedCURL_Unlock(CURL *handle ATTRIBUTE_UNUSED, curl_lock_data data,
|
||||
size_t i;
|
||||
esxVI_SharedCURL *shared = userptr;
|
||||
|
||||
switch (data) {
|
||||
switch ((int)data) {
|
||||
case CURL_LOCK_DATA_SHARE:
|
||||
i = 0;
|
||||
break;
|
||||
@ -1563,9 +1563,9 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
|
||||
|
||||
break;
|
||||
|
||||
case esxVI_Occurrence_Undefined:
|
||||
default:
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Invalid argument (occurrence)"));
|
||||
virReportEnumRangeError(esxVI_Occurrence, occurrence);
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
@ -2280,9 +2280,10 @@ esxVI_LookupObjectContentByType(esxVI_Context *ctx,
|
||||
type, root->type);
|
||||
break;
|
||||
|
||||
case esxVI_Occurrence_None:
|
||||
case esxVI_Occurrence_Undefined:
|
||||
default:
|
||||
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
|
||||
_("Invalid occurrence value"));
|
||||
virReportEnumRangeError(esxVI_Occurrence, occurrence);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -544,7 +544,7 @@ VIR_LOG_INIT("esx.esx_vi_types");
|
||||
|
||||
#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_AnyType *src)
|
||||
goto failure;
|
||||
}
|
||||
|
||||
switch (src->type) {
|
||||
switch ((int)src->type) {
|
||||
case esxVI_Type_Boolean:
|
||||
(*dest)->boolean = src->boolean;
|
||||
break;
|
||||
@ -1071,7 +1071,7 @@ esxVI_AnyType_Deserialize(xmlNodePtr node, esxVI_AnyType **anyType)
|
||||
(*anyType)->_name = number; \
|
||||
} while (0)
|
||||
|
||||
switch ((*anyType)->type) {
|
||||
switch ((int)(*anyType)->type) {
|
||||
case esxVI_Type_Boolean:
|
||||
if (STREQ((*anyType)->value, "true")) {
|
||||
(*anyType)->boolean = esxVI_Boolean_True;
|
||||
@ -1876,6 +1876,7 @@ esxVI_VirtualMachinePowerState_ConvertToLibvirt
|
||||
case esxVI_VirtualMachinePowerState_Suspended:
|
||||
return VIR_DOMAIN_PAUSED;
|
||||
|
||||
case esxVI_VirtualMachinePowerState_Undefined:
|
||||
default:
|
||||
return VIR_DOMAIN_NOSTATE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user