diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-07-09 19:12:43 -0700 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2012-07-09 19:58:30 -0700 |
commit | 2f5caeaddb3616dc9ff57d784f7feba589c536e7 (patch) | |
tree | 1909962a69a7a643c6f66b0320416cbdca191e59 | |
parent | 6a721e3af5e11bae1d59ca551a02470f35d9e844 (diff) |
Use C99 designated initializers in Xinput Replies
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Tested-by: Daniel Stone <daniel@fooishbar.org>
-rw-r--r-- | Xi/chgdctl.c | 10 | ||||
-rw-r--r-- | Xi/getbmap.c | 12 | ||||
-rw-r--r-- | Xi/getdctl.c | 10 | ||||
-rw-r--r-- | Xi/getfctl.c | 12 | ||||
-rw-r--r-- | Xi/getfocus.c | 10 | ||||
-rw-r--r-- | Xi/getkmap.c | 12 | ||||
-rw-r--r-- | Xi/getmmap.c | 12 | ||||
-rw-r--r-- | Xi/getprop.c | 12 | ||||
-rw-r--r-- | Xi/getselev.c | 14 | ||||
-rw-r--r-- | Xi/getvers.c | 17 | ||||
-rw-r--r-- | Xi/grabdev.c | 10 | ||||
-rw-r--r-- | Xi/gtmotion.c | 16 | ||||
-rw-r--r-- | Xi/listdev.c | 11 | ||||
-rw-r--r-- | Xi/opendev.c | 13 | ||||
-rw-r--r-- | Xi/queryst.c | 14 | ||||
-rw-r--r-- | Xi/setbmap.c | 12 | ||||
-rw-r--r-- | Xi/setdval.c | 12 | ||||
-rw-r--r-- | Xi/setmmap.c | 10 | ||||
-rw-r--r-- | Xi/setmode.c | 10 | ||||
-rw-r--r-- | Xi/xigetclientpointer.c | 14 | ||||
-rw-r--r-- | Xi/xigrabdev.c | 12 | ||||
-rw-r--r-- | Xi/xipassivegrab.c | 14 | ||||
-rw-r--r-- | Xi/xiproperty.c | 62 | ||||
-rw-r--r-- | Xi/xiquerydevice.c | 13 | ||||
-rw-r--r-- | Xi/xiquerypointer.c | 19 | ||||
-rw-r--r-- | Xi/xiqueryversion.c | 15 | ||||
-rw-r--r-- | Xi/xiselectev.c | 12 | ||||
-rw-r--r-- | Xi/xisetdevfocus.c | 10 |
28 files changed, 226 insertions, 174 deletions
diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c index 0de5f2b59..caef0bf54 100644 --- a/Xi/chgdctl.c +++ b/Xi/chgdctl.c @@ -123,10 +123,12 @@ ProcXChangeDeviceControl(ClientPtr client) if (ret != Success) goto out; - rep.repType = X_Reply; - rep.RepType = X_ChangeDeviceControl; - rep.length = 0; - rep.sequenceNumber = client->sequence; + rep = (xChangeDeviceControlReply) { + .repType = X_Reply, + .RepType = X_ChangeDeviceControl, + .sequenceNumber = client->sequence, + .length = 0 + }; switch (stuff->control) { case DEVICE_RESOLUTION: diff --git a/Xi/getbmap.c b/Xi/getbmap.c index 2712fcdbc..49b868889 100644 --- a/Xi/getbmap.c +++ b/Xi/getbmap.c @@ -92,11 +92,13 @@ ProcXGetDeviceButtonMapping(ClientPtr client) REQUEST(xGetDeviceButtonMappingReq); REQUEST_SIZE_MATCH(xGetDeviceButtonMappingReq); - rep.repType = X_Reply; - rep.RepType = X_GetDeviceButtonMapping; - rep.nElts = 0; - rep.length = 0; - rep.sequenceNumber = client->sequence; + rep = (xGetDeviceButtonMappingReply) { + .repType = X_Reply, + .RepType = X_GetDeviceButtonMapping, + .sequenceNumber = client->sequence, + .nElts = 0, + .length = 0 + }; rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess); if (rc != Success) diff --git a/Xi/getdctl.c b/Xi/getdctl.c index 27775e24d..6f73e0979 100644 --- a/Xi/getdctl.c +++ b/Xi/getdctl.c @@ -182,10 +182,12 @@ ProcXGetDeviceControl(ClientPtr client) if (rc != Success) return rc; - rep.repType = X_Reply; - rep.RepType = X_GetDeviceControl; - rep.length = 0; - rep.sequenceNumber = client->sequence; + rep = (xGetDeviceControlReply) { + .repType = X_Reply, + .RepType = X_GetDeviceControl, + .sequenceNumber = client->sequence, + .length = 0 + }; switch (stuff->control) { case DEVICE_RESOLUTION: diff --git a/Xi/getfctl.c b/Xi/getfctl.c index 5f97cc3a9..599b2ef97 100644 --- a/Xi/getfctl.c +++ b/Xi/getfctl.c @@ -295,11 +295,13 @@ ProcXGetFeedbackControl(ClientPtr client) if (rc != Success) return rc; - rep.repType = X_Reply; - rep.RepType = X_GetFeedbackControl; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.num_feedbacks = 0; + rep = (xGetFeedbackControlReply) { + .repType = X_Reply, + .RepType = X_GetFeedbackControl, + .sequenceNumber = client->sequence, + .length = 0, + .num_feedbacks = 0 + }; for (k = dev->kbdfeed; k; k = k->next) { rep.num_feedbacks++; diff --git a/Xi/getfocus.c b/Xi/getfocus.c index 54c176fa2..40546cb84 100644 --- a/Xi/getfocus.c +++ b/Xi/getfocus.c @@ -99,10 +99,12 @@ ProcXGetDeviceFocus(ClientPtr client) if (!dev->focus) return BadDevice; - rep.repType = X_Reply; - rep.RepType = X_GetDeviceFocus; - rep.length = 0; - rep.sequenceNumber = client->sequence; + rep = (xGetDeviceFocusReply) { + .repType = X_Reply, + .RepType = X_GetDeviceFocus, + .sequenceNumber = client->sequence, + .length = 0 + }; focus = dev->focus; diff --git a/Xi/getkmap.c b/Xi/getkmap.c index 353687947..87c197759 100644 --- a/Xi/getkmap.c +++ b/Xi/getkmap.c @@ -119,11 +119,13 @@ ProcXGetDeviceKeyMapping(ClientPtr client) if (!syms) return BadAlloc; - rep.repType = X_Reply; - rep.RepType = X_GetDeviceKeyMapping; - rep.sequenceNumber = client->sequence; - rep.keySymsPerKeyCode = syms->mapWidth; - rep.length = (syms->mapWidth * stuff->count); /* KeySyms are 4 bytes */ + rep = (xGetDeviceKeyMappingReply) { + .repType = X_Reply, + .RepType = X_GetDeviceKeyMapping, + .sequenceNumber = client->sequence, + .keySymsPerKeyCode = syms->mapWidth, + .length = (syms->mapWidth * stuff->count) /* KeySyms are 4 bytes */ + }; WriteReplyToClient(client, sizeof(xGetDeviceKeyMappingReply), &rep); client->pSwapReplyFunc = (ReplySwapPtr) CopySwap32Write; diff --git a/Xi/getmmap.c b/Xi/getmmap.c index 97d4c0d87..f07f2bb5c 100644 --- a/Xi/getmmap.c +++ b/Xi/getmmap.c @@ -101,12 +101,14 @@ ProcXGetDeviceModifierMapping(ClientPtr client) if (ret != Success) return ret; - rep.repType = X_Reply; - rep.RepType = X_GetDeviceModifierMapping; - rep.numKeyPerModifier = max_keys_per_mod; - rep.sequenceNumber = client->sequence; + rep = (xGetDeviceModifierMappingReply) { + .repType = X_Reply, + .RepType = X_GetDeviceModifierMapping, + .sequenceNumber = client->sequence, + .numKeyPerModifier = max_keys_per_mod, /* 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(xGetDeviceModifierMappingReply), &rep); WriteToClient(client, max_keys_per_mod * 8, modkeymap); diff --git a/Xi/getprop.c b/Xi/getprop.c index b5af13a62..4d6ce6338 100644 --- a/Xi/getprop.c +++ b/Xi/getprop.c @@ -101,11 +101,13 @@ ProcXGetDeviceDontPropagateList(ClientPtr client) REQUEST(xGetDeviceDontPropagateListReq); REQUEST_SIZE_MATCH(xGetDeviceDontPropagateListReq); - rep.repType = X_Reply; - rep.RepType = X_GetDeviceDontPropagateList; - rep.sequenceNumber = client->sequence; - rep.length = 0; - rep.count = 0; + rep = (xGetDeviceDontPropagateListReply) { + .repType = X_Reply, + .RepType = X_GetDeviceDontPropagateList, + .sequenceNumber = client->sequence, + .length = 0, + .count = 0 + }; rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) diff --git a/Xi/getselev.c b/Xi/getselev.c index 4fcc902ee..60a46c2d1 100644 --- a/Xi/getselev.c +++ b/Xi/getselev.c @@ -102,12 +102,14 @@ ProcXGetSelectedExtensionEvents(ClientPtr client) REQUEST(xGetSelectedExtensionEventsReq); REQUEST_SIZE_MATCH(xGetSelectedExtensionEventsReq); - rep.repType = X_Reply; - rep.RepType = X_GetSelectedExtensionEvents; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.this_client_count = 0; - rep.all_clients_count = 0; + rep = (xGetSelectedExtensionEventsReply) { + .repType = X_Reply, + .RepType = X_GetSelectedExtensionEvents, + .sequenceNumber = client->sequence, + .length = 0, + .this_client_count = 0, + .all_clients_count = 0 + }; rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) diff --git a/Xi/getvers.c b/Xi/getvers.c index b380344a4..829e69535 100644 --- a/Xi/getvers.c +++ b/Xi/getvers.c @@ -98,14 +98,15 @@ ProcXGetExtensionVersion(ClientPtr client) stuff->nbytes)) return BadLength; - memset(&rep, 0, sizeof(xGetExtensionVersionReply)); - rep.repType = X_Reply; - rep.RepType = X_GetExtensionVersion; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.present = TRUE; - rep.major_version = XIVersion.major_version; - rep.minor_version = XIVersion.minor_version; + rep = (xGetExtensionVersionReply) { + .repType = X_Reply, + .RepType = X_GetExtensionVersion, + .sequenceNumber = client->sequence, + .length = 0, + .major_version = XIVersion.major_version, + .minor_version = XIVersion.minor_version, + .present = TRUE + }; WriteReplyToClient(client, sizeof(xGetExtensionVersionReply), &rep); diff --git a/Xi/grabdev.c b/Xi/grabdev.c index bdc0c4bcd..443ef56c1 100644 --- a/Xi/grabdev.c +++ b/Xi/grabdev.c @@ -113,10 +113,12 @@ ProcXGrabDevice(ClientPtr client) bytes_to_int32(sizeof(xGrabDeviceReq)) + stuff->event_count) return BadLength; - rep.repType = X_Reply; - rep.RepType = X_GrabDevice; - rep.sequenceNumber = client->sequence; - rep.length = 0; + rep = (xGrabDeviceReply) { + .repType = X_Reply, + .RepType = X_GrabDevice, + .sequenceNumber = client->sequence, + .length = 0, + }; rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGrabAccess); if (rc != Success) diff --git a/Xi/gtmotion.c b/Xi/gtmotion.c index 2249b86d7..4642b194a 100644 --- a/Xi/gtmotion.c +++ b/Xi/gtmotion.c @@ -110,13 +110,15 @@ ProcXGetDeviceMotionEvents(ClientPtr client) if (dev->valuator->motionHintWindow) MaybeStopDeviceHint(dev, client); axes = v->numAxes; - rep.repType = X_Reply; - rep.RepType = X_GetDeviceMotionEvents; - rep.sequenceNumber = client->sequence; - rep.nEvents = 0; - rep.axes = axes; - rep.mode = Absolute; /* XXX we don't do relative at the moment */ - rep.length = 0; + rep = (xGetDeviceMotionEventsReply) { + .repType = X_Reply, + .RepType = X_GetDeviceMotionEvents, + .sequenceNumber = client->sequence, + .length = 0, + .nEvents = 0, + .axes = axes, + .mode = Absolute /* XXX we don't do relative at the moment */ + }; start = ClientTimeToServerTime(stuff->start); stop = ClientTimeToServerTime(stuff->stop); if (CompareTimeStamps(start, stop) == LATER || diff --git a/Xi/listdev.c b/Xi/listdev.c index 1fff73804..014c61db0 100644 --- a/Xi/listdev.c +++ b/Xi/listdev.c @@ -342,11 +342,12 @@ ProcXListInputDevices(ClientPtr client) REQUEST_SIZE_MATCH(xListInputDevicesReq); - memset(&rep, 0, sizeof(xListInputDevicesReply)); - rep.repType = X_Reply; - rep.RepType = X_ListInputDevices; - rep.length = 0; - rep.sequenceNumber = client->sequence; + rep = (xListInputDevicesReply) { + .repType = X_Reply, + .RepType = X_ListInputDevices, + .sequenceNumber = client->sequence, + .length = 0 + }; /* allocate space for saving skip value */ skip = calloc(sizeof(Bool), inputInfo.numDevices); diff --git a/Xi/opendev.c b/Xi/opendev.c index 486ac143a..6708bade1 100644 --- a/Xi/opendev.c +++ b/Xi/opendev.c @@ -117,10 +117,6 @@ ProcXOpenDevice(ClientPtr client) if (status != Success) return status; - memset(&rep, 0, sizeof(xOpenDeviceReply)); - rep.repType = X_Reply; - rep.RepType = X_OpenDevice; - rep.sequenceNumber = client->sequence; if (dev->key != NULL) { evbase[j].class = KeyClass; evbase[j++].event_type_base = event_base[KeyClass]; @@ -148,8 +144,13 @@ ProcXOpenDevice(ClientPtr client) } evbase[j].class = OtherClass; evbase[j++].event_type_base = event_base[OtherClass]; - rep.length = bytes_to_int32(j * sizeof(xInputClassInfo)); - rep.num_classes = j; + rep = (xOpenDeviceReply) { + .repType = X_Reply, + .RepType = X_OpenDevice, + .sequenceNumber = client->sequence, + .length = bytes_to_int32(j * sizeof(xInputClassInfo)), + .num_classes = j + }; WriteReplyToClient(client, sizeof(xOpenDeviceReply), &rep); WriteToClient(client, j * sizeof(xInputClassInfo), evbase); return Success; diff --git a/Xi/queryst.c b/Xi/queryst.c index de199743c..04a652be3 100644 --- a/Xi/queryst.c +++ b/Xi/queryst.c @@ -87,11 +87,6 @@ ProcXQueryDeviceState(ClientPtr client) REQUEST(xQueryDeviceStateReq); REQUEST_SIZE_MATCH(xQueryDeviceStateReq); - rep.repType = X_Reply; - rep.RepType = X_QueryDeviceState; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rc = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess); if (rc != Success && rc != BadAccess) return rc; @@ -163,8 +158,13 @@ ProcXQueryDeviceState(ClientPtr client) } } - rep.num_classes = num_classes; - rep.length = bytes_to_int32(total_length); + rep = (xQueryDeviceStateReply) { + .repType = X_Reply, + .RepType = X_QueryDeviceState, + .sequenceNumber = client->sequence, + .length = bytes_to_int32(total_length), + .num_classes = num_classes + }; WriteReplyToClient(client, sizeof(xQueryDeviceStateReply), &rep); if (total_length > 0) WriteToClient(client, total_length, savbuf); diff --git a/Xi/setbmap.c b/Xi/setbmap.c index 296b43917..94796558d 100644 --- a/Xi/setbmap.c +++ b/Xi/setbmap.c @@ -100,11 +100,13 @@ ProcXSetDeviceButtonMapping(ClientPtr client) if (ret != Success) return ret; - rep.repType = X_Reply; - rep.RepType = X_SetDeviceButtonMapping; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.status = MappingSuccess; + rep = (xSetDeviceButtonMappingReply) { + .repType = X_Reply, + .RepType = X_SetDeviceButtonMapping, + .sequenceNumber = client->sequence, + .length = 0, + .status = MappingSuccess + }; ret = ApplyPointerMapping(dev, (CARD8 *) &stuff[1], stuff->map_length, diff --git a/Xi/setdval.c b/Xi/setdval.c index 8c3816de7..4c9c99f55 100644 --- a/Xi/setdval.c +++ b/Xi/setdval.c @@ -92,11 +92,13 @@ ProcXSetDeviceValuators(ClientPtr client) REQUEST(xSetDeviceValuatorsReq); REQUEST_AT_LEAST_SIZE(xSetDeviceValuatorsReq); - rep.repType = X_Reply; - rep.RepType = X_SetDeviceValuators; - rep.length = 0; - rep.status = Success; - rep.sequenceNumber = client->sequence; + rep = (xSetDeviceValuatorsReply) { + .repType = X_Reply, + .RepType = X_SetDeviceValuators, + .sequenceNumber = client->sequence, + .length = 0, + .status = Success + }; if (stuff->length != bytes_to_int32(sizeof(xSetDeviceValuatorsReq)) + stuff->num_valuators) diff --git a/Xi/setmmap.c b/Xi/setmmap.c index e70038ee3..1320cfec7 100644 --- a/Xi/setmmap.c +++ b/Xi/setmmap.c @@ -98,10 +98,12 @@ ProcXSetDeviceModifierMapping(ClientPtr client) (stuff->numKeyPerModifier << 1)) return BadLength; - rep.repType = X_Reply; - rep.RepType = X_SetDeviceModifierMapping; - rep.length = 0; - rep.sequenceNumber = client->sequence; + rep = (xSetDeviceModifierMappingReply) { + .repType = X_Reply, + .RepType = X_SetDeviceModifierMapping, + .sequenceNumber = client->sequence, + .length = 0 + }; ret = dixLookupDevice(&dev, stuff->deviceid, client, DixManageAccess); if (ret != Success) diff --git a/Xi/setmode.c b/Xi/setmode.c index f212d8395..535655257 100644 --- a/Xi/setmode.c +++ b/Xi/setmode.c @@ -92,10 +92,12 @@ ProcXSetDeviceMode(ClientPtr client) REQUEST(xSetDeviceModeReq); REQUEST_SIZE_MATCH(xSetDeviceModeReq); - rep.repType = X_Reply; - rep.RepType = X_SetDeviceMode; - rep.length = 0; - rep.sequenceNumber = client->sequence; + rep = (xSetDeviceModeReply) { + .repType = X_Reply, + .RepType = X_SetDeviceMode, + .sequenceNumber = client->sequence, + .length = 0 + }; rc = dixLookupDevice(&dev, stuff->deviceid, client, DixSetAttrAccess); if (rc != Success) diff --git a/Xi/xigetclientpointer.c b/Xi/xigetclientpointer.c index 8a5f54f9e..3c90d588d 100644 --- a/Xi/xigetclientpointer.c +++ b/Xi/xigetclientpointer.c @@ -75,12 +75,14 @@ ProcXIGetClientPointer(ClientPtr client) else winclient = client; - rep.repType = X_Reply; - rep.RepType = X_XIGetClientPointer; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.set = (winclient->clientPtr != NULL); - rep.deviceid = (winclient->clientPtr) ? winclient->clientPtr->id : 0; + rep = (xXIGetClientPointerReply) { + .repType = X_Reply, + .RepType = X_XIGetClientPointer, + .sequenceNumber = client->sequence, + .length = 0, + .set = (winclient->clientPtr != NULL), + .deviceid = (winclient->clientPtr) ? winclient->clientPtr->id : 0 + }; WriteReplyToClient(client, sizeof(xXIGetClientPointerReply), &rep); return Success; diff --git a/Xi/xigrabdev.c b/Xi/xigrabdev.c index 095fcfa63..09186e84f 100644 --- a/Xi/xigrabdev.c +++ b/Xi/xigrabdev.c @@ -104,11 +104,13 @@ ProcXIGrabDevice(ClientPtr client) if (ret != Success) return ret; - rep.repType = X_Reply; - rep.RepType = X_XIGrabDevice; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.status = status; + rep = (xXIGrabDeviceReply) { + .repType = X_Reply, + .RepType = X_XIGrabDevice, + .sequenceNumber = client->sequence, + .length = 0, + .status = status + }; WriteReplyToClient(client, sizeof(rep), &rep); return ret; diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c index 5e4fa4e60..ddab53dec 100644 --- a/Xi/xipassivegrab.c +++ b/Xi/xipassivegrab.c @@ -78,7 +78,13 @@ int ProcXIPassiveGrabDevice(ClientPtr client) { DeviceIntPtr dev, mod_dev; - xXIPassiveGrabDeviceReply rep; + xXIPassiveGrabDeviceReply rep = { + .repType = X_Reply, + .RepType = X_XIPassiveGrabDevice, + .sequenceNumber = client->sequence, + .length = 0, + .num_modifiers = 0 + }; int i, ret = Success; uint32_t *modifiers; xXIGrabModifierInfo *modifiers_failed; @@ -137,12 +143,6 @@ ProcXIPassiveGrabDevice(ClientPtr client) xi2mask_set_one_mask(mask.xi2mask, stuff->deviceid, (unsigned char *) &stuff[1], mask_len * 4); - rep.repType = X_Reply; - rep.RepType = X_XIPassiveGrabDevice; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.num_modifiers = 0; - memset(¶m, 0, sizeof(param)); param.grabtype = XI2; param.ownerEvents = stuff->owner_events; diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c index ab8696365..51a36d41a 100644 --- a/Xi/xiproperty.c +++ b/Xi/xiproperty.c @@ -864,11 +864,13 @@ ProcXListDeviceProperties(ClientPtr client) if (rc != Success) return rc; - rep.repType = X_Reply; - rep.RepType = X_ListDeviceProperties; - rep.length = natoms; - rep.sequenceNumber = client->sequence; - rep.nAtoms = natoms; + rep = (xListDevicePropertiesReply) { + .repType = X_Reply, + .RepType = X_ListDeviceProperties, + .sequenceNumber = client->sequence, + .length = natoms, + .nAtoms = natoms + }; WriteReplyToClient(client, sizeof(xListDevicePropertiesReply), &rep); if (natoms) { @@ -958,15 +960,17 @@ ProcXGetDeviceProperty(ClientPtr client) if (rc != Success) return rc; - reply.repType = X_Reply; - reply.RepType = X_GetDeviceProperty; - reply.sequenceNumber = client->sequence; - reply.deviceid = dev->id; - reply.nItems = nitems; - reply.format = format; - reply.bytesAfter = bytes_after; - reply.propertyType = type; - reply.length = bytes_to_int32(length); + reply = (xGetDevicePropertyReply) { + .repType = X_Reply, + .RepType = X_GetDeviceProperty, + .sequenceNumber = client->sequence, + .length = bytes_to_int32(length), + .propertyType = type, + .bytesAfter = bytes_after, + .nItems = nitems, + .format = format, + .deviceid = dev->id + }; if (stuff->delete && (reply.bytesAfter == 0)) send_property_event(dev, stuff->property, XIPropertyDeleted); @@ -1100,11 +1104,13 @@ ProcXIListProperties(ClientPtr client) if (rc != Success) return rc; - rep.repType = X_Reply; - rep.RepType = X_XIListProperties; - rep.length = natoms; - rep.sequenceNumber = client->sequence; - rep.num_properties = natoms; + rep = (xXIListPropertiesReply) { + .repType = X_Reply, + .RepType = X_XIListProperties, + .sequenceNumber = client->sequence, + .length = natoms, + .num_properties = natoms + }; WriteReplyToClient(client, sizeof(xXIListPropertiesReply), &rep); if (natoms) { @@ -1194,14 +1200,16 @@ ProcXIGetProperty(ClientPtr client) if (rc != Success) return rc; - reply.repType = X_Reply; - reply.RepType = X_XIGetProperty; - reply.sequenceNumber = client->sequence; - reply.num_items = nitems; - reply.format = format; - reply.bytes_after = bytes_after; - reply.type = type; - reply.length = bytes_to_int32(length); + reply = (xXIGetPropertyReply) { + .repType = X_Reply, + .RepType = X_XIGetProperty, + .sequenceNumber = client->sequence, + .length = bytes_to_int32(length), + .type = type, + .bytes_after = bytes_after, + .num_items = nitems, + .format = format + }; if (length && stuff->delete && (reply.bytes_after == 0)) send_property_event(dev, stuff->property, XIPropertyDeleted); diff --git a/Xi/xiquerydevice.c b/Xi/xiquerydevice.c index af7ea5394..85c1dd81d 100644 --- a/Xi/xiquerydevice.c +++ b/Xi/xiquerydevice.c @@ -107,12 +107,13 @@ ProcXIQueryDevice(ClientPtr client) return BadAlloc; } - memset(&rep, 0, sizeof(xXIQueryDeviceReply)); - rep.repType = X_Reply; - rep.RepType = X_XIQueryDevice; - rep.sequenceNumber = client->sequence; - rep.length = len / 4; - rep.num_devices = 0; + rep = (xXIQueryDeviceReply) { + .repType = X_Reply, + .RepType = X_XIQueryDevice, + .sequenceNumber = client->sequence, + .length = len / 4, + .num_devices = 0 + }; ptr = info; if (dev) { diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c index e09a1f694..7e6852dd0 100644 --- a/Xi/xiquerypointer.c +++ b/Xi/xiquerypointer.c @@ -121,15 +121,16 @@ ProcXIQueryPointer(ClientPtr client) pSprite = pDev->spriteInfo->sprite; - memset(&rep, 0, sizeof(rep)); - rep.repType = X_Reply; - rep.RepType = X_XIQueryPointer; - rep.length = 6; - rep.sequenceNumber = client->sequence; - rep.root = (GetCurrentRootWindow(pDev))->drawable.id; - rep.root_x = FP1616(pSprite->hot.x, 0); - rep.root_y = FP1616(pSprite->hot.y, 0); - rep.child = None; + rep = (xXIQueryPointerReply) { + .repType = X_Reply, + .RepType = X_XIQueryPointer, + .sequenceNumber = client->sequence, + .length = 6, + .root = (GetCurrentRootWindow(pDev))->drawable.id, + .root_x = FP1616(pSprite->hot.x, 0), + .root_y = FP1616(pSprite->hot.y, 0), + .child = None + }; if (kbd) { state = &kbd->key->xkbInfo->state; diff --git a/Xi/xiqueryversion.c b/Xi/xiqueryversion.c index 0d4962f10..b807a53ce 100644 --- a/Xi/xiqueryversion.c +++ b/Xi/xiqueryversion.c @@ -93,13 +93,14 @@ ProcXIQueryVersion(ClientPtr client) pXIClient->minor_version = minor; } - memset(&rep, 0, sizeof(xXIQueryVersionReply)); - rep.repType = X_Reply; - rep.RepType = X_XIQueryVersion; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.major_version = major; - rep.minor_version = minor; + rep = (xXIQueryVersionReply) { + .repType = X_Reply, + .RepType = X_XIQueryVersion, + .sequenceNumber = client->sequence, + .length = 0, + .major_version = major, + .minor_version = minor + }; WriteReplyToClient(client, sizeof(xXIQueryVersionReply), &rep); diff --git a/Xi/xiselectev.c b/Xi/xiselectev.c index 6dd2c1cac..0e45cb8cb 100644 --- a/Xi/xiselectev.c +++ b/Xi/xiselectev.c @@ -260,11 +260,13 @@ ProcXIGetSelectedEvents(ClientPtr client) if (rc != Success) return rc; - reply.repType = X_Reply; - reply.RepType = X_XIGetSelectedEvents; - reply.length = 0; - reply.sequenceNumber = client->sequence; - reply.num_masks = 0; + reply = (xXIGetSelectedEventsReply) { + .repType = X_Reply, + .RepType = X_XIGetSelectedEvents, + .sequenceNumber = client->sequence, + .length = 0, + .num_masks = 0 + }; masks = wOtherInputMasks(win); if (masks) { diff --git a/Xi/xisetdevfocus.c b/Xi/xisetdevfocus.c index 55e5c3560..372ec248a 100644 --- a/Xi/xisetdevfocus.c +++ b/Xi/xisetdevfocus.c @@ -97,10 +97,12 @@ ProcXIGetFocus(ClientPtr client) if (!dev->focus) return BadDevice; - rep.repType = X_Reply; - rep.RepType = X_XIGetFocus; - rep.length = 0; - rep.sequenceNumber = client->sequence; + rep = (xXIGetFocusReply) { + .repType = X_Reply, + .RepType = X_XIGetFocus, + .sequenceNumber = client->sequence, + .length = 0 + }; if (dev->focus->win == NoneWin) rep.focus = None; |