Signed-off-by: Tim Wiederhake <twiederh(a)redhat.com>
---
src/conf/domain_conf.c | 75 ++++++------------------------------------
1 file changed, 10 insertions(+), 65 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index c6c78abb84..8f906e455d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13397,23 +13397,10 @@ virDomainGraphicsDefParseXMLSpice(virDomainGraphicsDefPtr def,
def->data.spice.zlib = compressionVal;
} else if (virXMLNodeNameEqual(cur, "playback")) {
- int compressionVal;
- g_autofree char *compression = virXMLPropString(cur,
"compression");
-
- if (!compression) {
- virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
- _("spice playback missing compression"));
- return -1;
- }
-
- if ((compressionVal =
- virTristateSwitchTypeFromString(compression)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
- _("unknown spice playback compression"));
+ if (virXMLPropTristateSwitch(cur, "compression", true,
+ &def->data.spice.playback) < 0)
return -1;
- }
- def->data.spice.playback = compressionVal;
} else if (virXMLNodeNameEqual(cur, "streaming")) {
int modeVal;
g_autofree char *mode = virXMLPropString(cur, "mode");
@@ -13432,62 +13419,20 @@ virDomainGraphicsDefParseXMLSpice(virDomainGraphicsDefPtr def,
def->data.spice.streaming = modeVal;
} else if (virXMLNodeNameEqual(cur, "clipboard")) {
- int copypasteVal;
- g_autofree char *copypaste = virXMLPropString(cur,
"copypaste");
-
- if (!copypaste) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("spice clipboard missing copypaste"));
+ if (virXMLPropTristateBool(cur, "copypaste", true,
+ &def->data.spice.copypaste) < 0)
return -1;
- }
-
- if ((copypasteVal =
- virTristateBoolTypeFromString(copypaste)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown copypaste value '%s'"),
copypaste);
- return -1;
- }
-
- def->data.spice.copypaste = copypasteVal;
} else if (virXMLNodeNameEqual(cur, "filetransfer")) {
- int enableVal;
- g_autofree char *enable = virXMLPropString(cur, "enable");
-
- if (!enable) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("spice filetransfer missing enable"));
+ if (virXMLPropTristateBool(cur, "enable", true,
+ &def->data.spice.filetransfer) < 0)
return -1;
- }
-
- if ((enableVal =
- virTristateBoolTypeFromString(enable)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown enable value '%s'"),
enable);
- return -1;
- }
-
- def->data.spice.filetransfer = enableVal;
} else if (virXMLNodeNameEqual(cur, "gl")) {
- int enableVal;
- g_autofree char *enable = virXMLPropString(cur, "enable");
- g_autofree char *rendernode = virXMLPropString(cur,
"rendernode");
+ def->data.spice.rendernode = virXMLPropString(cur,
+ "rendernode");
- if (!enable) {
- virReportError(VIR_ERR_XML_ERROR, "%s",
- _("spice gl element missing enable"));
- return -1;
- }
-
- if ((enableVal =
- virTristateBoolTypeFromString(enable)) <= 0) {
- virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
- _("unknown enable value '%s'"),
enable);
+ if (virXMLPropTristateBool(cur, "enable", true,
+ &def->data.spice.gl) < 0)
return -1;
- }
-
- def->data.spice.gl = enableVal;
- def->data.spice.rendernode = g_steal_pointer(&rendernode);
-
} else if (virXMLNodeNameEqual(cur, "mouse")) {
int modeVal;
g_autofree char *mode = virXMLPropString(cur, "mode");
--
2.26.2