aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xext
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/Xext')
-rw-r--r--xorg-server/Xext/Makefile.am42
-rw-r--r--xorg-server/Xext/bigreq.c19
-rw-r--r--xorg-server/Xext/dpms.c67
-rw-r--r--xorg-server/Xext/geext.c21
-rw-r--r--xorg-server/Xext/geext.h2
-rw-r--r--xorg-server/Xext/panoramiX.c99
-rw-r--r--xorg-server/Xext/panoramiXprocs.c47
-rw-r--r--xorg-server/Xext/saver.c55
-rw-r--r--xorg-server/Xext/security.c44
-rw-r--r--xorg-server/Xext/shape.c83
-rw-r--r--xorg-server/Xext/shm.c79
-rw-r--r--xorg-server/Xext/sync.c144
-rw-r--r--xorg-server/Xext/syncsrv.h2
-rw-r--r--xorg-server/Xext/xcmisc.c46
-rw-r--r--xorg-server/Xext/xf86bigfont.c38
-rw-r--r--xorg-server/Xext/xf86bigfontsrv.h67
-rw-r--r--xorg-server/Xext/xres.c93
-rw-r--r--xorg-server/Xext/xselinux_ext.c46
-rw-r--r--xorg-server/Xext/xtest.c32
-rw-r--r--xorg-server/Xext/xvdisp.c186
-rw-r--r--xorg-server/Xext/xvdix.h6
-rw-r--r--xorg-server/Xext/xvmain.c27
-rw-r--r--xorg-server/Xext/xvmc.c129
-rw-r--r--xorg-server/Xext/xvmcext.h4
24 files changed, 722 insertions, 656 deletions
diff --git a/xorg-server/Xext/Makefile.am b/xorg-server/Xext/Makefile.am
index 5929a3e49..8e31f1367 100644
--- a/xorg-server/Xext/Makefile.am
+++ b/xorg-server/Xext/Makefile.am
@@ -1,16 +1,4 @@
-# libXext.la: includes all extensions and should be linked into Xvfb,
-# Xnest, Xdmx and Xprt
-# libXextbuiltin.la: includes those extensions that are built directly into
-# Xorg by default
-# libXextmodule.la: includes those extensions that are built into a module
-# that Xorg loads
-if XORG
-noinst_LTLIBRARIES = libXext.la libXextbuiltin.la libXextmodule.la
-else
noinst_LTLIBRARIES = libXext.la
-endif
-
-INCLUDES = -I$(top_srcdir)/hw/xfree86/dixmods/extmod
AM_CFLAGS = $(DIX_CFLAGS)
@@ -30,10 +18,7 @@ BUILTIN_SRCS = \
syncsrv.h \
xcmisc.c \
xtest.c
-
-# Sources always included in libXextmodule.la & libXext.la. That's right, zero.
-MODULE_SRCS =
-MODULE_LIBS =
+BUILTIN_LIBS =
# Optional sources included if extension enabled by configure.ac rules
@@ -46,19 +31,19 @@ endif
# XVideo extension
XV_SRCS = xvmain.c xvdisp.c xvmc.c xvdix.h xvmcext.h xvdisp.h
if XV
-MODULE_SRCS += $(XV_SRCS)
+BUILTIN_SRCS += $(XV_SRCS)
endif
# XResource extension: lets clients get data about per-client resource usage
-RES_SRCS = hashtable.c xres.c
+RES_SRCS = hashtable.c hashtable.h xres.c
if RES
-MODULE_SRCS += $(RES_SRCS)
+BUILTIN_SRCS += $(RES_SRCS)
endif
# MIT ScreenSaver extension
SCREENSAVER_SRCS = saver.c
if SCREENSAVER
-MODULE_SRCS += $(SCREENSAVER_SRCS)
+BUILTIN_SRCS += $(SCREENSAVER_SRCS)
endif
# Xinerama extension: making multiple video devices act as one virtual screen
@@ -84,8 +69,8 @@ endif
# requires X-ACE extension
XSELINUX_SRCS = xselinux_ext.c xselinux_hooks.c xselinux_label.c xselinux.h xselinuxint.h
if XSELINUX
-MODULE_SRCS += $(XSELINUX_SRCS)
-MODULE_LIBS += $(SELINUX_LIBS)
+BUILTIN_SRCS += $(XSELINUX_SRCS)
+BUILTIN_LIBS += $(SELINUX_LIBS)
endif
# Security extension: multi-level security to protect clients from each other
@@ -103,20 +88,13 @@ endif
# DPMS extension
DPMS_SRCS = dpms.c dpmsproc.h
if DPMSExtension
-MODULE_SRCS += $(DPMS_SRCS)
+BUILTIN_SRCS += $(DPMS_SRCS)
endif
# Now take all of the above, mix well, bake for 10 minutes and get libXext*.la
-libXext_la_SOURCES = $(BUILTIN_SRCS) $(MODULE_SRCS)
-libXext_la_LIBADD = $(MODULE_LIBS)
-
-if XORG
-libXextbuiltin_la_SOURCES = $(BUILTIN_SRCS)
-
-libXextmodule_la_SOURCES = $(MODULE_SRCS)
-libXextmodule_la_LIBADD = $(MODULE_LIBS)
-endif
+libXext_la_SOURCES = $(BUILTIN_SRCS)
+libXext_la_LIBADD = $(BUILTIN_LIBS)
EXTRA_DIST = \
$(MITSHM_SRCS) \
diff --git a/xorg-server/Xext/bigreq.c b/xorg-server/Xext/bigreq.c
index 49355c4a4..c78a1e4b4 100644
--- a/xorg-server/Xext/bigreq.c
+++ b/xorg-server/Xext/bigreq.c
@@ -38,9 +38,7 @@ from The Open Group.
#include "extnsionst.h"
#include <X11/extensions/bigreqsproto.h>
#include "opaque.h"
-#include "modinit.h"
-
-void BigReqExtensionInit(INITARGS);
+#include "extinit.h"
static int
ProcBigReqDispatch(ClientPtr client)
@@ -55,21 +53,22 @@ ProcBigReqDispatch(ClientPtr client)
return BadRequest;
REQUEST_SIZE_MATCH(xBigReqEnableReq);
client->big_requests = TRUE;
- memset(&rep, 0, sizeof(xBigReqEnableReply));
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.max_request_size = maxBigRequestSize;
+ rep = (xBigReqEnableReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .max_request_size = maxBigRequestSize
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.max_request_size);
}
- WriteToClient(client, sizeof(xBigReqEnableReply), (char *) &rep);
+ WriteToClient(client, sizeof(xBigReqEnableReply), &rep);
return Success;
}
void
-BigReqExtensionInit(INITARGS)
+BigReqExtensionInit(void)
{
AddExtension(XBigReqExtensionName, 0, 0,
ProcBigReqDispatch, ProcBigReqDispatch,
diff --git a/xorg-server/Xext/dpms.c b/xorg-server/Xext/dpms.c
index 348c87289..5f1a35d9c 100644
--- a/xorg-server/Xext/dpms.c
+++ b/xorg-server/Xext/dpms.c
@@ -39,27 +39,28 @@ Equipment Corporation.
#include "opaque.h"
#include <X11/extensions/dpmsproto.h>
#include "dpmsproc.h"
-#include "modinit.h"
+#include "extinit.h"
static int
ProcDPMSGetVersion(ClientPtr client)
{
/* REQUEST(xDPMSGetVersionReq); */
- xDPMSGetVersionReply rep;
+ xDPMSGetVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = DPMSMajorVersion,
+ .minorVersion = DPMSMinorVersion
+ };
REQUEST_SIZE_MATCH(xDPMSGetVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = DPMSMajorVersion;
- rep.minorVersion = DPMSMinorVersion;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xDPMSGetVersionReply), (char *) &rep);
+ WriteToClient(client, sizeof(xDPMSGetVersionReply), &rep);
return Success;
}
@@ -67,19 +68,19 @@ static int
ProcDPMSCapable(ClientPtr client)
{
/* REQUEST(xDPMSCapableReq); */
- xDPMSCapableReply rep;
+ xDPMSCapableReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .capable = DPMSCapableFlag
+ };
REQUEST_SIZE_MATCH(xDPMSCapableReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.capable = DPMSCapableFlag;
-
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
- WriteToClient(client, sizeof(xDPMSCapableReply), (char *) &rep);
+ WriteToClient(client, sizeof(xDPMSCapableReply), &rep);
return Success;
}
@@ -87,24 +88,24 @@ static int
ProcDPMSGetTimeouts(ClientPtr client)
{
/* REQUEST(xDPMSGetTimeoutsReq); */
- xDPMSGetTimeoutsReply rep;
+ xDPMSGetTimeoutsReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .standby = DPMSStandbyTime / MILLI_PER_SECOND,
+ .suspend = DPMSSuspendTime / MILLI_PER_SECOND,
+ .off = DPMSOffTime / MILLI_PER_SECOND
+ };
REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.standby = DPMSStandbyTime / MILLI_PER_SECOND;
- rep.suspend = DPMSSuspendTime / MILLI_PER_SECOND;
- rep.off = DPMSOffTime / MILLI_PER_SECOND;
-
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.standby);
swaps(&rep.suspend);
swaps(&rep.off);
}
- WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), (char *) &rep);
+ WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), &rep);
return Success;
}
@@ -188,21 +189,21 @@ static int
ProcDPMSInfo(ClientPtr client)
{
/* REQUEST(xDPMSInfoReq); */
- xDPMSInfoReply rep;
+ xDPMSInfoReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .power_level = DPMSPowerLevel,
+ .state = DPMSEnabled
+ };
REQUEST_SIZE_MATCH(xDPMSInfoReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.power_level = DPMSPowerLevel;
- rep.state = DPMSEnabled;
-
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.power_level);
}
- WriteToClient(client, sizeof(xDPMSInfoReply), (char *) &rep);
+ WriteToClient(client, sizeof(xDPMSInfoReply), &rep);
return Success;
}
@@ -354,7 +355,7 @@ SProcDPMSDispatch(ClientPtr client)
}
void
-DPMSExtensionInit(INITARGS)
+DPMSExtensionInit(void)
{
AddExtension(DPMSExtensionName, 0, 0,
ProcDPMSDispatch, SProcDPMSDispatch,
diff --git a/xorg-server/Xext/geext.c b/xorg-server/Xext/geext.c
index 07028238e..1e5ae6f82 100644
--- a/xorg-server/Xext/geext.c
+++ b/xorg-server/Xext/geext.c
@@ -32,11 +32,10 @@
#include "geint.h"
#include "geext.h"
#include "protocol-versions.h"
+#include "extinit.h"
DevPrivateKeyRec GEClientPrivateKeyRec;
-int RT_GECLIENT = 0;
-
GEExtension GEExtensions[MAXEXTENSIONS];
/* Major available requests */
@@ -65,14 +64,16 @@ ProcGEQueryVersion(ClientPtr client)
REQUEST_SIZE_MATCH(xGEQueryVersionReq);
- rep.repType = X_Reply;
- rep.RepType = X_GEQueryVersion;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xGEQueryVersionReply) {
+ .repType = X_Reply,
+ .RepType = X_GEQueryVersion,
+ .sequenceNumber = client->sequence,
+ .length = 0,
- /* return the supported version by the server */
- rep.majorVersion = SERVER_GE_MAJOR_VERSION;
- rep.minorVersion = SERVER_GE_MINOR_VERSION;
+ /* return the supported version by the server */
+ .majorVersion = SERVER_GE_MAJOR_VERSION,
+ .minorVersion = SERVER_GE_MINOR_VERSION
+ };
/* Remember version the client requested */
pGEClient->major_version = stuff->majorVersion;
@@ -85,7 +86,7 @@ ProcGEQueryVersion(ClientPtr client)
swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xGEQueryVersionReply), (char *) &rep);
+ WriteToClient(client, sizeof(xGEQueryVersionReply), &rep);
return Success;
}
diff --git a/xorg-server/Xext/geext.h b/xorg-server/Xext/geext.h
index d2a15dcb9..f46897966 100644
--- a/xorg-server/Xext/geext.h
+++ b/xorg-server/Xext/geext.h
@@ -78,6 +78,4 @@ extern _X_EXPORT void GERegisterExtension(int extension,
extern _X_EXPORT void GEInitEvent(xGenericEvent *ev, int extension);
-extern _X_EXPORT void GEExtensionInit(void);
-
#endif /* _GEEXT_H_ */
diff --git a/xorg-server/Xext/panoramiX.c b/xorg-server/Xext/panoramiX.c
index de62a35e7..5653c08e1 100644
--- a/xorg-server/Xext/panoramiX.c
+++ b/xorg-server/Xext/panoramiX.c
@@ -59,7 +59,7 @@ Equipment Corporation.
#ifdef COMPOSITE
#include "compint.h"
#endif
-#include "modinit.h"
+#include "extinit.h"
#include "protocol-versions.h"
#ifdef GLXPROXY
@@ -434,7 +434,7 @@ XineramaReinitData(void)
*/
void
-PanoramiXExtensionInit(int argc, char *argv[])
+PanoramiXExtensionInit(void)
{
int i;
Bool success = FALSE;
@@ -895,6 +895,9 @@ PanoramiXResetProc(ExtensionEntry * extEntry)
#ifdef XFIXES
PanoramiXFixesReset();
#endif
+#ifdef COMPOSITE
+ PanoramiXCompositeReset ();
+#endif
screenInfo.numScreens = PanoramiXNumScreens;
for (i = 256; i--;)
ProcVector[i] = SavedProcVector[i];
@@ -904,21 +907,22 @@ int
ProcPanoramiXQueryVersion(ClientPtr client)
{
/* REQUEST(xPanoramiXQueryVersionReq); */
- xPanoramiXQueryVersionReply rep;
+ xPanoramiXQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = SERVER_PANORAMIX_MAJOR_VERSION,
+ .minorVersion = SERVER_PANORAMIX_MINOR_VERSION
+ };
REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = SERVER_PANORAMIX_MAJOR_VERSION;
- rep.minorVersion = SERVER_PANORAMIX_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), (char *) &rep);
+ WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), &rep);
return Success;
}
@@ -935,17 +939,19 @@ ProcPanoramiXGetState(ClientPtr client)
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.state = !noPanoramiXExtension;
- rep.window = stuff->window;
+ rep = (xPanoramiXGetStateReply) {
+ .type = X_Reply,
+ .state = !noPanoramiXExtension,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .window = stuff->window
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.window);
}
- WriteToClient(client, sizeof(xPanoramiXGetStateReply), (char *) &rep);
+ WriteToClient(client, sizeof(xPanoramiXGetStateReply), &rep);
return Success;
}
@@ -963,17 +969,19 @@ ProcPanoramiXGetScreenCount(ClientPtr client)
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.ScreenCount = PanoramiXNumScreens;
- rep.window = stuff->window;
+ rep = (xPanoramiXGetScreenCountReply) {
+ .type = X_Reply,
+ .ScreenCount = PanoramiXNumScreens,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .window = stuff->window
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.window);
}
- WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), (char *) &rep);
+ WriteToClient(client, sizeof(xPanoramiXGetScreenCountReply), &rep);
return Success;
}
@@ -993,14 +1001,16 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xPanoramiXGetScreenSizeReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
/* screen dimensions */
- rep.width = screenInfo.screens[stuff->screen]->width;
- rep.height = screenInfo.screens[stuff->screen]->height;
- rep.window = stuff->window;
- rep.screen = stuff->screen;
+ .width = screenInfo.screens[stuff->screen]->width,
+ .height = screenInfo.screens[stuff->screen]->height,
+ .window = stuff->window,
+ .screen = stuff->screen
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -1009,7 +1019,7 @@ ProcPanoramiXGetScreenSize(ClientPtr client)
swapl(&rep.window);
swapl(&rep.screen);
}
- WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *) &rep);
+ WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), &rep);
return Success;
}
@@ -1021,24 +1031,24 @@ ProcXineramaIsActive(ClientPtr client)
REQUEST_SIZE_MATCH(xXineramaIsActiveReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xXineramaIsActiveReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
#if 1
- {
/* The following hack fools clients into thinking that Xinerama
* is disabled even though it is not. */
- rep.state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack;
- }
+ .state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack
#else
- rep.state = !noPanoramiXExtension;
+ .state = !noPanoramiXExtension;
#endif
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.state);
}
- WriteToClient(client, sizeof(xXineramaIsActiveReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXineramaIsActiveReply), &rep);
return Success;
}
@@ -1046,20 +1056,21 @@ int
ProcXineramaQueryScreens(ClientPtr client)
{
/* REQUEST(xXineramaQueryScreensReq); */
- xXineramaQueryScreensReply rep;
+ xXineramaQueryScreensReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(rep.number * sz_XineramaScreenInfo),
+ .number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens
+ };
REQUEST_SIZE_MATCH(xXineramaQueryScreensReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens;
- rep.length = bytes_to_int32(rep.number * sz_XineramaScreenInfo);
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.number);
}
- WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXineramaQueryScreensReply), &rep);
if (!noPanoramiXExtension) {
xXineramaScreenInfo scratch;
@@ -1077,7 +1088,7 @@ ProcXineramaQueryScreens(ClientPtr client)
swaps(&scratch.width);
swaps(&scratch.height);
}
- WriteToClient(client, sz_XineramaScreenInfo, (char *) &scratch);
+ WriteToClient(client, sz_XineramaScreenInfo, &scratch);
}
}
diff --git a/xorg-server/Xext/panoramiXprocs.c b/xorg-server/Xext/panoramiXprocs.c
index 12d6163bb..576844cbf 100644
--- a/xorg-server/Xext/panoramiXprocs.c
+++ b/xorg-server/Xext/panoramiXprocs.c
@@ -566,14 +566,18 @@ PanoramiXGetGeometry(ClientPtr client)
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.root = screenInfo.screens[0]->root->drawable.id;
- rep.depth = pDraw->depth;
- rep.width = pDraw->width;
- rep.height = pDraw->height;
- rep.x = rep.y = rep.borderWidth = 0;
+ rep = (xGetGeometryReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .root = screenInfo.screens[0]->root->drawable.id,
+ .depth = pDraw->depth,
+ .width = pDraw->width,
+ .height = pDraw->height,
+ .x = 0,
+ .y = 0,
+ .borderWidth = 0
+ };
if (stuff->id == rep.root) {
xWindowRoot *root = (xWindowRoot *)
@@ -617,11 +621,13 @@ PanoramiXTranslateCoords(ClientPtr client)
rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess);
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.sameScreen = xTrue;
- rep.child = None;
+ rep = (xTranslateCoordsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .sameScreen = xTrue,
+ .child = None
+ };
if ((pWin == screenInfo.screens[0]->root) ||
(pWin->drawable.id == screenInfo.screens[0]->screensaver.wid)) {
@@ -1954,10 +1960,12 @@ PanoramiXGetImage(ClientPtr client)
return rc;
}
- xgi.visual = wVisual(((WindowPtr) pDraw));
- xgi.type = X_Reply;
- xgi.sequenceNumber = client->sequence;
- xgi.depth = pDraw->depth;
+ xgi = (xGetImageReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .visual = wVisual(((WindowPtr) pDraw)),
+ .depth = pDraw->depth
+ };
if (format == ZPixmap) {
widthBytesLine = PixmapBytePad(w, pDraw->depth);
length = widthBytesLine * h;
@@ -2003,7 +2011,7 @@ PanoramiXGetImage(ClientPtr client)
format, planemask, pBuf, widthBytesLine,
isRoot);
- (void) WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
+ WriteToClient(client, (int) (nlines * widthBytesLine), pBuf);
linesDone += nlines;
}
}
@@ -2020,8 +2028,7 @@ PanoramiXGetImage(ClientPtr client)
nlines, format, plane, pBuf,
widthBytesLine, isRoot);
- (void) WriteToClient(client,
- (int) (nlines * widthBytesLine), pBuf);
+ WriteToClient(client, (int)(nlines * widthBytesLine), pBuf);
linesDone += nlines;
}
diff --git a/xorg-server/Xext/saver.c b/xorg-server/Xext/saver.c
index 61fc044d7..ac4a633e7 100644
--- a/xorg-server/Xext/saver.c
+++ b/xorg-server/Xext/saver.c
@@ -58,7 +58,7 @@ in this Software without prior written authorization from the X Consortium.
#include <stdio.h>
-#include "modinit.h"
+#include "extinit.h"
static int ScreenSaverEventBase = 0;
@@ -406,7 +406,6 @@ SendScreenSaverNotify(ScreenPtr pScreen, int state, Bool forced)
ScreenSaverScreenPrivatePtr pPriv;
ScreenSaverEventPtr pEv;
unsigned long mask;
- xScreenSaverNotifyEvent ev;
int kind;
UpdateCurrentTimeIf();
@@ -424,16 +423,18 @@ SendScreenSaverNotify(ScreenPtr pScreen, int state, Bool forced)
else
kind = ScreenSaverInternal;
for (pEv = pPriv->events; pEv; pEv = pEv->next) {
- if (!(pEv->mask & mask))
- continue;
- ev.type = ScreenSaverNotify + ScreenSaverEventBase;
- ev.state = state;
- ev.timestamp = currentTime.milliseconds;
- ev.root = pScreen->root->drawable.id;
- ev.window = pScreen->screensaver.wid;
- ev.kind = kind;
- ev.forced = forced;
- WriteEventsToClient(pEv->client, 1, (xEvent *) &ev);
+ if (pEv->mask & mask) {
+ xScreenSaverNotifyEvent ev = {
+ .type = ScreenSaverNotify + ScreenSaverEventBase,
+ .state = state,
+ .timestamp = currentTime.milliseconds,
+ .root = pScreen->root->drawable.id,
+ .window = pScreen->screensaver.wid,
+ .kind = kind,
+ .forced = forced
+ };
+ WriteEventsToClient(pEv->client, 1, (xEvent *) &ev);
+ }
}
}
@@ -634,19 +635,21 @@ ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force)
static int
ProcScreenSaverQueryVersion(ClientPtr client)
{
- xScreenSaverQueryVersionReply rep;
+ xScreenSaverQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = SERVER_SAVER_MAJOR_VERSION,
+ .minorVersion = SERVER_SAVER_MINOR_VERSION
+ };
REQUEST_SIZE_MATCH(xScreenSaverQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = SERVER_SAVER_MAJOR_VERSION;
- rep.minorVersion = SERVER_SAVER_MINOR_VERSION;
+
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
- WriteToClient(client, sizeof(xScreenSaverQueryVersionReply), (char *) &rep);
+ WriteToClient(client, sizeof(xScreenSaverQueryVersionReply), &rep);
return Success;
}
@@ -677,10 +680,12 @@ ProcScreenSaverQueryInfo(ClientPtr client)
UpdateCurrentTime();
lastInput = GetTimeInMillis() - lastDeviceEventTime[XIAllDevices].milliseconds;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.window = pSaver->wid;
+ rep = (xScreenSaverQueryInfoReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .window = pSaver->wid
+ };
if (screenIsSaved != SCREEN_SAVER_OFF) {
rep.state = ScreenSaverOn;
if (ScreenSaverTime)
@@ -717,7 +722,7 @@ ProcScreenSaverQueryInfo(ClientPtr client)
swapl(&rep.idle);
swapl(&rep.eventMask);
}
- WriteToClient(client, sizeof(xScreenSaverQueryInfoReply), (char *) &rep);
+ WriteToClient(client, sizeof(xScreenSaverQueryInfoReply), &rep);
return Success;
}
@@ -1384,7 +1389,7 @@ SProcScreenSaverDispatch(ClientPtr client)
}
void
-ScreenSaverExtensionInit(INITARGS)
+ScreenSaverExtensionInit(void)
{
ExtensionEntry *extEntry;
int i;
diff --git a/xorg-server/Xext/security.c b/xorg-server/Xext/security.c
index 3699510d3..6cc9aa044 100644
--- a/xorg-server/Xext/security.c
+++ b/xorg-server/Xext/security.c
@@ -38,7 +38,7 @@ in this Software without prior written authorization from The Open Group.
#include "xacestr.h"
#include "securitysrv.h"
#include <X11/extensions/securproto.h>
-#include "modinit.h"
+#include "extinit.h"
#include "protocol-versions.h"
/* Extension stuff */
@@ -192,10 +192,10 @@ SecurityDeleteAuthorization(pointer value, XID id)
while ((pEventClient = pAuth->eventClients)) {
/* send revocation event event */
- xSecurityAuthorizationRevokedEvent are;
-
- are.type = SecurityEventBase + XSecurityAuthorizationRevoked;
- are.authId = pAuth->id;
+ xSecurityAuthorizationRevokedEvent are = {
+ .type = SecurityEventBase + XSecurityAuthorizationRevoked,
+ .authId = pAuth->id
+ };
WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are);
FreeResource(pEventClient->resource, RT_NONE);
}
@@ -338,21 +338,22 @@ static int
ProcSecurityQueryVersion(ClientPtr client)
{
/* REQUEST(xSecurityQueryVersionReq); */
- xSecurityQueryVersionReply rep;
+ xSecurityQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = SERVER_SECURITY_MAJOR_VERSION,
+ .minorVersion = SERVER_SECURITY_MINOR_VERSION
+ };
REQUEST_SIZE_MATCH(xSecurityQueryVersionReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.majorVersion = SERVER_SECURITY_MAJOR_VERSION;
- rep.minorVersion = SERVER_SECURITY_MINOR_VERSION;
+
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
- (void) WriteToClient(client, SIZEOF(xSecurityQueryVersionReply),
- (char *) &rep);
+ WriteToClient(client, SIZEOF(xSecurityQueryVersionReply), &rep);
return Success;
} /* ProcSecurityQueryVersion */
@@ -528,11 +529,13 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
/* tell client the auth id and data */
- rep.type = X_Reply;
- rep.length = bytes_to_int32(authdata_len);
- rep.sequenceNumber = client->sequence;
- rep.authId = authId;
- rep.dataLength = authdata_len;
+ rep = (xSecurityGenerateAuthorizationReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(authdata_len),
+ .authId = authId,
+ .dataLength = authdata_len
+ };
if (client->swapped) {
swapl(&rep.length);
@@ -541,8 +544,7 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
swaps(&rep.dataLength);
}
- WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply),
- (char *) &rep);
+ WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply), &rep);
WriteToClient(client, authdata_len, pAuthdata);
SecurityAudit
@@ -1025,7 +1027,7 @@ SecurityResetProc(ExtensionEntry * extEntry)
*/
void
-SecurityExtensionInit(INITARGS)
+SecurityExtensionInit(void)
{
ExtensionEntry *extEntry;
int ret = TRUE;
diff --git a/xorg-server/Xext/shape.c b/xorg-server/Xext/shape.c
index cc5214a1b..d36867cc8 100644
--- a/xorg-server/Xext/shape.c
+++ b/xorg-server/Xext/shape.c
@@ -44,7 +44,7 @@ in this Software without prior written authorization from The Open Group.
#include <X11/extensions/shapeproto.h>
#include "regionstr.h"
#include "gcstruct.h"
-#include "modinit.h"
+#include "extinit.h"
#include "protocol-versions.h"
typedef RegionPtr (*CreateDftPtr) (WindowPtr /* pWin */
@@ -204,22 +204,23 @@ CreateClipShape(WindowPtr pWin)
static int
ProcShapeQueryVersion(ClientPtr client)
{
- xShapeQueryVersionReply rep;
+ xShapeQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = SERVER_SHAPE_MAJOR_VERSION,
+ .minorVersion = SERVER_SHAPE_MINOR_VERSION
+ };
REQUEST_SIZE_MATCH(xShapeQueryVersionReq);
- memset(&rep, 0, sizeof(xShapeQueryVersionReply));
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = SERVER_SHAPE_MAJOR_VERSION;
- rep.minorVersion = SERVER_SHAPE_MINOR_VERSION;
+
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xShapeQueryVersionReply), (char *) &rep);
+ WriteToClient(client, sizeof(xShapeQueryVersionReply), &rep);
return Success;
}
@@ -631,12 +632,13 @@ ProcShapeQueryExtents(ClientPtr client)
rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess);
if (rc != Success)
return rc;
- memset(&rep, 0, sizeof(xShapeQueryExtentsReply));
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.boundingShaped = (wBoundingShape(pWin) != 0);
- rep.clipShaped = (wClipShape(pWin) != 0);
+ rep = (xShapeQueryExtentsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .boundingShaped = (wBoundingShape(pWin) != 0),
+ .clipShaped = (wClipShape(pWin) != 0)
+ };
if ((region = wBoundingShape(pWin))) {
/* this is done in two steps because of a compiler bug on SunOS 4.1.3 */
pExtents = RegionExtents(region);
@@ -679,7 +681,7 @@ ProcShapeQueryExtents(ClientPtr client)
swaps(&rep.widthClipShape);
swaps(&rep.heightClipShape);
}
- WriteToClient(client, sizeof(xShapeQueryExtentsReply), (char *) &rep);
+ WriteToClient(client, sizeof(xShapeQueryExtentsReply), &rep);
return Success;
}
@@ -824,7 +826,6 @@ void
SendShapeNotify(WindowPtr pWin, int which)
{
ShapeEventPtr *pHead, pShapeEvent;
- xShapeNotifyEvent se;
BoxRec extents;
RegionPtr region;
BYTE shaped;
@@ -881,15 +882,17 @@ SendShapeNotify(WindowPtr pWin, int which)
return;
}
for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) {
- se.type = ShapeNotify + ShapeEventBase;
- se.kind = which;
- se.window = pWin->drawable.id;
- se.x = extents.x1;
- se.y = extents.y1;
- se.width = extents.x2 - extents.x1;
- se.height = extents.y2 - extents.y1;
- se.time = currentTime.milliseconds;
- se.shaped = shaped;
+ xShapeNotifyEvent se = {
+ .type = ShapeNotify + ShapeEventBase,
+ .kind = which,
+ .window = pWin->drawable.id,
+ .x = extents.x1,
+ .y = extents.y1,
+ .width = extents.x2 - extents.x1,
+ .height = extents.y2 - extents.y1,
+ .time = currentTime.milliseconds,
+ .shaped = shaped
+ };
WriteEventsToClient(pShapeEvent->client, 1, (xEvent *) &se);
}
}
@@ -920,15 +923,17 @@ ProcShapeInputSelected(ClientPtr client)
}
}
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.enabled = enabled;
+ rep = (xShapeInputSelectedReply) {
+ .type = X_Reply,
+ .enabled = enabled,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
- WriteToClient(client, sizeof(xShapeInputSelectedReply), (char *) &rep);
+ WriteToClient(client, sizeof(xShapeInputSelectedReply), &rep);
return Success;
}
@@ -1001,19 +1006,21 @@ ProcShapeGetRectangles(ClientPtr client)
rects[i].height = box->y2 - box->y1;
}
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = bytes_to_int32(nrects * sizeof(xRectangle));
- rep.ordering = YXBanded;
- rep.nrects = nrects;
+ rep = (xShapeGetRectanglesReply) {
+ .type = X_Reply,
+ .ordering = YXBanded,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(nrects * sizeof(xRectangle)),
+ .nrects = nrects
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.nrects);
SwapShorts((short *) rects, (unsigned long) nrects * 4);
}
- WriteToClient(client, sizeof(rep), (char *) &rep);
- WriteToClient(client, nrects * sizeof(xRectangle), (char *) rects);
+ WriteToClient(client, sizeof(rep), &rep);
+ WriteToClient(client, nrects * sizeof(xRectangle), rects);
free(rects);
return Success;
}
diff --git a/xorg-server/Xext/shm.c b/xorg-server/Xext/shm.c
index e9c4a4e06..3fa04b921 100644
--- a/xorg-server/Xext/shm.c
+++ b/xorg-server/Xext/shm.c
@@ -87,7 +87,7 @@ in this Software without prior written authorization from The Open Group.
#include "panoramiXsrv.h"
#endif
-#include "modinit.h"
+#include "extinit.h"
typedef struct _ShmDesc {
struct _ShmDesc *next;
@@ -285,19 +285,20 @@ ShmRegisterFbFuncs(ScreenPtr pScreen)
static int
ProcShmQueryVersion(ClientPtr client)
{
- xShmQueryVersionReply rep;
+ xShmQueryVersionReply rep = {
+ .type = X_Reply,
+ .sharedPixmaps = sharedPixmaps,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = SERVER_SHM_MAJOR_VERSION,
+ .minorVersion = SERVER_SHM_MINOR_VERSION,
+ .uid = geteuid(),
+ .gid = getegid(),
+ .pixmapFormat = sharedPixmaps ? ZPixmap : 0
+ };
REQUEST_SIZE_MATCH(xShmQueryVersionReq);
- memset(&rep, 0, sizeof(xShmQueryVersionReply));
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.sharedPixmaps = sharedPixmaps;
- rep.pixmapFormat = sharedPixmaps ? ZPixmap : 0;
- rep.majorVersion = SERVER_SHM_MAJOR_VERSION;
- rep.minorVersion = SERVER_SHM_MINOR_VERSION;
- rep.uid = geteuid();
- rep.gid = getegid();
+
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
@@ -306,7 +307,7 @@ ProcShmQueryVersion(ClientPtr client)
swaps(&rep.uid);
swaps(&rep.gid);
}
- WriteToClient(client, sizeof(xShmQueryVersionReply), (char *) &rep);
+ WriteToClient(client, sizeof(xShmQueryVersionReply), &rep);
return Success;
}
@@ -594,14 +595,14 @@ ProcShmPutImage(ClientPtr client)
stuff->dstX, stuff->dstY, shmdesc->addr + stuff->offset);
if (stuff->sendEvent) {
- xShmCompletionEvent ev;
-
- ev.type = ShmCompletionCode;
- ev.drawable = stuff->drawable;
- ev.minorEvent = X_ShmPutImage;
- ev.majorEvent = ShmReqCode;
- ev.shmseg = stuff->shmseg;
- ev.offset = stuff->offset;
+ xShmCompletionEvent ev = {
+ .type = ShmCompletionCode,
+ .drawable = stuff->drawable,
+ .minorEvent = X_ShmPutImage,
+ .majorEvent = ShmReqCode,
+ .shmseg = stuff->shmseg,
+ .offset = stuff->offset
+ };
WriteEventsToClient(client, 1, (xEvent *) &ev);
}
@@ -616,6 +617,7 @@ ProcShmGetImage(ClientPtr client)
Mask plane = 0;
xShmGetImageReply xgi;
ShmDescPtr shmdesc;
+ VisualID visual = None;
int rc;
REQUEST(xShmGetImageReq);
@@ -630,7 +632,7 @@ ProcShmGetImage(ClientPtr client)
return rc;
VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);
if (pDraw->type == DRAWABLE_WINDOW) {
- if ( /* check for being viewable */
+ if ( /* check for being viewable */
!((WindowPtr) pDraw)->realized ||
/* check for being on screen */
pDraw->x + stuff->x < 0 ||
@@ -646,19 +648,22 @@ ProcShmGetImage(ClientPtr client)
stuff->y + (int) stuff->height >
wBorderWidth((WindowPtr) pDraw) + (int) pDraw->height)
return BadMatch;
- xgi.visual = wVisual(((WindowPtr) pDraw));
+ visual = wVisual(((WindowPtr) pDraw));
}
else {
if (stuff->x < 0 ||
stuff->x + (int) stuff->width > pDraw->width ||
stuff->y < 0 || stuff->y + (int) stuff->height > pDraw->height)
return BadMatch;
- xgi.visual = None;
+ visual = None;
}
- xgi.type = X_Reply;
- xgi.length = 0;
- xgi.sequenceNumber = client->sequence;
- xgi.depth = pDraw->depth;
+ xgi = (xShmGetImageReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .visual = visual,
+ .depth = pDraw->depth
+ };
if (stuff->format == ZPixmap) {
length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height;
}
@@ -702,7 +707,7 @@ ProcShmGetImage(ClientPtr client)
swapl(&xgi.visual);
swapl(&xgi.size);
}
- WriteToClient(client, sizeof(xShmGetImageReply), (char *) &xgi);
+ WriteToClient(client, sizeof(xShmGetImageReply), &xgi);
return Success;
}
@@ -830,11 +835,13 @@ ProcPanoramiXShmGetImage(ClientPtr client)
}
}
- xgi.visual = wVisual(((WindowPtr) pDraw));
- xgi.type = X_Reply;
- xgi.length = 0;
- xgi.sequenceNumber = client->sequence;
- xgi.depth = pDraw->depth;
+ xgi = (xShmGetImageReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .visual = wVisual(((WindowPtr) pDraw)),
+ .depth = pDraw->depth
+ };
if (format == ZPixmap) {
widthBytesLine = PixmapBytePad(w, pDraw->depth);
@@ -877,7 +884,7 @@ ProcPanoramiXShmGetImage(ClientPtr client)
swapl(&xgi.visual);
swapl(&xgi.size);
}
- WriteToClient(client, sizeof(xShmGetImageReply), (char *) &xgi);
+ WriteToClient(client, sizeof(xShmGetImageReply), &xgi);
return Success;
}
@@ -1241,7 +1248,7 @@ SProcShmDispatch(ClientPtr client)
}
void
-ShmExtensionInit(INITARGS)
+ShmExtensionInit(void)
{
ExtensionEntry *extEntry;
int i;
diff --git a/xorg-server/Xext/sync.c b/xorg-server/Xext/sync.c
index 91968e498..8a333dd3a 100644
--- a/xorg-server/Xext/sync.c
+++ b/xorg-server/Xext/sync.c
@@ -76,7 +76,7 @@ PERFORMANCE OF THIS SOFTWARE.
#include <sys/time.h>
#endif
-#include "modinit.h"
+#include "extinit.h"
/*
* Local Global Variables
@@ -437,22 +437,25 @@ SyncSendAlarmNotifyEvents(SyncAlarm * pAlarm)
UpdateCurrentTime();
- ane.type = SyncEventBase + XSyncAlarmNotify;
- ane.kind = XSyncAlarmNotify;
- ane.alarm = pAlarm->alarm_id;
+ ane = (xSyncAlarmNotifyEvent) {
+ .type = SyncEventBase + XSyncAlarmNotify,
+ .kind = XSyncAlarmNotify,
+ .alarm = pAlarm->alarm_id,
+ .alarm_value_hi = XSyncValueHigh32(pTrigger->test_value),
+ .alarm_value_lo = XSyncValueLow32(pTrigger->test_value),
+ .time = currentTime.milliseconds,
+ .state = pAlarm->state
+ };
+
if (pTrigger->pSync && SYNC_COUNTER == pTrigger->pSync->type) {
ane.counter_value_hi = XSyncValueHigh32(pCounter->value);
ane.counter_value_lo = XSyncValueLow32(pCounter->value);
}
- else { /* XXX what else can we do if there's no counter? */
+ else {
+ /* XXX what else can we do if there's no counter? */
ane.counter_value_hi = ane.counter_value_lo = 0;
}
- ane.alarm_value_hi = XSyncValueHigh32(pTrigger->test_value);
- ane.alarm_value_lo = XSyncValueLow32(pTrigger->test_value);
- ane.time = currentTime.milliseconds;
- ane.state = pAlarm->state;
-
/* send to owner */
if (pAlarm->events)
WriteEventsToClient(pAlarm->client, 1, (xEvent *) &ane);
@@ -474,7 +477,7 @@ SyncSendCounterNotifyEvents(ClientPtr client, SyncAwait ** ppAwait,
if (client->clientGone)
return;
- pev = pEvents = malloc(num_events * sizeof(xSyncCounterNotifyEvent));
+ pev = pEvents = calloc(num_events, sizeof(xSyncCounterNotifyEvent));
if (!pEvents)
return;
UpdateCurrentTime();
@@ -1184,21 +1187,20 @@ FreeAlarmClient(void *value, XID id)
static int
ProcSyncInitialize(ClientPtr client)
{
- xSyncInitializeReply rep;
+ xSyncInitializeReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = SERVER_SYNC_MAJOR_VERSION,
+ .minorVersion = SERVER_SYNC_MINOR_VERSION,
+ };
REQUEST_SIZE_MATCH(xSyncInitializeReq);
- memset(&rep, 0, sizeof(xSyncInitializeReply));
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = SERVER_SYNC_MAJOR_VERSION;
- rep.minorVersion = SERVER_SYNC_MINOR_VERSION;
- rep.length = 0;
-
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
- WriteToClient(client, sizeof(rep), (char *) &rep);
+ WriteToClient(client, sizeof(rep), &rep);
return Success;
}
@@ -1208,17 +1210,17 @@ ProcSyncInitialize(ClientPtr client)
static int
ProcSyncListSystemCounters(ClientPtr client)
{
- xSyncListSystemCountersReply rep;
+ xSyncListSystemCountersReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .nCounters = 0,
+ };
SysCounterInfo *psci;
int len = 0;
xSyncSystemCounter *list = NULL, *walklist = NULL;
REQUEST_SIZE_MATCH(xSyncListSystemCountersReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.nCounters = 0;
-
xorg_list_for_each_entry(psci, &SysCounterList, entry) {
/* pad to 4 byte boundary */
len += pad_to_int32(sz_xSyncSystemCounter + strlen(psci->name));
@@ -1263,9 +1265,9 @@ ProcSyncListSystemCounters(ClientPtr client)
namelen));
}
- WriteToClient(client, sizeof(rep), (char *) &rep);
+ WriteToClient(client, sizeof(rep), &rep);
if (len) {
- WriteToClient(client, len, (char *) list);
+ WriteToClient(client, len, list);
free(list);
}
@@ -1328,17 +1330,19 @@ ProcSyncGetPriority(ClientPtr client)
return rc;
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.priority = priorityclient->priority;
+ rep = (xSyncGetPriorityReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .priority = priorityclient->priority
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.priority);
}
- WriteToClient(client, sizeof(xSyncGetPriorityReply), (char *) &rep);
+ WriteToClient(client, sizeof(xSyncGetPriorityReply), &rep);
return Success;
}
@@ -1605,26 +1609,27 @@ ProcSyncQueryCounter(ClientPtr client)
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
-
/* if system counter, ask it what the current value is */
-
if (IsSystemCounter(pCounter)) {
(*pCounter->pSysCounterInfo->QueryValue) ((pointer) pCounter,
&pCounter->value);
}
- rep.value_hi = XSyncValueHigh32(pCounter->value);
- rep.value_lo = XSyncValueLow32(pCounter->value);
+ rep = (xSyncQueryCounterReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .value_hi = XSyncValueHigh32(pCounter->value),
+ .value_lo = XSyncValueLow32(pCounter->value)
+ };
+
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.value_hi);
swapl(&rep.value_lo);
}
- WriteToClient(client, sizeof(xSyncQueryCounterReply), (char *) &rep);
+ WriteToClient(client, sizeof(xSyncQueryCounterReply), &rep);
return Success;
}
@@ -1771,32 +1776,33 @@ ProcSyncQueryAlarm(ClientPtr client)
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.length =
- bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply));
- rep.sequenceNumber = client->sequence;
-
pTrigger = &pAlarm->trigger;
- rep.counter = (pTrigger->pSync) ? pTrigger->pSync->id : None;
-
-#if 0 /* XXX unclear what to do, depends on whether relative value-types
- * are "consumed" immediately and are considered absolute from then
- * on.
- */
- rep.value_type = pTrigger->value_type;
- rep.wait_value_hi = XSyncValueHigh32(pTrigger->wait_value);
- rep.wait_value_lo = XSyncValueLow32(pTrigger->wait_value);
+ rep = (xSyncQueryAlarmReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length =
+ bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply)),
+ .counter = (pTrigger->pSync) ? pTrigger->pSync->id : None,
+
+#if 0 /* XXX unclear what to do, depends on whether relative value-types
+ * are "consumed" immediately and are considered absolute from then
+ * on.
+ */
+ .value_type = pTrigger->value_type,
+ .wait_value_hi = XSyncValueHigh32(pTrigger->wait_value),
+ .wait_value_lo = XSyncValueLow32(pTrigger->wait_value),
#else
- rep.value_type = XSyncAbsolute;
- rep.wait_value_hi = XSyncValueHigh32(pTrigger->test_value);
- rep.wait_value_lo = XSyncValueLow32(pTrigger->test_value);
+ .value_type = XSyncAbsolute,
+ .wait_value_hi = XSyncValueHigh32(pTrigger->test_value),
+ .wait_value_lo = XSyncValueLow32(pTrigger->test_value),
#endif
- rep.test_type = pTrigger->test_type;
- rep.delta_hi = XSyncValueHigh32(pAlarm->delta);
- rep.delta_lo = XSyncValueLow32(pAlarm->delta);
- rep.events = pAlarm->events;
- rep.state = pAlarm->state;
+ .test_type = pTrigger->test_type,
+ .delta_hi = XSyncValueHigh32(pAlarm->delta),
+ .delta_lo = XSyncValueLow32(pAlarm->delta),
+ .events = pAlarm->events,
+ .state = pAlarm->state
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
@@ -1809,7 +1815,7 @@ ProcSyncQueryAlarm(ClientPtr client)
swapl(&rep.delta_lo);
}
- WriteToClient(client, sizeof(xSyncQueryAlarmReply), (char *) &rep);
+ WriteToClient(client, sizeof(xSyncQueryAlarmReply), &rep);
return Success;
}
@@ -1955,18 +1961,20 @@ ProcSyncQueryFence(ClientPtr client)
if (rc != Success)
return rc;
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+ rep = (xSyncQueryFenceReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
- rep.triggered = pFence->funcs.CheckTriggered(pFence);
+ .triggered = pFence->funcs.CheckTriggered(pFence)
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
}
- WriteToClient(client, sizeof(xSyncQueryFenceReply), (char *) &rep);
+ WriteToClient(client, sizeof(xSyncQueryFenceReply), &rep);
return client->noClientException;
}
diff --git a/xorg-server/Xext/syncsrv.h b/xorg-server/Xext/syncsrv.h
index dbed476f2..c68229f46 100644
--- a/xorg-server/Xext/syncsrv.h
+++ b/xorg-server/Xext/syncsrv.h
@@ -134,8 +134,6 @@ extern void SyncChangeCounter(SyncCounter *pCounter,
extern void SyncDestroySystemCounter(pointer pCounter);
-extern void SyncExtensionInit(void);
-
extern SyncCounter *SyncInitDeviceIdleTime(DeviceIntPtr dev);
extern void SyncRemoveDeviceIdleTime(SyncCounter *counter);
#endif /* _SYNCSRV_H_ */
diff --git a/xorg-server/Xext/xcmisc.c b/xorg-server/Xext/xcmisc.c
index 99a6ece43..034bfb63b 100644
--- a/xorg-server/Xext/xcmisc.c
+++ b/xorg-server/Xext/xcmisc.c
@@ -38,27 +38,29 @@ from The Open Group.
#include "extnsionst.h"
#include "swaprep.h"
#include <X11/extensions/xcmiscproto.h>
-#include "modinit.h"
+#include "extinit.h"
#include <stdint.h>
static int
ProcXCMiscGetVersion(ClientPtr client)
{
- xXCMiscGetVersionReply rep;
+ xXCMiscGetVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = XCMiscMajorVersion,
+ .minorVersion = XCMiscMinorVersion
+ };
REQUEST_SIZE_MATCH(xXCMiscGetVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = XCMiscMajorVersion;
- rep.minorVersion = XCMiscMinorVersion;
+
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.majorVersion);
swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xXCMiscGetVersionReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXCMiscGetVersionReply), &rep);
return Success;
}
@@ -70,17 +72,19 @@ ProcXCMiscGetXIDRange(ClientPtr client)
REQUEST_SIZE_MATCH(xXCMiscGetXIDRangeReq);
GetXIDRange(client->index, FALSE, &min_id, &max_id);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.start_id = min_id;
- rep.count = max_id - min_id + 1;
+ rep = (xXCMiscGetXIDRangeReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .start_id = min_id,
+ .count = max_id - min_id + 1
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.start_id);
swapl(&rep.count);
}
- WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), &rep);
return Success;
}
@@ -102,16 +106,18 @@ ProcXCMiscGetXIDList(ClientPtr client)
return BadAlloc;
}
count = GetXIDList(client, stuff->count, pids);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = count;
- rep.count = count;
+ rep = (xXCMiscGetXIDListReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = count,
+ .count = count
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.count);
}
- WriteToClient(client, sizeof(xXCMiscGetXIDListReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXCMiscGetXIDListReply), &rep);
if (count) {
client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write;
WriteSwappedDataToClient(client, count * sizeof(XID), pids);
@@ -184,7 +190,7 @@ SProcXCMiscDispatch(ClientPtr client)
}
void
-XCMiscExtensionInit(INITARGS)
+XCMiscExtensionInit(void)
{
AddExtension(XCMiscExtensionName, 0, 0,
ProcXCMiscDispatch, SProcXCMiscDispatch,
diff --git a/xorg-server/Xext/xf86bigfont.c b/xorg-server/Xext/xf86bigfont.c
index 9de785678..b4ef5e460 100644
--- a/xorg-server/Xext/xf86bigfont.c
+++ b/xorg-server/Xext/xf86bigfont.c
@@ -71,6 +71,7 @@
#include "gcstruct.h"
#include "dixfontstr.h"
#include "extnsionst.h"
+#include "extinit.h"
#include "protocol-versions.h"
#include <X11/extensions/xf86bigfproto.h>
@@ -277,25 +278,23 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
xXF86BigfontQueryVersionReply reply;
REQUEST_SIZE_MATCH(xXF86BigfontQueryVersionReq);
- reply.type = X_Reply;
- reply.length = 0;
- reply.sequenceNumber = client->sequence;
- reply.majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION;
- reply.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION;
- reply.uid = geteuid();
- reply.gid = getegid();
+ reply = (xXF86BigfontQueryVersionReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION,
+ .minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION,
+ .uid = geteuid(),
+ .gid = getegid(),
#ifdef HAS_SHM
- reply.signature = signature;
+ .signature = signature,
+ .capabilities = (LocalClient(client) && !client->swapped)
+ ? XF86Bigfont_CAP_LocalShm : 0
#else
- reply.signature = 0; /* This is redundant. Avoids uninitialized memory. */
+ .signature = 0,
+ .capabilities = 0
#endif
- reply.capabilities =
-#ifdef HAS_SHM
- (LocalClient(client) && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0)
-#else
- 0
-#endif
- ; /* may add more bits here in future versions */
+ };
if (client->swapped) {
char tmp;
@@ -307,8 +306,7 @@ ProcXF86BigfontQueryVersion(ClientPtr client)
swapl(&reply.gid);
swapl(&reply.signature);
}
- WriteToClient(client,
- sizeof(xXF86BigfontQueryVersionReply), (char *) &reply);
+ WriteToClient(client, sizeof(xXF86BigfontQueryVersionReply), &reply);
return Success;
}
@@ -555,7 +553,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
? nUniqCharInfos * sizeof(xCharInfo)
+ (nCharInfos + 1) / 2 * 2 * sizeof(CARD16)
: 0);
- xXF86BigfontQueryFontReply *reply = malloc(rlength);
+ xXF86BigfontQueryFontReply *reply = calloc(1, rlength);
char *p;
if (!reply) {
@@ -644,7 +642,7 @@ ProcXF86BigfontQueryFont(ClientPtr client)
}
}
}
- WriteToClient(client, rlength, (char *) reply);
+ WriteToClient(client, rlength, reply);
free(reply);
if (nCharInfos > 0) {
if (shmid == -1)
diff --git a/xorg-server/Xext/xf86bigfontsrv.h b/xorg-server/Xext/xf86bigfontsrv.h
index 3c4887dfd..eab528775 100644
--- a/xorg-server/Xext/xf86bigfontsrv.h
+++ b/xorg-server/Xext/xf86bigfontsrv.h
@@ -1,34 +1,33 @@
-/*
- * Copyright © 2010 Yaakov Selkowitz
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
- * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
- * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
- * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
- * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-#ifndef _XF86BIGFONTSRV_H_
-#define _XF86BIGFONTSRV_H_
-
-#include <X11/fonts/font.h>
-
-extern void XFree86BigfontExtensionInit(void);
-extern void XF86BigfontFreeFontShm(FontPtr);
-extern void XF86BigfontCleanup(void);
-
-#endif
+/*
+ * Copyright © 2010 Yaakov Selkowitz
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _XF86BIGFONTSRV_H_
+#define _XF86BIGFONTSRV_H_
+
+#include <X11/fonts/font.h>
+
+extern void XF86BigfontFreeFontShm(FontPtr);
+extern void XF86BigfontCleanup(void);
+
+#endif
diff --git a/xorg-server/Xext/xres.c b/xorg-server/Xext/xres.c
index dbefeebdb..7d21ad7e9 100644
--- a/xorg-server/Xext/xres.c
+++ b/xorg-server/Xext/xres.c
@@ -21,7 +21,7 @@
#include "pixmapstr.h"
#include "windowstr.h"
#include "gcstruct.h"
-#include "modinit.h"
+#include "extinit.h"
#include "protocol-versions.h"
#include "client.h"
#include "list.h"
@@ -190,26 +190,29 @@ DestroyConstructResourceBytesCtx(ConstructResourceBytesCtx *ctx)
ht_destroy(ctx->visitedResources);
}
+extern void ResExtensionInit(void);
+
static int
ProcXResQueryVersion(ClientPtr client)
{
REQUEST(xXResQueryVersionReq);
- xXResQueryVersionReply rep;
+ xXResQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .server_major = SERVER_XRES_MAJOR_VERSION,
+ .server_minor = SERVER_XRES_MINOR_VERSION
+ };
REQUEST_SIZE_MATCH(xXResQueryVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.server_major = SERVER_XRES_MAJOR_VERSION;
- rep.server_minor = SERVER_XRES_MINOR_VERSION;
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.server_major);
swaps(&rep.server_minor);
}
- WriteToClient(client, sizeof(xXResQueryVersionReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXResQueryVersionReply), &rep);
return Success;
}
@@ -233,16 +236,18 @@ ProcXResQueryClients(ClientPtr client)
}
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_clients = num_clients;
- rep.length = bytes_to_int32(rep.num_clients * sz_xXResClient);
+ rep = (xXResQueryClientsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(num_clients * sz_xXResClient),
+ .num_clients = num_clients
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.num_clients);
}
- WriteToClient(client, sizeof(xXResQueryClientsReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXResQueryClientsReply), &rep);
if (num_clients) {
xXResClient scratch;
@@ -255,7 +260,7 @@ ProcXResQueryClients(ClientPtr client)
swapl(&scratch.resource_base);
swapl(&scratch.resource_mask);
}
- WriteToClient(client, sz_xXResClient, (char *) &scratch);
+ WriteToClient(client, sz_xXResClient, &scratch);
}
}
@@ -300,18 +305,19 @@ ProcXResQueryClientResources(ClientPtr client)
num_types++;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_types = num_types;
- rep.length = bytes_to_int32(rep.num_types * sz_xXResType);
+ rep = (xXResQueryClientResourcesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(num_types * sz_xXResType),
+ .num_types = num_types
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.num_types);
}
- WriteToClient(client, sizeof(xXResQueryClientResourcesReply),
- (char *) &rep);
+ WriteToClient(client, sizeof(xXResQueryClientResourcesReply), &rep);
if (num_types) {
xXResType scratch;
@@ -337,7 +343,7 @@ ProcXResQueryClientResources(ClientPtr client)
swapl(&scratch.resource_type);
swapl(&scratch.count);
}
- WriteToClient(client, sz_xXResType, (char *) &scratch);
+ WriteToClient(client, sz_xXResType, &scratch);
}
}
@@ -471,23 +477,24 @@ ProcXResQueryClientPixmapBytes(ClientPtr client)
(pointer)(&bytes));
#endif
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.bytes = bytes;
+ rep = (xXResQueryClientPixmapBytesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .bytes = bytes,
#ifdef _XSERVER64
- rep.bytes_overflow = bytes >> 32;
+ .bytes_overflow = bytes >> 32
#else
- rep.bytes_overflow = 0;
+ .bytes_overflow = 0
#endif
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swapl(&rep.bytes);
swapl(&rep.bytes_overflow);
}
- WriteToClient(client, sizeof(xXResQueryClientPixmapBytesReply),
- (char *) &rep);
+ WriteToClient(client, sizeof(xXResQueryClientPixmapBytesReply), &rep);
return Success;
}
@@ -652,7 +659,6 @@ ProcXResQueryClientIds (ClientPtr client)
{
REQUEST(xXResQueryClientIdsReq);
- xXResQueryClientIdsReply rep;
xXResClientIdSpec *specs = (void*) ((char*) stuff + sizeof(*stuff));
int rc;
ConstructClientIdCtx ctx;
@@ -666,12 +672,14 @@ ProcXResQueryClientIds (ClientPtr client)
rc = ConstructClientIds(client, stuff->numSpecs, specs, &ctx);
if (rc == Success) {
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
+ xXResQueryClientIdsReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(ctx.resultBytes),
+ .numIds = ctx.numIds
+ };
assert((ctx.resultBytes & 3) == 0);
- rep.length = bytes_to_int32(ctx.resultBytes);
- rep.numIds = ctx.numIds;
if (client->swapped) {
swaps (&rep.sequenceNumber);
@@ -679,7 +687,7 @@ ProcXResQueryClientIds (ClientPtr client)
swapl (&rep.numIds);
}
- WriteToClient(client,sizeof(rep),(char*)&rep);
+ WriteToClient(client, sizeof(rep), &rep);
WriteFragmentsToClient(client, &ctx.response);
}
@@ -1030,7 +1038,6 @@ ProcXResQueryResourceBytes (ClientPtr client)
{
REQUEST(xXResQueryResourceBytesReq);
- xXResQueryResourceBytesReply rep;
int rc;
ConstructResourceBytesCtx ctx;
@@ -1048,10 +1055,12 @@ ProcXResQueryResourceBytes (ClientPtr client)
rc = ConstructResourceBytes(stuff->client, &ctx);
if (rc == Success) {
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.numSizes = ctx.numSizes;
- rep.length = bytes_to_int32(ctx.resultBytes);
+ xXResQueryResourceBytesReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(ctx.resultBytes),
+ .numSizes = ctx.numSizes
+ };
if (client->swapped) {
swaps (&rep.sequenceNumber);
@@ -1061,7 +1070,7 @@ ProcXResQueryResourceBytes (ClientPtr client)
SwapXResQueryResourceBytes(&ctx.response);
}
- WriteToClient(client,sizeof(rep),(char*)&rep);
+ WriteToClient(client, sizeof(rep), &rep);
WriteFragmentsToClient(client, &ctx.response);
}
@@ -1177,7 +1186,7 @@ SProcResDispatch (ClientPtr client)
}
void
-ResExtensionInit(INITARGS)
+ResExtensionInit(void)
{
(void) AddExtension(XRES_NAME, 0, 0,
ProcResDispatch, SProcResDispatch,
diff --git a/xorg-server/Xext/xselinux_ext.c b/xorg-server/Xext/xselinux_ext.c
index 342abb1a6..3115f03ea 100644
--- a/xorg-server/Xext/xselinux_ext.c
+++ b/xorg-server/Xext/xselinux_ext.c
@@ -26,7 +26,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#include "windowstr.h"
#include "propertyst.h"
#include "extnsionst.h"
-#include "modinit.h"
+#include "extinit.h"
#include "xselinuxint.h"
#define CTX_DEV offsetof(SELinuxSubjectRec, dev_create_sid)
@@ -63,20 +63,20 @@ SELinuxCopyContext(char *ptr, unsigned len)
static int
ProcSELinuxQueryVersion(ClientPtr client)
{
- SELinuxQueryVersionReply rep;
-
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.server_major = SELINUX_MAJOR_VERSION;
- rep.server_minor = SELINUX_MINOR_VERSION;
+ SELinuxQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .server_major = SELINUX_MAJOR_VERSION,
+ .server_minor = SELINUX_MINOR_VERSION
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
swapl(&rep.length);
swaps(&rep.server_major);
swaps(&rep.server_minor);
}
- WriteToClient(client, sizeof(rep), (char *) &rep);
+ WriteToClient(client, sizeof(rep), &rep);
return Success;
}
@@ -93,10 +93,12 @@ SELinuxSendContextReply(ClientPtr client, security_id_t sid)
len = strlen(ctx) + 1;
}
- rep.type = X_Reply;
- rep.length = bytes_to_int32(len);
- rep.sequenceNumber = client->sequence;
- rep.context_len = len;
+ rep = (SELinuxGetContextReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = bytes_to_int32(len),
+ .context_len = len
+ };
if (client->swapped) {
swapl(&rep.length);
@@ -104,7 +106,7 @@ SELinuxSendContextReply(ClientPtr client, security_id_t sid)
swapl(&rep.context_len);
}
- WriteToClient(client, sizeof(SELinuxGetContextReply), (char *) &rep);
+ WriteToClient(client, sizeof(SELinuxGetContextReply), &rep);
WriteToClient(client, len, ctx);
freecon(ctx);
return Success;
@@ -372,10 +374,12 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
}
/* Send reply to client */
- rep.type = X_Reply;
- rep.length = size;
- rep.sequenceNumber = client->sequence;
- rep.count = count;
+ rep = (SELinuxListItemsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = size,
+ .count = count
+ };
if (client->swapped) {
swapl(&rep.length);
@@ -383,8 +387,8 @@ SELinuxSendItemsToClient(ClientPtr client, SELinuxListItemRec * items,
swapl(&rep.count);
}
- WriteToClient(client, sizeof(SELinuxListItemsReply), (char *) &rep);
- WriteToClient(client, size * 4, (char *) buf);
+ WriteToClient(client, sizeof(SELinuxListItemsReply), &rep);
+ WriteToClient(client, size * 4, buf);
/* Free stuff and return */
rc = Success;
@@ -683,7 +687,7 @@ SELinuxResetProc(ExtensionEntry * extEntry)
}
void
-SELinuxExtensionInit(INITARGS)
+SELinuxExtensionInit(void)
{
ExtensionEntry *extEntry;
diff --git a/xorg-server/Xext/xtest.c b/xorg-server/Xext/xtest.c
index e659b4154..c593372e7 100644
--- a/xorg-server/Xext/xtest.c
+++ b/xorg-server/Xext/xtest.c
@@ -55,7 +55,7 @@
#include "eventstr.h"
#include "inpututils.h"
-#include "modinit.h"
+#include "extinit.h"
extern int DeviceValuator;
@@ -88,19 +88,21 @@ static int XTestSwapFakeInput(ClientPtr /* client */ ,
static int
ProcXTestGetVersion(ClientPtr client)
{
- xXTestGetVersionReply rep;
+ xXTestGetVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .majorVersion = XTestMajorVersion,
+ .minorVersion = XTestMinorVersion
+ };
REQUEST_SIZE_MATCH(xXTestGetVersionReq);
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.majorVersion = XTestMajorVersion;
- rep.minorVersion = XTestMinorVersion;
+
if (client->swapped) {
swaps(&rep.sequenceNumber);
swaps(&rep.minorVersion);
}
- WriteToClient(client, sizeof(xXTestGetVersionReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXTestGetVersionReply), &rep);
return Success;
}
@@ -134,14 +136,16 @@ ProcXTestCompareCursor(ClientPtr client)
return rc;
}
}
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
- rep.same = (wCursor(pWin) == pCursor);
+ rep = (xXTestCompareCursorReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .same = (wCursor(pWin) == pCursor)
+ };
if (client->swapped) {
swaps(&rep.sequenceNumber);
}
- WriteToClient(client, sizeof(xXTestCompareCursorReply), (char *) &rep);
+ WriteToClient(client, sizeof(xXTestCompareCursorReply), &rep);
return Success;
}
@@ -675,7 +679,7 @@ XTestExtensionTearDown(ExtensionEntry * e)
}
void
-XTestExtensionInit(INITARGS)
+XTestExtensionInit(void)
{
AddExtension(XTestExtensionName, 0, 0,
ProcXTestDispatch, SProcXTestDispatch,
diff --git a/xorg-server/Xext/xvdisp.c b/xorg-server/Xext/xvdisp.c
index 8abd51c11..31b77839f 100644
--- a/xorg-server/Xext/xvdisp.c
+++ b/xorg-server/Xext/xvdisp.c
@@ -62,7 +62,7 @@ SWriteQueryExtensionReply(ClientPtr client, xvQueryExtensionReply * rep)
swaps(&rep->version);
swaps(&rep->revision);
- (void) WriteToClient(client, sz_xvQueryExtensionReply, (char *) rep);
+ WriteToClient(client, sz_xvQueryExtensionReply, rep);
return Success;
}
@@ -74,7 +74,7 @@ SWriteQueryAdaptorsReply(ClientPtr client, xvQueryAdaptorsReply * rep)
swapl(&rep->length);
swaps(&rep->num_adaptors);
- (void) WriteToClient(client, sz_xvQueryAdaptorsReply, (char *) rep);
+ WriteToClient(client, sz_xvQueryAdaptorsReply, rep);
return Success;
}
@@ -86,7 +86,7 @@ SWriteQueryEncodingsReply(ClientPtr client, xvQueryEncodingsReply * rep)
swapl(&rep->length);
swaps(&rep->num_encodings);
- (void) WriteToClient(client, sz_xvQueryEncodingsReply, (char *) rep);
+ WriteToClient(client, sz_xvQueryEncodingsReply, rep);
return Success;
}
@@ -99,7 +99,7 @@ SWriteAdaptorInfo(ClientPtr client, xvAdaptorInfo * pAdaptor)
swaps(&pAdaptor->num_ports);
swaps(&pAdaptor->num_formats);
- (void) WriteToClient(client, sz_xvAdaptorInfo, (char *) pAdaptor);
+ WriteToClient(client, sz_xvAdaptorInfo, pAdaptor);
return Success;
}
@@ -114,7 +114,7 @@ SWriteEncodingInfo(ClientPtr client, xvEncodingInfo * pEncoding)
swaps(&pEncoding->height);
swapl(&pEncoding->rate.numerator);
swapl(&pEncoding->rate.denominator);
- (void) WriteToClient(client, sz_xvEncodingInfo, (char *) pEncoding);
+ WriteToClient(client, sz_xvEncodingInfo, pEncoding);
return Success;
}
@@ -123,7 +123,7 @@ static int
SWriteFormat(ClientPtr client, xvFormat * pFormat)
{
swapl(&pFormat->visual);
- (void) WriteToClient(client, sz_xvFormat, (char *) pFormat);
+ WriteToClient(client, sz_xvFormat, pFormat);
return Success;
}
@@ -135,7 +135,7 @@ SWriteAttributeInfo(ClientPtr client, xvAttributeInfo * pAtt)
swapl(&pAtt->size);
swapl(&pAtt->min);
swapl(&pAtt->max);
- (void) WriteToClient(client, sz_xvAttributeInfo, (char *) pAtt);
+ WriteToClient(client, sz_xvAttributeInfo, pAtt);
return Success;
}
@@ -157,7 +157,7 @@ SWriteImageFormatInfo(ClientPtr client, xvImageFormatInfo * pImage)
swapl(&pImage->vert_u_period);
swapl(&pImage->vert_v_period);
- (void) WriteToClient(client, sz_xvImageFormatInfo, (char *) pImage);
+ WriteToClient(client, sz_xvImageFormatInfo, pImage);
return Success;
}
@@ -168,7 +168,7 @@ SWriteGrabPortReply(ClientPtr client, xvGrabPortReply * rep)
swaps(&rep->sequenceNumber);
swapl(&rep->length);
- (void) WriteToClient(client, sz_xvGrabPortReply, (char *) rep);
+ WriteToClient(client, sz_xvGrabPortReply, rep);
return Success;
}
@@ -180,7 +180,7 @@ SWriteGetPortAttributeReply(ClientPtr client, xvGetPortAttributeReply * rep)
swapl(&rep->length);
swapl(&rep->value);
- (void) WriteToClient(client, sz_xvGetPortAttributeReply, (char *) rep);
+ WriteToClient(client, sz_xvGetPortAttributeReply, rep);
return Success;
}
@@ -193,7 +193,7 @@ SWriteQueryBestSizeReply(ClientPtr client, xvQueryBestSizeReply * rep)
swaps(&rep->actual_width);
swaps(&rep->actual_height);
- (void) WriteToClient(client, sz_xvQueryBestSizeReply, (char *) rep);
+ WriteToClient(client, sz_xvQueryBestSizeReply, rep);
return Success;
}
@@ -207,7 +207,7 @@ SWriteQueryPortAttributesReply(ClientPtr client,
swapl(&rep->num_attributes);
swapl(&rep->text_size);
- (void) WriteToClient(client, sz_xvQueryPortAttributesReply, (char *) rep);
+ WriteToClient(client, sz_xvQueryPortAttributesReply, rep);
return Success;
}
@@ -223,7 +223,7 @@ SWriteQueryImageAttributesReply(ClientPtr client,
swaps(&rep->width);
swaps(&rep->height);
- (void) WriteToClient(client, sz_xvQueryImageAttributesReply, (char *) rep);
+ WriteToClient(client, sz_xvQueryImageAttributesReply, rep);
return Success;
}
@@ -235,66 +235,66 @@ SWriteListImageFormatsReply(ClientPtr client, xvListImageFormatsReply * rep)
swapl(&rep->length);
swapl(&rep->num_formats);
- (void) WriteToClient(client, sz_xvListImageFormatsReply, (char *) rep);
+ WriteToClient(client, sz_xvListImageFormatsReply, rep);
return Success;
}
#define _WriteQueryAdaptorsReply(_c,_d) \
if ((_c)->swapped) SWriteQueryAdaptorsReply(_c, _d); \
- else WriteToClient(_c, sz_xvQueryAdaptorsReply, (char*)_d)
+ else WriteToClient(_c, sz_xvQueryAdaptorsReply, _d)
#define _WriteQueryExtensionReply(_c,_d) \
if ((_c)->swapped) SWriteQueryExtensionReply(_c, _d); \
- else WriteToClient(_c, sz_xvQueryExtensionReply, (char*)_d)
+ else WriteToClient(_c, sz_xvQueryExtensionReply, _d)
#define _WriteQueryEncodingsReply(_c,_d) \
if ((_c)->swapped) SWriteQueryEncodingsReply(_c, _d); \
- else WriteToClient(_c, sz_xvQueryEncodingsReply, (char*)_d)
+ else WriteToClient(_c, sz_xvQueryEncodingsReply, _d)
#define _WriteAdaptorInfo(_c,_d) \
if ((_c)->swapped) SWriteAdaptorInfo(_c, _d); \
- else WriteToClient(_c, sz_xvAdaptorInfo, (char*)_d)
+ else WriteToClient(_c, sz_xvAdaptorInfo, _d)
#define _WriteAttributeInfo(_c,_d) \
if ((_c)->swapped) SWriteAttributeInfo(_c, _d); \
- else WriteToClient(_c, sz_xvAttributeInfo, (char*)_d)
+ else WriteToClient(_c, sz_xvAttributeInfo, _d)
#define _WriteEncodingInfo(_c,_d) \
if ((_c)->swapped) SWriteEncodingInfo(_c, _d); \
- else WriteToClient(_c, sz_xvEncodingInfo, (char*)_d)
+ else WriteToClient(_c, sz_xvEncodingInfo, _d)
#define _WriteFormat(_c,_d) \
if ((_c)->swapped) SWriteFormat(_c, _d); \
- else WriteToClient(_c, sz_xvFormat, (char*)_d)
+ else WriteToClient(_c, sz_xvFormat, _d)
#define _WriteGrabPortReply(_c,_d) \
if ((_c)->swapped) SWriteGrabPortReply(_c, _d); \
- else WriteToClient(_c, sz_xvGrabPortReply, (char*)_d)
+ else WriteToClient(_c, sz_xvGrabPortReply, _d)
#define _WriteGetPortAttributeReply(_c,_d) \
if ((_c)->swapped) SWriteGetPortAttributeReply(_c, _d); \
- else WriteToClient(_c, sz_xvGetPortAttributeReply, (char*)_d)
+ else WriteToClient(_c, sz_xvGetPortAttributeReply, _d)
#define _WriteQueryBestSizeReply(_c,_d) \
if ((_c)->swapped) SWriteQueryBestSizeReply(_c, _d); \
- else WriteToClient(_c, sz_xvQueryBestSizeReply,(char*) _d)
+ else WriteToClient(_c, sz_xvQueryBestSizeReply, _d)
#define _WriteQueryPortAttributesReply(_c,_d) \
if ((_c)->swapped) SWriteQueryPortAttributesReply(_c, _d); \
- else WriteToClient(_c, sz_xvQueryPortAttributesReply,(char*) _d)
+ else WriteToClient(_c, sz_xvQueryPortAttributesReply, _d)
#define _WriteQueryImageAttributesReply(_c,_d) \
if ((_c)->swapped) SWriteQueryImageAttributesReply(_c, _d); \
- else WriteToClient(_c, sz_xvQueryImageAttributesReply,(char*) _d)
+ else WriteToClient(_c, sz_xvQueryImageAttributesReply, _d)
#define _WriteListImageFormatsReply(_c,_d) \
if ((_c)->swapped) SWriteListImageFormatsReply(_c, _d); \
- else WriteToClient(_c, sz_xvListImageFormatsReply,(char*) _d)
+ else WriteToClient(_c, sz_xvListImageFormatsReply, _d)
#define _WriteImageFormatInfo(_c,_d) \
if ((_c)->swapped) SWriteImageFormatInfo(_c, _d); \
- else WriteToClient(_c, sz_xvImageFormatInfo, (char*)_d)
+ else WriteToClient(_c, sz_xvImageFormatInfo, _d)
#define _AllocatePort(_i,_p) \
((_p)->id != _i) ? (* (_p)->pAdaptor->ddAllocatePort)(_i,_p,&_p) : Success
@@ -302,17 +302,17 @@ SWriteListImageFormatsReply(ClientPtr client, xvListImageFormatsReply * rep)
static int
ProcXvQueryExtension(ClientPtr client)
{
- xvQueryExtensionReply rep;
+ xvQueryExtensionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .version = XvVersion,
+ .revision = XvRevision
+ };
/* REQUEST(xvQueryExtensionReq); */
REQUEST_SIZE_MATCH(xvQueryExtensionReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.version = XvVersion;
- rep.revision = XvRevision;
-
_WriteQueryExtensionReply(client, &rep);
return Success;
@@ -343,10 +343,12 @@ ProcXvQueryAdaptors(ClientPtr client)
pxvs = (XvScreenPtr) dixLookupPrivate(&pScreen->devPrivates,
XvGetScreenKey());
if (!pxvs) {
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_adaptors = 0;
- rep.length = 0;
+ rep = (xvQueryAdaptorsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .num_adaptors = 0
+ };
_WriteQueryAdaptorsReply(client, &rep);
@@ -355,9 +357,11 @@ ProcXvQueryAdaptors(ClientPtr client)
(*pxvs->ddQueryAdaptors) (pScreen, &pxvs->pAdaptors, &pxvs->nAdaptors);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_adaptors = pxvs->nAdaptors;
+ rep = (xvQueryAdaptorsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .num_adaptors = pxvs->nAdaptors
+ };
/* CALCULATE THE TOTAL SIZE OF THE REPLY IN BYTES */
@@ -429,9 +433,11 @@ ProcXvQueryEncodings(ClientPtr client)
return status;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_encodings = pPort->pAdaptor->nEncodings;
+ rep = (xvQueryEncodingsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .num_encodings = pPort->pAdaptor->nEncodings
+ };
/* FOR EACH ENCODING ADD UP THE BYTES FOR ENCODING NAMES */
@@ -662,11 +668,12 @@ ProcXvGrabPort(ClientPtr client)
if (status != Success) {
return status;
}
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.result = result;
+ rep = (xvGrabPortReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .result = result
+ };
_WriteGrabPortReply(client, &rep);
@@ -777,10 +784,12 @@ ProcXvGetPortAttribute(ClientPtr client)
return status;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.value = value;
+ rep = (xvGetPortAttributeReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .value = value
+ };
_WriteGetPortAttributeReply(client, &rep);
@@ -805,17 +814,18 @@ ProcXvQueryBestSize(ClientPtr client)
return status;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
-
(*pPort->pAdaptor->ddQueryBestSize) (client, pPort, stuff->motion,
stuff->vid_w, stuff->vid_h,
stuff->drw_w, stuff->drw_h,
&actual_width, &actual_height);
- rep.actual_width = actual_width;
- rep.actual_height = actual_height;
+ rep = (xvQueryBestSizeReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .actual_width = actual_width,
+ .actual_height = actual_height
+ };
_WriteQueryBestSizeReply(client, &rep);
@@ -841,10 +851,12 @@ ProcXvQueryPortAttributes(ClientPtr client)
return status;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_attributes = pPort->pAdaptor->nAttributes;
- rep.text_size = 0;
+ rep = (xvQueryPortAttributesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .num_attributes = pPort->pAdaptor->nAttributes,
+ .text_size = 0
+ };
for (i = 0, pAtt = pPort->pAdaptor->pAttributes;
i < pPort->pAdaptor->nAttributes; i++, pAtt++) {
@@ -1017,14 +1029,14 @@ ProcXvShmPutImage(ClientPtr client)
stuff->send_event, stuff->width, stuff->height);
if ((status == Success) && stuff->send_event) {
- xShmCompletionEvent ev;
-
- ev.type = ShmCompletionCode;
- ev.drawable = stuff->drawable;
- ev.minorEvent = xv_ShmPutImage;
- ev.majorEvent = XvReqCode;
- ev.shmseg = stuff->shmseg;
- ev.offset = stuff->offset;
+ xShmCompletionEvent ev = {
+ .type = ShmCompletionCode,
+ .drawable = stuff->drawable,
+ .minorEvent = xv_ShmPutImage,
+ .majorEvent = XvReqCode,
+ .shmseg = stuff->shmseg,
+ .offset = stuff->offset
+ };
WriteEventsToClient(client, 1, (xEvent *) &ev);
}
@@ -1089,18 +1101,20 @@ ProcXvQueryImageAttributes(ClientPtr client)
&width, &height, offsets,
pitches);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = planeLength = num_planes << 1;
- rep.num_planes = num_planes;
- rep.width = width;
- rep.height = height;
- rep.data_size = size;
+ rep = (xvQueryImageAttributesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = planeLength = num_planes << 1,
+ .num_planes = num_planes,
+ .width = width,
+ .height = height,
+ .data_size = size
+ };
_WriteQueryImageAttributesReply(client, &rep);
if (client->swapped)
SwapLongs((CARD32 *) offsets, planeLength);
- WriteToClient(client, planeLength << 2, (char *) offsets);
+ WriteToClient(client, planeLength << 2, offsets);
free(offsets);
@@ -1122,11 +1136,13 @@ ProcXvListImageFormats(ClientPtr client)
VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num_formats = pPort->pAdaptor->nImages;
- rep.length =
- bytes_to_int32(pPort->pAdaptor->nImages * sz_xvImageFormatInfo);
+ rep = (xvListImageFormatsReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .num_formats = pPort->pAdaptor->nImages,
+ .length =
+ bytes_to_int32(pPort->pAdaptor->nImages * sz_xvImageFormatInfo)
+ };
_WriteListImageFormatsReply(client, &rep);
diff --git a/xorg-server/Xext/xvdix.h b/xorg-server/Xext/xvdix.h
index 59fc1ffc8..9c6160c3b 100644
--- a/xorg-server/Xext/xvdix.h
+++ b/xorg-server/Xext/xvdix.h
@@ -55,7 +55,6 @@ SOFTWARE.
#include "scrnintstr.h"
#include <X11/extensions/Xvproto.h>
-#ifndef XorgLoader
extern _X_EXPORT unsigned long XvExtensionGeneration;
extern _X_EXPORT unsigned long XvScreenGeneration;
extern _X_EXPORT unsigned long XvResourceGeneration;
@@ -70,7 +69,6 @@ extern _X_EXPORT RESTYPE XvRTGrab;
extern _X_EXPORT RESTYPE XvRTVideoNotify;
extern _X_EXPORT RESTYPE XvRTVideoNotifyList;
extern _X_EXPORT RESTYPE XvRTPortNotify;
-#endif
typedef struct {
int numerator;
@@ -231,11 +229,9 @@ typedef struct {
#define _XvBadPort (XvBadPort+XvErrorBase)
#define _XvBadEncoding (XvBadEncoding+XvErrorBase)
-#ifndef XorgLoader
extern _X_EXPORT int ProcXvDispatch(ClientPtr);
extern _X_EXPORT int SProcXvDispatch(ClientPtr);
-extern _X_EXPORT void XvExtensionInit(void);
extern _X_EXPORT int XvScreenInit(ScreenPtr);
extern _X_EXPORT DevPrivateKey XvGetScreenKey(void);
extern _X_EXPORT unsigned long XvGetRTPort(void);
@@ -268,6 +264,4 @@ extern _X_EXPORT int XvdiPreemptVideo(ClientPtr, XvPortPtr, DrawablePtr);
extern _X_EXPORT int XvdiMatchPort(XvPortPtr, DrawablePtr);
extern _X_EXPORT int XvdiGrabPort(ClientPtr, XvPortPtr, Time, int *);
extern _X_EXPORT int XvdiUngrabPort(ClientPtr, XvPortPtr, Time);
-#endif /* XorgLoader */
-
#endif /* XVDIX_H */
diff --git a/xorg-server/Xext/xvmain.c b/xorg-server/Xext/xvmain.c
index 736114b6e..c2860b86a 100644
--- a/xorg-server/Xext/xvmain.c
+++ b/xorg-server/Xext/xvmain.c
@@ -88,6 +88,7 @@ SOFTWARE.
#include "pixmapstr.h"
#include "gc.h"
#include "extnsionst.h"
+#include "extinit.h"
#include "dixstruct.h"
#include "resource.h"
#include "opaque.h"
@@ -507,19 +508,20 @@ XvdiDestroyEncoding(pointer value, XID id)
static int
XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
{
- xvEvent event;
XvVideoNotifyPtr pn;
dixLookupResourceByType((pointer *) &pn, pDraw->id, XvRTVideoNotifyList,
serverClient, DixReadAccess);
while (pn) {
+ xvEvent event = {
+ .u.videoNotify.reason = reason,
+ .u.videoNotify.time = currentTime.milliseconds,
+ .u.videoNotify.drawable = pDraw->id,
+ .u.videoNotify.port = pPort->id
+ };
event.u.u.type = XvEventBase + XvVideoNotify;
- event.u.videoNotify.time = currentTime.milliseconds;
- event.u.videoNotify.drawable = pDraw->id;
- event.u.videoNotify.port = pPort->id;
- event.u.videoNotify.reason = reason;
- WriteEventsToClient(pn->client, 1, (xEventPtr) & event);
+ WriteEventsToClient(pn->client, 1, (xEventPtr) &event);
pn = pn->next;
}
@@ -530,18 +532,19 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason)
int
XvdiSendPortNotify(XvPortPtr pPort, Atom attribute, INT32 value)
{
- xvEvent event;
XvPortNotifyPtr pn;
pn = pPort->pNotify;
while (pn) {
+ xvEvent event = {
+ .u.portNotify.time = currentTime.milliseconds,
+ .u.portNotify.port = pPort->id,
+ .u.portNotify.attribute = attribute,
+ .u.portNotify.value = value
+ };
event.u.u.type = XvEventBase + XvPortNotify;
- event.u.portNotify.time = currentTime.milliseconds;
- event.u.portNotify.port = pPort->id;
- event.u.portNotify.attribute = attribute;
- event.u.portNotify.value = value;
- WriteEventsToClient(pn->client, 1, (xEventPtr) & event);
+ WriteEventsToClient(pn->client, 1, (xEventPtr) &event);
pn = pn->next;
}
diff --git a/xorg-server/Xext/xvmc.c b/xorg-server/Xext/xvmc.c
index 4aaff4d9f..8d93cc3b0 100644
--- a/xorg-server/Xext/xvmc.c
+++ b/xorg-server/Xext/xvmc.c
@@ -13,6 +13,7 @@
#include "resource.h"
#include "scrnintstr.h"
#include "extnsionst.h"
+#include "extinit.h"
#include "servermd.h"
#include <X11/Xfuncproto.h>
#include "xvdix.h"
@@ -36,8 +37,6 @@ static DevPrivateKeyRec XvMCScreenKeyRec;
#define XvMCScreenKey (&XvMCScreenKeyRec)
static Bool XvMCInUse;
-unsigned long XvMCGeneration = 0;
-
int XvMCReqCode;
int XvMCEventBase;
@@ -45,6 +44,8 @@ static RESTYPE XvMCRTContext;
static RESTYPE XvMCRTSurface;
static RESTYPE XvMCRTSubpicture;
+int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr) = NULL;
+
typedef struct {
int num_adaptors;
XvMCAdaptorPtr adaptors;
@@ -109,16 +110,18 @@ XvMCDestroySubpictureRes(pointer data, XID id)
static int
ProcXvMCQueryVersion(ClientPtr client)
{
- xvmcQueryVersionReply rep;
+ xvmcQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0,
+ .major = SERVER_XVMC_MAJOR_VERSION,
+ .minor = SERVER_XVMC_MINOR_VERSION
+ };
/* REQUEST(xvmcQueryVersionReq); */
REQUEST_SIZE_MATCH(xvmcQueryVersionReq);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = 0;
- rep.major = SERVER_XVMC_MAJOR_VERSION;
- rep.minor = SERVER_XVMC_MINOR_VERSION;
- WriteToClient(client, sizeof(xvmcQueryVersionReply), (char *) &rep);
+
+ WriteToClient(client, sizeof(xvmcQueryVersionReply), &rep);
return Success;
}
@@ -151,12 +154,14 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
}
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num = (adaptor) ? adaptor->num_surfaces : 0;
- rep.length = bytes_to_int32(rep.num * sizeof(xvmcSurfaceInfo));
+ rep = (xvmcListSurfaceTypesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .num = (adaptor) ? adaptor->num_surfaces : 0,
+ .length = bytes_to_int32(rep.num * sizeof(xvmcSurfaceInfo)),
+ };
- WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), (char *) &rep);
+ WriteToClient(client, sizeof(xvmcListSurfaceTypesReply), &rep);
for (i = 0; i < rep.num; i++) {
surface = adaptor->surfaces[i];
@@ -168,7 +173,7 @@ ProcXvMCListSurfaceTypes(ClientPtr client)
info.subpicture_max_height = surface->subpicture_max_height;
info.mc_type = surface->mc_type;
info.flags = surface->flags;
- WriteToClient(client, sizeof(xvmcSurfaceInfo), (char *) &info);
+ WriteToClient(client, sizeof(xvmcSurfaceInfo), &info);
}
return Success;
@@ -247,16 +252,18 @@ ProcXvMCCreateContext(ClientPtr client)
return result;
}
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.width_actual = pContext->width;
- rep.height_actual = pContext->height;
- rep.flags_return = pContext->flags;
- rep.length = dwords;
+ rep = (xvmcCreateContextReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = dwords,
+ .width_actual = pContext->width,
+ .height_actual = pContext->height,
+ .flags_return = pContext->flags
+ };
- WriteToClient(client, sizeof(xvmcCreateContextReply), (char *) &rep);
+ WriteToClient(client, sizeof(xvmcCreateContextReply), &rep);
if (dwords)
- WriteToClient(client, dwords << 2, (char *) data);
+ WriteToClient(client, dwords << 2, data);
AddResource(pContext->context_id, XvMCRTContext, pContext);
free(data);
@@ -320,14 +327,15 @@ ProcXvMCCreateSurface(ClientPtr client)
free(pSurface);
return result;
}
+ rep = (xvmcCreateSurfaceReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = dwords
+ };
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.length = dwords;
-
- WriteToClient(client, sizeof(xvmcCreateSurfaceReply), (char *) &rep);
+ WriteToClient(client, sizeof(xvmcCreateSurfaceReply), &rep);
if (dwords)
- WriteToClient(client, dwords << 2, (char *) data);
+ WriteToClient(client, dwords << 2, data);
AddResource(pSurface->surface_id, XvMCRTSurface, pSurface);
free(data);
@@ -435,22 +443,23 @@ ProcXvMCCreateSubpicture(ClientPtr client)
free(pSubpicture);
return result;
}
-
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.width_actual = pSubpicture->width;
- rep.height_actual = pSubpicture->height;
- rep.num_palette_entries = pSubpicture->num_palette_entries;
- rep.entry_bytes = pSubpicture->entry_bytes;
- rep.component_order[0] = pSubpicture->component_order[0];
- rep.component_order[1] = pSubpicture->component_order[1];
- rep.component_order[2] = pSubpicture->component_order[2];
- rep.component_order[3] = pSubpicture->component_order[3];
- rep.length = dwords;
-
- WriteToClient(client, sizeof(xvmcCreateSubpictureReply), (char *) &rep);
+ rep = (xvmcCreateSubpictureReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = dwords,
+ .width_actual = pSubpicture->width,
+ .height_actual = pSubpicture->height,
+ .num_palette_entries = pSubpicture->num_palette_entries,
+ .entry_bytes = pSubpicture->entry_bytes,
+ .component_order[0] = pSubpicture->component_order[0],
+ .component_order[1] = pSubpicture->component_order[1],
+ .component_order[2] = pSubpicture->component_order[2],
+ .component_order[3] = pSubpicture->component_order[3]
+ };
+
+ WriteToClient(client, sizeof(xvmcCreateSubpictureReply), &rep);
if (dwords)
- WriteToClient(client, dwords << 2, (char *) data);
+ WriteToClient(client, dwords << 2, data);
AddResource(pSubpicture->subpicture_id, XvMCRTSubpicture, pSubpicture);
free(data);
@@ -525,15 +534,17 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
if (!surface)
return BadMatch;
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.num = 0;
+ rep = (xvmcListSubpictureTypesReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .num = 0
+ };
if (surface->compatible_subpictures)
rep.num = surface->compatible_subpictures->num_xvimages;
rep.length = bytes_to_int32(rep.num * sizeof(xvImageFormatInfo));
- WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), (char *) &rep);
+ WriteToClient(client, sizeof(xvmcListSubpictureTypesReply), &rep);
for (i = 0; i < rep.num; i++) {
pImage = NULL;
@@ -569,7 +580,7 @@ ProcXvMCListSubpictureTypes(ClientPtr client)
info.vert_v_period = pImage->vert_v_period;
memcpy(&info.comp_order, pImage->component_order, 32);
info.scanline_order = pImage->scanline_order;
- WriteToClient(client, sizeof(xvImageFormatInfo), (char *) &info);
+ WriteToClient(client, sizeof(xvImageFormatInfo), &info);
}
return Success;
@@ -595,13 +606,16 @@ ProcXvMCGetDRInfo(ClientPtr client)
pScreen = pPort->pAdaptor->pScreen;
pScreenPriv = XVMC_GET_PRIVATE(pScreen);
- rep.type = X_Reply;
- rep.sequenceNumber = client->sequence;
- rep.major = pScreenPriv->major;
- rep.minor = pScreenPriv->minor;
- rep.patchLevel = pScreenPriv->patchLevel;
- rep.nameLen = bytes_to_int32(strlen(pScreenPriv->clientDriverName) + 1);
- rep.busIDLen = bytes_to_int32(strlen(pScreenPriv->busID) + 1);
+ rep = (xvmcGetDRInfoReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .major = pScreenPriv->major,
+ .minor = pScreenPriv->minor,
+ .patchLevel = pScreenPriv->patchLevel,
+ .nameLen = bytes_to_int32(strlen(pScreenPriv->clientDriverName) + 1),
+ .busIDLen = bytes_to_int32(strlen(pScreenPriv->busID) + 1),
+ .isLocal = 1
+ };
rep.length = rep.nameLen + rep.busIDLen;
rep.nameLen <<= 2;
@@ -612,7 +626,6 @@ ProcXvMCGetDRInfo(ClientPtr client)
* segment she prepared for us.
*/
- rep.isLocal = 1;
#ifdef HAS_XVMCSHM
patternP = (CARD32 *) shmat(stuff->shmKey, NULL, SHM_RDONLY);
if (-1 != (long) patternP) {
@@ -634,7 +647,7 @@ ProcXvMCGetDRInfo(ClientPtr client)
}
#endif /* HAS_XVMCSHM */
- WriteToClient(client, sizeof(xvmcGetDRInfoReply), (char *) &rep);
+ WriteToClient(client, sizeof(xvmcGetDRInfoReply), &rep);
if (rep.length) {
WriteToClient(client, rep.nameLen, pScreenPriv->clientDriverName);
WriteToClient(client, rep.busIDLen, pScreenPriv->busID);
diff --git a/xorg-server/Xext/xvmcext.h b/xorg-server/Xext/xvmcext.h
index 5a4261bbd..2201d7b5b 100644
--- a/xorg-server/Xext/xvmcext.h
+++ b/xorg-server/Xext/xvmcext.h
@@ -84,8 +84,7 @@ typedef struct {
XvMCDestroySubpictureProcPtr DestroySubpicture;
} XvMCAdaptorRec, *XvMCAdaptorPtr;
-#ifndef XorgLoader
-extern _X_EXPORT void XvMCExtensionInit(void);
+extern int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr);
extern _X_EXPORT int XvMCScreenInit(ScreenPtr pScreen,
int num, XvMCAdaptorPtr adapt);
@@ -95,6 +94,5 @@ extern _X_EXPORT XvImagePtr XvMCFindXvImage(XvPortPtr pPort, CARD32 id);
extern _X_EXPORT int xf86XvMCRegisterDRInfo(ScreenPtr pScreen, char *name,
char *busID, int major, int minor,
int patchLevel);
-#endif
#endif /* _XVMC_H */