diff options
author | marha <marha@users.sourceforge.net> | 2012-07-11 11:55:48 +0200 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2012-07-11 11:55:48 +0200 |
commit | 6cab6b3ebc8ed1a81ced93d621ea3abf05e282ab (patch) | |
tree | 21e1af7ee94600e349ae21353dc11963a06e988d /xorg-server/Xext | |
parent | 75f57cf199b6c042b0f7515e3a1ab80f7ccecfab (diff) | |
parent | d137057fd13e83ec15ab416c7fe774741da06047 (diff) | |
download | vcxsrv-6cab6b3ebc8ed1a81ced93d621ea3abf05e282ab.tar.gz vcxsrv-6cab6b3ebc8ed1a81ced93d621ea3abf05e282ab.tar.bz2 vcxsrv-6cab6b3ebc8ed1a81ced93d621ea3abf05e282ab.zip |
Merge remote-tracking branch 'origin/released'
Conflicts:
xorg-server/Xext/shm.c
xorg-server/Xext/sync.c
xorg-server/Xext/xf86bigfont.c
xorg-server/Xi/opendev.c
xorg-server/dix/dispatch.c
xorg-server/include/globals.h
xorg-server/mi/miinitext.c
Diffstat (limited to 'xorg-server/Xext')
-rw-r--r-- | xorg-server/Xext/Makefile.am | 42 | ||||
-rw-r--r-- | xorg-server/Xext/bigreq.c | 10 | ||||
-rw-r--r-- | xorg-server/Xext/dpms.c | 20 | ||||
-rw-r--r-- | xorg-server/Xext/geext.c | 7 | ||||
-rw-r--r-- | xorg-server/Xext/geext.h | 2 | ||||
-rw-r--r-- | xorg-server/Xext/panoramiX.c | 43 | ||||
-rw-r--r-- | xorg-server/Xext/panoramiXprocs.c | 19 | ||||
-rw-r--r-- | xorg-server/Xext/saver.c | 34 | ||||
-rw-r--r-- | xorg-server/Xext/security.c | 15 | ||||
-rw-r--r-- | xorg-server/Xext/securitysrv.h | 1 | ||||
-rw-r--r-- | xorg-server/Xext/shape.c | 28 | ||||
-rw-r--r-- | xorg-server/Xext/shm.c | 79 | ||||
-rw-r--r-- | xorg-server/Xext/sync.c | 53 | ||||
-rw-r--r-- | xorg-server/Xext/syncsrv.h | 2 | ||||
-rw-r--r-- | xorg-server/Xext/xcmisc.c | 16 | ||||
-rw-r--r-- | xorg-server/Xext/xf86bigfont.c | 18 | ||||
-rw-r--r-- | xorg-server/Xext/xf86bigfontsrv.h | 67 | ||||
-rw-r--r-- | xorg-server/Xext/xres.c | 43 | ||||
-rw-r--r-- | xorg-server/Xext/xselinux_ext.c | 46 | ||||
-rw-r--r-- | xorg-server/Xext/xtest.c | 13 | ||||
-rw-r--r-- | xorg-server/Xext/xvdisp.c | 186 | ||||
-rw-r--r-- | xorg-server/Xext/xvdix.h | 6 | ||||
-rw-r--r-- | xorg-server/Xext/xvmain.c | 27 | ||||
-rw-r--r-- | xorg-server/Xext/xvmc.c | 129 | ||||
-rw-r--r-- | xorg-server/Xext/xvmcext.h | 4 |
25 files changed, 467 insertions, 443 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..c4508ddb5 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) @@ -57,19 +55,19 @@ ProcBigReqDispatch(ClientPtr client) client->big_requests = TRUE; memset(&rep, 0, sizeof(xBigReqEnableReply)); rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; rep.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 bf01c8905..6a6039ad3 100644 --- a/xorg-server/Xext/dpms.c +++ b/xorg-server/Xext/dpms.c @@ -41,7 +41,7 @@ Equipment Corporation. #include "opaque.h" #include <X11/extensions/dpmsproto.h> #include "dpmsproc.h" -#include "modinit.h" +#include "extinit.h" static int ProcDPMSGetVersion(ClientPtr client) @@ -52,8 +52,8 @@ ProcDPMSGetVersion(ClientPtr client) REQUEST_SIZE_MATCH(xDPMSGetVersionReq); rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; rep.majorVersion = DPMSMajorVersion; rep.minorVersion = DPMSMinorVersion; if (client->swapped) { @@ -61,7 +61,7 @@ ProcDPMSGetVersion(ClientPtr client) swaps(&rep.majorVersion); swaps(&rep.minorVersion); } - WriteToClient(client, sizeof(xDPMSGetVersionReply), (char *) &rep); + WriteToClient(client, sizeof(xDPMSGetVersionReply), &rep); return Success; } @@ -74,14 +74,14 @@ ProcDPMSCapable(ClientPtr client) REQUEST_SIZE_MATCH(xDPMSCapableReq); rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; rep.capable = DPMSCapableFlag; if (client->swapped) { swaps(&rep.sequenceNumber); } - WriteToClient(client, sizeof(xDPMSCapableReply), (char *) &rep); + WriteToClient(client, sizeof(xDPMSCapableReply), &rep); return Success; } @@ -94,8 +94,8 @@ ProcDPMSGetTimeouts(ClientPtr client) REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq); rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; rep.standby = DPMSStandbyTime / MILLI_PER_SECOND; rep.suspend = DPMSSuspendTime / MILLI_PER_SECOND; rep.off = DPMSOffTime / MILLI_PER_SECOND; @@ -106,7 +106,7 @@ ProcDPMSGetTimeouts(ClientPtr client) swaps(&rep.suspend); swaps(&rep.off); } - WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), (char *) &rep); + WriteToClient(client, sizeof(xDPMSGetTimeoutsReply), &rep); return Success; } @@ -195,8 +195,8 @@ ProcDPMSInfo(ClientPtr client) REQUEST_SIZE_MATCH(xDPMSInfoReq); rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; rep.power_level = DPMSPowerLevel; rep.state = DPMSEnabled; @@ -204,7 +204,7 @@ ProcDPMSInfo(ClientPtr client) swaps(&rep.sequenceNumber); swaps(&rep.power_level); } - WriteToClient(client, sizeof(xDPMSInfoReply), (char *) &rep); + WriteToClient(client, sizeof(xDPMSInfoReply), &rep); return Success; } @@ -356,7 +356,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..f96b76468 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 */ @@ -67,8 +66,8 @@ ProcGEQueryVersion(ClientPtr client) rep.repType = X_Reply; rep.RepType = X_GEQueryVersion; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; /* return the supported version by the server */ rep.majorVersion = SERVER_GE_MAJOR_VERSION; @@ -85,7 +84,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..070f54d7a 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]; @@ -908,8 +911,8 @@ ProcPanoramiXQueryVersion(ClientPtr client) REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq); rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; rep.majorVersion = SERVER_PANORAMIX_MAJOR_VERSION; rep.minorVersion = SERVER_PANORAMIX_MINOR_VERSION; if (client->swapped) { @@ -918,7 +921,7 @@ ProcPanoramiXQueryVersion(ClientPtr client) swaps(&rep.majorVersion); swaps(&rep.minorVersion); } - WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), (char *) &rep); + WriteToClient(client, sizeof(xPanoramiXQueryVersionReply), &rep); return Success; } @@ -935,17 +938,18 @@ ProcPanoramiXGetState(ClientPtr client) if (rc != Success) return rc; + rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; rep.state = !noPanoramiXExtension; + rep.sequenceNumber = client->sequence; + rep.length = 0; rep.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 +967,18 @@ ProcPanoramiXGetScreenCount(ClientPtr client) if (rc != Success) return rc; + rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; rep.ScreenCount = PanoramiXNumScreens; + rep.sequenceNumber = client->sequence; + rep.length = 0; rep.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,9 +998,10 @@ ProcPanoramiXGetScreenSize(ClientPtr client) if (rc != Success) return rc; + rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; /* screen dimensions */ rep.width = screenInfo.screens[stuff->screen]->width; rep.height = screenInfo.screens[stuff->screen]->height; @@ -1009,7 +1015,7 @@ ProcPanoramiXGetScreenSize(ClientPtr client) swapl(&rep.window); swapl(&rep.screen); } - WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), (char *) &rep); + WriteToClient(client, sizeof(xPanoramiXGetScreenSizeReply), &rep); return Success; } @@ -1021,15 +1027,14 @@ ProcXineramaIsActive(ClientPtr client) REQUEST_SIZE_MATCH(xXineramaIsActiveReq); + rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; #if 1 - { /* The following hack fools clients into thinking that Xinerama * is disabled even though it is not. */ - rep.state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack; - } + rep.state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack; #else rep.state = !noPanoramiXExtension; #endif @@ -1038,7 +1043,7 @@ ProcXineramaIsActive(ClientPtr client) swapl(&rep.length); swapl(&rep.state); } - WriteToClient(client, sizeof(xXineramaIsActiveReply), (char *) &rep); + WriteToClient(client, sizeof(xXineramaIsActiveReply), &rep); return Success; } @@ -1059,7 +1064,7 @@ ProcXineramaQueryScreens(ClientPtr client) swapl(&rep.length); swapl(&rep.number); } - WriteToClient(client, sizeof(xXineramaQueryScreensReply), (char *) &rep); + WriteToClient(client, sizeof(xXineramaQueryScreensReply), &rep); if (!noPanoramiXExtension) { xXineramaScreenInfo scratch; @@ -1077,7 +1082,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..1a855fe08 100644 --- a/xorg-server/Xext/panoramiXprocs.c +++ b/xorg-server/Xext/panoramiXprocs.c @@ -566,14 +566,17 @@ PanoramiXGetGeometry(ClientPtr client) if (rc != Success) return rc; + rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; 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.x = 0; + rep.y = 0; + rep.borderWidth = 0; if (stuff->id == rep.root) { xWindowRoot *root = (xWindowRoot *) @@ -617,9 +620,10 @@ 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.length = 0; rep.sameScreen = xTrue; rep.child = None; @@ -1954,10 +1958,12 @@ PanoramiXGetImage(ClientPtr client) return rc; } - xgi.visual = wVisual(((WindowPtr) pDraw)); + xgi.type = X_Reply; xgi.sequenceNumber = client->sequence; + xgi.visual = wVisual(((WindowPtr) pDraw)); xgi.depth = pDraw->depth; + if (format == ZPixmap) { widthBytesLine = PixmapBytePad(w, pDraw->depth); length = widthBytesLine * h; @@ -2003,7 +2009,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 +2026,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 6c8fc6e0b..b0314faad 100644 --- a/xorg-server/Xext/saver.c +++ b/xorg-server/Xext/saver.c @@ -64,7 +64,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; @@ -412,7 +412,6 @@ SendScreenSaverNotify(ScreenPtr pScreen, int state, Bool forced) ScreenSaverScreenPrivatePtr pPriv; ScreenSaverEventPtr pEv; unsigned long mask; - xScreenSaverNotifyEvent ev; int kind; UpdateCurrentTimeIf(); @@ -430,16 +429,17 @@ 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; + 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); + } } } @@ -652,7 +652,7 @@ ProcScreenSaverQueryVersion(ClientPtr client) swaps(&rep.sequenceNumber); swapl(&rep.length); } - WriteToClient(client, sizeof(xScreenSaverQueryVersionReply), (char *) &rep); + WriteToClient(client, sizeof(xScreenSaverQueryVersionReply), &rep); return Success; } @@ -683,10 +683,12 @@ ProcScreenSaverQueryInfo(ClientPtr client) UpdateCurrentTime(); lastInput = GetTimeInMillis() - lastDeviceEventTime[XIAllDevices].milliseconds; + rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; rep.window = pSaver->wid; + if (screenIsSaved != SCREEN_SAVER_OFF) { rep.state = ScreenSaverOn; if (ScreenSaverTime) @@ -723,7 +725,7 @@ ProcScreenSaverQueryInfo(ClientPtr client) swapl(&rep.idle); swapl(&rep.eventMask); } - WriteToClient(client, sizeof(xScreenSaverQueryInfoReply), (char *) &rep); + WriteToClient(client, sizeof(xScreenSaverQueryInfoReply), &rep); return Success; } @@ -1390,7 +1392,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 1e0bfefb9..8a82806e9 100644 --- a/xorg-server/Xext/security.c +++ b/xorg-server/Xext/security.c @@ -40,7 +40,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 */ @@ -195,9 +195,9 @@ SecurityDeleteAuthorization(pointer value, XID id) while ((pEventClient = pAuth->eventClients)) { /* send revocation event event */ xSecurityAuthorizationRevokedEvent are; - are.type = SecurityEventBase + XSecurityAuthorizationRevoked; are.authId = pAuth->id; + WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are); FreeResource(pEventClient->resource, RT_NONE); } @@ -353,8 +353,7 @@ ProcSecurityQueryVersion(ClientPtr client) swaps(&rep.majorVersion); swaps(&rep.minorVersion); } - (void) WriteToClient(client, SIZEOF(xSecurityQueryVersionReply), - (char *) &rep); + WriteToClient(client, SIZEOF(xSecurityQueryVersionReply), &rep); return Success; } /* ProcSecurityQueryVersion */ @@ -530,9 +529,10 @@ 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.length = bytes_to_int32(authdata_len); rep.authId = authId; rep.dataLength = authdata_len; @@ -543,8 +543,7 @@ ProcSecurityGenerateAuthorization(ClientPtr client) swaps(&rep.dataLength); } - WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply), - (char *) &rep); + WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply), &rep); WriteToClient(client, authdata_len, pAuthdata); SecurityAudit @@ -1027,7 +1026,7 @@ SecurityResetProc(ExtensionEntry * extEntry) */ void -SecurityExtensionInit(INITARGS) +SecurityExtensionInit(void) { ExtensionEntry *extEntry; int ret = TRUE; diff --git a/xorg-server/Xext/securitysrv.h b/xorg-server/Xext/securitysrv.h index b5084fea4..3ae711d11 100644 --- a/xorg-server/Xext/securitysrv.h +++ b/xorg-server/Xext/securitysrv.h @@ -31,7 +31,6 @@ from The Open Group. #define _SECURITY_SRV_H /* Allow client side portions of <X11/extensions/security.h> to compile */ -typedef int Status; #ifndef Display #define Display void #define NEED_UNDEF_Display diff --git a/xorg-server/Xext/shape.c b/xorg-server/Xext/shape.c index d3859a51d..dfe6fe70b 100644 --- a/xorg-server/Xext/shape.c +++ b/xorg-server/Xext/shape.c @@ -46,7 +46,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 */ @@ -211,8 +211,8 @@ ProcShapeQueryVersion(ClientPtr client) REQUEST_SIZE_MATCH(xShapeQueryVersionReq); memset(&rep, 0, sizeof(xShapeQueryVersionReply)); rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; rep.majorVersion = SERVER_SHAPE_MAJOR_VERSION; rep.minorVersion = SERVER_SHAPE_MINOR_VERSION; if (client->swapped) { @@ -221,7 +221,7 @@ ProcShapeQueryVersion(ClientPtr client) swaps(&rep.majorVersion); swaps(&rep.minorVersion); } - WriteToClient(client, sizeof(xShapeQueryVersionReply), (char *) &rep); + WriteToClient(client, sizeof(xShapeQueryVersionReply), &rep); return Success; } @@ -635,8 +635,8 @@ ProcShapeQueryExtents(ClientPtr client) return rc; memset(&rep, 0, sizeof(xShapeQueryExtentsReply)); rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; rep.boundingShaped = (wBoundingShape(pWin) != 0); rep.clipShaped = (wClipShape(pWin) != 0); if ((region = wBoundingShape(pWin))) { @@ -681,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; } @@ -826,7 +826,6 @@ void SendShapeNotify(WindowPtr pWin, int which) { ShapeEventPtr *pHead, pShapeEvent; - xShapeNotifyEvent se; BoxRec extents; RegionPtr region; BYTE shaped; @@ -883,6 +882,7 @@ SendShapeNotify(WindowPtr pWin, int which) return; } for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) { + xShapeNotifyEvent se; se.type = ShapeNotify + ShapeEventBase; se.kind = which; se.window = pWin->drawable.id; @@ -922,15 +922,17 @@ ProcShapeInputSelected(ClientPtr client) } } } + rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; rep.enabled = enabled; + rep.sequenceNumber = client->sequence; + rep.length = 0; + if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); } - WriteToClient(client, sizeof(xShapeInputSelectedReply), (char *) &rep); + WriteToClient(client, sizeof(xShapeInputSelectedReply), &rep); return Success; } @@ -1003,19 +1005,21 @@ ProcShapeGetRectangles(ClientPtr client) rects[i].height = box->y2 - box->y1; } } + rep.type = X_Reply; + rep.ordering = YXBanded; rep.sequenceNumber = client->sequence; rep.length = bytes_to_int32(nrects * sizeof(xRectangle)); - rep.ordering = YXBanded; rep.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 06a919bdc..843956008 100644 --- a/xorg-server/Xext/shm.c +++ b/xorg-server/Xext/shm.c @@ -89,7 +89,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; @@ -287,20 +287,21 @@ 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; + #ifndef _MSC_VER - rep.uid = geteuid(); - rep.gid = getegid(); #endif if (client->swapped) { swaps(&rep.sequenceNumber); @@ -310,7 +311,7 @@ ProcShmQueryVersion(ClientPtr client) swaps(&rep.uid); swaps(&rep.gid); } - WriteToClient(client, sizeof(xShmQueryVersionReply), (char *) &rep); + WriteToClient(client, sizeof(xShmQueryVersionReply), &rep); return Success; } @@ -613,14 +614,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); } @@ -635,6 +636,7 @@ ProcShmGetImage(ClientPtr client) Mask plane = 0; xShmGetImageReply xgi; ShmDescPtr shmdesc; + VisualID visual = None; int rc; REQUEST(xShmGetImageReq); @@ -649,7 +651,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 || @@ -665,19 +667,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; } @@ -721,7 +726,7 @@ ProcShmGetImage(ClientPtr client) swapl(&xgi.visual); swapl(&xgi.size); } - WriteToClient(client, sizeof(xShmGetImageReply), (char *) &xgi); + WriteToClient(client, sizeof(xShmGetImageReply), &xgi); return Success; } @@ -849,11 +854,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); @@ -896,7 +903,7 @@ ProcPanoramiXShmGetImage(ClientPtr client) swapl(&xgi.visual); swapl(&xgi.size); } - WriteToClient(client, sizeof(xShmGetImageReply), (char *) &xgi); + WriteToClient(client, sizeof(xShmGetImageReply), &xgi); return Success; } @@ -1260,7 +1267,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 44e2b12eb..23423bde0 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 @@ -444,7 +444,8 @@ SyncSendAlarmNotifyEvents(SyncAlarm * pAlarm) 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; } @@ -474,7 +475,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(); @@ -1202,7 +1203,7 @@ ProcSyncInitialize(ClientPtr client) if (client->swapped) { swaps(&rep.sequenceNumber); } - WriteToClient(client, sizeof(rep), (char *) &rep); + WriteToClient(client, sizeof(rep), &rep); return Success; } @@ -1267,9 +1268,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); } @@ -1332,9 +1333,10 @@ ProcSyncGetPriority(ClientPtr client) return rc; } + rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; rep.priority = priorityclient->priority; if (client->swapped) { @@ -1342,7 +1344,7 @@ ProcSyncGetPriority(ClientPtr client) swapl(&rep.priority); } - WriteToClient(client, sizeof(xSyncGetPriorityReply), (char *) &rep); + WriteToClient(client, sizeof(xSyncGetPriorityReply), &rep); return Success; } @@ -1609,26 +1611,26 @@ 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.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; rep.value_hi = XSyncValueHigh32(pCounter->value); rep.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; } @@ -1775,18 +1777,18 @@ ProcSyncQueryAlarm(ClientPtr client) if (rc != Success) return rc; + pTrigger = &pAlarm->trigger; + rep.type = X_Reply; - rep.length = - bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply)); rep.sequenceNumber = client->sequence; - - pTrigger = &pAlarm->trigger; + rep.length = + bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply)); 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. - */ +#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); @@ -1813,7 +1815,7 @@ ProcSyncQueryAlarm(ClientPtr client) swapl(&rep.delta_lo); } - WriteToClient(client, sizeof(xSyncQueryAlarmReply), (char *) &rep); + WriteToClient(client, sizeof(xSyncQueryAlarmReply), &rep); return Success; } @@ -1959,9 +1961,10 @@ ProcSyncQueryFence(ClientPtr client) if (rc != Success) return rc; + rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; rep.triggered = pFence->funcs.CheckTriggered(pFence); @@ -1970,7 +1973,7 @@ ProcSyncQueryFence(ClientPtr client) 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..a48f61282 100644 --- a/xorg-server/Xext/xcmisc.c +++ b/xorg-server/Xext/xcmisc.c @@ -38,7 +38,7 @@ from The Open Group. #include "extnsionst.h" #include "swaprep.h" #include <X11/extensions/xcmiscproto.h> -#include "modinit.h" +#include "extinit.h" #include <stdint.h> @@ -49,8 +49,8 @@ ProcXCMiscGetVersion(ClientPtr client) REQUEST_SIZE_MATCH(xXCMiscGetVersionReq); rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; rep.majorVersion = XCMiscMajorVersion; rep.minorVersion = XCMiscMinorVersion; if (client->swapped) { @@ -58,7 +58,7 @@ ProcXCMiscGetVersion(ClientPtr client) swaps(&rep.majorVersion); swaps(&rep.minorVersion); } - WriteToClient(client, sizeof(xXCMiscGetVersionReply), (char *) &rep); + WriteToClient(client, sizeof(xXCMiscGetVersionReply), &rep); return Success; } @@ -70,9 +70,10 @@ 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.length = 0; rep.start_id = min_id; rep.count = max_id - min_id + 1; if (client->swapped) { @@ -80,7 +81,7 @@ ProcXCMiscGetXIDRange(ClientPtr client) swapl(&rep.start_id); swapl(&rep.count); } - WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), (char *) &rep); + WriteToClient(client, sizeof(xXCMiscGetXIDRangeReply), &rep); return Success; } @@ -102,6 +103,7 @@ ProcXCMiscGetXIDList(ClientPtr client) return BadAlloc; } count = GetXIDList(client, stuff->count, pids); + rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = count; @@ -111,7 +113,7 @@ ProcXCMiscGetXIDList(ClientPtr client) 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 +186,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 d10a36eef..2bc5fc93f 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> @@ -291,16 +292,12 @@ ProcXF86BigfontQueryVersion(ClientPtr client) #endif #ifdef HAS_SHM reply.signature = signature; + reply.capabilities = (LocalClient(client) && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0); #else reply.signature = 0; /* This is redundant. Avoids uninitialized memory. */ + reply.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; @@ -312,8 +309,7 @@ ProcXF86BigfontQueryVersion(ClientPtr client) swapl(&reply.gid); swapl(&reply.signature); } - WriteToClient(client, - sizeof(xXF86BigfontQueryVersionReply), (char *) &reply); + WriteToClient(client, sizeof(xXF86BigfontQueryVersionReply), &reply); return Success; } @@ -560,7 +556,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) { @@ -649,7 +645,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 a390227b0..a08a5778b 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,6 +190,8 @@ DestroyConstructResourceBytesCtx(ConstructResourceBytesCtx *ctx) ht_destroy(ctx->visitedResources); } +extern void ResExtensionInit(void); + static int ProcXResQueryVersion(ClientPtr client) { @@ -199,8 +201,8 @@ ProcXResQueryVersion(ClientPtr client) REQUEST_SIZE_MATCH(xXResQueryVersionReq); rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; rep.server_major = SERVER_XRES_MAJOR_VERSION; rep.server_minor = SERVER_XRES_MINOR_VERSION; if (client->swapped) { @@ -209,7 +211,7 @@ ProcXResQueryVersion(ClientPtr client) swaps(&rep.server_major); swaps(&rep.server_minor); } - WriteToClient(client, sizeof(xXResQueryVersionReply), (char *) &rep); + WriteToClient(client, sizeof(xXResQueryVersionReply), &rep); return Success; } @@ -233,16 +235,17 @@ ProcXResQueryClients(ClientPtr client) } } + rep.type = X_Reply; rep.sequenceNumber = client->sequence; + rep.length = bytes_to_int32(num_clients * sz_xXResClient); rep.num_clients = num_clients; - rep.length = bytes_to_int32(rep.num_clients * sz_xXResClient); 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 +258,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 +303,18 @@ ProcXResQueryClientResources(ClientPtr client) num_types++; } + rep.type = X_Reply; rep.sequenceNumber = client->sequence; + rep.length = bytes_to_int32(num_types * sz_xXResType); rep.num_types = num_types; - rep.length = bytes_to_int32(rep.num_types * sz_xXResType); 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 +340,7 @@ ProcXResQueryClientResources(ClientPtr client) swapl(&scratch.resource_type); swapl(&scratch.count); } - WriteToClient(client, sz_xXResType, (char *) &scratch); + WriteToClient(client, sz_xXResType, &scratch); } } @@ -471,6 +474,7 @@ ProcXResQueryClientPixmapBytes(ClientPtr client) (pointer)(&bytes)); #endif + rep.type = X_Reply; rep.sequenceNumber = client->sequence; rep.length = 0; @@ -486,8 +490,7 @@ ProcXResQueryClientPixmapBytes(ClientPtr client) swapl(&rep.bytes); swapl(&rep.bytes_overflow); } - WriteToClient(client, sizeof(xXResQueryClientPixmapBytesReply), - (char *) &rep); + WriteToClient(client, sizeof(xXResQueryClientPixmapBytesReply), &rep); return Success; } @@ -652,7 +655,6 @@ ProcXResQueryClientIds (ClientPtr client) { REQUEST(xXResQueryClientIdsReq); - xXResQueryClientIdsReply rep; xXResClientIdSpec *specs = (void*) ((char*) stuff + sizeof(*stuff)); int rc; ConstructClientIdCtx ctx; @@ -666,20 +668,21 @@ ProcXResQueryClientIds (ClientPtr client) rc = ConstructClientIds(client, stuff->numSpecs, specs, &ctx); if (rc == Success) { + xXResQueryClientIdsReply rep; rep.type = X_Reply; rep.sequenceNumber = client->sequence; - - assert((ctx.resultBytes & 3) == 0); rep.length = bytes_to_int32(ctx.resultBytes); rep.numIds = ctx.numIds; + assert((ctx.resultBytes & 3) == 0); + if (client->swapped) { swaps (&rep.sequenceNumber); swapl (&rep.length); swapl (&rep.numIds); } - WriteToClient(client,sizeof(rep),(char*)&rep); + WriteToClient(client, sizeof(rep), &rep); WriteFragmentsToClient(client, &ctx.response); } @@ -1030,7 +1033,6 @@ ProcXResQueryResourceBytes (ClientPtr client) { REQUEST(xXResQueryResourceBytesReq); - xXResQueryResourceBytesReply rep; int rc; ConstructResourceBytesCtx ctx; @@ -1048,10 +1050,11 @@ ProcXResQueryResourceBytes (ClientPtr client) rc = ConstructResourceBytes(stuff->client, &ctx); if (rc == Success) { + xXResQueryResourceBytesReply rep; rep.type = X_Reply; rep.sequenceNumber = client->sequence; - rep.numSizes = ctx.numSizes; rep.length = bytes_to_int32(ctx.resultBytes); + rep.numSizes = ctx.numSizes; if (client->swapped) { swaps (&rep.sequenceNumber); @@ -1061,7 +1064,7 @@ ProcXResQueryResourceBytes (ClientPtr client) SwapXResQueryResourceBytes(&ctx.response); } - WriteToClient(client,sizeof(rep),(char*)&rep); + WriteToClient(client, sizeof(rep), &rep); WriteFragmentsToClient(client, &ctx.response); } @@ -1177,7 +1180,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..a0e463e0e 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; @@ -92,15 +92,15 @@ ProcXTestGetVersion(ClientPtr client) REQUEST_SIZE_MATCH(xXTestGetVersionReq); rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; 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 +134,15 @@ ProcXTestCompareCursor(ClientPtr client) return rc; } } + rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; rep.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 +676,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 0b508611c..e0708b352 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 */ |