aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/xkb/xkb.c
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-06-29 01:36:31 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-07-04 16:36:59 +0200
commit286d83260216e8e53db701eed5c785aae1c716bf (patch)
tree3b27e6dd17a7d4d00266819545ae97defa11cf81 /nx-X11/programs/Xserver/xkb/xkb.c
parentd1d859dfdec4b4665e06401383ab71926e4e731c (diff)
downloadnx-libs-286d83260216e8e53db701eed5c785aae1c716bf.tar.gz
nx-libs-286d83260216e8e53db701eed5c785aae1c716bf.tar.bz2
nx-libs-286d83260216e8e53db701eed5c785aae1c716bf.zip
Use internal temp variable for swap macros. Make swaps/swapl type safe (introducing wrong_size check at build time).
While working on this changeset, various spots got discovered where swapl or swaps was used on a wrong type, where byte swapping calls had been forgotten or done on the wrong variable. This backport at least includes changes from the following X.org commits, listed in non-chronological order: commit 2c7c520cfe0df30f4bc3adba59d9c62582823bf8 Author: Matt Turner <mattst88@gmail.com> Date: Thu Aug 4 15:35:41 2011 -0400 Use internal temp variable for swap macros Also, fix whitespace, mainly around swaps(&rep.sequenceNumber) Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Matt Turner <mattst88@gmail.com> commit 9edcae78c46286baff42e74bfe26f6ae4d00fe01 Author: Matt Turner <mattst88@gmail.com> Date: Wed Sep 21 17:14:16 2011 -0400 Use correct swap{l,s} (or none at all for CARD8) Swapping the wrong size was never caught because swap{l,s} are macros. It's clear in the case of Xext/xres.c, that the author believed client_major/minor to be CARD16 from looking at the code in the first hunk. v2: dmx.c fixes from Keith. Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Matt Turner <mattst88@gmail.com> commit dab064fa5e0b1f5c67222562ad5367005832cba1 Author: Andrea Canciani <ranma42@gmail.com> Date: Tue Nov 2 20:10:32 2010 +0100 render: Fix byteswapping of gradient stops The function swapStops repeatedly swaps the color components as CARD16, but incorrectly steps over them as if they were CARD32. This causes half of the stops not to be swapped at all and some unrelated data be swapped instead. Signed-off-by: Andrea Canciani <ranma42@gmail.com> Reviewed-by: Soren Sandmann <sandmann@daimi.au.dk> Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Keith Packard <keithp@keithp.com> commit 54770c980cd2b91a8377f975a58ed69def5cfa42 Author: Matt Turner <mattst88@gmail.com> Date: Tue Aug 16 16:59:07 2011 -0400 Cast char* buffers to swap functions Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Matt Turner <mattst88@gmail.com> commit 6844bd2e63490870bab3c469eec6030354ef2865 Author: Alan Coopersmith <alan.coopersmith@sun.com> Date: Wed Jan 9 19:52:00 2008 -0800 More Xv extension byte swapping fixes commit e46f6ddeccd082b2d507a1e8b57ea30e6b0a2c83 Author: Michel Dänzer <michel@tungstengraphics.com> Date: Wed Jan 16 14:24:22 2008 +0100 Yet another Xv extension byte swapping fix.
Diffstat (limited to 'nx-X11/programs/Xserver/xkb/xkb.c')
-rw-r--r--nx-X11/programs/Xserver/xkb/xkb.c423
1 files changed, 182 insertions, 241 deletions
diff --git a/nx-X11/programs/Xserver/xkb/xkb.c b/nx-X11/programs/Xserver/xkb/xkb.c
index 7085fbfe4..6c6e67f1e 100644
--- a/nx-X11/programs/Xserver/xkb/xkb.c
+++ b/nx-X11/programs/Xserver/xkb/xkb.c
@@ -165,7 +165,6 @@ ProcXkbUseExtension(ClientPtr client)
{
REQUEST(xkbUseExtensionReq);
xkbUseExtensionReply rep;
- register int n;
int supported;
REQUEST_SIZE_MATCH(xkbUseExtensionReq);
@@ -201,9 +200,9 @@ ProcXkbUseExtension(ClientPtr client)
rep.serverMajor = SERVER_XKB_MAJOR_VERSION;
rep.serverMinor = SERVER_XKB_MINOR_VERSION;
if ( client->swapped ) {
- swaps(&rep.sequenceNumber, n);
- swaps(&rep.serverMajor, n);
- swaps(&rep.serverMinor, n);
+ swaps(&rep.sequenceNumber);
+ swaps(&rep.serverMajor);
+ swaps(&rep.serverMinor);
}
WriteToClient(client,SIZEOF(xkbUseExtensionReply), (char *)&rep);
return client->noClientException;
@@ -535,9 +534,8 @@ ProcXkbGetState(ClientPtr client)
rep.compatState = xkb->compat_state;
rep.ptrBtnState = xkb->ptr_buttons;
if (client->swapped) {
- register int n;
- swaps(&rep.sequenceNumber,n);
- swaps(&rep.ptrBtnState,n);
+ swaps(&rep.sequenceNumber);
+ swaps(&rep.ptrBtnState);
}
WriteToClient(client, SIZEOF(xkbGetStateReply), (char *)&rep);
return client->noClientException;
@@ -610,7 +608,6 @@ ProcXkbGetControls(ClientPtr client)
xkbGetControlsReply rep;
XkbControlsPtr xkb;
DeviceIntPtr dev;
- register int n;
REQUEST(xkbGetControlsReq);
REQUEST_SIZE_MATCH(xkbGetControlsReq);
@@ -653,26 +650,26 @@ ProcXkbGetControls(ClientPtr client)
rep.axOptions = xkb->ax_options;
memcpy(rep.perKeyRepeat,xkb->per_key_repeat,XkbPerKeyBitArraySize);
if (client->swapped) {
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.length,n);
- swaps(&rep.internalVMods, n);
- swaps(&rep.ignoreLockVMods, n);
- swapl(&rep.enabledCtrls, n);
- swaps(&rep.repeatDelay, n);
- swaps(&rep.repeatInterval, n);
- swaps(&rep.slowKeysDelay, n);
- swaps(&rep.debounceDelay, n);
- swaps(&rep.mkDelay, n);
- swaps(&rep.mkInterval, n);
- swaps(&rep.mkTimeToMax, n);
- swaps(&rep.mkMaxSpeed, n);
- swaps(&rep.mkCurve, n);
- swaps(&rep.axTimeout, n);
- swapl(&rep.axtCtrlsMask, n);
- swapl(&rep.axtCtrlsValues, n);
- swaps(&rep.axtOptsMask, n);
- swaps(&rep.axtOptsValues, n);
- swaps(&rep.axOptions, n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.internalVMods);
+ swaps(&rep.ignoreLockVMods);
+ swapl(&rep.enabledCtrls);
+ swaps(&rep.repeatDelay);
+ swaps(&rep.repeatInterval);
+ swaps(&rep.slowKeysDelay);
+ swaps(&rep.debounceDelay);
+ swaps(&rep.mkDelay);
+ swaps(&rep.mkInterval);
+ swaps(&rep.mkTimeToMax);
+ swaps(&rep.mkMaxSpeed);
+ swaps(&rep.mkCurve);
+ swaps(&rep.axTimeout);
+ swapl(&rep.axtCtrlsMask);
+ swapl(&rep.axtCtrlsValues);
+ swaps(&rep.axtOptsMask);
+ swaps(&rep.axtOptsValues);
+ swaps(&rep.axOptions);
}
WriteToClient(client, SIZEOF(xkbGetControlsReply), (char *)&rep);
return(client->noClientException);
@@ -940,8 +937,7 @@ XkbWriteKeyTypes( XkbDescPtr xkb,
wire->nMapEntries = type->map_count;
wire->preserve = (type->preserve!=NULL);
if (client->swapped) {
- register int n;
- swaps(&wire->virtualMods,n);
+ swaps(&wire->virtualMods);
}
buf= (char *)&wire[1];
@@ -957,8 +953,7 @@ XkbWriteKeyTypes( XkbDescPtr xkb,
wire->realMods= entry->mods.real_mods;
wire->virtualMods= entry->mods.vmods;
if (client->swapped) {
- register int n;
- swaps(&wire->virtualMods,n);
+ swaps(&wire->virtualMods);
}
}
buf= (char *)wire;
@@ -972,8 +967,7 @@ XkbWriteKeyTypes( XkbDescPtr xkb,
pwire->realMods= preserve->real_mods;
pwire->virtualMods= preserve->vmods;
if (client->swapped) {
- register int n;
- swaps(&pwire->virtualMods,n);
+ swaps(&pwire->virtualMods);
}
}
buf= (char *)pwire;
@@ -1053,10 +1047,10 @@ register unsigned i;
pSym = &xkb->map->syms[symMap->offset];
memcpy((char *)buf,(char *)pSym,outMap->nSyms*4);
if (client->swapped) {
- register int n,nSyms= outMap->nSyms;
- swaps(&outMap->nSyms,n);
+ register int nSyms= outMap->nSyms;
+ swaps(&outMap->nSyms);
while (nSyms-->0) {
- swapl(buf,n);
+ swapl((int *)buf);
buf+= 4;
}
}
@@ -1345,12 +1339,11 @@ char *desc,*start;
len, (unsigned long)(desc-start));
}
if (client->swapped) {
- register int n;
- swaps(&rep->sequenceNumber,n);
- swapl(&rep->length,n);
- swaps(&rep->present,n);
- swaps(&rep->totalSyms,n);
- swaps(&rep->totalActs,n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->present);
+ swaps(&rep->totalSyms);
+ swaps(&rep->totalActs);
}
WriteToClient(client, (i=SIZEOF(xkbGetMapReply)), (char *)rep);
WriteToClient(client, len, start);
@@ -1532,8 +1525,7 @@ register xkbKeyTypeWireDesc *wire = *wireRtrn;
for (i=0;i<req->nTypes;i++) {
unsigned width;
if (client->swapped) {
- register int s;
- swaps(&wire->virtualMods,s);
+ swaps(&wire->virtualMods);
}
n= i+req->firstType;
width= wire->numLevels;
@@ -1559,8 +1551,7 @@ register xkbKeyTypeWireDesc *wire = *wireRtrn;
preWire= (xkbModsWireDesc *)&mapWire[wire->nMapEntries];
for (n=0;n<wire->nMapEntries;n++) {
if (client->swapped) {
- register int s;
- swaps(&mapWire[n].virtualMods,s);
+ swaps(&mapWire[n].virtualMods);
}
if (mapWire[n].realMods&(~wire->realMods)) {
*nMapsRtrn= _XkbErrCode4(0x06,n,mapWire[n].realMods,
@@ -1578,8 +1569,7 @@ register xkbKeyTypeWireDesc *wire = *wireRtrn;
}
if (wire->preserve) {
if (client->swapped) {
- register int s;
- swaps(&preWire[n].virtualMods,s);
+ swaps(&preWire[n].virtualMods);
}
if (preWire[n].realMods&(~mapWire[n].realMods)) {
*nMapsRtrn= _XkbErrCode4(0x09,n,preWire[n].realMods,
@@ -1643,7 +1633,7 @@ xkbSymMapWireDesc* wire = *wireRtrn;
KeySym *pSyms;
register unsigned nG;
if (client->swapped) {
- swaps(&wire->nSyms,nG);
+ swaps(&wire->nSyms);
}
nG = XkbNumGroups(wire->groupInfo);
if (nG>XkbNumKbdGroups) {
@@ -2023,9 +2013,8 @@ unsigned first,last;
newSyms[s]= pSyms[s];
}
if (client->swapped) {
- int n;
for (s=0;s<wire->nSyms;s++) {
- swapl(&newSyms[s],n);
+ swapl(&newSyms[s]);
}
}
}
@@ -2516,8 +2505,7 @@ int size;
wire->flags= sym->flags;
memcpy((char*)&wire->act,(char*)&sym->act,sz_xkbActionWireDesc);
if (client->swapped) {
- register int n;
- swapl(&wire->sym,n);
+ swapl(&wire->sym);
}
}
if (rep->groups) {
@@ -2528,8 +2516,7 @@ int size;
grp->realMods= compat->groups[i].real_mods;
grp->virtualMods= compat->groups[i].vmods;
if (client->swapped) {
- register int n;
- swaps(&grp->virtualMods,n);
+ swaps(&grp->virtualMods);
}
grp++;
}
@@ -2542,12 +2529,11 @@ int size;
else data= NULL;
if (client->swapped) {
- register int n;
- swaps(&rep->sequenceNumber,n);
- swapl(&rep->length,n);
- swaps(&rep->firstSI,n);
- swaps(&rep->nSI,n);
- swaps(&rep->nTotalSI,n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swaps(&rep->firstSI);
+ swaps(&rep->nSI);
+ swaps(&rep->nTotalSI);
}
WriteToClient(client, SIZEOF(xkbGetCompatMapReply), (char *)rep);
@@ -2662,8 +2648,7 @@ ProcXkbSetCompatMap(ClientPtr client)
sym = &compat->sym_interpret[stuff->firstSI];
for (i=0;i<stuff->nSI;i++,wire++,sym++) {
if (client->swapped) {
- register int n;
- swapl(&wire->sym,n);
+ swapl(&wire->sym);
}
sym->sym= wire->sym;
sym->mods= wire->mods;
@@ -2685,8 +2670,7 @@ ProcXkbSetCompatMap(ClientPtr client)
for (i=0,bit=1;i<XkbNumKbdGroups;i++,bit<<=1) {
if (stuff->groups&bit) {
if (client->swapped) {
- register int n;
- swaps(&wire->virtualMods,n);
+ swaps(&wire->virtualMods);
}
compat->groups[i].mask= wire->realMods;
compat->groups[i].real_mods= wire->realMods;
@@ -2742,7 +2726,6 @@ ProcXkbGetIndicatorState(ClientPtr client)
xkbGetIndicatorStateReply rep;
XkbSrvLedInfoPtr sli;
DeviceIntPtr dev;
- register int i;
REQUEST(xkbGetIndicatorStateReq);
REQUEST_SIZE_MATCH(xkbGetIndicatorStateReq);
@@ -2764,8 +2747,8 @@ ProcXkbGetIndicatorState(ClientPtr client)
rep.state = sli->effectiveState;
if (client->swapped) {
- swaps(&rep.sequenceNumber,i);
- swapl(&rep.state,i);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.state);
}
WriteToClient(client, SIZEOF(xkbGetIndicatorStateReply), (char *)&rep);
return client->noClientException;
@@ -2817,9 +2800,8 @@ register unsigned bit;
wire->virtualMods= indicators->maps[i].mods.vmods;
wire->ctrls= indicators->maps[i].ctrls;
if (client->swapped) {
- register int n;
- swaps(&wire->virtualMods,n);
- swapl(&wire->ctrls,n);
+ swaps(&wire->virtualMods);
+ swapl(&wire->ctrls);
}
wire++;
}
@@ -2834,10 +2816,10 @@ register unsigned bit;
}
else map = NULL;
if (client->swapped) {
- swaps(&rep->sequenceNumber,i);
- swapl(&rep->length,i);
- swapl(&rep->which,i);
- swapl(&rep->realIndicators,i);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->which);
+ swapl(&rep->realIndicators);
}
WriteToClient(client, SIZEOF(xkbGetIndicatorMapReply), (char *)rep);
if (map) {
@@ -2920,9 +2902,8 @@ ProcXkbSetIndicatorMap(ClientPtr client)
for (i=0,bit=1;i<XkbNumIndicators;i++,bit<<=1) {
if (stuff->which&bit) {
if (client->swapped) {
- register int n;
- swaps(&from->virtualMods,n);
- swapl(&from->ctrls,n);
+ swaps(&from->virtualMods);
+ swapl(&from->ctrls);
}
CHK_MASK_LEGAL(i,from->whichGroups,XkbIM_UseAnyGroup);
CHK_MASK_LEGAL(i,from->whichMods,XkbIM_UseAnyMods);
@@ -3037,12 +3018,11 @@ ProcXkbGetNamedIndicator(ClientPtr client)
rep.supported= supported;
}
if ( client->swapped ) {
- register int n;
- swapl(&rep.length,n);
- swaps(&rep.sequenceNumber,n);
- swapl(&rep.indicator,n);
- swaps(&rep.virtualMods,n);
- swapl(&rep.ctrls,n);
+ swapl(&rep.length);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.indicator);
+ swaps(&rep.virtualMods);
+ swapl(&rep.ctrls);
}
WriteToClient(client,SIZEOF(xkbGetNamedIndicatorReply), (char *)&rep);
@@ -3203,8 +3183,7 @@ Atom *atm;
if (atoms[i]!=None) {
*atm= atoms[i];
if (swap) {
- register int n;
- swapl(atm,n);
+ swapl(atm);
}
atm++;
}
@@ -3327,12 +3306,11 @@ char * desc;
length= rep->length*4;
which= rep->which;
if (client->swapped) {
- register int n;
- swaps(&rep->sequenceNumber,n);
- swapl(&rep->length,n);
- swapl(&rep->which,n);
- swaps(&rep->virtualMods,n);
- swapl(&rep->indicators,n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->which);
+ swaps(&rep->virtualMods);
+ swapl(&rep->indicators);
}
start = desc = (char *)ALLOCATE_LOCAL(length);
@@ -3341,24 +3319,21 @@ char * desc;
if (which&XkbKeycodesNameMask) {
*((CARD32 *)desc)= xkb->names->keycodes;
if (client->swapped) {
- register int n;
- swapl(desc,n);
+ swapl((int *)desc);
}
desc+= 4;
}
if (which&XkbGeometryNameMask) {
*((CARD32 *)desc)= xkb->names->geometry;
if (client->swapped) {
- register int n;
- swapl(desc,n);
+ swapl((int *)desc);
}
desc+= 4;
}
if (which&XkbSymbolsNameMask) {
*((CARD32 *)desc)= xkb->names->symbols;
if (client->swapped) {
- register int n;
- swapl(desc,n);
+ swapl((int *)desc);
}
desc+= 4;
}
@@ -3366,24 +3341,21 @@ char * desc;
register CARD32 *atm= (CARD32 *)desc;
atm[0]= (CARD32)xkb->names->phys_symbols;
if (client->swapped) {
- register int n;
- swapl(&atm[0],n);
+ swapl(&atm[0]);
}
desc+= 4;
}
if (which&XkbTypesNameMask) {
*((CARD32 *)desc)= (CARD32)xkb->names->types;
if (client->swapped) {
- register int n;
- swapl(desc,n);
+ swapl((int *)desc);
}
desc+= 4;
}
if (which&XkbCompatNameMask) {
*((CARD32 *)desc)= (CARD32)xkb->names->compat;
if (client->swapped) {
- register int n;
- swapl(desc,n);
+ swapl((int *)desc);
}
desc+= 4;
}
@@ -3394,8 +3366,7 @@ char * desc;
for (i=0;i<xkb->map->num_types;i++,atm++,type++) {
*atm= (CARD32)type->name;
if (client->swapped) {
- register int n;
- swapl(atm,n);
+ swapl(atm);
}
}
desc= (char *)atm;
@@ -3416,8 +3387,7 @@ char * desc;
for (l=0;l<type->num_levels;l++,atm++) {
*atm= type->level_names[l];
if (client->swapped) {
- register unsigned n;
- swapl(atm,n);
+ swapl(atm);
}
}
desc+= type->num_levels*4;
@@ -3453,8 +3423,7 @@ char * desc;
for (i=0;i<rep->nRadioGroups;i++,atm++) {
*atm= (CARD32)xkb->names->radio_groups[i];
if (client->swapped) {
- register unsigned n;
- swapl(atm,n);
+ swapl(atm);
}
}
desc+= rep->nRadioGroups*4;
@@ -3515,8 +3484,7 @@ register int i;
for (i=0;i<nAtoms;i++,wire++) {
if (swapped) {
- register int n;
- swapl(wire,n);
+ swapl(wire);
}
if ((((Atom)*wire)!=None)&&(!ValidAtom((Atom)*wire))) {
*pError= ((Atom)*wire);
@@ -3536,8 +3504,7 @@ register unsigned i,bit;
if ((present&bit)==0)
continue;
if (swapped) {
- register int n;
- swapl(wire,n);
+ swapl(wire);
}
if ((((Atom)*wire)!=None)&&(!ValidAtom(((Atom)*wire)))) {
*pError= (Atom)*wire;
@@ -3930,8 +3897,7 @@ CARD16 len,*pLen;
pLen= (CARD16 *)wire;
*pLen= len;
if (swap) {
- register int n;
- swaps(pLen,n);
+ swaps(pLen);
}
memcpy(&wire[2],str,len);
wire+= ((2+len+3)/4)*4;
@@ -4046,8 +4012,7 @@ xkbShapeWireDesc * shapeWire;
shapeWire->approxNdx= XkbOutlineIndex(shape,shape->approx);
else shapeWire->approxNdx= XkbNoShape;
if (swap) {
- register int n;
- swapl(&shapeWire->name,n);
+ swapl(&shapeWire->name);
}
wire= (char *)&shapeWire[1];
for (o=0,ol=shape->outlines;o<shape->num_outlines;o++,ol++) {
@@ -4063,9 +4028,8 @@ xkbShapeWireDesc * shapeWire;
ptWire[p].x= pt->x;
ptWire[p].y= pt->y;
if (swap) {
- register int n;
- swaps(&ptWire[p].x,n);
- swaps(&ptWire[p].y,n);
+ swaps(&ptWire[p].x);
+ swaps(&ptWire[p].y);
}
}
wire= (char *)&ptWire[ol->num_points];
@@ -4108,10 +4072,9 @@ xkbDoodadWireDesc * doodadWire;
doodadWire->any.top= doodad->any.top;
doodadWire->any.left= doodad->any.left;
if (swap) {
- register int n;
- swapl(&doodadWire->any.name,n);
- swaps(&doodadWire->any.top,n);
- swaps(&doodadWire->any.left,n);
+ swapl(&doodadWire->any.name);
+ swaps(&doodadWire->any.top);
+ swaps(&doodadWire->any.left);
}
switch (doodad->any.type) {
case XkbOutlineDoodad:
@@ -4120,8 +4083,7 @@ xkbDoodadWireDesc * doodadWire;
doodadWire->shape.colorNdx= doodad->shape.color_ndx;
doodadWire->shape.shapeNdx= doodad->shape.shape_ndx;
if (swap) {
- register int n;
- swaps(&doodadWire->shape.angle,n);
+ swaps(&doodadWire->shape.angle);
}
break;
case XkbTextDoodad:
@@ -4130,10 +4092,9 @@ xkbDoodadWireDesc * doodadWire;
doodadWire->text.height= doodad->text.height;
doodadWire->text.colorNdx= doodad->text.color_ndx;
if (swap) {
- register int n;
- swaps(&doodadWire->text.angle,n);
- swaps(&doodadWire->text.width,n);
- swaps(&doodadWire->text.height,n);
+ swaps(&doodadWire->text.angle);
+ swaps(&doodadWire->text.width);
+ swaps(&doodadWire->text.height);
}
wire= XkbWriteCountedString(wire,doodad->text.text,swap);
wire= XkbWriteCountedString(wire,doodad->text.font,swap);
@@ -4171,8 +4132,7 @@ xkbOverlayWireDesc * olWire;
olWire->name= ol->name;
olWire->nRows= ol->num_rows;
if (swap) {
- register int n;
- swapl(&olWire->name,n);
+ swapl(&olWire->name);
}
wire= (char *)&olWire[1];
for (r=0,row=ol->rows;r<ol->num_rows;r++,row++) {
@@ -4250,13 +4210,12 @@ xkbSectionWireDesc * sectionWire;
sectionWire->nOverlays= section->num_overlays;
sectionWire->pad= 0;
if (swap) {
- register int n;
- swapl(&sectionWire->name,n);
- swaps(&sectionWire->top,n);
- swaps(&sectionWire->left,n);
- swaps(&sectionWire->width,n);
- swaps(&sectionWire->height,n);
- swaps(&sectionWire->angle,n);
+ swapl(&sectionWire->name);
+ swaps(&sectionWire->top);
+ swaps(&sectionWire->left);
+ swaps(&sectionWire->width);
+ swaps(&sectionWire->height);
+ swaps(&sectionWire->angle);
}
wire= (char *)&sectionWire[1];
if (section->rows) {
@@ -4271,9 +4230,8 @@ xkbSectionWireDesc * sectionWire;
rowWire->vertical= row->vertical;
rowWire->pad= 0;
if (swap) {
- register int n;
- swaps(&rowWire->top,n);
- swaps(&rowWire->left,n);
+ swaps(&rowWire->top);
+ swaps(&rowWire->left);
}
wire= (char *)&rowWire[1];
if (row->keys) {
@@ -4287,8 +4245,7 @@ xkbSectionWireDesc * sectionWire;
keyWire[k].shapeNdx= key->shape_ndx;
keyWire[k].colorNdx= key->color_ndx;
if (swap) {
- register int n;
- swaps(&keyWire[k].gap,n);
+ swaps(&keyWire[k].gap);
}
}
wire= (char *)&keyWire[row->num_keys];
@@ -4390,18 +4347,17 @@ XkbSendGeometry( ClientPtr client,
start= NULL;
}
if (client->swapped) {
- register int n;
- swaps(&rep->sequenceNumber,n);
- swapl(&rep->length,n);
- swapl(&rep->name,n);
- swaps(&rep->widthMM,n);
- swaps(&rep->heightMM,n);
- swaps(&rep->nProperties,n);
- swaps(&rep->nColors,n);
- swaps(&rep->nShapes,n);
- swaps(&rep->nSections,n);
- swaps(&rep->nDoodads,n);
- swaps(&rep->nKeyAliases,n);
+ swaps(&rep->sequenceNumber);
+ swapl(&rep->length);
+ swapl(&rep->name);
+ swaps(&rep->widthMM);
+ swaps(&rep->heightMM);
+ swaps(&rep->nProperties);
+ swaps(&rep->nColors);
+ swaps(&rep->nShapes);
+ swaps(&rep->nSections);
+ swaps(&rep->nDoodads);
+ swaps(&rep->nKeyAliases);
}
WriteToClient(client, SIZEOF(xkbGetGeometryReply), (char *)rep);
if (len>0)
@@ -4453,8 +4409,7 @@ CARD16 len;
wire= *wire_inout;
len= (CARD16 *)wire;
if (client->swapped) {
- register int n;
- swaps(&len, n);
+ swaps(&len);
}
next = wire + XkbPaddedSize(len + 2);
/* Check we're still within the size of the request */
@@ -4487,11 +4442,10 @@ Status status;
any = dWire->any;
wire= (char *)&dWire[1];
if (client->swapped) {
- register int n;
- swapl(&any.name, n);
- swaps(&any.top, n);
- swaps(&any.left, n);
- swaps(&any.angle, n);
+ swapl(&any.name);
+ swaps(&any.top);
+ swaps(&any.left);
+ swaps(&any.angle);
}
CHK_ATOM_ONLY(dWire->any.name);
doodad = XkbAddGeomDoodad(geom, section, any.name);
@@ -4526,9 +4480,8 @@ Status status;
}
text = dWire->text;
if (client->swapped) {
- register int n;
- swaps(&text.width, n);
- swaps(&text.height, n);
+ swaps(&text.width);
+ swaps(&text.height);
}
doodad->text.width= text.width;
doodad->text.height= text.height;
@@ -4602,8 +4555,7 @@ xkbOverlayRowWireDesc * rWire;
wire= *wire_inout;
olWire= (xkbOverlayWireDesc *)wire;
if (client->swapped) {
- register int n;
- swapl(&olWire->name,n);
+ swapl(&olWire->name);
}
CHK_ATOM_ONLY(olWire->name);
ol= XkbAddGeomOverlay(section,olWire->name,olWire->nRows);
@@ -4655,13 +4607,12 @@ XkbSectionPtr section;
register int r;
xkbRowWireDesc * rWire;
if (client->swapped) {
- register int n;
- swapl(&sWire->name,n);
- swaps(&sWire->top,n);
- swaps(&sWire->left,n);
- swaps(&sWire->width,n);
- swaps(&sWire->height,n);
- swaps(&sWire->angle,n);
+ swapl(&sWire->name);
+ swaps(&sWire->top);
+ swaps(&sWire->left);
+ swaps(&sWire->width);
+ swaps(&sWire->height);
+ swaps(&sWire->angle);
}
CHK_ATOM_ONLY(sWire->name);
section= XkbAddGeomSection(geom,sWire->name,sWire->nRows,
@@ -4680,9 +4631,8 @@ XkbSectionPtr section;
XkbRowPtr row;
xkbKeyWireDesc * kWire;
if (client->swapped) {
- register int n;
- swaps(&rWire->top,n);
- swaps(&rWire->left,n);
+ swaps(&rWire->top);
+ swaps(&rWire->left);
}
row= XkbAddGeomRow(section,rWire->nKeys);
if (!row)
@@ -4777,9 +4727,8 @@ char * wire;
pt->x= ptWire[p].x;
pt->y= ptWire[p].y;
if (client->swapped) {
- register int n;
- swaps(&pt->x,n);
- swaps(&pt->y,n);
+ swaps(&pt->x);
+ swaps(&pt->y);
}
}
ol->num_points= olWire->nPoints;
@@ -5022,12 +4971,11 @@ ProcXkbPerClientFlags(ClientPtr client)
rep.autoCtrls= rep.autoCtrlValues= 0;
}
if ( client->swapped ) {
- register int n;
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.supported,n);
- swapl(&rep.value,n);
- swapl(&rep.autoCtrls,n);
- swapl(&rep.autoCtrlValues,n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.supported);
+ swapl(&rep.value);
+ swapl(&rep.autoCtrls);
+ swapl(&rep.autoCtrlValues);
}
WriteToClient(client,SIZEOF(xkbPerClientFlagsReply), (char *)&rep);
return client->noClientException;
@@ -5148,16 +5096,15 @@ ProcXkbListComponents(ClientPtr client)
if (list.nTotal>list.maxRtrn)
rep.extra = (list.nTotal-list.maxRtrn);
if (client->swapped) {
- register int n;
- swaps(&rep.sequenceNumber,n);
- swapl(&rep.length,n);
- swaps(&rep.nKeymaps,n);
- swaps(&rep.nKeycodes,n);
- swaps(&rep.nTypes,n);
- swaps(&rep.nCompatMaps,n);
- swaps(&rep.nSymbols,n);
- swaps(&rep.nGeometries,n);
- swaps(&rep.extra,n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.nKeymaps);
+ swaps(&rep.nKeycodes);
+ swaps(&rep.nTypes);
+ swaps(&rep.nCompatMaps);
+ swaps(&rep.nSymbols);
+ swaps(&rep.nGeometries);
+ swaps(&rep.extra);
}
WriteToClient(client,SIZEOF(xkbListComponentsReply),(char *)&rep);
if (list.nPool && list.pool) {
@@ -5416,11 +5363,10 @@ ProcXkbGetKbdByName(ClientPtr client)
reported= rep.reported;
if ( client->swapped ) {
- register int n;
- swaps(&rep.sequenceNumber,n);
- swapl(&rep.length,n);
- swaps(&rep.found,n);
- swaps(&rep.reported,n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.found);
+ swaps(&rep.reported);
}
WriteToClient(client,SIZEOF(xkbGetKbdByNameReply), (char *)&rep);
if (reported&(XkbGBN_SymbolsMask|XkbGBN_TypesMask))
@@ -5606,13 +5552,12 @@ int length;
wire.physIndicators= sli->physIndicators;
wire.state= sli->effectiveState;
if (client->swapped) {
- register int n;
- swaps(&wire.ledClass,n);
- swaps(&wire.ledID,n);
- swapl(&wire.namesPresent,n);
- swapl(&wire.mapsPresent,n);
- swapl(&wire.physIndicators,n);
- swapl(&wire.state,n);
+ swaps(&wire.ledClass);
+ swaps(&wire.ledID);
+ swapl(&wire.namesPresent);
+ swapl(&wire.mapsPresent);
+ swapl(&wire.physIndicators);
+ swapl(&wire.state);
}
WriteToClient(client,SIZEOF(xkbDeviceLedsWireDesc),(char *)&wire);
length+= SIZEOF(xkbDeviceLedsWireDesc);
@@ -5624,8 +5569,7 @@ int length;
if (sli->namesPresent&bit) {
awire= (CARD32)sli->names[i];
if (client->swapped) {
- register int n;
- swapl(&awire,n);
+ swapl(&awire);
}
WriteToClient(client,4,(char *)&awire);
length+= 4;
@@ -5645,9 +5589,8 @@ int length;
iwire.virtualMods= sli->maps[i].mods.vmods;
iwire.ctrls= sli->maps[i].ctrls;
if (client->swapped) {
- register int n;
- swaps(&iwire.virtualMods,n);
- swapl(&iwire.ctrls,n);
+ swaps(&iwire.virtualMods);
+ swapl(&iwire.ctrls);
}
WriteToClient(client,SIZEOF(xkbIndicatorMapWireDesc),
(char *)&iwire);
@@ -5802,14 +5745,16 @@ char * str;
supported= rep.supported;
nDeviceLedFBs = rep.nDeviceLedFBs;
if (client->swapped) {
- register int n;
- swaps(&rep.sequenceNumber,n);
- swapl(&rep.length,n);
- swaps(&rep.present,n);
- swaps(&rep.supported,n);
- swaps(&rep.unsupported,n);
- swaps(&rep.nDeviceLedFBs,n);
- swapl(&rep.type,n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.length);
+ swaps(&rep.present);
+ swaps(&rep.supported);
+ swaps(&rep.unsupported);
+ swaps(&rep.nDeviceLedFBs);
+
+ // FIXME: rep.type here is an Atom... this might go terribly wrong...
+
+ swapl((int *)&rep.type);
}
WriteToClient(client,SIZEOF(xkbGetDeviceInfoReply), (char *)&rep);
@@ -5871,12 +5816,11 @@ XkbSrvLedInfoPtr sli;
ledWire= (xkbDeviceLedsWireDesc *)wire;
for (i=0;i<num;i++) {
if (client->swapped) {
- register int n;
- swaps(&ledWire->ledClass,n);
- swaps(&ledWire->ledID,n);
- swapl(&ledWire->namesPresent,n);
- swapl(&ledWire->mapsPresent,n);
- swapl(&ledWire->physIndicators,n);
+ swaps(&ledWire->ledClass);
+ swaps(&ledWire->ledID);
+ swapl(&ledWire->namesPresent);
+ swapl(&ledWire->mapsPresent);
+ swapl(&ledWire->physIndicators);
}
sli= XkbFindSrvLedInfo(dev,ledWire->ledClass,ledWire->ledID,
@@ -5899,8 +5843,7 @@ XkbSrvLedInfoPtr sli;
if (nNames>0) {
for (n=0;n<nNames;n++) {
if (client->swapped) {
- register int t;
- swapl(atomWire,t);
+ swapl(atomWire);
}
CHK_ATOM_OR_NONE3(((Atom)(*atomWire)),client->errorValue,
*status_rtrn,NULL);
@@ -5911,9 +5854,8 @@ XkbSrvLedInfoPtr sli;
if (nMaps>0) {
for (n=0;n<nMaps;n++) {
if (client->swapped) {
- register int t;
- swaps(&mapWire->virtualMods,t);
- swapl(&mapWire->ctrls,t);
+ swaps(&mapWire->virtualMods);
+ swapl(&mapWire->ctrls);
}
CHK_MASK_LEGAL3(0x21,mapWire->whichGroups,
XkbIM_UseAnyGroup,
@@ -6165,12 +6107,11 @@ xkbSetDebuggingFlagsReply rep;
rep.supportedFlags = ~0;
rep.supportedCtrls = ~0;
if ( client->swapped ) {
- register int n;
- swaps(&rep.sequenceNumber, n);
- swapl(&rep.currentFlags, n);
- swapl(&rep.currentCtrls, n);
- swapl(&rep.supportedFlags, n);
- swapl(&rep.supportedCtrls, n);
+ swaps(&rep.sequenceNumber);
+ swapl(&rep.currentFlags);
+ swapl(&rep.currentCtrls);
+ swapl(&rep.supportedFlags);
+ swapl(&rep.supportedCtrls);
}
WriteToClient(client,SIZEOF(xkbSetDebuggingFlagsReply), (char *)&rep);
return client->noClientException;