Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/bhyve/bhyve_command.c | 2 +-
src/conf/domain_conf.c | 18 ++++++++++--------
src/conf/domain_conf.h | 2 +-
src/qemu/qemu_command.c | 4 ++--
src/qemu/qemu_validate.c | 2 +-
5 files changed, 15 insertions(+), 13 deletions(-)
diff --git a/src/bhyve/bhyve_command.c b/src/bhyve/bhyve_command.c
index f8e0ce5123..ab9d3026cc 100644
--- a/src/bhyve/bhyve_command.c
+++ b/src/bhyve/bhyve_command.c
@@ -524,7 +524,7 @@ bhyveBuildSoundArgStr(const virDomainDef *def G_GNUC_UNUSED,
virCommandAddArg(cmd, "-s");
if (audio) {
- switch ((virDomainAudioType) audio->type) {
+ switch (audio->type) {
case VIR_DOMAIN_AUDIO_TYPE_OSS:
if (virDomainAudioIOCommonIsSet(&audio->input) ||
virDomainAudioIOCommonIsSet(&audio->output)) {
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 942d6f269a..758f699c2c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2922,7 +2922,7 @@ virDomainAudioDefFree(virDomainAudioDef *def)
if (!def)
return;
- switch ((virDomainAudioType) def->type) {
+ switch (def->type) {
case VIR_DOMAIN_AUDIO_TYPE_NONE:
break;
@@ -13123,24 +13123,26 @@ virDomainAudioDefParseXML(virDomainXMLOption *xmlopt
G_GNUC_UNUSED,
virDomainAudioDef *def;
VIR_XPATH_NODE_AUTORESTORE(ctxt)
g_autofree char *tmp = NULL;
- g_autofree char *type = NULL;
+ g_autofree char *typestr = NULL;
+ int type;
xmlNodePtr inputNode, outputNode;
def = g_new0(virDomainAudioDef, 1);
ctxt->node = node;
- type = virXMLPropString(node, "type");
- if (!type) {
+ typestr = virXMLPropString(node, "type");
+ if (!typestr) {
virReportError(VIR_ERR_XML_ERROR, "%s",
_("missing audio 'type' attribute"));
goto error;
}
- if ((def->type = virDomainAudioTypeTypeFromString(type)) < 0) {
+ if ((type = virDomainAudioTypeTypeFromString(typestr)) < 0) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown audio type '%s'"), type);
+ _("unknown audio type '%s'"), typestr);
goto error;
}
+ def->type = type;
tmp = virXMLPropString(node, "id");
if (!tmp) {
@@ -13163,7 +13165,7 @@ virDomainAudioDefParseXML(virDomainXMLOption *xmlopt
G_GNUC_UNUSED,
if (outputNode && virDomainAudioCommonParse(&def->output, outputNode,
ctxt) < 0)
goto error;
- switch ((virDomainAudioType) def->type) {
+ switch (def->type) {
case VIR_DOMAIN_AUDIO_TYPE_NONE:
break;
@@ -25465,7 +25467,7 @@ virDomainAudioDefFormat(virBuffer *buf,
virBufferAsprintf(buf, "<audio id='%d' type='%s'",
def->id, type);
- switch ((virDomainAudioType)def->type) {
+ switch (def->type) {
case VIR_DOMAIN_AUDIO_TYPE_NONE:
break;
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index cf8481f1f6..462c61a807 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1543,7 +1543,7 @@ struct _virDomainAudioIOSDL {
};
struct _virDomainAudioDef {
- int type;
+ virDomainAudioType type;
unsigned int id;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d6c5308ef0..dcc060bde9 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -7670,7 +7670,7 @@ qemuBuildAudioCommandLineArg(virCommand *cmd,
qemuBuildAudioCommonArg(&buf, "in", &def->input);
qemuBuildAudioCommonArg(&buf, "out", &def->output);
- switch ((virDomainAudioType)def->type) {
+ switch (def->type) {
case VIR_DOMAIN_AUDIO_TYPE_NONE:
break;
@@ -7859,7 +7859,7 @@ qemuBuildAudioCommandLineEnv(virCommand *cmd,
qemuBuildAudioCommonEnv(cmd, "QEMU_AUDIO_ADC_", &audio->input);
qemuBuildAudioCommonEnv(cmd, "QEMU_AUDIO_DAC_", &audio->output);
- switch ((virDomainAudioType)audio->type) {
+ switch (audio->type) {
case VIR_DOMAIN_AUDIO_TYPE_NONE:
break;
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 141203f979..e6ddb43113 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -4223,7 +4223,7 @@ qemuValidateDomainDeviceDefAudio(virDomainAudioDef *audio,
}
}
- switch ((virDomainAudioType)audio->type) {
+ switch (audio->type) {
case VIR_DOMAIN_AUDIO_TYPE_NONE:
break;
--
2.26.3