cleanup: Change datatype of graphic's members to boolean

This commit is contained in:
Osier Yang 2013-04-12 16:49:38 +08:00
parent b044b4d78f
commit 00b6828dc2
8 changed files with 36 additions and 36 deletions

View File

@ -7419,18 +7419,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);
}
@ -7446,9 +7446,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);
@ -7457,7 +7457,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");
@ -7476,17 +7476,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);
}
@ -7496,14 +7496,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);
}
@ -7513,9 +7513,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);
@ -7524,7 +7524,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");
@ -7563,7 +7563,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);
}
@ -7583,7 +7583,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)) {

View File

@ -1375,7 +1375,7 @@ struct _virDomainGraphicsDef {
union {
struct {
int port;
unsigned int autoport :1;
bool autoport;
char *keymap;
char *socket;
virDomainGraphicsAuthDef auth;
@ -1383,17 +1383,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;
@ -1401,7 +1401,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;

View File

@ -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;

View File

@ -9189,7 +9189,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;
@ -9354,7 +9354,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) {
@ -9511,7 +9511,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")) {

View File

@ -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++;

View File

@ -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;

View File

@ -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;

View File

@ -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)