Commit 9838b703 authored by Keith Packard's avatar Keith Packard
Browse files

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
do...
parent 75199129
......@@ -43,16 +43,16 @@ from The Open Group.
void BigReqExtensionInit(INITARGS);
static int
ProcBigReqDispatch (ClientPtr client)
ProcBigReqDispatch(ClientPtr client)
{
REQUEST(xBigReqEnableReq);
xBigReqEnableReply rep;
if (client->swapped) {
swaps(&stuff->length);
swaps(&stuff->length);
}
if (stuff->brReqType != X_BigReqEnable)
return BadRequest;
return BadRequest;
REQUEST_SIZE_MATCH(xBigReqEnableReq);
client->big_requests = TRUE;
memset(&rep, 0, sizeof(xBigReqEnableReply));
......@@ -61,10 +61,10 @@ ProcBigReqDispatch (ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.max_request_size = maxBigRequestSize;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.max_request_size);
swaps(&rep.sequenceNumber);
swapl(&rep.max_request_size);
}
WriteToClient(client, sizeof(xBigReqEnableReply), (char *)&rep);
WriteToClient(client, sizeof(xBigReqEnableReply), (char *) &rep);
return Success;
}
......@@ -72,6 +72,6 @@ void
BigReqExtensionInit(INITARGS)
{
AddExtension(XBigReqExtensionName, 0, 0,
ProcBigReqDispatch, ProcBigReqDispatch,
NULL, StandardMinorOpcode);
ProcBigReqDispatch, ProcBigReqDispatch,
NULL, StandardMinorOpcode);
}
......@@ -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);
}
......@@ -9,7 +9,7 @@
#include "dixstruct.h"
int DPMSSet(ClientPtr client, int level);
int DPMSSet(ClientPtr client, int level);
Bool DPMSSupported(void);
#endif
......@@ -34,12 +34,14 @@ Equipment Corporation.
#define FALSE 0
Bool DPMSSupported(void)
Bool
DPMSSupported(void)
{
return FALSE;
}
int DPMSSet(ClientPtr client, int level)
int
DPMSSet(ClientPtr client, int level)
{
return Success;
}
......@@ -35,18 +35,18 @@
DevPrivateKeyRec GEClientPrivateKeyRec;
int RT_GECLIENT = 0;
int RT_GECLIENT = 0;
GEExtension GEExtensions[MAXEXTENSIONS];
/* Major available requests */
static const int version_requests[] = {
X_GEQueryVersion, /* before client sends QueryVersion */
X_GEQueryVersion, /* must be set to last request in version 1 */
X_GEQueryVersion, /* before client sends QueryVersion */
X_GEQueryVersion, /* must be set to last request in version 1 */
};
/* Forward declarations */
static void SGEGenericEvent(xEvent* from, xEvent* to);
static void SGEGenericEvent(xEvent *from, xEvent *to);
#define NUM_VERSION_REQUESTS (sizeof (version_requests) / sizeof (version_requests[0]))
#define EXT_MASK(ext) ((ext) & 0x7F)
......@@ -60,6 +60,7 @@ ProcGEQueryVersion(ClientPtr client)
{
GEClientInfoPtr pGEClient = GEGetClient(client);
xGEQueryVersionReply rep;
REQUEST(xGEQueryVersionReq);
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
......@@ -77,22 +78,20 @@ ProcGEQueryVersion(ClientPtr client)
pGEClient->major_version = stuff->majorVersion;
pGEClient->minor_version = stuff->minorVersion;
if (client->swapped)
{
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
WriteToClient(client, sizeof(xGEQueryVersionReply), (char*)&rep);
WriteToClient(client, sizeof(xGEQueryVersionReply), (char *) &rep);
return Success;
}
int (*ProcGEVector[GENumberRequests])(ClientPtr) = {
int (*ProcGEVector[GENumberRequests]) (ClientPtr) = {
/* Version 1.0 */
ProcGEQueryVersion
};
ProcGEQueryVersion};
/************************************************************/
/* swapped request handlers */
......@@ -106,14 +105,12 @@ SProcGEQueryVersion(ClientPtr client)
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
swaps(&stuff->majorVersion);
swaps(&stuff->minorVersion);
return(*ProcGEVector[stuff->ReqType])(client);
return (*ProcGEVector[stuff->ReqType]) (client);
}
int (*SProcGEVector[GENumberRequests])(ClientPtr) = {
int (*SProcGEVector[GENumberRequests]) (ClientPtr) = {
/* Version 1.0 */
SProcGEQueryVersion
};
SProcGEQueryVersion};
/************************************************************/
/* callbacks */
......@@ -124,6 +121,7 @@ static int
ProcGEDispatch(ClientPtr client)
{
GEClientInfoPtr pGEClient = GEGetClient(client);
REQUEST(xGEReq);
if (pGEClient->major_version >= NUM_VERSION_REQUESTS)
......@@ -131,7 +129,7 @@ ProcGEDispatch(ClientPtr client)
if (stuff->ReqType > version_requests[pGEClient->major_version])
return BadRequest;
return (ProcGEVector[stuff->ReqType])(client);
return (ProcGEVector[stuff->ReqType]) (client);
}
/* dispatch swapped requests */
......@@ -141,7 +139,7 @@ SProcGEDispatch(ClientPtr client)
REQUEST(xGEReq);
if (stuff->ReqType >= GENumberRequests)
return BadRequest;
return (*SProcGEVector[stuff->ReqType])(client);
return (*SProcGEVector[stuff->ReqType]) (client);
}
/**
......@@ -151,13 +149,11 @@ SProcGEDispatch(ClientPtr client)
* used in the furture for versioning support.
*/
static void
GEClientCallback(CallbackListPtr *list,
pointer closure,
pointer data)
GEClientCallback(CallbackListPtr *list, pointer closure, pointer data)
{
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
ClientPtr pClient = clientinfo->client;
GEClientInfoPtr pGEClient = GEGetClient(pClient);
NewClientInfoRec *clientinfo = (NewClientInfoRec *) data;
ClientPtr pClient = clientinfo->client;
GEClientInfoPtr pGEClient = GEGetClient(pClient);
pGEClient->major_version = 0;
pGEClient->minor_version = 0;
......@@ -165,7 +161,7 @@ GEClientCallback(CallbackListPtr *list,
/* Reset extension. Called on server shutdown. */
static void
GEResetProc(ExtensionEntry *extEntry)
GEResetProc(ExtensionEntry * extEntry)
{
DeleteCallback(&ClientStateCallback, GEClientCallback, 0);
EventSwapVector[GenericEvent] = NotImplemented;
......@@ -179,13 +175,12 @@ GEResetProc(ExtensionEntry *extEntry)
* work.
*/
static void
SGEGenericEvent(xEvent* from, xEvent* to)
SGEGenericEvent(xEvent *from, xEvent *to)
{
xGenericEvent* gefrom = (xGenericEvent*)from;
xGenericEvent* geto = (xGenericEvent*)to;
xGenericEvent *gefrom = (xGenericEvent *) from;
xGenericEvent *geto = (xGenericEvent *) to;
if ((gefrom->extension & 0x7f) > MAXEXTENSIONS)
{
if ((gefrom->extension & 0x7f) > MAXEXTENSIONS) {
ErrorF("GE: Invalid extension offset for event.\n");
return;
}
......@@ -203,23 +198,23 @@ GEExtensionInit(void)
{
ExtensionEntry *extEntry;
if (!dixRegisterPrivateKey(&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
if (!dixRegisterPrivateKey
(&GEClientPrivateKeyRec, PRIVATE_CLIENT, sizeof(GEClientInfoRec)))
FatalError("GEExtensionInit: GE private request failed.\n");
if(!AddCallback(&ClientStateCallback, GEClientCallback, 0))
{
if (!AddCallback(&ClientStateCallback, GEClientCallback, 0)) {
FatalError("GEExtensionInit: register client callback failed.\n");
}
if((extEntry = AddExtension(GE_NAME,
0, GENumberErrors,
ProcGEDispatch, SProcGEDispatch,
GEResetProc, StandardMinorOpcode)) != 0)
{
if ((extEntry = AddExtension(GE_NAME,
0, GENumberErrors,
ProcGEDispatch, SProcGEDispatch,
GEResetProc, StandardMinorOpcode)) != 0) {
memset(GEExtensions, 0, sizeof(GEExtensions));
EventSwapVector[GenericEvent] = (EventSwapPtr) SGEGenericEvent;
} else {
}
else {
FatalError("GEInit: AddExtensions failed.\n");
}
......@@ -238,24 +233,22 @@ GEExtensionInit(void)
*/
void
GERegisterExtension(int extension,
void (*ev_swap)(xGenericEvent* from, xGenericEvent* to))
void (*ev_swap) (xGenericEvent *from, xGenericEvent *to))
{
if (EXT_MASK(extension) >= MAXEXTENSIONS)
if (EXT_MASK(extension) >= MAXEXTENSIONS)
FatalError("GE: extension > MAXEXTENSIONS. This should not happen.\n");
/* extension opcodes are > 128, might as well save some space here */
GEExtensions[EXT_MASK(extension)].evswap = ev_swap;
}
/* Sets type and extension field for a generic event. This is just an
* auxiliary function, extensions could do it manually too.
*/
void
GEInitEvent(xGenericEvent* ev, int extension)
GEInitEvent(xGenericEvent *ev, int extension)
{
ev->type = GenericEvent;
ev->extension = extension;
ev->length = 0;
}
......@@ -37,10 +37,9 @@ from the author.
/** Struct to keep information about registered extensions */
typedef struct _GEExtension {
/** Event swapping routine */
void (*evswap)(xGenericEvent* from, xGenericEvent* to);
void (*evswap) (xGenericEvent *from, xGenericEvent *to);
} GEExtension, *GEExtensionPtr;
/* All registered extensions and their handling functions. */
extern _X_EXPORT GEExtension GEExtensions[MAXEXTENSIONS];
......@@ -70,14 +69,15 @@ extern _X_EXPORT GEExtension GEExtensions[MAXEXTENSIONS];
GEEXT(ev) == (ext) && \
GEV(ev)->evtype == (ev_type))
/* Interface for other extensions */
extern _X_EXPORT void GERegisterExtension(
int extension,
void (*ev_dispatch)(xGenericEvent* from, xGenericEvent* to));
extern _X_EXPORT void GERegisterExtension(int extension,
void (*ev_dispatch) (xGenericEvent
*from,
xGenericEvent
*to));
extern _X_EXPORT void GEInitEvent(xGenericEvent* ev, int extension);
extern _X_EXPORT void GEInitEvent(xGenericEvent *ev, int extension);
extern _X_EXPORT void GEExtensionInit(void);
#endif /* _GEEXT_H_ */
#endif /* _GEEXT_H_ */
......@@ -38,16 +38,17 @@
#include <X11/extensions/geproto.h>
extern _X_EXPORT DevPrivateKeyRec GEClientPrivateKeyRec;
#define GEClientPrivateKey (&GEClientPrivateKeyRec)
typedef struct _GEClientInfo {
CARD32 major_version;
CARD32 minor_version;
CARD32 major_version;
CARD32 minor_version;
} GEClientInfoRec, *GEClientInfoPtr;
#define GEGetClient(pClient) ((GEClientInfoPtr)(dixLookupPrivate(&((pClient)->devPrivates), GEClientPrivateKey)))
extern _X_EXPORT int (*ProcGEVector[/*GENumRequests*/])(ClientPtr);
extern _X_EXPORT int (*SProcGEVector[/*GENumRequests*/])(ClientPtr);
extern _X_EXPORT int (*ProcGEVector[ /*GENumRequests */ ]) (ClientPtr);
extern _X_EXPORT int (*SProcGEVector[ /*GENumRequests */ ]) (ClientPtr);
#endif /* _GEINT_H_ */
#endif /* _GEINT_H_ */
This diff is collapsed.
......@@ -26,7 +26,6 @@ Equipment Corporation.
******************************************************************/
/* THIS IS NOT AN X PROJECT TEAM SPECIFICATION */
/*
......@@ -47,25 +46,25 @@ Equipment Corporation.
#include "dixstruct.h"
typedef struct _PanoramiXInfo {
XID id ;
XID id;
} PanoramiXInfo;
typedef struct {
PanoramiXInfo info[MAXSCREENS];
RESTYPE type;
union {
struct {
char visibility;
char class;
char root;
} win;
struct {
Bool shared;
} pix;
struct {
Bool root;
} pict;
char raw_data[4];
struct {
char visibility;
char class;
char root;
} win;
struct {
Bool shared;
} pix;
struct {
Bool root;
} pict;
char raw_data[4];
} u;
} PanoramiXRes;
......@@ -77,4 +76,4 @@ typedef struct {
#define IS_SHARED_PIXMAP(r) (((r)->type == XRT_PIXMAP) && (r)->u.pix.shared)
#define IS_ROOT_DRAWABLE(d) (((d)->type == XRT_WINDOW) && (d)->u.win.root)
#endif /* _PANORAMIX_H_ */
#endif /* _PANORAMIX_H_ */
......@@ -48,89 +48,86 @@ Equipment Corporation.
#include "panoramiXh.h"
static int
SProcPanoramiXQueryVersion (ClientPtr client)
SProcPanoramiXQueryVersion(ClientPtr client)
{
REQUEST(xPanoramiXQueryVersionReq);
REQUEST(xPanoramiXQueryVersionReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH (xPanoramiXQueryVersionReq);
return ProcPanoramiXQueryVersion(client);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
return ProcPanoramiXQueryVersion(client);
}
static int
SProcPanoramiXGetState(ClientPtr client)
{
REQUEST(xPanoramiXGetStateReq);
REQUEST(xPanoramiXGetStateReq);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
swapl(&stuff->window);
return ProcPanoramiXGetState(client);
swaps(&stuff->length);
REQUEST_SIZE_MATCH(xPanoramiXGetStateReq);
swapl(&stuff->window);
return ProcPanoramiXGetState(client);
}
static int
static int
SProcPanoramiXGetScreenCount(ClientPtr client)
{
REQUEST(xPanoramiXGetScreenCountReq);
REQUEST(xPanoramiXGetScreenCountReq);