On Wed, Apr 19, 2023 at 02:04:19PM +0200, Peter Krempa wrote:
Ensure that all switch statements in this module use the proper type
in
switch() statements to ensure complier protections.
Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/util/virtypedparam.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/util/virtypedparam.c b/src/util/virtypedparam.c
index 0cca16053d..974ec51a79 100644
--- a/src/util/virtypedparam.c
+++ b/src/util/virtypedparam.c
@@ -170,7 +170,7 @@ virTypedParameterToString(virTypedParameterPtr param)
{
char *value = NULL;
- switch (param->type) {
+ switch ((virTypedParameterType) param->type) {
case VIR_TYPED_PARAM_INT:
value = g_strdup_printf("%d", param->value.i);
break;
@@ -192,6 +192,7 @@ virTypedParameterToString(virTypedParameterPtr param)
case VIR_TYPED_PARAM_STRING:
value = g_strdup(param->value.s);
break;
+ case VIR_TYPED_PARAM_LAST:
default:
To ensure compiler protection in switch() statements you should also
remove the default case from the switch statements.
With that changed:
Reviewed-by: Martin Kletzander <mkletzan(a)redhat.com>