diff options
Diffstat (limited to 'xorg-server/xfixes')
-rw-r--r-- | xorg-server/xfixes/cursor.c | 18 | ||||
-rw-r--r-- | xorg-server/xfixes/region.c | 5 | ||||
-rw-r--r-- | xorg-server/xfixes/select.c | 8 | ||||
-rw-r--r-- | xorg-server/xfixes/xfixes.c | 5 | ||||
-rw-r--r-- | xorg-server/xfixes/xfixesint.h | 5 |
5 files changed, 18 insertions, 23 deletions
diff --git a/xorg-server/xfixes/cursor.c b/xorg-server/xfixes/cursor.c index 648271ec8..8f55c291e 100644 --- a/xorg-server/xfixes/cursor.c +++ b/xorg-server/xfixes/cursor.c @@ -175,7 +175,6 @@ CursorDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) for (e = cursorEvents; e; e = e->next) { if ((e->eventMask & XFixesDisplayCursorNotifyMask)) { xXFixesCursorNotifyEvent ev; - ev.type = XFixesEventBase + XFixesCursorNotify; ev.subtype = XFixesDisplayCursorNotify; ev.window = e->pWindow->drawable.id; @@ -382,7 +381,8 @@ ProcXFixesGetCursorImage(ClientPtr client) width = pCursor->bits->width; height = pCursor->bits->height; npixels = width * height; - rep = malloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32)); + rep = calloc(sizeof(xXFixesGetCursorImageReply) + npixels * sizeof(CARD32), + 1); if (!rep) return BadAlloc; @@ -411,8 +411,8 @@ ProcXFixesGetCursorImage(ClientPtr client) swapl(&rep->cursorSerial); SwapLongs(image, npixels); } - WriteToClient(client, sizeof(xXFixesGetCursorImageReply) + - (npixels << 2), (char *) rep); + WriteToClient(client, + sizeof(xXFixesGetCursorImageReply) + (npixels << 2), rep); free(rep); return Success; } @@ -475,11 +475,13 @@ ProcXFixesGetCursorName(ClientPtr client) str = ""; len = strlen(str); + reply.type = X_Reply; - reply.length = bytes_to_int32(len); reply.sequenceNumber = client->sequence; + reply.length = bytes_to_int32(len); reply.atom = pCursor->name; reply.nbytes = len; + if (client->swapped) { swaps(&reply.sequenceNumber); swapl(&reply.length); @@ -531,8 +533,8 @@ ProcXFixesGetCursorImageAndName(ClientPtr client) name = pCursor->name ? NameForAtom(pCursor->name) : ""; nbytes = strlen(name); nbytesRound = pad_to_int32(nbytes); - rep = malloc(sizeof(xXFixesGetCursorImageAndNameReply) + - npixels * sizeof(CARD32) + nbytesRound); + rep = calloc(sizeof(xXFixesGetCursorImageAndNameReply) + + npixels * sizeof(CARD32) + nbytesRound, 1); if (!rep) return BadAlloc; @@ -567,7 +569,7 @@ ProcXFixesGetCursorImageAndName(ClientPtr client) SwapLongs(image, npixels); } WriteToClient(client, sizeof(xXFixesGetCursorImageAndNameReply) + - (npixels << 2) + nbytesRound, (char *) rep); + (npixels << 2) + nbytesRound, rep); free(rep); return Success; } diff --git a/xorg-server/xfixes/region.c b/xorg-server/xfixes/region.c index 0acbadae2..0e9ca443f 100644 --- a/xorg-server/xfixes/region.c +++ b/xorg-server/xfixes/region.c @@ -557,7 +557,8 @@ ProcXFixesFetchRegion(ClientPtr client) pBox = RegionRects(pRegion); nBox = RegionNumRects(pRegion); - reply = malloc(sizeof(xXFixesFetchRegionReply) + nBox * sizeof(xRectangle)); + reply = calloc(sizeof(xXFixesFetchRegionReply) + nBox * sizeof(xRectangle), + 1); if (!reply) return BadAlloc; reply->type = X_Reply; @@ -584,7 +585,7 @@ ProcXFixesFetchRegion(ClientPtr client) swaps(&reply->height); SwapShorts((INT16 *) pRect, nBox * 4); } - (void) WriteToClient(client, sizeof(xXFixesFetchRegionReply) + + WriteToClient(client, sizeof(xXFixesFetchRegionReply) + nBox * sizeof(xRectangle), (char *) reply); free(reply); return Success; diff --git a/xorg-server/xfixes/select.c b/xorg-server/xfixes/select.c index a896846a7..17fb0b583 100644 --- a/xorg-server/xfixes/select.c +++ b/xorg-server/xfixes/select.c @@ -78,15 +78,11 @@ XFixesSelectionCallback(CallbackListPtr *callbacks, pointer data, pointer args) for (e = selectionEvents; e; e = e->next) { if (e->selection == selection->selection && (e->eventMask & eventMask)) { xXFixesSelectionNotifyEvent ev; - - memset(&ev, 0, sizeof(xXFixesSelectionNotifyEvent)); ev.type = XFixesEventBase + XFixesSelectionNotify; ev.subtype = subtype; ev.window = e->pWindow->drawable.id; - if (subtype == XFixesSetSelectionOwnerNotify) - ev.owner = selection->window; - else - ev.owner = 0; + ev.owner = (subtype == XFixesSetSelectionOwnerNotify) ? + selection->window : 0; ev.selection = e->selection; ev.timestamp = currentTime.milliseconds; ev.selectionTimestamp = selection->lastTimeChanged.milliseconds; diff --git a/xorg-server/xfixes/xfixes.c b/xorg-server/xfixes/xfixes.c index f80230fd3..533482c56 100644 --- a/xorg-server/xfixes/xfixes.c +++ b/xorg-server/xfixes/xfixes.c @@ -48,6 +48,7 @@ #include "xfixesint.h" #include "protocol-versions.h" +#include "extinit.h" static unsigned char XFixesReqCode; int XFixesEventBase; @@ -68,8 +69,8 @@ ProcXFixesQueryVersion(ClientPtr client) REQUEST_SIZE_MATCH(xXFixesQueryVersionReq); memset(&rep, 0, sizeof(xXFixesQueryVersionReply)); rep.type = X_Reply; - rep.length = 0; rep.sequenceNumber = client->sequence; + rep.length = 0; if (version_compare(stuff->majorVersion, stuff->minorVersion, SERVER_XFIXES_MAJOR_VERSION, @@ -90,7 +91,7 @@ ProcXFixesQueryVersion(ClientPtr client) swapl(&rep.majorVersion); swapl(&rep.minorVersion); } - WriteToClient(client, sizeof(xXFixesQueryVersionReply), (char *) &rep); + WriteToClient(client, sizeof(xXFixesQueryVersionReply), &rep); return Success; } diff --git a/xorg-server/xfixes/xfixesint.h b/xorg-server/xfixes/xfixesint.h index 71f88a93d..334c71fbf 100644 --- a/xorg-server/xfixes/xfixesint.h +++ b/xorg-server/xfixes/xfixesint.h @@ -71,11 +71,6 @@ typedef struct _XFixesClient { extern int (*ProcXFixesVector[XFixesNumberRequests]) (ClientPtr); -/* Initialize extension at server startup time */ - -void - XFixesExtensionInit(void); - /* Save set */ int ProcXFixesChangeSaveSet(ClientPtr client); |