aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/xfixes
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/xfixes')
-rw-r--r--nx-X11/programs/Xserver/xfixes/cursor.c24
-rw-r--r--nx-X11/programs/Xserver/xfixes/region.c4
-rw-r--r--nx-X11/programs/Xserver/xfixes/xfixes.c11
3 files changed, 21 insertions, 18 deletions
diff --git a/nx-X11/programs/Xserver/xfixes/cursor.c b/nx-X11/programs/Xserver/xfixes/cursor.c
index 152bda500..fc4c1d803 100644
--- a/nx-X11/programs/Xserver/xfixes/cursor.c
+++ b/nx-X11/programs/Xserver/xfixes/cursor.c
@@ -201,7 +201,7 @@ XFixesSelectCursorInput (ClientPtr pClient,
}
if (!e)
{
- e = (CursorEventPtr) malloc (sizeof (CursorEventRec));
+ e = (CursorEventPtr) calloc (1, sizeof (CursorEventRec));
if (!e)
return BadAlloc;
@@ -364,8 +364,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;
@@ -456,11 +456,13 @@ ProcXFixesGetCursorName (ClientPtr client)
str = "";
len = strlen (str);
- reply.type = X_Reply;
- reply.length = (len + 3) >> 2;
- reply.sequenceNumber = client->sequence;
- reply.atom = pCursor->name;
- reply.nbytes = len;
+ reply = (xXFixesGetCursorNameReply) {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = (len + 3) >> 2,
+ .atom = pCursor->name,
+ .nbytes = len
+ };
if (client->swapped) {
swaps(&reply.sequenceNumber);
swapl(&reply.length);
@@ -508,8 +510,8 @@ ProcXFixesGetCursorImageAndName (ClientPtr client)
name = pCursor->name ? NameForAtom (pCursor->name) : "";
nbytes = strlen (name);
nbytesRound = (nbytes + 3) & ~3;
- rep = malloc (sizeof (xXFixesGetCursorImageAndNameReply) +
- npixels * sizeof (CARD32) + nbytesRound);
+ rep = calloc (sizeof (xXFixesGetCursorImageAndNameReply) +
+ npixels * sizeof (CARD32) + nbytesRound, 1);
if (!rep)
return BadAlloc;
@@ -757,7 +759,7 @@ createCursorHideCount (ClientPtr pClient, ScreenPtr pScreen)
CursorScreenPtr cs = GetCursorScreen(pScreen);
CursorHideCountPtr pChc;
- pChc = (CursorHideCountPtr) malloc(sizeof(CursorHideCountRec));
+ pChc = (CursorHideCountPtr) calloc(1, sizeof(CursorHideCountRec));
if (pChc == NULL) {
return BadAlloc;
}
diff --git a/nx-X11/programs/Xserver/xfixes/region.c b/nx-X11/programs/Xserver/xfixes/region.c
index ba8c62835..849df6869 100644
--- a/nx-X11/programs/Xserver/xfixes/region.c
+++ b/nx-X11/programs/Xserver/xfixes/region.c
@@ -570,8 +570,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;
diff --git a/nx-X11/programs/Xserver/xfixes/xfixes.c b/nx-X11/programs/Xserver/xfixes/xfixes.c
index fadaf73b2..7fe94a99c 100644
--- a/nx-X11/programs/Xserver/xfixes/xfixes.c
+++ b/nx-X11/programs/Xserver/xfixes/xfixes.c
@@ -56,14 +56,15 @@ static int
ProcXFixesQueryVersion(ClientPtr client)
{
XFixesClientPtr pXFixesClient = GetXFixesClient (client);
- xXFixesQueryVersionReply rep;
+ xXFixesQueryVersionReply rep = {
+ .type = X_Reply,
+ .sequenceNumber = client->sequence,
+ .length = 0
+ };
REQUEST(xXFixesQueryVersionReq);
REQUEST_SIZE_MATCH(xXFixesQueryVersionReq);
- memset(&rep, 0, sizeof(xXFixesQueryVersionReply));
- rep.type = X_Reply;
- rep.length = 0;
- rep.sequenceNumber = client->sequence;
+
if (stuff->majorVersion < SERVER_XFIXES_MAJOR_VERSION) {
rep.majorVersion = stuff->majorVersion;
rep.minorVersion = stuff->minorVersion;