[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 2/4] cleanup: Change datatype of graphic's members to boolean



---
 src/conf/domain_conf.c           | 32 ++++++++++++++++----------------
 src/conf/domain_conf.h           | 14 +++++++-------
 src/parallels/parallels_driver.c |  4 ++--
 src/qemu/qemu_command.c          |  6 +++---
 src/vbox/vbox_tmpl.c             |  6 +++---
 src/vmx/vmx.c                    |  4 ++--
 src/xenxs/xen_sxpr.c             |  4 ++--
 src/xenxs/xen_xm.c               |  2 +-
 8 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 62f448d..70df165 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -7297,18 +7297,18 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
             if (def->data.vnc.port == -1) {
                 if (flags & VIR_DOMAIN_XML_INACTIVE)
                     def->data.vnc.port = 0;
-                def->data.vnc.autoport = 1;
+                def->data.vnc.autoport = true;
             }
         } else {
             def->data.vnc.port = 0;
-            def->data.vnc.autoport = 1;
+            def->data.vnc.autoport = true;
         }
 
         if ((autoport = virXMLPropString(node, "autoport")) != NULL) {
             if (STREQ(autoport, "yes")) {
                 if (flags & VIR_DOMAIN_XML_INACTIVE)
                     def->data.vnc.port = 0;
-                def->data.vnc.autoport = 1;
+                def->data.vnc.autoport = true;
             }
             VIR_FREE(autoport);
         }
@@ -7324,9 +7324,9 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
 
         if (fullscreen != NULL) {
             if (STREQ(fullscreen, "yes")) {
-                def->data.sdl.fullscreen = 1;
+                def->data.sdl.fullscreen = true;
             } else if (STREQ(fullscreen, "no")) {
-                def->data.sdl.fullscreen = 0;
+                def->data.sdl.fullscreen = false;
             } else {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
                                _("unknown fullscreen value '%s'"), fullscreen);
@@ -7335,7 +7335,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
             }
             VIR_FREE(fullscreen);
         } else {
-            def->data.sdl.fullscreen = 0;
+            def->data.sdl.fullscreen = false;
         }
         def->data.sdl.xauth = virXMLPropString(node, "xauth");
         def->data.sdl.display = virXMLPropString(node, "display");
@@ -7354,17 +7354,17 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
             }
             /* Legacy compat syntax, used -1 for auto-port */
             if (def->data.rdp.port == -1)
-                def->data.rdp.autoport = 1;
+                def->data.rdp.autoport = true;
 
             VIR_FREE(port);
         } else {
             def->data.rdp.port = 0;
-            def->data.rdp.autoport = 1;
+            def->data.rdp.autoport = true;
         }
 
         if ((autoport = virXMLPropString(node, "autoport")) != NULL) {
             if (STREQ(autoport, "yes"))
-                def->data.rdp.autoport = 1;
+                def->data.rdp.autoport = true;
 
             VIR_FREE(autoport);
         }
@@ -7374,14 +7374,14 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
 
         if ((replaceUser = virXMLPropString(node, "replaceUser")) != NULL) {
             if (STREQ(replaceUser, "yes")) {
-                def->data.rdp.replaceUser = 1;
+                def->data.rdp.replaceUser = true;
             }
             VIR_FREE(replaceUser);
         }
 
         if ((multiUser = virXMLPropString(node, "multiUser")) != NULL) {
             if (STREQ(multiUser, "yes")) {
-                def->data.rdp.multiUser = 1;
+                def->data.rdp.multiUser = true;
             }
             VIR_FREE(multiUser);
         }
@@ -7391,9 +7391,9 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
 
         if (fullscreen != NULL) {
             if (STREQ(fullscreen, "yes")) {
-                def->data.desktop.fullscreen = 1;
+                def->data.desktop.fullscreen = true;
             } else if (STREQ(fullscreen, "no")) {
-                def->data.desktop.fullscreen = 0;
+                def->data.desktop.fullscreen = false;
             } else {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
                                _("unknown fullscreen value '%s'"), fullscreen);
@@ -7402,7 +7402,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
             }
             VIR_FREE(fullscreen);
         } else {
-            def->data.desktop.fullscreen = 0;
+            def->data.desktop.fullscreen = false;
         }
 
         def->data.desktop.display = virXMLPropString(node, "display");
