xf86misc.c: Avoid use of swapped values
This commit is contained in:
parent
59a63d72a1
commit
0883e838e2
|
@ -250,6 +250,7 @@ ProcXF86MiscGetMouseSettings(client)
|
||||||
char *devname;
|
char *devname;
|
||||||
pointer mouse;
|
pointer mouse;
|
||||||
register int n;
|
register int n;
|
||||||
|
int devnamelen;
|
||||||
|
|
||||||
DEBUG_P("XF86MiscGetMouseSettings");
|
DEBUG_P("XF86MiscGetMouseSettings");
|
||||||
|
|
||||||
|
@ -269,7 +270,7 @@ ProcXF86MiscGetMouseSettings(client)
|
||||||
rep.emulate3timeout = MiscExtGetMouseValue(mouse, MISC_MSE_EM3TIMEOUT);
|
rep.emulate3timeout = MiscExtGetMouseValue(mouse, MISC_MSE_EM3TIMEOUT);
|
||||||
rep.chordmiddle = MiscExtGetMouseValue(mouse, MISC_MSE_CHORDMIDDLE);
|
rep.chordmiddle = MiscExtGetMouseValue(mouse, MISC_MSE_CHORDMIDDLE);
|
||||||
rep.flags = MiscExtGetMouseValue(mouse, MISC_MSE_FLAGS);
|
rep.flags = MiscExtGetMouseValue(mouse, MISC_MSE_FLAGS);
|
||||||
rep.devnamelen = (devname? strlen(devname): 0);
|
devnamelen = rep.devnamelen = (devname? strlen(devname): 0);
|
||||||
rep.length = (sizeof(xXF86MiscGetMouseSettingsReply) -
|
rep.length = (sizeof(xXF86MiscGetMouseSettingsReply) -
|
||||||
sizeof(xGenericReply) + ((rep.devnamelen+3) & ~3)) >> 2;
|
sizeof(xGenericReply) + ((rep.devnamelen+3) & ~3)) >> 2;
|
||||||
|
|
||||||
|
@ -289,8 +290,8 @@ ProcXF86MiscGetMouseSettings(client)
|
||||||
WriteToClient(client, SIZEOF(xXF86MiscGetMouseSettingsReply), (char *)&rep);
|
WriteToClient(client, SIZEOF(xXF86MiscGetMouseSettingsReply), (char *)&rep);
|
||||||
MiscExtDestroyStruct(mouse, MISC_POINTER);
|
MiscExtDestroyStruct(mouse, MISC_POINTER);
|
||||||
|
|
||||||
if (rep.devnamelen)
|
if (devnamelen)
|
||||||
WriteToClient(client, rep.devnamelen, devname);
|
WriteToClient(client, devnamelen, devname);
|
||||||
return (client->noClientException);
|
return (client->noClientException);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,6 +509,7 @@ ProcXF86MiscGetFilePaths(client)
|
||||||
const char *modulepath;
|
const char *modulepath;
|
||||||
const char *logfile;
|
const char *logfile;
|
||||||
register int n;
|
register int n;
|
||||||
|
int configlen, modulelen, loglen;
|
||||||
|
|
||||||
DEBUG_P("XF86MiscGetFilePaths");
|
DEBUG_P("XF86MiscGetFilePaths");
|
||||||
|
|
||||||
|
@ -518,9 +520,9 @@ ProcXF86MiscGetFilePaths(client)
|
||||||
if (!MiscExtGetFilePaths(&configfile, &modulepath, &logfile))
|
if (!MiscExtGetFilePaths(&configfile, &modulepath, &logfile))
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
rep.configlen = (configfile? strlen(configfile): 0);
|
configlen = rep.configlen = (configfile? strlen(configfile): 0);
|
||||||
rep.modulelen = (modulepath? strlen(modulepath): 0);
|
modulelen = rep.modulelen = (modulepath? strlen(modulepath): 0);
|
||||||
rep.loglen = (logfile? strlen(logfile): 0);
|
loglen = rep.loglen = (logfile? strlen(logfile): 0);
|
||||||
rep.length = (SIZEOF(xXF86MiscGetFilePathsReply) - SIZEOF(xGenericReply) +
|
rep.length = (SIZEOF(xXF86MiscGetFilePathsReply) - SIZEOF(xGenericReply) +
|
||||||
((rep.configlen + 3) & ~3) +
|
((rep.configlen + 3) & ~3) +
|
||||||
((rep.modulelen + 3) & ~3) +
|
((rep.modulelen + 3) & ~3) +
|
||||||
|
@ -535,12 +537,12 @@ ProcXF86MiscGetFilePaths(client)
|
||||||
}
|
}
|
||||||
WriteToClient(client, SIZEOF(xXF86MiscGetFilePathsReply), (char *)&rep);
|
WriteToClient(client, SIZEOF(xXF86MiscGetFilePathsReply), (char *)&rep);
|
||||||
|
|
||||||
if (rep.configlen)
|
if (configlen)
|
||||||
WriteToClient(client, rep.configlen, (char *)configfile);
|
WriteToClient(client, configlen, (char *)configfile);
|
||||||
if (rep.modulelen)
|
if (modulelen)
|
||||||
WriteToClient(client, rep.modulelen, (char *)modulepath);
|
WriteToClient(client, modulelen, (char *)modulepath);
|
||||||
if (rep.loglen)
|
if (loglen)
|
||||||
WriteToClient(client, rep.loglen, (char *)logfile);
|
WriteToClient(client, loglen, (char *)logfile);
|
||||||
|
|
||||||
return (client->noClientException);
|
return (client->noClientException);
|
||||||
}
|
}
|
||||||
|
@ -553,6 +555,7 @@ ProcXF86MiscPassMessage(client)
|
||||||
char *msgtype, *msgval, *retstr;
|
char *msgtype, *msgval, *retstr;
|
||||||
int retval, size;
|
int retval, size;
|
||||||
register int n;
|
register int n;
|
||||||
|
int mesglen;
|
||||||
|
|
||||||
REQUEST(xXF86MiscPassMessageReq);
|
REQUEST(xXF86MiscPassMessageReq);
|
||||||
|
|
||||||
|
@ -589,7 +592,7 @@ ProcXF86MiscPassMessage(client)
|
||||||
|
|
||||||
rep.type = X_Reply;
|
rep.type = X_Reply;
|
||||||
rep.sequenceNumber = client->sequence;
|
rep.sequenceNumber = client->sequence;
|
||||||
rep.mesglen = (retstr? strlen(retstr): 0);
|
mesglen = rep.mesglen = (retstr? strlen(retstr): 0);
|
||||||
rep.length = (SIZEOF(xXF86MiscPassMessageReply) - SIZEOF(xGenericReply) +
|
rep.length = (SIZEOF(xXF86MiscPassMessageReply) - SIZEOF(xGenericReply) +
|
||||||
((rep.mesglen + 3) & ~3)) >> 2;
|
((rep.mesglen + 3) & ~3)) >> 2;
|
||||||
rep.status = 0;
|
rep.status = 0;
|
||||||
|
@ -601,8 +604,8 @@ ProcXF86MiscPassMessage(client)
|
||||||
}
|
}
|
||||||
WriteToClient(client, SIZEOF(xXF86MiscPassMessageReply), (char *)&rep);
|
WriteToClient(client, SIZEOF(xXF86MiscPassMessageReply), (char *)&rep);
|
||||||
|
|
||||||
if (rep.mesglen)
|
if (mesglen)
|
||||||
WriteToClient(client, rep.mesglen, (char *)retstr);
|
WriteToClient(client, mesglen, (char *)retstr);
|
||||||
|
|
||||||
xfree(msgtype);
|
xfree(msgtype);
|
||||||
xfree(msgval);
|
xfree(msgval);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user