diff options
Diffstat (limited to 'xorg-server/Xext')
-rw-r--r-- | xorg-server/Xext/Makefile | 38 | ||||
-rw-r--r-- | xorg-server/Xext/bigreq.c | 11 | ||||
-rw-r--r-- | xorg-server/Xext/dpms.c | 57 | ||||
-rw-r--r-- | xorg-server/Xext/geext.c | 18 | ||||
-rw-r--r-- | xorg-server/Xext/hashtable.c | 12 | ||||
-rw-r--r-- | xorg-server/Xext/panoramiX.c | 80 | ||||
-rw-r--r-- | xorg-server/Xext/panoramiXprocs.c | 48 | ||||
-rw-r--r-- | xorg-server/Xext/saver.c | 49 | ||||
-rw-r--r-- | xorg-server/Xext/security.c | 37 | ||||
-rw-r--r-- | xorg-server/Xext/securitysrv.h | 4 | ||||
-rw-r--r-- | xorg-server/Xext/shape.c | 77 | ||||
-rw-r--r-- | xorg-server/Xext/shm.c | 19 | ||||
-rw-r--r-- | xorg-server/Xext/sync.c | 119 | ||||
-rw-r--r-- | xorg-server/Xext/xace.c | 2 | ||||
-rw-r--r-- | xorg-server/Xext/xcmisc.c | 38 | ||||
-rw-r--r-- | xorg-server/Xext/xf86bigfont.c | 31 | ||||
-rw-r--r-- | xorg-server/Xext/xres.c | 78 | ||||
-rw-r--r-- | xorg-server/Xext/xtest.c | 25 | ||||
-rw-r--r-- | xorg-server/Xext/xvmain.c | 4 |
19 files changed, 392 insertions, 355 deletions
diff --git a/xorg-server/Xext/Makefile b/xorg-server/Xext/Makefile new file mode 100644 index 000000000..d59f345d0 --- /dev/null +++ b/xorg-server/Xext/Makefile @@ -0,0 +1,38 @@ +CSRCS=\ +bigreq.c \ +dpms.c \ +dpmsstubs.c \ +saver.c \ +security.c \ +shape.c \ +sleepuntil.c \ +sync.c \ +xace.c \ +xcmisc.c \ +hashtable.c \ +xres.c \ +xtest.c \ +geext.c \ +panoramiX.c \ +panoramiXprocs.c \ +xf86bigfont.c \ +panoramiXSwap.c + +#shm.c \ +#appgroup.c \ +#fontcache.c \ +#mbufbf.c \ +#mbufpx.c \ +#xcalibrate.c \ +#xprint.c \ +#xselinux.c \ +#xvdisp.c \ +#xvmain.c \ +#xvmc.c + +LIBRARY=libxext + +INCLUDES += ..\hw\xfree86\dixmods\extmod ..\composite ..\miext\sync + + + diff --git a/xorg-server/Xext/bigreq.c b/xorg-server/Xext/bigreq.c index c78a1e4b4..c4508ddb5 100644 --- a/xorg-server/Xext/bigreq.c +++ b/xorg-server/Xext/bigreq.c @@ -53,12 +53,11 @@ ProcBigReqDispatch(ClientPtr client) return BadRequest; REQUEST_SIZE_MATCH(xBigReqEnableReq); client->big_requests = TRUE; - rep = (xBigReqEnableReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .max_request_size = maxBigRequestSize - }; + memset(&rep, 0, sizeof(xBigReqEnableReply)); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.max_request_size = maxBigRequestSize; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.max_request_size); diff --git a/xorg-server/Xext/dpms.c b/xorg-server/Xext/dpms.c index 5f1a35d9c..6a6039ad3 100644 --- a/xorg-server/Xext/dpms.c +++ b/xorg-server/Xext/dpms.c @@ -28,6 +28,8 @@ Equipment Corporation. #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else +#define DPMSExtension #endif #include <X11/X.h> @@ -45,16 +47,15 @@ static int ProcDPMSGetVersion(ClientPtr client) { /* REQUEST(xDPMSGetVersionReq); */ - xDPMSGetVersionReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .majorVersion = DPMSMajorVersion, - .minorVersion = DPMSMinorVersion - }; + xDPMSGetVersionReply rep; REQUEST_SIZE_MATCH(xDPMSGetVersionReq); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.majorVersion = DPMSMajorVersion; + rep.minorVersion = DPMSMinorVersion; if (client->swapped) { swaps(&rep.sequenceNumber); swaps(&rep.majorVersion); @@ -68,15 +69,15 @@ static int ProcDPMSCapable(ClientPtr client) { /* REQUEST(xDPMSCapableReq); */ - xDPMSCapableReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .capable = DPMSCapableFlag - }; + xDPMSCapableReply rep; REQUEST_SIZE_MATCH(xDPMSCapableReq); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.capable = DPMSCapableFlag; + if (client->swapped) { swaps(&rep.sequenceNumber); } @@ -88,17 +89,17 @@ static int ProcDPMSGetTimeouts(ClientPtr client) { /* REQUEST(xDPMSGetTimeoutsReq); */ - 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 - }; + xDPMSGetTimeoutsReply rep; REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq); + rep.type = X_Reply; + 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; + if (client->swapped) { swaps(&rep.sequenceNumber); swaps(&rep.standby); @@ -189,16 +190,16 @@ static int ProcDPMSInfo(ClientPtr client) { /* REQUEST(xDPMSInfoReq); */ - xDPMSInfoReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .power_level = DPMSPowerLevel, - .state = DPMSEnabled - }; + xDPMSInfoReply rep; REQUEST_SIZE_MATCH(xDPMSInfoReq); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.power_level = DPMSPowerLevel; + rep.state = DPMSEnabled; + if (client->swapped) { swaps(&rep.sequenceNumber); swaps(&rep.power_level); diff --git a/xorg-server/Xext/geext.c b/xorg-server/Xext/geext.c index 1e5ae6f82..f96b76468 100644 --- a/xorg-server/Xext/geext.c +++ b/xorg-server/Xext/geext.c @@ -64,16 +64,14 @@ ProcGEQueryVersion(ClientPtr client) REQUEST_SIZE_MATCH(xGEQueryVersionReq); - rep = (xGEQueryVersionReply) { - .repType = X_Reply, - .RepType = X_GEQueryVersion, - .sequenceNumber = client->sequence, - .length = 0, - - /* return the supported version by the server */ - .majorVersion = SERVER_GE_MAJOR_VERSION, - .minorVersion = SERVER_GE_MINOR_VERSION - }; + rep.repType = X_Reply; + rep.RepType = X_GEQueryVersion; + rep.sequenceNumber = client->sequence; + rep.length = 0; + + /* return the supported version by the server */ + rep.majorVersion = SERVER_GE_MAJOR_VERSION; + rep.minorVersion = SERVER_GE_MINOR_VERSION; /* Remember version the client requested */ pGEClient->major_version = stuff->majorVersion; diff --git a/xorg-server/Xext/hashtable.c b/xorg-server/Xext/hashtable.c index 9d9ef8949..e362ad12f 100644 --- a/xorg-server/Xext/hashtable.c +++ b/xorg-server/Xext/hashtable.c @@ -72,7 +72,7 @@ void ht_destroy(HashTable ht) { int c; - BucketPtr it, tmp; + BucketPtr it=NULL, tmp; int numBuckets = 1 << ht->bucketBits; for (c = 0; c < numBuckets; ++c) { xorg_list_for_each_entry_safe(it, tmp, &ht->buckets[c], l) { @@ -99,7 +99,7 @@ double_size(HashTable ht) } for (c = 0; c < numBuckets; ++c) { - BucketPtr it, tmp; + BucketPtr it=NULL, tmp; xorg_list_for_each_entry_safe(it, tmp, &ht->buckets[c], l) { struct xorg_list *newBucket = &newBuckets[ht->hash(ht->cdata, it->key, newBucketBits)]; @@ -168,7 +168,7 @@ ht_remove(HashTable ht, pointer key) { unsigned index = ht->hash(ht->cdata, key, ht->bucketBits); struct xorg_list *bucket = &ht->buckets[index]; - BucketPtr it; + BucketPtr it=NULL; xorg_list_for_each_entry(it, bucket, l) { if (ht->compare(ht->cdata, key, it->key) == 0) { @@ -187,7 +187,7 @@ ht_find(HashTable ht, pointer key) { unsigned index = ht->hash(ht->cdata, key, ht->bucketBits); struct xorg_list *bucket = &ht->buckets[index]; - BucketPtr it; + BucketPtr it=NULL; xorg_list_for_each_entry(it, bucket, l) { if (ht->compare(ht->cdata, key, it->key) == 0) { @@ -204,7 +204,7 @@ ht_dump_distribution(HashTable ht) int c; int numBuckets = 1 << ht->bucketBits; for (c = 0; c < numBuckets; ++c) { - BucketPtr it; + BucketPtr it=NULL; int n = 0; xorg_list_for_each_entry(it, &ht->buckets[c], l) { @@ -277,7 +277,7 @@ ht_dump_contents(HashTable ht, int c; int numBuckets = 1 << ht->bucketBits; for (c = 0; c < numBuckets; ++c) { - BucketPtr it; + BucketPtr it=NULL; int n = 0; printf("%d: ", c); diff --git a/xorg-server/Xext/panoramiX.c b/xorg-server/Xext/panoramiX.c index 1c7197d5d..6eefa9789 100644 --- a/xorg-server/Xext/panoramiX.c +++ b/xorg-server/Xext/panoramiX.c @@ -907,15 +907,14 @@ int ProcPanoramiXQueryVersion(ClientPtr client) { /* REQUEST(xPanoramiXQueryVersionReq); */ - xPanoramiXQueryVersionReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .majorVersion = SERVER_PANORAMIX_MAJOR_VERSION, - .minorVersion = SERVER_PANORAMIX_MINOR_VERSION - }; + xPanoramiXQueryVersionReply rep; REQUEST_SIZE_MATCH(xPanoramiXQueryVersionReq); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.majorVersion = SERVER_PANORAMIX_MAJOR_VERSION; + rep.minorVersion = SERVER_PANORAMIX_MINOR_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -939,13 +938,12 @@ ProcPanoramiXGetState(ClientPtr client) if (rc != Success) return rc; - rep = (xPanoramiXGetStateReply) { - .type = X_Reply, - .state = !noPanoramiXExtension, - .sequenceNumber = client->sequence, - .length = 0, - .window = stuff->window - }; + + rep.type = X_Reply; + rep.state = !noPanoramiXExtension; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.window = stuff->window; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -969,13 +967,12 @@ ProcPanoramiXGetScreenCount(ClientPtr client) if (rc != Success) return rc; - rep = (xPanoramiXGetScreenCountReply) { - .type = X_Reply, - .ScreenCount = PanoramiXNumScreens, - .sequenceNumber = client->sequence, - .length = 0, - .window = stuff->window - }; + + rep.type = X_Reply; + rep.ScreenCount = PanoramiXNumScreens; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.window = stuff->window; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -1001,16 +998,15 @@ ProcPanoramiXGetScreenSize(ClientPtr client) if (rc != Success) return rc; - rep = (xPanoramiXGetScreenSizeReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; /* screen dimensions */ - .width = screenInfo.screens[stuff->screen]->width, - .height = screenInfo.screens[stuff->screen]->height, - .window = stuff->window, - .screen = stuff->screen - }; + rep.width = screenInfo.screens[stuff->screen]->width; + rep.height = screenInfo.screens[stuff->screen]->height; + rep.window = stuff->window; + rep.screen = stuff->screen; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -1031,18 +1027,17 @@ ProcXineramaIsActive(ClientPtr client) REQUEST_SIZE_MATCH(xXineramaIsActiveReq); - rep = (xXineramaIsActiveReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, + + rep.type = X_Reply; + 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. */ - .state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack + rep.state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack; #else - .state = !noPanoramiXExtension; + rep.state = !noPanoramiXExtension; #endif - }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -1057,15 +1052,14 @@ ProcXineramaQueryScreens(ClientPtr client) { /* REQUEST(xXineramaQueryScreensReq); */ CARD32 number = (noPanoramiXExtension) ? 0 : PanoramiXNumScreens; - xXineramaQueryScreensReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = bytes_to_int32(number * sz_XineramaScreenInfo), - .number = number - }; + xXineramaQueryScreensReply rep; REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = bytes_to_int32(number * sz_XineramaScreenInfo); + rep.number = number; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); diff --git a/xorg-server/Xext/panoramiXprocs.c b/xorg-server/Xext/panoramiXprocs.c index 576844cbf..1a855fe08 100644 --- a/xorg-server/Xext/panoramiXprocs.c +++ b/xorg-server/Xext/panoramiXprocs.c @@ -566,18 +566,17 @@ PanoramiXGetGeometry(ClientPtr client) if (rc != Success) return rc; - 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 - }; + + rep.type = X_Reply; + 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 = 0; + rep.y = 0; + rep.borderWidth = 0; if (stuff->id == rep.root) { xWindowRoot *root = (xWindowRoot *) @@ -621,13 +620,12 @@ PanoramiXTranslateCoords(ClientPtr client) rc = dixLookupWindow(&pDst, stuff->dstWid, client, DixReadAccess); if (rc != Success) return rc; - rep = (xTranslateCoordsReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .sameScreen = xTrue, - .child = None - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.sameScreen = xTrue; + rep.child = None; if ((pWin == screenInfo.screens[0]->root) || (pWin->drawable.id == screenInfo.screens[0]->screensaver.wid)) { @@ -1960,12 +1958,12 @@ PanoramiXGetImage(ClientPtr client) return rc; } - xgi = (xGetImageReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .visual = wVisual(((WindowPtr) pDraw)), - .depth = pDraw->depth - }; + + 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; diff --git a/xorg-server/Xext/saver.c b/xorg-server/Xext/saver.c index ac4a633e7..b0314faad 100644 --- a/xorg-server/Xext/saver.c +++ b/xorg-server/Xext/saver.c @@ -28,6 +28,12 @@ in this Software without prior written authorization from the X Consortium. #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else +#define SCREENSAVER +#endif + +#ifdef CreateWindow +#undef CreateWindow #endif #include <X11/X.h> @@ -424,15 +430,14 @@ SendScreenSaverNotify(ScreenPtr pScreen, int state, Bool forced) kind = ScreenSaverInternal; for (pEv = pPriv->events; pEv; pEv = pEv->next) { 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 - }; + 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); } } @@ -635,16 +640,14 @@ ScreenSaverHandle(ScreenPtr pScreen, int xstate, Bool force) static int ProcScreenSaverQueryVersion(ClientPtr client) { - xScreenSaverQueryVersionReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .majorVersion = SERVER_SAVER_MAJOR_VERSION, - .minorVersion = SERVER_SAVER_MINOR_VERSION - }; + xScreenSaverQueryVersionReply rep; 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); @@ -680,12 +683,12 @@ ProcScreenSaverQueryInfo(ClientPtr client) UpdateCurrentTime(); lastInput = GetTimeInMillis() - lastDeviceEventTime[XIAllDevices].milliseconds; - rep = (xScreenSaverQueryInfoReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .window = pSaver->wid - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.window = pSaver->wid; + if (screenIsSaved != SCREEN_SAVER_OFF) { rep.state = ScreenSaverOn; if (ScreenSaverTime) diff --git a/xorg-server/Xext/security.c b/xorg-server/Xext/security.c index 6cc9aa044..8a82806e9 100644 --- a/xorg-server/Xext/security.c +++ b/xorg-server/Xext/security.c @@ -26,6 +26,8 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else +#define XACE #endif #include "scrnintstr.h" @@ -192,10 +194,10 @@ SecurityDeleteAuthorization(pointer value, XID id) while ((pEventClient = pAuth->eventClients)) { /* send revocation event event */ - xSecurityAuthorizationRevokedEvent are = { - .type = SecurityEventBase + XSecurityAuthorizationRevoked, - .authId = pAuth->id - }; + xSecurityAuthorizationRevokedEvent are; + are.type = SecurityEventBase + XSecurityAuthorizationRevoked; + are.authId = pAuth->id; + WriteEventsToClient(rClient(pEventClient), 1, (xEvent *) &are); FreeResource(pEventClient->resource, RT_NONE); } @@ -338,16 +340,14 @@ static int ProcSecurityQueryVersion(ClientPtr client) { /* REQUEST(xSecurityQueryVersionReq); */ - xSecurityQueryVersionReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .majorVersion = SERVER_SECURITY_MAJOR_VERSION, - .minorVersion = SERVER_SECURITY_MINOR_VERSION - }; + xSecurityQueryVersionReply rep; 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); @@ -529,13 +529,12 @@ ProcSecurityGenerateAuthorization(ClientPtr client) /* tell client the auth id and data */ - rep = (xSecurityGenerateAuthorizationReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = bytes_to_int32(authdata_len), - .authId = authId, - .dataLength = authdata_len - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = bytes_to_int32(authdata_len); + rep.authId = authId; + rep.dataLength = authdata_len; if (client->swapped) { swapl(&rep.length); diff --git a/xorg-server/Xext/securitysrv.h b/xorg-server/Xext/securitysrv.h index 8904242d6..3ae711d11 100644 --- a/xorg-server/Xext/securitysrv.h +++ b/xorg-server/Xext/securitysrv.h @@ -31,10 +31,6 @@ from The Open Group. #define _SECURITY_SRV_H /* Allow client side portions of <X11/extensions/security.h> to compile */ -#ifndef Status -#define Status int -#define NEED_UNDEF_Status -#endif #ifndef Display #define Display void #define NEED_UNDEF_Display diff --git a/xorg-server/Xext/shape.c b/xorg-server/Xext/shape.c index d36867cc8..dfe6fe70b 100644 --- a/xorg-server/Xext/shape.c +++ b/xorg-server/Xext/shape.c @@ -26,6 +26,8 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else +#define SHAPE #endif #include <stdlib.h> @@ -204,16 +206,15 @@ CreateClipShape(WindowPtr pWin) static int ProcShapeQueryVersion(ClientPtr client) { - xShapeQueryVersionReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .majorVersion = SERVER_SHAPE_MAJOR_VERSION, - .minorVersion = SERVER_SHAPE_MINOR_VERSION - }; + xShapeQueryVersionReply rep; REQUEST_SIZE_MATCH(xShapeQueryVersionReq); - + memset(&rep, 0, sizeof(xShapeQueryVersionReply)); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.majorVersion = SERVER_SHAPE_MAJOR_VERSION; + rep.minorVersion = SERVER_SHAPE_MINOR_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -632,13 +633,12 @@ ProcShapeQueryExtents(ClientPtr client) rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; - rep = (xShapeQueryExtentsReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .boundingShaped = (wBoundingShape(pWin) != 0), - .clipShaped = (wClipShape(pWin) != 0) - }; + memset(&rep, 0, sizeof(xShapeQueryExtentsReply)); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.boundingShaped = (wBoundingShape(pWin) != 0); + rep.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); @@ -882,17 +882,16 @@ SendShapeNotify(WindowPtr pWin, int which) return; } for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) { - 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 - }; + xShapeNotifyEvent se; + 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; WriteEventsToClient(pShapeEvent->client, 1, (xEvent *) &se); } } @@ -923,12 +922,12 @@ ProcShapeInputSelected(ClientPtr client) } } } - rep = (xShapeInputSelectedReply) { - .type = X_Reply, - .enabled = enabled, - .sequenceNumber = client->sequence, - .length = 0 - }; + + rep.type = X_Reply; + rep.enabled = enabled; + rep.sequenceNumber = client->sequence; + rep.length = 0; + if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -1006,13 +1005,13 @@ ProcShapeGetRectangles(ClientPtr client) rects[i].height = box->y2 - box->y1; } } - rep = (xShapeGetRectanglesReply) { - .type = X_Reply, - .ordering = YXBanded, - .sequenceNumber = client->sequence, - .length = bytes_to_int32(nrects * sizeof(xRectangle)), - .nrects = nrects - }; + + rep.type = X_Reply; + rep.ordering = YXBanded; + rep.sequenceNumber = client->sequence; + rep.length = bytes_to_int32(nrects * sizeof(xRectangle)); + rep.nrects = nrects; + if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); diff --git a/xorg-server/Xext/shm.c b/xorg-server/Xext/shm.c index 3fa04b921..843956008 100644 --- a/xorg-server/Xext/shm.c +++ b/xorg-server/Xext/shm.c @@ -33,8 +33,10 @@ in this Software without prior written authorization from The Open Group. #endif #include <sys/types.h> +#if !defined(_MSC_VER) #include <sys/ipc.h> #include <sys/shm.h> +#endif #include <unistd.h> #include <sys/stat.h> #include <X11/X.h> @@ -299,6 +301,8 @@ ProcShmQueryVersion(ClientPtr client) REQUEST_SIZE_MATCH(xShmQueryVersionReq); +#ifndef _MSC_VER +#endif if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -348,6 +352,9 @@ shm_access(ClientPtr client, SHMPERM_TYPE * perm, int readonly) if (uid == 0) { return 0; } + #ifdef _MSC_VER + __asm int 3; + #else /* Check the owner */ if (SHMPERM_UID(perm) == uid || SHMPERM_CUID(perm) == uid) { mask = S_IRUSR; @@ -356,10 +363,14 @@ shm_access(ClientPtr client, SHMPERM_TYPE * perm, int readonly) } return (SHMPERM_MODE(perm) & mask) == mask ? 0 : -1; } + #endif } if (gidset) { /* Check the group */ + #ifdef _MSC_VER + __asm int 3; + #else if (SHMPERM_GID(perm) == gid || SHMPERM_CGID(perm) == gid) { mask = S_IRGRP; if (!readonly) { @@ -367,14 +378,20 @@ shm_access(ClientPtr client, SHMPERM_TYPE * perm, int readonly) } return (SHMPERM_MODE(perm) & mask) == mask ? 0 : -1; } + #endif } } + #ifdef _MSC_VER + __asm int 3; + return -1; + #else /* Otherwise, check everyone else */ mask = S_IROTH; if (!readonly) { mask |= S_IWOTH; } return (SHMPERM_MODE(perm) & mask) == mask ? 0 : -1; + #endif } static int @@ -440,7 +457,9 @@ ShmDetachSegment(pointer value, /* must conform to DeleteType */ if (--shmdesc->refcnt) return TRUE; +#ifndef _MSC_VER shmdt(shmdesc->addr); +#endif for (prev = &Shmsegs; *prev != shmdesc; prev = &(*prev)->next); *prev = shmdesc->next; free(shmdesc); diff --git a/xorg-server/Xext/sync.c b/xorg-server/Xext/sync.c index 4d11992bb..3c9090e66 100644 --- a/xorg-server/Xext/sync.c +++ b/xorg-server/Xext/sync.c @@ -437,16 +437,9 @@ SyncSendAlarmNotifyEvents(SyncAlarm * pAlarm) UpdateCurrentTime(); - 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 - }; - + ane.type = SyncEventBase + XSyncAlarmNotify; + ane.kind = XSyncAlarmNotify; + ane.alarm = pAlarm->alarm_id; if (pTrigger->pSync && SYNC_COUNTER == pTrigger->pSync->type) { ane.counter_value_hi = XSyncValueHigh32(pCounter->value); ane.counter_value_lo = XSyncValueLow32(pCounter->value); @@ -456,6 +449,11 @@ SyncSendAlarmNotifyEvents(SyncAlarm * pAlarm) 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); @@ -1157,6 +1155,10 @@ FreeAwait(void *addr, XID id) return Success; } +#ifdef _MSC_VER +#pragma warning(disable:4715) /* Not all control paths return a value */ +#endif + /* loosely based on dix/events.c/OtherClientGone */ static int FreeAlarmClient(void *value, XID id) @@ -1188,16 +1190,17 @@ FreeAlarmClient(void *value, XID id) static int ProcSyncInitialize(ClientPtr client) { - xSyncInitializeReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .majorVersion = SERVER_SYNC_MAJOR_VERSION, - .minorVersion = SERVER_SYNC_MINOR_VERSION, - }; + xSyncInitializeReply rep; 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); } @@ -1211,17 +1214,17 @@ ProcSyncInitialize(ClientPtr client) static int ProcSyncListSystemCounters(ClientPtr client) { - xSyncListSystemCountersReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .nCounters = 0, - }; - SysCounterInfo *psci; + xSyncListSystemCountersReply rep; + SysCounterInfo *psci=NULL; 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)); @@ -1331,12 +1334,11 @@ ProcSyncGetPriority(ClientPtr client) return rc; } - rep = (xSyncGetPriorityReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .priority = priorityclient->priority - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.priority = priorityclient->priority; if (client->swapped) { swaps(&rep.sequenceNumber); @@ -1616,13 +1618,12 @@ ProcSyncQueryCounter(ClientPtr client) &pCounter->value); } - rep = (xSyncQueryCounterReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .value_hi = XSyncValueHigh32(pCounter->value), - .value_lo = XSyncValueLow32(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); @@ -1778,32 +1779,31 @@ ProcSyncQueryAlarm(ClientPtr client) return rc; pTrigger = &pAlarm->trigger; - rep = (xSyncQueryAlarmReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = - bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply)), - .counter = (pTrigger->pSync) ? pTrigger->pSync->id : None, + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + 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. */ - .value_type = pTrigger->value_type, - .wait_value_hi = XSyncValueHigh32(pTrigger->wait_value), - .wait_value_lo = XSyncValueLow32(pTrigger->wait_value), + rep.value_type = pTrigger->value_type; + rep.wait_value_hi = XSyncValueHigh32(pTrigger->wait_value); + rep.wait_value_lo = XSyncValueLow32(pTrigger->wait_value); #else - .value_type = XSyncAbsolute, - .wait_value_hi = XSyncValueHigh32(pTrigger->test_value), - .wait_value_lo = XSyncValueLow32(pTrigger->test_value), + rep.value_type = XSyncAbsolute; + rep.wait_value_hi = XSyncValueHigh32(pTrigger->test_value); + rep.wait_value_lo = XSyncValueLow32(pTrigger->test_value); #endif - .test_type = pTrigger->test_type, - .delta_hi = XSyncValueHigh32(pAlarm->delta), - .delta_lo = XSyncValueLow32(pAlarm->delta), - .events = pAlarm->events, - .state = pAlarm->state - }; + 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; if (client->swapped) { swaps(&rep.sequenceNumber); @@ -1962,13 +1962,12 @@ ProcSyncQueryFence(ClientPtr client) if (rc != Success) return rc; - rep = (xSyncQueryFenceReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .triggered = pFence->funcs.CheckTriggered(pFence) - }; + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + + rep.triggered = pFence->funcs.CheckTriggered(pFence); if (client->swapped) { swaps(&rep.sequenceNumber); diff --git a/xorg-server/Xext/xace.c b/xorg-server/Xext/xace.c index b2e7ddaf0..b4884fb6e 100644 --- a/xorg-server/Xext/xace.c +++ b/xorg-server/Xext/xace.c @@ -19,6 +19,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> +#else +#define XACE #endif #include <stdarg.h> diff --git a/xorg-server/Xext/xcmisc.c b/xorg-server/Xext/xcmisc.c index 034bfb63b..a48f61282 100644 --- a/xorg-server/Xext/xcmisc.c +++ b/xorg-server/Xext/xcmisc.c @@ -45,16 +45,14 @@ from The Open Group. static int ProcXCMiscGetVersion(ClientPtr client) { - xXCMiscGetVersionReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .majorVersion = XCMiscMajorVersion, - .minorVersion = XCMiscMinorVersion - }; + xXCMiscGetVersionReply rep; REQUEST_SIZE_MATCH(xXCMiscGetVersionReq); - + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.majorVersion = XCMiscMajorVersion; + rep.minorVersion = XCMiscMinorVersion; if (client->swapped) { swaps(&rep.sequenceNumber); swaps(&rep.majorVersion); @@ -72,13 +70,12 @@ ProcXCMiscGetXIDRange(ClientPtr client) REQUEST_SIZE_MATCH(xXCMiscGetXIDRangeReq); GetXIDRange(client->index, FALSE, &min_id, &max_id); - rep = (xXCMiscGetXIDRangeReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .start_id = min_id, - .count = max_id - min_id + 1 - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.start_id = min_id; + rep.count = max_id - min_id + 1; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.start_id); @@ -106,12 +103,11 @@ ProcXCMiscGetXIDList(ClientPtr client) return BadAlloc; } count = GetXIDList(client, stuff->count, pids); - rep = (xXCMiscGetXIDListReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = count, - .count = count - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = count; + rep.count = count; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); diff --git a/xorg-server/Xext/xf86bigfont.c b/xorg-server/Xext/xf86bigfont.c index faf81f7dc..42f5549be 100644 --- a/xorg-server/Xext/xf86bigfont.c +++ b/xorg-server/Xext/xf86bigfont.c @@ -278,23 +278,28 @@ ProcXF86BigfontQueryVersion(ClientPtr client) xXF86BigfontQueryVersionReply reply; REQUEST_SIZE_MATCH(xXF86BigfontQueryVersionReq); - reply = (xXF86BigfontQueryVersionReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION, - .minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION, - .uid = geteuid(), - .gid = getegid(), + + reply.type = X_Reply; + reply.sequenceNumber = client->sequence; + reply.length = 0; + reply.majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION; + reply.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION; + #ifdef WIN32 + reply.uid = 0; + reply.gid = 0; + #else + reply.uid = geteuid(); + reply.gid = getegid(); + #endif #ifdef HAS_SHM - .signature = signature, - .capabilities = (client->local && !client->swapped) + reply.signature = signature; + reply.capabilities = (client->local && !client->swapped) ? XF86Bigfont_CAP_LocalShm : 0 #else - .signature = 0, - .capabilities = 0 + reply.signature = 0; /* This is redundant. Avoids uninitialized memory. */ + reply.capabilities = 0; #endif - }; + if (client->swapped) { char tmp; diff --git a/xorg-server/Xext/xres.c b/xorg-server/Xext/xres.c index 7d21ad7e9..a08a5778b 100644 --- a/xorg-server/Xext/xres.c +++ b/xorg-server/Xext/xres.c @@ -120,7 +120,7 @@ AddFragment(struct xorg_list *frags, int bytes) static void WriteFragmentsToClient(ClientPtr client, struct xorg_list *frags) { - FragmentList *it; + FragmentList *it=NULL; xorg_list_for_each_entry(it, frags, l) { WriteToClient(client, it->bytes, (char*) it + sizeof(*it)); } @@ -133,7 +133,7 @@ WriteFragmentsToClient(ClientPtr client, struct xorg_list *frags) static void DestroyFragments(struct xorg_list *frags) { - FragmentList *it, *tmp; + FragmentList *it=NULL, *tmp; xorg_list_for_each_entry_safe(it, tmp, frags, l) { xorg_list_del(&it->l); free(it); @@ -196,16 +196,15 @@ static int ProcXResQueryVersion(ClientPtr client) { REQUEST(xXResQueryVersionReq); - xXResQueryVersionReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .server_major = SERVER_XRES_MAJOR_VERSION, - .server_minor = SERVER_XRES_MINOR_VERSION - }; + xXResQueryVersionReply rep; REQUEST_SIZE_MATCH(xXResQueryVersionReq); + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.server_major = SERVER_XRES_MAJOR_VERSION; + rep.server_minor = SERVER_XRES_MINOR_VERSION; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -236,12 +235,11 @@ ProcXResQueryClients(ClientPtr client) } } - rep = (xXResQueryClientsReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = bytes_to_int32(num_clients * sz_xXResClient), - .num_clients = num_clients - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = bytes_to_int32(num_clients * sz_xXResClient); + rep.num_clients = num_clients; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -305,12 +303,11 @@ ProcXResQueryClientResources(ClientPtr client) num_types++; } - rep = (xXResQueryClientResourcesReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = bytes_to_int32(num_types * sz_xXResType), - .num_types = num_types - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = bytes_to_int32(num_types * sz_xXResType); + rep.num_types = num_types; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -477,17 +474,16 @@ ProcXResQueryClientPixmapBytes(ClientPtr client) (pointer)(&bytes)); #endif - rep = (xXResQueryClientPixmapBytesReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .bytes = bytes, + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.bytes = bytes; #ifdef _XSERVER64 - .bytes_overflow = bytes >> 32 + rep.bytes_overflow = bytes >> 32; #else - .bytes_overflow = 0 + rep.bytes_overflow = 0; #endif - }; if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -672,12 +668,11 @@ ProcXResQueryClientIds (ClientPtr client) rc = ConstructClientIds(client, stuff->numSpecs, specs, &ctx); if (rc == Success) { - xXResQueryClientIdsReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = bytes_to_int32(ctx.resultBytes), - .numIds = ctx.numIds - }; + xXResQueryClientIdsReply rep; + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = bytes_to_int32(ctx.resultBytes); + rep.numIds = ctx.numIds; assert((ctx.resultBytes & 3) == 0); @@ -829,7 +824,7 @@ AddResourceSizeValue(pointer ptr, XID id, RESTYPE type, pointer cdata) Bool ok = TRUE; HashTable ht; HtGenericHashSetupRec htSetup = { - .keySize = sizeof(void*) + /*.keySize = */sizeof(void*) }; /* it doesn't matter that we don't undo the work done here @@ -1055,12 +1050,11 @@ ProcXResQueryResourceBytes (ClientPtr client) rc = ConstructResourceBytes(stuff->client, &ctx); if (rc == Success) { - xXResQueryResourceBytesReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = bytes_to_int32(ctx.resultBytes), - .numSizes = ctx.numSizes - }; + xXResQueryResourceBytesReply rep; + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = bytes_to_int32(ctx.resultBytes); + rep.numSizes = ctx.numSizes; if (client->swapped) { swaps (&rep.sequenceNumber); diff --git a/xorg-server/Xext/xtest.c b/xorg-server/Xext/xtest.c index c593372e7..a0e463e0e 100644 --- a/xorg-server/Xext/xtest.c +++ b/xorg-server/Xext/xtest.c @@ -88,16 +88,14 @@ static int XTestSwapFakeInput(ClientPtr /* client */ , static int ProcXTestGetVersion(ClientPtr client) { - xXTestGetVersionReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .majorVersion = XTestMajorVersion, - .minorVersion = XTestMinorVersion - }; + xXTestGetVersionReply rep; REQUEST_SIZE_MATCH(xXTestGetVersionReq); - + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.majorVersion = XTestMajorVersion; + rep.minorVersion = XTestMinorVersion; if (client->swapped) { swaps(&rep.sequenceNumber); swaps(&rep.minorVersion); @@ -136,12 +134,11 @@ ProcXTestCompareCursor(ClientPtr client) return rc; } } - rep = (xXTestCompareCursorReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .same = (wCursor(pWin) == pCursor) - }; + + rep.type = X_Reply; + rep.sequenceNumber = client->sequence; + rep.length = 0; + rep.same = (wCursor(pWin) == pCursor); if (client->swapped) { swaps(&rep.sequenceNumber); } diff --git a/xorg-server/Xext/xvmain.c b/xorg-server/Xext/xvmain.c index c2860b86a..e0708b352 100644 --- a/xorg-server/Xext/xvmain.c +++ b/xorg-server/Xext/xvmain.c @@ -271,7 +271,7 @@ XvScreenInit(ScreenPtr pScreen) /* ALLOCATE SCREEN PRIVATE RECORD */ - pxvs = malloc(sizeof(XvScreenRec)); + pxvs = calloc(1,sizeof(XvScreenRec)); if (!pxvs) { ErrorF("XvScreenInit: Unable to allocate screen private structure\n"); return BadAlloc; @@ -302,7 +302,7 @@ XvCloseScreen(ScreenPtr pScreen) pScreen->DestroyWindow = pxvs->DestroyWindow; pScreen->CloseScreen = pxvs->CloseScreen; - (*pxvs->ddCloseScreen) (pScreen); + if (pxvs->ddCloseScreen) (*pxvs->ddCloseScreen) (pScreen); free(pxvs); |