mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 20:45:18 +00:00
qemu: sound: Handle all possible sound cards in switch statement
Use correct type in the switch and handle all sound card models in it so that the compiler tracks additions.
This commit is contained in:
parent
1c6999d340
commit
e5f36698e3
@ -4674,16 +4674,10 @@ qemuBuildSoundDevStr(virDomainDefPtr def,
|
|||||||
virQEMUCapsPtr qemuCaps)
|
virQEMUCapsPtr qemuCaps)
|
||||||
{
|
{
|
||||||
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
virBuffer buf = VIR_BUFFER_INITIALIZER;
|
||||||
const char *model = virDomainSoundModelTypeToString(sound->model);
|
const char *model;
|
||||||
|
|
||||||
if (!model) {
|
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
||||||
"%s", _("invalid sound model"));
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hack for devices with different names in QEMU and libvirt */
|
/* Hack for devices with different names in QEMU and libvirt */
|
||||||
switch (sound->model) {
|
switch ((virDomainSoundModel) sound->model) {
|
||||||
case VIR_DOMAIN_SOUND_MODEL_ES1370:
|
case VIR_DOMAIN_SOUND_MODEL_ES1370:
|
||||||
model = "ES1370";
|
model = "ES1370";
|
||||||
break;
|
break;
|
||||||
@ -4702,6 +4696,15 @@ qemuBuildSoundDevStr(virDomainDefPtr def,
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case VIR_DOMAIN_SOUND_MODEL_SB16:
|
||||||
|
model = "sb16";
|
||||||
|
break;
|
||||||
|
case VIR_DOMAIN_SOUND_MODEL_PCSPK: /* pc-speaker is handled separately */
|
||||||
|
case VIR_DOMAIN_SOUND_MODEL_LAST:
|
||||||
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("sound card model '%s' is not supported by qemu"),
|
||||||
|
virDomainSoundModelTypeToString(sound->model));
|
||||||
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
virBufferAsprintf(&buf, "%s,id=%s", model, sound->info.alias);
|
virBufferAsprintf(&buf, "%s,id=%s", model, sound->info.alias);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user