diff options
author | Keith Packard <keithp@keithp.com> | 2012-03-21 12:55:09 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2012-03-21 13:54:42 -0700 |
commit | 9838b7032ea9792bec21af424c53c07078636d21 (patch) | |
tree | b72d0827dac50f0f3b8eab29b3b7639546d735d7 /Xext/dpms.c | |
parent | 75199129c603fc8567185ac31866c9518193cb78 (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 'Xext/dpms.c')
-rw-r--r-- | Xext/dpms.c | 109 |
1 files changed, 52 insertions, 57 deletions
diff --git a/Xext/dpms.c b/Xext/dpms.c index 0c8f18f47..348c87289 100644 --- a/Xext/dpms.c +++ b/Xext/dpms.c @@ -55,11 +55,11 @@ ProcDPMSGetVersion(ClientPtr client) rep.majorVersion = DPMSMajorVersion; rep.minorVersion = DPMSMinorVersion; if (client->swapped) { - swaps(&rep.sequenceNumber); - swaps(&rep.majorVersion); - swaps(&rep.minorVersion); + swaps(&rep.sequenceNumber); + swaps(&rep.majorVersion); + swaps(&rep.minorVersion); } - WriteToClient(client, sizeof(xDPMSGetVersionReply), (char *)&rep); + WriteToClient(client, sizeof(xDPMSGetVersionReply), (char *) &rep); return Success; } @@ -77,9 +77,9 @@ ProcDPMSCapable(ClientPtr client) rep.capable = DPMSCapableFlag; if (client->swapped) { - swaps(&rep.sequenceNumber); + swaps(&rep.sequenceNumber); } - WriteToClient(client, sizeof(xDPMSCapableReply), (char *)&rep); + WriteToClient(client, sizeof(xDPMSCapableReply), (char *) &rep); return Success; } @@ -99,12 +99,12 @@ ProcDPMSGetTimeouts(ClientPtr client) rep.off = DPMSOffTime / MILLI_PER_SECOND; if (client->swapped) { - swaps(&rep.sequenceNumber); - swaps(&rep.standby); - swaps(&rep.suspend); - swaps(&rep.off); + swaps(&rep.sequenceNumber); + swaps(&rep.standby); + swaps(&rep.suspend); + swaps(&rep.off); } - WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), (char *)&rep); + WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), (char *) &rep); return Success; } @@ -115,16 +115,14 @@ ProcDPMSSetTimeouts(ClientPtr client) REQUEST_SIZE_MATCH(xDPMSSetTimeoutsReq); - if ((stuff->off != 0)&&(stuff->off < stuff->suspend)) - { - client->errorValue = stuff->off; - return BadValue; + if ((stuff->off != 0) && (stuff->off < stuff->suspend)) { + client->errorValue = stuff->off; + return BadValue; + } + if ((stuff->suspend != 0) && (stuff->suspend < stuff->standby)) { + client->errorValue = stuff->suspend; + return BadValue; } - if ((stuff->suspend != 0)&&(stuff->suspend < stuff->standby)) - { - client->errorValue = stuff->suspend; - return BadValue; - } DPMSStandbyTime = stuff->standby * MILLI_PER_SECOND; DPMSSuspendTime = stuff->suspend * MILLI_PER_SECOND; @@ -142,9 +140,9 @@ ProcDPMSEnable(ClientPtr client) REQUEST_SIZE_MATCH(xDPMSEnableReq); if (DPMSCapableFlag) { - DPMSEnabled = TRUE; - if (!was_enabled) - SetScreenSaverTimer(); + DPMSEnabled = TRUE; + if (!was_enabled) + SetScreenSaverTimer(); } return Success; @@ -172,14 +170,13 @@ ProcDPMSForceLevel(ClientPtr client) REQUEST_SIZE_MATCH(xDPMSForceLevelReq); if (!DPMSEnabled) - return BadMatch; + return BadMatch; if (stuff->level != DPMSModeOn && stuff->level != DPMSModeStandby && - stuff->level != DPMSModeSuspend && - stuff->level != DPMSModeOff) { - client->errorValue = stuff->level; - return BadValue; + stuff->level != DPMSModeSuspend && stuff->level != DPMSModeOff) { + client->errorValue = stuff->level; + return BadValue; } DPMSSet(client, stuff->level); @@ -202,38 +199,37 @@ ProcDPMSInfo(ClientPtr client) rep.state = DPMSEnabled; if (client->swapped) { - swaps(&rep.sequenceNumber); - swaps(&rep.power_level); + swaps(&rep.sequenceNumber); + swaps(&rep.power_level); } - WriteToClient(client, sizeof(xDPMSInfoReply), (char *)&rep); + WriteToClient(client, sizeof(xDPMSInfoReply), (char *) &rep); return Success; } static int -ProcDPMSDispatch (ClientPtr client) +ProcDPMSDispatch(ClientPtr client) { REQUEST(xReq); - switch (stuff->data) - { + switch (stuff->data) { case X_DPMSGetVersion: - return ProcDPMSGetVersion(client); + return ProcDPMSGetVersion(client); case X_DPMSCapable: - return ProcDPMSCapable(client); + return ProcDPMSCapable(client); case X_DPMSGetTimeouts: - return ProcDPMSGetTimeouts(client); + return ProcDPMSGetTimeouts(client); case X_DPMSSetTimeouts: - return ProcDPMSSetTimeouts(client); + return ProcDPMSSetTimeouts(client); case X_DPMSEnable: - return ProcDPMSEnable(client); + return ProcDPMSEnable(client); case X_DPMSDisable: - return ProcDPMSDisable(client); + return ProcDPMSDisable(client); case X_DPMSForceLevel: - return ProcDPMSForceLevel(client); + return ProcDPMSForceLevel(client); case X_DPMSInfo: - return ProcDPMSInfo(client); + return ProcDPMSInfo(client); default: - return BadRequest; + return BadRequest; } } @@ -332,29 +328,28 @@ SProcDPMSInfo(ClientPtr client) } static int -SProcDPMSDispatch (ClientPtr client) +SProcDPMSDispatch(ClientPtr client) { REQUEST(xReq); - switch (stuff->data) - { + switch (stuff->data) { case X_DPMSGetVersion: - return SProcDPMSGetVersion(client); + return SProcDPMSGetVersion(client); case X_DPMSCapable: - return SProcDPMSCapable(client); + return SProcDPMSCapable(client); case X_DPMSGetTimeouts: - return SProcDPMSGetTimeouts(client); + return SProcDPMSGetTimeouts(client); case X_DPMSSetTimeouts: - return SProcDPMSSetTimeouts(client); + return SProcDPMSSetTimeouts(client); case X_DPMSEnable: - return SProcDPMSEnable(client); + return SProcDPMSEnable(client); case X_DPMSDisable: - return SProcDPMSDisable(client); + return SProcDPMSDisable(client); case X_DPMSForceLevel: - return SProcDPMSForceLevel(client); + return SProcDPMSForceLevel(client); case X_DPMSInfo: - return SProcDPMSInfo(client); + return SProcDPMSInfo(client); default: - return BadRequest; + return BadRequest; } } @@ -362,6 +357,6 @@ void DPMSExtensionInit(INITARGS) { AddExtension(DPMSExtensionName, 0, 0, - ProcDPMSDispatch, SProcDPMSDispatch, - NULL, StandardMinorOpcode); + ProcDPMSDispatch, SProcDPMSDispatch, + NULL, StandardMinorOpcode); } |