@@ -7441,7 +7441,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
 
         if ((autoport = virXMLPropString(node, "autoport")) != NULL) {
             if (STREQ(autoport, "yes"))
-                def->data.spice.autoport = 1;
+                def->data.spice.autoport = true;
             VIR_FREE(autoport);
         }
 
@@ -7461,7 +7461,7 @@ virDomainGraphicsDefParseXML(xmlNodePtr node,
 
         if (def->data.spice.port == -1 && def->data.spice.tlsPort == -1) {
             /* Legacy compat syntax, used -1 for auto-port */
-            def->data.spice.autoport = 1;
+            def->data.spice.autoport = true;
         }
 
         if (def->data.spice.autoport && (flags & VIR_DOMAIN_XML_INACTIVE)) {
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index cae6547..7088bee 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1348,7 +1348,7 @@ struct _virDomainGraphicsDef {
     union {
         struct {
             int port;
-            unsigned int autoport :1;
+            bool autoport;
             char *keymap;
             char *socket;
             virDomainGraphicsAuthDef auth;
@@ -1356,17 +1356,17 @@ struct _virDomainGraphicsDef {
         struct {
             char *display;
             char *xauth;
-            int fullscreen;
+            bool fullscreen;
         } sdl;
         struct {
             int port;
-            unsigned int autoport :1;
-            unsigned int replaceUser :1;
-            unsigned int multiUser :1;
+            bool autoport;
+            bool replaceUser;
+            bool multiUser;
         } rdp;
         struct {
             char *display;
-            unsigned int fullscreen :1;
+            bool fullscreen;
         } desktop;
         struct {
             int port;
@@ -1374,7 +1374,7 @@ struct _virDomainGraphicsDef {
             int mousemode;
             char *keymap;
             virDomainGraphicsAuthDef auth;
-            unsigned int autoport :1;
+            bool autoport;
             int channels[VIR_DOMAIN_GRAPHICS_SPICE_CHANNEL_LAST];
             int defaultMode; /* enum virDomainGraphicsSpiceChannelMode */
             int image;
diff --git a/src/parallels/parallels_driver.c b/src/parallels/parallels_driver.c
index 451e948..5b8d85f 100644
--- a/src/parallels/parallels_driver.c
+++ b/src/parallels/parallels_driver.c
@@ -615,13 +615,13 @@ parallelsAddVNCInfo(virDomainDefPtr def, virJSONValuePtr jobj_root)
     if (STREQ(tmp, "auto")) {
         if (virJSONValueObjectGetNumberUint(jobj, "port", &port) < 0)
             port = 0;
-        gr->data.vnc.autoport = 1;
+        gr->data.vnc.autoport = true;
     } else {
         if (virJSONValueObjectGetNumberUint(jobj, "port", &port) < 0) {
             parallelsParseError();
             goto cleanup;
         }
-        gr->data.vnc.autoport = 0;
+        gr->data.vnc.autoport = false;
     }
 
     gr->type = VIR_DOMAIN_GRAPHICS_TYPE_VNC;
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index d899239..ea31952 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -9079,7 +9079,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
     virDomainDefPtr def;
     int i;
     int nographics = 0;
-    int fullscreen = 0;
+    bool fullscreen = false;
     char *path;
     int nnics = 0;
     const char **nics = NULL;
@@ -9244,7 +9244,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
                     goto no_memory;
                 }
                 vnc->data.vnc.port += 5900;
-                vnc->data.vnc.autoport = 0;
+                vnc->data.vnc.autoport = false;
             }
 
             if (VIR_REALLOC_N(def->graphics, def->ngraphics+1) < 0) {
@@ -9401,7 +9401,7 @@ virDomainDefPtr qemuParseCommandLine(virCapsPtr qemuCaps,
         } else if (STREQ(arg, "-nographic")) {
             nographics = 1;
         } else if (STREQ(arg, "-full-screen")) {
-            fullscreen = 1;
+            fullscreen = true;
         } else if (STREQ(arg, "-localtime")) {
             def->clock.offset = VIR_DOMAIN_CLOCK_OFFSET_LOCALTIME;
         } else if (STREQ(arg, "-kernel")) {
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index ff8f9d1..0c82675 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -2566,7 +2566,7 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
                                 VBOX_UTF16_FREE(VRDEPortsValue);
 #endif /* VBOX_API_VERSION >= 4000 */
                             } else {
-                                def->graphics[def->ngraphics]->data.rdp.autoport = 1;
+                                def->graphics[def->ngraphics]->data.rdp.autoport = true;
                             }
 
                             def->graphics[def->ngraphics]->type = VIR_DOMAIN_GRAPHICS_TYPE_RDP;
@@ -2590,12 +2590,12 @@ static char *vboxDomainGetXMLDesc(virDomainPtr dom, unsigned int flags) {
 
                             VRDxServer->vtbl->GetAllowMultiConnection(VRDxServer, &allowMultiConnection);
                             if (allowMultiConnection) {
-                                def->graphics[def->ngraphics]->data.rdp.multiUser = 1;
+                                def->graphics[def->ngraphics]->data.rdp.multiUser = true;
                             }
 
                             VRDxServer->vtbl->GetReuseSingleConnection(VRDxServer, &reuseSingleConnection);
                             if (reuseSingleConnection) {
-                                def->graphics[def->ngraphics]->data.rdp.replaceUser = 1;
+                                def->graphics[def->ngraphics]->data.rdp.replaceUser = true;
                             }
 
                             def->ngraphics++;
diff --git a/src/vmx/vmx.c b/src/vmx/vmx.c
index 5dc5046..f520a85 100644
--- a/src/vmx/vmx.c
+++ b/src/vmx/vmx.c
@@ -1870,14 +1870,14 @@ virVMXParseVNC(virConfPtr conf, virDomainGraphicsDefPtr *def)
                   "is missing, the VNC port is unknown");
 
         (*def)->data.vnc.port = 0;
-        (*def)->data.vnc.autoport = 1;
+        (*def)->data.vnc.autoport = true;
     } else {
         if (port < 5900 || port > 5964) {
             VIR_WARN("VNC port %lld it out of [5900..5964] range", port);
         }
 
         (*def)->data.vnc.port = port;
-        (*def)->data.vnc.autoport = 0;
+        (*def)->data.vnc.autoport = false;
     }
 
     return 0;
diff --git a/src/xenxs/xen_sxpr.c b/src/xenxs/xen_sxpr.c
index a179612..f2c345b 100644
--- a/src/xenxs/xen_sxpr.c
+++ b/src/xenxs/xen_sxpr.c
@@ -825,7 +825,7 @@ xenParseSxprGraphicsOld(virDomainDefPtr def,
             port = 5900 + def->id;
 
         if ((unused && STREQ(unused, "1")) || port == -1)
-            graphics->data.vnc.autoport = 1;
+            graphics->data.vnc.autoport = true;
         graphics->data.vnc.port = port;
 
         if (listenAddr &&
@@ -949,7 +949,7 @@ xenParseSxprGraphicsNew(virDomainDefPtr def,
                 }
 
                 if ((unused && STREQ(unused, "1")) || port == -1)
-                    graphics->data.vnc.autoport = 1;
+                    graphics->data.vnc.autoport = true;
 
                 if (port >= 0 && port < 5900)
                     port += 5900;
diff --git a/src/xenxs/xen_xm.c b/src/xenxs/xen_xm.c
index b2e7645..0e9f8d2 100644
--- a/src/xenxs/xen_xm.c
+++ b/src/xenxs/xen_xm.c
@@ -1012,7 +1012,7 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
                 if (graphics->type == VIR_DOMAIN_GRAPHICS_TYPE_VNC) {
                     if (STRPREFIX(key, "vncunused=")) {
                         if (STREQ(key + 10, "1"))
-                            graphics->data.vnc.autoport = 1;
+                            graphics->data.vnc.autoport = true;
                     } else if (STRPREFIX(key, "vnclisten=")) {
                         if (virDomainGraphicsListenSetAddress(graphics, 0, key+10,
                                                               -1, true) < 0)
-- 
1.8.1.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]