qemu: validate: Enforce compile time switch type checking for videos

There wasn't an explicit type case to the video type enum in
qemuDomainDeviceDefValidateVideo, _TYPE_GOP was also missing from the
switch.

Signed-off-by: Erik Skultety <eskultet@redhat.com>
Reviewed-by: John Ferlan <jferlan@redhat.com>
This commit is contained in:
Erik Skultety 2018-06-28 10:55:47 +02:00
parent 75aa179ad6
commit 767f9e1449
2 changed files with 3 additions and 2 deletions

View File

@ -1453,7 +1453,7 @@ struct _virDomainVideoDriverDef {
};
struct _virDomainVideoDef {
int type;
int type; /* enum virDomainVideoType */
unsigned int ram; /* kibibytes (multiples of 1024) */
unsigned int vram; /* kibibytes (multiples of 1024) */
unsigned int vram64; /* kibibytes (multiples of 1024) */

View File

@ -4470,10 +4470,11 @@ qemuDomainDeviceDefValidateHostdev(const virDomainHostdevDef *hostdev,
static int
qemuDomainDeviceDefValidateVideo(const virDomainVideoDef *video)
{
switch (video->type) {
switch ((virDomainVideoType) video->type) {
case VIR_DOMAIN_VIDEO_TYPE_XEN:
case VIR_DOMAIN_VIDEO_TYPE_VBOX:
case VIR_DOMAIN_VIDEO_TYPE_PARALLELS:
case VIR_DOMAIN_VIDEO_TYPE_GOP:
case VIR_DOMAIN_VIDEO_TYPE_DEFAULT:
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("video type '%s' is not supported with QEMU"),