summaryrefslogtreecommitdiff
path: root/Xi/getdctl.c
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-03-21 12:55:09 -0700
committerKeith Packard <keithp@keithp.com>2012-03-21 13:54:42 -0700
commit9838b7032ea9792bec21af424c53c07078636d21 (patch)
treeb72d0827dac50f0f3b8eab29b3b7639546d735d7 /Xi/getdctl.c
parent75199129c603fc8567185ac31866c9518193cb78 (diff)
Introduce a consistent coding style
This is strictly the application of the script 'x-indent-all.sh' from util/modular. Compared to the patch that Daniel posted in January, I've added a few indent flags: -bap -psl -T PrivatePtr -T pmWait -T _XFUNCPROTOBEGIN -T _XFUNCPROTOEND -T _X_EXPORT The typedefs were needed to make the output of sdksyms.sh match the previous output, otherwise, the code is formatted badly enough that sdksyms.sh generates incorrect output. The generated code was compared with the previous version and found to be essentially identical -- "assert" line numbers and BUILD_TIME were the only differences found. The comparison was done with this script: dir1=$1 dir2=$2 for dir in $dir1 $dir2; do (cd $dir && find . -name '*.o' | while read file; do dir=`dirname $file` base=`basename $file .o` dump=$dir/$base.dump objdump -d $file > $dump done) done find $dir1 -name '*.dump' | while read dump; do otherdump=`echo $dump | sed "s;$dir1;$dir2;"` diff -u $dump $otherdump done Signed-off-by: Keith Packard <keithp@keithp.com> Acked-by: Daniel Stone <daniel@fooishbar.org> Acked-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'Xi/getdctl.c')
-rw-r--r--Xi/getdctl.c58
1 files changed, 30 insertions, 28 deletions
diff --git a/Xi/getdctl.c b/Xi/getdctl.c
index 6090b814a..4d66a4dfc 100644
--- a/Xi/getdctl.c
+++ b/Xi/getdctl.c
@@ -54,7 +54,7 @@ SOFTWARE.
#include <dix-config.h>
#endif
-#include "inputstr.h" /* DeviceIntPtr */
+#include "inputstr.h" /* DeviceIntPtr */
#include <X11/extensions/XI.h>
#include <X11/extensions/XIproto.h>
#include "exglobals.h"
@@ -86,7 +86,7 @@ SProcXGetDeviceControl(ClientPtr client)
static void
CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
- int length)
+ int length)
{
AxisInfoPtr a;
xDeviceResolutionState *r;
@@ -97,25 +97,26 @@ CopySwapDeviceResolution(ClientPtr client, ValuatorClassPtr v, char *buf,
r->length = length;
r->num_valuators = v->numAxes;
buf += sizeof(xDeviceResolutionState);
- iptr = (int *)buf;
+ iptr = (int *) buf;
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
- *iptr++ = a->resolution;
+ *iptr++ = a->resolution;
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
- *iptr++ = a->min_resolution;
+ *iptr++ = a->min_resolution;
for (i = 0, a = v->axes; i < v->numAxes; i++, a++)
- *iptr++ = a->max_resolution;
+ *iptr++ = a->max_resolution;
if (client->swapped) {
- swaps(&r->control);
- swaps(&r->length);
- swapl(&r->num_valuators);
- iptr = (int *)buf;
- for (i = 0; i < (3 * v->numAxes); i++, iptr++) {
- swapl(iptr);
- }
+ swaps(&r->control);
+ swaps(&r->length);
+ swapl(&r->num_valuators);
+ iptr = (int *) buf;
+ for (i = 0; i < (3 * v->numAxes); i++, iptr++) {
+ swapl(iptr);
+ }
}
}
-static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
+static void
+CopySwapDeviceCore(ClientPtr client, DeviceIntPtr dev, char *buf)
{
xDeviceCoreState *c = (xDeviceCoreState *) buf;
@@ -130,7 +131,8 @@ static void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf)
}
}
-static void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf)
+static void
+CopySwapDeviceEnable(ClientPtr client, DeviceIntPtr dev, char *buf)
{
xDeviceEnableState *e = (xDeviceEnableState *) buf;
@@ -156,7 +158,7 @@ SRepXGetDeviceControl(ClientPtr client, int size, xGetDeviceControlReply * rep)
{
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- WriteToClient(client, size, (char *)rep);
+ WriteToClient(client, size, (char *) rep);
}
/***********************************************************************
@@ -178,7 +180,7 @@ ProcXGetDeviceControl(ClientPtr client)
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixGetAttrAccess);
if (rc != Success)
- return rc;
+ return rc;
rep.repType = X_Reply;
rep.RepType = X_GetDeviceControl;
@@ -187,11 +189,11 @@ ProcXGetDeviceControl(ClientPtr client)
switch (stuff->control) {
case DEVICE_RESOLUTION:
- if (!dev->valuator)
- return BadMatch;
- total_length = sizeof(xDeviceResolutionState) +
- (3 * sizeof(int) * dev->valuator->numAxes);
- break;
+ if (!dev->valuator)
+ return BadMatch;
+ total_length = sizeof(xDeviceResolutionState) +
+ (3 * sizeof(int) * dev->valuator->numAxes);
+ break;
case DEVICE_ABS_CALIB:
case DEVICE_ABS_AREA:
return BadMatch;
@@ -202,18 +204,18 @@ ProcXGetDeviceControl(ClientPtr client)
total_length = sizeof(xDeviceEnableState);
break;
default:
- return BadValue;
+ return BadValue;
}
- buf = (char *)malloc(total_length);
+ buf = (char *) malloc(total_length);
if (!buf)
- return BadAlloc;
+ return BadAlloc;
savbuf = buf;
switch (stuff->control) {
case DEVICE_RESOLUTION:
- CopySwapDeviceResolution(client, dev->valuator, buf, total_length);
- break;
+ CopySwapDeviceResolution(client, dev->valuator, buf, total_length);
+ break;
case DEVICE_CORE:
CopySwapDeviceCore(client, dev, buf);
break;
@@ -221,7 +223,7 @@ ProcXGetDeviceControl(ClientPtr client)
CopySwapDeviceEnable(client, dev, buf);
break;
default:
- break;
+ break;
}
rep.length = bytes_to_int32(total_length);