Use C99 designated initializers in dix Replies

Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
Alan Coopersmith 2012-07-09 19:12:43 -07:00
parent 69fa5630b5
commit d792ac125a
7 changed files with 265 additions and 220 deletions

View File

@ -1666,9 +1666,11 @@ ProcSetModifierMapping(ClientPtr client)
bytes_to_int32(sizeof(xSetModifierMappingReq)))) bytes_to_int32(sizeof(xSetModifierMappingReq))))
return BadLength; return BadLength;
rep.type = X_Reply; rep = (xSetModifierMappingReply) {
rep.length = 0; .type = X_Reply,
rep.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
.length = 0
};
rc = change_modmap(client, PickKeyboard(client), (KeyCode *) &stuff[1], rc = change_modmap(client, PickKeyboard(client), (KeyCode *) &stuff[1],
stuff->numKeyPerModifier); stuff->numKeyPerModifier);
@ -1696,12 +1698,13 @@ ProcGetModifierMapping(ClientPtr client)
generate_modkeymap(client, PickKeyboard(client), &modkeymap, generate_modkeymap(client, PickKeyboard(client), &modkeymap,
&max_keys_per_mod); &max_keys_per_mod);
memset(&rep, 0, sizeof(xGetModifierMappingReply)); rep = (xGetModifierMappingReply) {
rep.type = X_Reply; .type = X_Reply,
rep.numKeyPerModifier = max_keys_per_mod; .numKeyPerModifier = max_keys_per_mod,
rep.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
/* length counts 4 byte quantities - there are 8 modifiers 1 byte big */ /* length counts 4 byte quantities - there are 8 modifiers 1 byte big */
rep.length = max_keys_per_mod << 1; .length = max_keys_per_mod << 1
};
WriteReplyToClient(client, sizeof(xGetModifierMappingReply), &rep); WriteReplyToClient(client, sizeof(xGetModifierMappingReply), &rep);
WriteToClient(client, max_keys_per_mod * 8, modkeymap); WriteToClient(client, max_keys_per_mod * 8, modkeymap);
@ -1785,10 +1788,13 @@ ProcSetPointerMapping(ClientPtr client)
if (client->req_len != if (client->req_len !=
bytes_to_int32(sizeof(xSetPointerMappingReq) + stuff->nElts)) bytes_to_int32(sizeof(xSetPointerMappingReq) + stuff->nElts))
return BadLength; return BadLength;
rep.type = X_Reply;
rep.length = 0; rep = (xSetPointerMappingReply) {
rep.sequenceNumber = client->sequence; .type = X_Reply,
rep.success = MappingSuccess; .success = MappingSuccess,
.sequenceNumber = client->sequence,
.length = 0
};
map = (BYTE *) &stuff[1]; map = (BYTE *) &stuff[1];
/* So we're bounded here by the number of core buttons. This check /* So we're bounded here by the number of core buttons. This check
@ -1857,12 +1863,13 @@ ProcGetKeyboardMapping(ClientPtr client)
if (!syms) if (!syms)
return BadAlloc; return BadAlloc;
memset(&rep, 0, sizeof(xGetKeyboardMappingReply)); rep = (xGetKeyboardMappingReply) {
rep.type = X_Reply; .type = X_Reply,
rep.sequenceNumber = client->sequence; .keySymsPerKeyCode = syms->mapWidth,
rep.keySymsPerKeyCode = syms->mapWidth; .sequenceNumber = client->sequence,
/* length is a count of 4 byte quantities and KeySyms are 4 bytes */ /* length is a count of 4 byte quantities and KeySyms are 4 bytes */
rep.length = syms->mapWidth * stuff->count; .length = syms->mapWidth * stuff->count
};
WriteReplyToClient(client, sizeof(xGetKeyboardMappingReply), &rep); WriteReplyToClient(client, sizeof(xGetKeyboardMappingReply), &rep);
client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write;
WriteSwappedDataToClient(client, WriteSwappedDataToClient(client,
@ -1892,10 +1899,12 @@ ProcGetPointerMapping(ClientPtr client)
if (rc != Success) if (rc != Success)
return rc; return rc;
rep.type = X_Reply; rep = (xGetPointerMappingReply) {
rep.sequenceNumber = client->sequence; .type = X_Reply,
rep.nElts = (butc) ? butc->numButtons : 0; .nElts = (butc) ? butc->numButtons : 0,
rep.length = ((unsigned) rep.nElts + (4 - 1)) / 4; .sequenceNumber = client->sequence,
.length = ((unsigned) rep.nElts + (4 - 1)) / 4
};
WriteReplyToClient(client, sizeof(xGetPointerMappingReply), &rep); WriteReplyToClient(client, sizeof(xGetPointerMappingReply), &rep);
if (butc) if (butc)
WriteToClient(client, (int) rep.nElts, &butc->map[1]); WriteToClient(client, (int) rep.nElts, &butc->map[1]);
@ -2144,15 +2153,17 @@ ProcGetKeyboardControl(ClientPtr client)
if (rc != Success) if (rc != Success)
return rc; return rc;
rep.type = X_Reply; rep = (xGetKeyboardControlReply) {
rep.length = 5; .type = X_Reply,
rep.sequenceNumber = client->sequence; .globalAutoRepeat = ctrl->autoRepeat,
rep.globalAutoRepeat = ctrl->autoRepeat; .sequenceNumber = client->sequence,
rep.keyClickPercent = ctrl->click; .length = 5,
rep.bellPercent = ctrl->bell; .ledMask = ctrl->leds,
rep.bellPitch = ctrl->bell_pitch; .keyClickPercent = ctrl->click,
rep.bellDuration = ctrl->bell_duration; .bellPercent = ctrl->bell,
rep.ledMask = ctrl->leds; .bellPitch = ctrl->bell_pitch,
.bellDuration = ctrl->bell_duration
};
for (i = 0; i < 32; i++) for (i = 0; i < 32; i++)
rep.map[i] = ctrl->autoRepeats[i]; rep.map[i] = ctrl->autoRepeats[i];
WriteReplyToClient(client, sizeof(xGetKeyboardControlReply), &rep); WriteReplyToClient(client, sizeof(xGetKeyboardControlReply), &rep);
@ -2287,12 +2298,14 @@ ProcGetPointerControl(ClientPtr client)
if (rc != Success) if (rc != Success)
return rc; return rc;
rep.type = X_Reply; rep = (xGetPointerControlReply) {
rep.length = 0; .type = X_Reply,
rep.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
rep.threshold = ctrl->threshold; .length = 0,
rep.accelNumerator = ctrl->num; .accelNumerator = ctrl->num,
rep.accelDenominator = ctrl->den; .accelDenominator = ctrl->den,
.threshold = ctrl->threshold
};
WriteReplyToClient(client, sizeof(xGenericReply), &rep); WriteReplyToClient(client, sizeof(xGenericReply), &rep);
return Success; return Success;
} }
@ -2336,8 +2349,10 @@ ProcGetMotionEvents(ClientPtr client)
if (mouse->valuator->motionHintWindow) if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client); MaybeStopHint(mouse, client);
rep.type = X_Reply; rep = (xGetMotionEventsReply) {
rep.sequenceNumber = client->sequence; .type = X_Reply,
.sequenceNumber = client->sequence
};
nEvents = 0; nEvents = 0;
start = ClientTimeToServerTime(stuff->start); start = ClientTimeToServerTime(stuff->start);
stop = ClientTimeToServerTime(stuff->stop); stop = ClientTimeToServerTime(stuff->stop);
@ -2385,10 +2400,11 @@ ProcQueryKeymap(ClientPtr client)
CARD8 *down = keybd->key->down; CARD8 *down = keybd->key->down;
REQUEST_SIZE_MATCH(xReq); REQUEST_SIZE_MATCH(xReq);
rep.type = X_Reply; rep = (xQueryKeymapReply) {
rep.sequenceNumber = client->sequence; .type = X_Reply,
rep.length = 2; .sequenceNumber = client->sequence,
memset(rep.map, 0, 32); .length = 2
};
rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess); rc = XaceHook(XACE_DEVICE_ACCESS, client, keybd, DixReadAccess);
/* If rc is Success, we're allowed to copy out the keymap. /* If rc is Success, we're allowed to copy out the keymap.

View File

@ -926,10 +926,9 @@ GetGeometry(ClientPtr client, xGetGeometryReply * rep)
int int
ProcGetGeometry(ClientPtr client) ProcGetGeometry(ClientPtr client)
{ {
xGetGeometryReply rep; xGetGeometryReply rep = { .type = X_Reply };
int status; int status;
memset(&rep, 0, sizeof(xGetGeometryReply));
if ((status = GetGeometry(client, &rep)) != Success) if ((status = GetGeometry(client, &rep)) != Success)
return status; return status;
@ -951,14 +950,13 @@ ProcQueryTree(ClientPtr client)
rc = dixLookupWindow(&pWin, stuff->id, client, DixListAccess); rc = dixLookupWindow(&pWin, stuff->id, client, DixListAccess);
if (rc != Success) if (rc != Success)
return rc; return rc;
memset(&reply, 0, sizeof(xQueryTreeReply));
reply.type = X_Reply; reply = (xQueryTreeReply) {
reply.root = pWin->drawable.pScreen->root->drawable.id; .type = X_Reply,
reply.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
if (pWin->parent) .root = pWin->drawable.pScreen->root->drawable.id,
reply.parent = pWin->parent->drawable.id; .parent = (pWin->parent) ? pWin->parent->drawable.id : (Window) None
else };
reply.parent = (Window) None;
pHead = RealChildHead(pWin); pHead = RealChildHead(pWin);
for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib)
numChildren++; numChildren++;
@ -1003,13 +1001,12 @@ ProcInternAtom(ClientPtr client)
tchar = (char *) &stuff[1]; tchar = (char *) &stuff[1];
atom = MakeAtom(tchar, stuff->nbytes, !stuff->onlyIfExists); atom = MakeAtom(tchar, stuff->nbytes, !stuff->onlyIfExists);
if (atom != BAD_RESOURCE) { if (atom != BAD_RESOURCE) {
xInternAtomReply reply; xInternAtomReply reply = {
.type = X_Reply,
memset(&reply, 0, sizeof(xInternAtomReply)); .sequenceNumber = client->sequence,
reply.type = X_Reply; .length = 0,
reply.length = 0; .atom = atom
reply.sequenceNumber = client->sequence; };
reply.atom = atom;
WriteReplyToClient(client, sizeof(xInternAtomReply), &reply); WriteReplyToClient(client, sizeof(xInternAtomReply), &reply);
return Success; return Success;
} }
@ -1021,19 +1018,19 @@ int
ProcGetAtomName(ClientPtr client) ProcGetAtomName(ClientPtr client)
{ {
const char *str; const char *str;
xGetAtomNameReply reply;
int len;
REQUEST(xResourceReq); REQUEST(xResourceReq);
REQUEST_SIZE_MATCH(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq);
if ((str = NameForAtom(stuff->id))) { if ((str = NameForAtom(stuff->id))) {
len = strlen(str); int len = strlen(str);
memset(&reply, 0, sizeof(xGetAtomNameReply)); xGetAtomNameReply reply = {
reply.type = X_Reply; .type = X_Reply,
reply.length = bytes_to_int32(len); .sequenceNumber = client->sequence,
reply.sequenceNumber = client->sequence; .length = bytes_to_int32(len),
reply.nameLength = len; .nameLength = len
};
WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply); WriteReplyToClient(client, sizeof(xGetAtomNameReply), &reply);
WriteToClient(client, len, str); WriteToClient(client, len, str);
return Success; return Success;
@ -1123,10 +1120,12 @@ ProcTranslateCoords(ClientPtr client)
rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixGetAttrAccess); rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixGetAttrAccess);
if (rc != Success) if (rc != Success)
return rc; return rc;
memset(&rep, 0, sizeof(xTranslateCoordsReply));
rep.type = X_Reply; rep = (xTranslateCoordsReply) {
rep.length = 0; .type = X_Reply,
rep.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
.length = 0
};
if (!SAME_SCREENS(pWin->drawable, pDst->drawable)) { if (!SAME_SCREENS(pWin->drawable, pDst->drawable)) {
rep.sameScreen = xFalse; rep.sameScreen = xFalse;
rep.child = None; rep.child = None;
@ -1288,17 +1287,19 @@ ProcQueryTextExtents(ClientPtr client)
} }
if (!QueryTextExtents(pFont, length, (unsigned char *) &stuff[1], &info)) if (!QueryTextExtents(pFont, length, (unsigned char *) &stuff[1], &info))
return BadAlloc; return BadAlloc;
reply.type = X_Reply; reply = (xQueryTextExtentsReply) {
reply.length = 0; .type = X_Reply,
reply.sequenceNumber = client->sequence; .drawDirection = info.drawDirection,
reply.drawDirection = info.drawDirection; .sequenceNumber = client->sequence,
reply.fontAscent = info.fontAscent; .length = 0,
reply.fontDescent = info.fontDescent; .fontAscent = info.fontAscent,
reply.overallAscent = info.overallAscent; .fontDescent = info.fontDescent,
reply.overallDescent = info.overallDescent; .overallAscent = info.overallAscent,
reply.overallWidth = info.overallWidth; .overallDescent = info.overallDescent,
reply.overallLeft = info.overallLeft; .overallWidth = info.overallWidth,
reply.overallRight = info.overallRight; .overallLeft = info.overallLeft,
.overallRight = info.overallRight
};
WriteReplyToClient(client, sizeof(xQueryTextExtentsReply), &reply); WriteReplyToClient(client, sizeof(xQueryTextExtentsReply), &reply);
return Success; return Success;
} }
@ -2466,7 +2467,6 @@ ProcAllocColor(ClientPtr client)
{ {
ColormapPtr pmap; ColormapPtr pmap;
int rc; int rc;
xAllocColorReply acr;
REQUEST(xAllocColorReq); REQUEST(xAllocColorReq);
@ -2474,13 +2474,15 @@ ProcAllocColor(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pmap, stuff->cmap, RT_COLORMAP, rc = dixLookupResourceByType((pointer *) &pmap, stuff->cmap, RT_COLORMAP,
client, DixAddAccess); client, DixAddAccess);
if (rc == Success) { if (rc == Success) {
acr.type = X_Reply; xAllocColorReply acr = {
acr.length = 0; .type = X_Reply,
acr.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
acr.red = stuff->red; .length = 0,
acr.green = stuff->green; .red = stuff->red,
acr.blue = stuff->blue; .green = stuff->green,
acr.pixel = 0; .blue = stuff->blue,
.pixel = 0
};
if ((rc = AllocColor(pmap, &acr.red, &acr.green, &acr.blue, if ((rc = AllocColor(pmap, &acr.red, &acr.green, &acr.blue,
&acr.pixel, client->index))) &acr.pixel, client->index)))
return rc; return rc;
@ -2509,12 +2511,11 @@ ProcAllocNamedColor(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP, rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
client, DixAddAccess); client, DixAddAccess);
if (rc == Success) { if (rc == Success) {
xAllocNamedColorReply ancr; xAllocNamedColorReply ancr = {
.type = X_Reply,
ancr.type = X_Reply; .sequenceNumber = client->sequence,
ancr.length = 0; .length = 0
ancr.sequenceNumber = client->sequence; };
if (OsLookupColor if (OsLookupColor
(pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes, (pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
&ancr.exactRed, &ancr.exactGreen, &ancr.exactBlue)) { &ancr.exactRed, &ancr.exactGreen, &ancr.exactBlue)) {
@ -2555,7 +2556,6 @@ ProcAllocColorCells(ClientPtr client)
rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP, rc = dixLookupResourceByType((pointer *) &pcmp, stuff->cmap, RT_COLORMAP,
client, DixAddAccess); client, DixAddAccess);
if (rc == Success) { if (rc == Success) {
xAllocColorCellsReply accr;
int npixels, nmasks; int npixels, nmasks;
long length; long length;
Pixel *ppixels, *pmasks; Pixel *ppixels, *pmasks;
@ -2585,11 +2585,13 @@ ProcAllocColorCells(ClientPtr client)
if (noPanoramiXExtension || !pcmp->pScreen->myNum) if (noPanoramiXExtension || !pcmp->pScreen->myNum)
#endif #endif
{ {
accr.type = X_Reply; xAllocColorCellsReply accr = {
accr.length = bytes_to_int32(length); .type = X_Reply,
accr.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
accr.nPixels = npixels; .length = bytes_to_int32(length),
accr.nMasks = nmasks; .nPixels = npixels,
.nMasks = nmasks
};
WriteReplyToClient(client, sizeof(xAllocColorCellsReply), &accr); WriteReplyToClient(client, sizeof(xAllocColorCellsReply), &accr);
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, length, ppixels); WriteSwappedDataToClient(client, length, ppixels);
@ -2629,9 +2631,11 @@ ProcAllocColorPlanes(ClientPtr client)
client->errorValue = stuff->contiguous; client->errorValue = stuff->contiguous;
return BadValue; return BadValue;
} }
acpr.type = X_Reply; acpr = (xAllocColorPlanesReply) {
acpr.sequenceNumber = client->sequence; .type = X_Reply,
acpr.nPixels = npixels; .sequenceNumber = client->sequence,
.nPixels = npixels
};
length = (long) npixels *sizeof(Pixel); length = (long) npixels *sizeof(Pixel);
ppixels = malloc(length); ppixels = malloc(length);
@ -2769,11 +2773,12 @@ ProcQueryColors(ClientPtr client)
free(prgbs); free(prgbs);
return rc; return rc;
} }
memset(&qcr, 0, sizeof(xQueryColorsReply)); qcr = (xQueryColorsReply) {
qcr.type = X_Reply; .type = X_Reply,
qcr.length = bytes_to_int32(count * sizeof(xrgb)); .sequenceNumber = client->sequence,
qcr.sequenceNumber = client->sequence; .length = bytes_to_int32(count * sizeof(xrgb)),
qcr.nColors = count; .nColors = count
};
WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr); WriteReplyToClient(client, sizeof(xQueryColorsReply), &qcr);
if (count) { if (count) {
client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend; client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
@ -2806,16 +2811,17 @@ ProcLookupColor(ClientPtr client)
if (OsLookupColor if (OsLookupColor
(pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes, (pcmp->pScreen->myNum, (char *) &stuff[1], stuff->nbytes,
&exactRed, &exactGreen, &exactBlue)) { &exactRed, &exactGreen, &exactBlue)) {
xLookupColorReply lcr; xLookupColorReply lcr = {
lcr.type = X_Reply; .type = X_Reply,
lcr.length = 0; .sequenceNumber = client->sequence,
lcr.sequenceNumber = client->sequence; .length = 0,
lcr.exactRed = exactRed; .exactRed = exactRed,
lcr.exactGreen = exactGreen; .exactGreen = exactGreen,
lcr.exactBlue = exactBlue; .exactBlue = exactBlue,
lcr.screenRed = exactRed; .screenRed = exactRed,
lcr.screenGreen = exactGreen; .screenGreen = exactGreen,
lcr.screenBlue = exactBlue; .screenBlue = exactBlue
};
(*pcmp->pScreen->ResolveColor) (&lcr.screenRed, (*pcmp->pScreen->ResolveColor) (&lcr.screenRed,
&lcr.screenGreen, &lcr.screenGreen,
&lcr.screenBlue, pcmp->pVisual); &lcr.screenBlue, pcmp->pVisual);
@ -2995,12 +3001,13 @@ ProcQueryBestSize(ClientPtr client)
return rc; return rc;
(*pScreen->QueryBestSize) (stuff->class, &stuff->width, (*pScreen->QueryBestSize) (stuff->class, &stuff->width,
&stuff->height, pScreen); &stuff->height, pScreen);
memset(&reply, 0, sizeof(xQueryBestSizeReply)); reply = (xQueryBestSizeReply) {
reply.type = X_Reply; .type = X_Reply,
reply.length = 0; .sequenceNumber = client->sequence,
reply.sequenceNumber = client->sequence; .length = 0,
reply.width = stuff->width; .width = stuff->width,
reply.height = stuff->height; .height = stuff->height
};
WriteReplyToClient(client, sizeof(xQueryBestSizeReply), &reply); WriteReplyToClient(client, sizeof(xQueryBestSizeReply), &reply);
return Success; return Success;
} }
@ -3080,13 +3087,15 @@ ProcGetScreenSaver(ClientPtr client)
return rc; return rc;
} }
rep.type = X_Reply; rep = (xGetScreenSaverReply) {
rep.length = 0; .type = X_Reply,
rep.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
rep.timeout = ScreenSaverTime / MILLI_PER_SECOND; .length = 0,
rep.interval = ScreenSaverInterval / MILLI_PER_SECOND; .timeout = ScreenSaverTime / MILLI_PER_SECOND,
rep.preferBlanking = ScreenSaverBlanking; .interval = ScreenSaverInterval / MILLI_PER_SECOND,
rep.allowExposures = ScreenSaverAllowExposures; .preferBlanking = ScreenSaverBlanking,
.allowExposures = ScreenSaverAllowExposures
};
WriteReplyToClient(client, sizeof(xGetScreenSaverReply), &rep); WriteReplyToClient(client, sizeof(xGetScreenSaverReply), &rep);
return Success; return Success;
} }
@ -3128,11 +3137,14 @@ ProcListHosts(ClientPtr client)
result = GetHosts(&pdata, &nHosts, &len, &enabled); result = GetHosts(&pdata, &nHosts, &len, &enabled);
if (result != Success) if (result != Success)
return result; return result;
reply.type = X_Reply;
reply.enabled = enabled; reply = (xListHostsReply) {
reply.sequenceNumber = client->sequence; .type = X_Reply,
reply.nHosts = nHosts; .enabled = enabled,
reply.length = bytes_to_int32(len); .sequenceNumber = client->sequence,
.length = bytes_to_int32(len),
.nHosts = nHosts
};
WriteReplyToClient(client, sizeof(xListHostsReply), &reply); WriteReplyToClient(client, sizeof(xListHostsReply), &reply);
if (nHosts) { if (nHosts) {
client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend; client->pSwapReplyFunc = (ReplySwapPtr) SLHostsExtend;
@ -3247,10 +3259,12 @@ ProcGetFontPath(ClientPtr client)
if (rc != Success) if (rc != Success)
return rc; return rc;
reply.type = X_Reply; reply = (xGetFontPathReply) {
reply.sequenceNumber = client->sequence; .type = X_Reply,
reply.length = bytes_to_int32(stringLens + numpaths); .sequenceNumber = client->sequence,
reply.nPaths = numpaths; .length = bytes_to_int32(stringLens + numpaths),
.nPaths = numpaths
};
WriteReplyToClient(client, sizeof(xGetFontPathReply), &reply); WriteReplyToClient(client, sizeof(xGetFontPathReply), &reply);
if (stringLens || numpaths) if (stringLens || numpaths)

View File

@ -753,11 +753,12 @@ doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
for (i = 0; i < nnames; i++) for (i = 0; i < nnames; i++)
stringLens += (names->length[i] <= 255) ? names->length[i] : 0; stringLens += (names->length[i] <= 255) ? names->length[i] : 0;
memset(&reply, 0, sizeof(xListFontsReply)); reply = (xListFontsReply) {
reply.type = X_Reply; .type = X_Reply,
reply.length = bytes_to_int32(stringLens + nnames); .length = bytes_to_int32(stringLens + nnames),
reply.nFonts = nnames; .nFonts = nnames,
reply.sequenceNumber = client->sequence; .sequenceNumber = client->sequence
};
bufptr = bufferStart = malloc(reply.length << 2); bufptr = bufferStart = malloc(reply.length << 2);
@ -1030,11 +1031,12 @@ doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
} }
finish: finish:
length = sizeof(xListFontsWithInfoReply); length = sizeof(xListFontsWithInfoReply);
memset((char *) &finalReply, 0, sizeof(xListFontsWithInfoReply)); finalReply = (xListFontsWithInfoReply) {
finalReply.type = X_Reply; .type = X_Reply,
finalReply.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
finalReply.length = bytes_to_int32(sizeof(xListFontsWithInfoReply) .length = bytes_to_int32(sizeof(xListFontsWithInfoReply)
- sizeof(xGenericReply)); - sizeof(xGenericReply))
};
WriteSwappedDataToClient(client, length, &finalReply); WriteSwappedDataToClient(client, length, &finalReply);
bail: bail:
ClientWakeup(client); ClientWakeup(client);

View File

@ -4767,17 +4767,20 @@ ProcGetInputFocus(ClientPtr client)
if (rc != Success) if (rc != Success)
return rc; return rc;
memset(&rep, 0, sizeof(xGetInputFocusReply)); rep = (xGetInputFocusReply) {
rep.type = X_Reply; .type = X_Reply,
rep.length = 0; .length = 0,
rep.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
.revertTo = focus->revert
};
if (focus->win == NoneWin) if (focus->win == NoneWin)
rep.focus = None; rep.focus = None;
else if (focus->win == PointerRootWin) else if (focus->win == PointerRootWin)
rep.focus = PointerRoot; rep.focus = PointerRoot;
else else
rep.focus = focus->win->drawable.id; rep.focus = focus->win->drawable.id;
rep.revertTo = focus->revert;
WriteReplyToClient(client, sizeof(xGetInputFocusReply), &rep); WriteReplyToClient(client, sizeof(xGetInputFocusReply), &rep);
return Success; return Success;
} }
@ -4840,11 +4843,12 @@ ProcGrabPointer(ClientPtr client)
if (oldCursor && status == GrabSuccess) if (oldCursor && status == GrabSuccess)
FreeCursor(oldCursor, (Cursor) 0); FreeCursor(oldCursor, (Cursor) 0);
memset(&rep, 0, sizeof(xGrabPointerReply)); rep = (xGrabPointerReply) {
rep.type = X_Reply; .type = X_Reply,
rep.status = status; .status = status,
rep.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
rep.length = 0; .length = 0
};
WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep); WriteReplyToClient(client, sizeof(xGrabPointerReply), &rep);
return Success; return Success;
} }
@ -5080,11 +5084,12 @@ ProcGrabKeyboard(ClientPtr client)
if (result != Success) if (result != Success)
return result; return result;
memset(&rep, 0, sizeof(xGrabKeyboardReply)); rep = (xGrabKeyboardReply) {
rep.type = X_Reply; .type = X_Reply,
rep.status = status; .status = status,
rep.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
rep.length = 0; .length = 0
};
WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep); WriteReplyToClient(client, sizeof(xGrabKeyboardReply), &rep);
return Success; return Success;
} }
@ -5147,15 +5152,16 @@ ProcQueryPointer(ClientPtr client)
pSprite = mouse->spriteInfo->sprite; pSprite = mouse->spriteInfo->sprite;
if (mouse->valuator->motionHintWindow) if (mouse->valuator->motionHintWindow)
MaybeStopHint(mouse, client); MaybeStopHint(mouse, client);
memset(&rep, 0, sizeof(xQueryPointerReply)); rep = (xQueryPointerReply) {
rep.type = X_Reply; .type = X_Reply,
rep.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
rep.mask = event_get_corestate(mouse, keyboard); .length = 0,
rep.length = 0; .mask = event_get_corestate(mouse, keyboard),
rep.root = (GetCurrentRootWindow(mouse))->drawable.id; .root = (GetCurrentRootWindow(mouse))->drawable.id,
rep.rootX = pSprite->hot.x; .rootX = pSprite->hot.x,
rep.rootY = pSprite->hot.y; .rootY = pSprite->hot.y,
rep.child = None; .child = None
};
if (pSprite->hot.pScreen == pWin->drawable.pScreen) { if (pSprite->hot.pScreen == pWin->drawable.pScreen) {
rep.sameScreen = xTrue; rep.sameScreen = xTrue;
rep.winX = pSprite->hot.x - pWin->drawable.x; rep.winX = pSprite->hot.x - pWin->drawable.x;

View File

@ -252,11 +252,12 @@ ProcQueryExtension(ClientPtr client)
REQUEST_FIXED_SIZE(xQueryExtensionReq, stuff->nbytes); REQUEST_FIXED_SIZE(xQueryExtensionReq, stuff->nbytes);
memset(&reply, 0, sizeof(xQueryExtensionReply)); reply = (xQueryExtensionReply) {
reply.type = X_Reply; .type = X_Reply,
reply.length = 0; .sequenceNumber = client->sequence,
reply.major_opcode = 0; .length = 0,
reply.sequenceNumber = client->sequence; .major_opcode = 0
};
if (!NumExtensions) if (!NumExtensions)
reply.present = xFalse; reply.present = xFalse;
@ -284,11 +285,12 @@ ProcListExtensions(ClientPtr client)
REQUEST_SIZE_MATCH(xReq); REQUEST_SIZE_MATCH(xReq);
memset(&reply, 0, sizeof(xListExtensionsReply)); reply = (xListExtensionsReply) {
reply.type = X_Reply; .type = X_Reply,
reply.nExtensions = 0; .nExtensions = 0,
reply.length = 0; .sequenceNumber = client->sequence,
reply.sequenceNumber = client->sequence; .length = 0
};
buffer = NULL; buffer = NULL;
if (NumExtensions) { if (NumExtensions) {

View File

@ -415,15 +415,15 @@ DeleteAllWindowProperties(WindowPtr pWin)
static int static int
NullPropertyReply(ClientPtr client, ATOM propertyType, int format) NullPropertyReply(ClientPtr client, ATOM propertyType, int format)
{ {
xGetPropertyReply reply; xGetPropertyReply reply = {
memset(&reply, 0, sizeof(xGetPropertyReply)); .type = X_Reply,
reply.type = X_Reply; .format = format,
reply.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
reply.nItems = 0; .length = 0,
reply.length = 0; .propertyType = propertyType,
reply.bytesAfter = 0; .bytesAfter = 0,
reply.propertyType = propertyType; .nItems = 0
reply.format = format; };
WriteReplyToClient(client, sizeof(xGenericReply), &reply); WriteReplyToClient(client, sizeof(xGenericReply), &reply);
return Success; return Success;
} }
@ -484,14 +484,15 @@ ProcGetProperty(ClientPtr client)
if (((stuff->type != pProp->type) && (stuff->type != AnyPropertyType)) if (((stuff->type != pProp->type) && (stuff->type != AnyPropertyType))
) { ) {
memset(&reply, 0, sizeof(xGetPropertyReply)); reply = (xGetPropertyReply) {
reply.type = X_Reply; .type = X_Reply,
reply.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
reply.bytesAfter = pProp->size; .bytesAfter = pProp->size,
reply.format = pProp->format; .format = pProp->format,
reply.length = 0; .length = 0,
reply.nItems = 0; .nItems = 0,
reply.propertyType = pProp->type; .propertyType = pProp->type
};
WriteReplyToClient(client, sizeof(xGenericReply), &reply); WriteReplyToClient(client, sizeof(xGenericReply), &reply);
return Success; return Success;
} }
@ -512,14 +513,15 @@ ProcGetProperty(ClientPtr client)
len = min(n - ind, 4 * stuff->longLength); len = min(n - ind, 4 * stuff->longLength);
memset(&reply, 0, sizeof(xGetPropertyReply)); reply = (xGetPropertyReply) {
reply.type = X_Reply; .type = X_Reply,
reply.sequenceNumber = client->sequence; .sequenceNumber = client->sequence,
reply.bytesAfter = n - (ind + len); .bytesAfter = n - (ind + len),
reply.format = pProp->format; .format = pProp->format,
reply.length = bytes_to_int32(len); .length = bytes_to_int32(len),
reply.nItems = len / (pProp->format / 8); .nItems = len / (pProp->format / 8),
reply.propertyType = pProp->type; .propertyType = pProp->type
};
if (stuff->delete && (reply.bytesAfter == 0)) if (stuff->delete && (reply.bytesAfter == 0))
deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName); deliverPropertyNotifyEvent(pWin, PropertyDelete, pProp->propertyName);
@ -594,10 +596,12 @@ ProcListProperties(ClientPtr client)
} }
} }
xlpr.type = X_Reply; xlpr = (xListPropertiesReply) {
xlpr.nProperties = numProps; .type = X_Reply,
xlpr.length = bytes_to_int32(numProps * sizeof(Atom)); .sequenceNumber = client->sequence,
xlpr.sequenceNumber = client->sequence; .length = bytes_to_int32(numProps * sizeof(Atom)),
.nProperties = numProps
};
WriteReplyToClient(client, sizeof(xGenericReply), &xlpr); WriteReplyToClient(client, sizeof(xGenericReply), &xlpr);
if (numProps) { if (numProps) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;

View File

@ -238,10 +238,11 @@ ProcGetSelectionOwner(ClientPtr client)
return BadAtom; return BadAtom;
} }
memset(&reply, 0, sizeof(xGetSelectionOwnerReply)); reply = (xGetSelectionOwnerReply) {
reply.type = X_Reply; .type = X_Reply,
reply.length = 0; .sequenceNumber = client->sequence,
reply.sequenceNumber = client->sequence; .length = 0,
};
rc = dixLookupSelection(&pSel, stuff->id, client, DixGetAttrAccess); rc = dixLookupSelection(&pSel, stuff->id, client, DixGetAttrAccess);
if (rc == Success) if (rc == Success)