aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/hw
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/hw')
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Clipboard.c13
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Events.c18
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXpicture.c9
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXproperty.c13
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXrender.c3
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/NXshm.c3
6 files changed, 42 insertions, 17 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
index 2e6f38efd..d26d3524a 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c
@@ -224,8 +224,6 @@ void nxagentClearClipboard(ClientPtr pClient, WindowPtr pWindow)
void nxagentClearSelection(XEvent *X)
{
- xEvent x;
-
int i = 0;
#ifdef DEBUG
@@ -252,6 +250,8 @@ void nxagentClearSelection(XEvent *X)
{
if (lastSelectionOwner[i].client != NULL)
{
+ xEvent x;
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionClear;
x.u.selectionClear.time = GetTimeInMillis();
x.u.selectionClear.window = lastSelectionOwner[i].window;
@@ -315,6 +315,7 @@ FIXME: Do we need this?
XFree(strTarget);
}
*/
+ memset(&eventSelection, 0, sizeof(XSelectionEvent));
eventSelection.property = None;
if (X->xselectionrequest.target == serverTARGETS)
@@ -423,6 +424,7 @@ FIXME: Do we need this?
lastServerTime = X->xselectionrequest.time;
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionRequest;
x.u.selectionRequest.time = GetTimeInMillis();
x.u.selectionRequest.owner = lastSelectionOwner[i].window;
@@ -501,6 +503,7 @@ void nxagentSendSelectionNotify(Atom property)
lastClientClientPtr -> index);
#endif
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionNotify;
x.u.selectionNotify.time = lastClientTime;
@@ -980,6 +983,7 @@ void nxagentNotifySelection(XEvent *X)
}
+ memset(&eventSelection, 0, sizeof(XSelectionEvent));
eventSelection.type = SelectionNotify;
eventSelection.send_event = True;
eventSelection.display = nxagentDisplay;
@@ -1150,6 +1154,7 @@ FIXME: Why this pointer can be not a valid
return;
}
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionNotify;
x.u.selectionNotify.time = time;
x.u.selectionNotify.requestor = requestor;
@@ -1255,6 +1260,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
4,
&xa_STRING, 1);
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionNotify;
x.u.selectionNotify.time = time;
x.u.selectionNotify.requestor = requestor;
@@ -1287,6 +1293,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
(unsigned char *) &lastSelectionOwner[i].lastTimeChanged,
1);
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionNotify;
x.u.selectionNotify.time = time;
x.u.selectionNotify.requestor = requestor;
@@ -1375,6 +1382,7 @@ int nxagentConvertSelection(ClientPtr client, WindowPtr pWin, Atom selection,
"to the requestor with property None.\n");
#endif
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = SelectionNotify;
x.u.selectionNotify.time = time;
x.u.selectionNotify.requestor = requestor;
@@ -1407,6 +1415,7 @@ int nxagentSendNotify(xEvent *event)
* Setup selection notify event to real server.
*/
+ memset(&x, 0, sizeof(XSelectionEvent));
x.type = SelectionNotify;
x.send_event = True;
x.display = nxagentDisplay;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c
index efe745718..d8512b548 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Events.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c
@@ -1177,6 +1177,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
nxagentXkbNumTrap = 0;
}
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = KeyRelease;
x.u.u.detail = nxagentConvertKeycode(X.xkey.keycode);
x.u.keyButtonPointer.time = nxagentLastKeyPressTime +
@@ -1263,6 +1264,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
X.xbutton.window == nxagentFullscreenWindow &&
X.xbutton.subwindow == None))
{
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = ButtonPress;
x.u.u.detail = inputInfo.pointer -> button -> map[nxagentReversePointerMap[X.xbutton.button]];
x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis();
@@ -1336,6 +1338,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
if (minimize != True)
{
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = ButtonRelease;
x.u.u.detail = inputInfo.pointer -> button -> map[nxagentReversePointerMap[X.xbutton.button]];
x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis();
@@ -1402,6 +1405,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
}
#endif
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = MotionNotify;
if (nxagentOption(Rootless))
@@ -1583,6 +1587,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
if (!nxagentOption(Rootless) ||
inputInfo.keyboard->key->modifierMap[i * 8 + k])
{
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = KeyRelease;
x.u.u.detail = i * 8 + k;
x.u.keyButtonPointer.time = nxagentLastEventTime = GetTimeInMillis();
@@ -1706,6 +1711,7 @@ FIXME: Don't enqueue the KeyRelease event if the key was
{
NewCurrentScreen(pScreen, X.xcrossing.x, X.xcrossing.y);
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = MotionNotify;
if (nxagentOption(Rootless))
@@ -2337,6 +2343,7 @@ int nxagentHandleKeyPress(XEvent *X, enum HandleEventResult *result)
nxagentLastEventTime = nxagentLastKeyPressTime = GetTimeInMillis();
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = KeyPress;
x.u.u.detail = nxagentConvertKeycode(X -> xkey.keycode);
x.u.keyButtonPointer.time = nxagentLastKeyPressTime;
@@ -2641,7 +2648,6 @@ int nxagentHandleGraphicsExposeEvent(XEvent *X)
int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result)
{
WindowPtr pWin;
- xEvent x;
*result = doNothing;
@@ -2695,6 +2701,9 @@ int nxagentHandleClientMessageEvent(XEvent *X, enum HandleEventResult *result)
char *message_data;
#endif
+ xEvent x;
+
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = ClientMessage;
x.u.u.detail = X -> xclient.format;
@@ -3201,7 +3210,6 @@ int nxagentHandleConfigureNotify(XEvent* X)
ClientPtr pClient;
WindowPtr pWinWindow;
WindowPtr pWin;
- xEvent x;
int sendEventAnyway = 0;
pWinWindow = nxagentWindowPtr(X -> xconfigure.window);
@@ -3294,6 +3302,9 @@ int nxagentHandleConfigureNotify(XEvent* X)
if (sendEventAnyway || X -> xconfigure.send_event)
{
+ xEvent x;
+
+ memset(&x, 0, sizeof(xEvent));
x.u.u.type = X -> xconfigure.type;
x.u.u.type |= 0x80;
@@ -3767,6 +3778,7 @@ void nxagentSendFakeKey(int key)
now = GetTimeInMillis();
+ memset(&fake, 0, sizeof(xEvent));
fake.u.u.type = KeyPress;
fake.u.u.detail = key;
fake.u.keyButtonPointer.time = now;
@@ -3792,6 +3804,8 @@ int nxagentInitKeyboardState()
fprintf(stderr, "nxagentInitKeyboardState: Initializing XKB state.\n");
#endif
+ memset(&X, 0, sizeof(XEvent));
+
XkbGetIndicatorState(nxagentDisplay, XkbUseCoreKbd, &modifiers);
xkbev -> state.locked_mods = 0x0;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c
index 1188d06bf..53a4633e5 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c
@@ -95,10 +95,9 @@ PictureCreateDefaultFormats (ScreenPtr pScreen, int *nformatp)
nxagentPictureCreateDefaultFormats(pScreen, formats, &nformats);
- pFormats = (PictFormatPtr) malloc (nformats * sizeof (PictFormatRec));
+ pFormats = (PictFormatPtr) calloc (nformats, sizeof (PictFormatRec));
if (!pFormats)
return 0;
- memset (pFormats, '\0', nformats * sizeof (PictFormatRec));
for (f = 0; f < nformats; f++)
{
pFormats[f].id = FakeClientID (0);
@@ -198,7 +197,7 @@ AllocatePicture (ScreenPtr pScreen)
unsigned int size;
int i;
- pPicture = (PicturePtr) malloc (ps->totalPictureSize);
+ pPicture = (PicturePtr) calloc(1, ps->totalPictureSize);
if (!pPicture)
return 0;
ppriv = (DevUnion *)(pPicture + 1);
@@ -289,7 +288,7 @@ CreateSolidPicture (Picture pid, xRenderColor *color, int *error)
}
pPicture->id = pid;
- pPicture->pSourcePict = (SourcePictPtr) malloc(sizeof(PictSolidFill));
+ pPicture->pSourcePict = (SourcePictPtr) calloc(1, sizeof(PictSolidFill));
if (!pPicture->pSourcePict) {
*error = BadAlloc;
free(pPicture);
@@ -326,7 +325,7 @@ static PicturePtr createSourcePicture(void)
picturePrivateCount * sizeof(DevUnion) +
sizeof(nxagentPrivPictureRec);
- pPicture = (PicturePtr) malloc(totalPictureSize);
+ pPicture = (PicturePtr) calloc(1, totalPictureSize);
if (pPicture != NULL)
{
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
index 28fdd19f5..ee77eb64e 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c
@@ -205,6 +205,8 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
void * data;
int copySize;
+ memset(&event, 0, sizeof(xEvent));
+
sizeInBytes = format>>3;
totalSize = len * sizeInBytes;
@@ -332,11 +334,6 @@ ChangeWindowProperty(WindowPtr pWin, Atom property, Atom type, int format,
int
ProcGetProperty(ClientPtr client)
{
- #ifdef NXAGENT_SERVER
- nxagentWMStateRec wmState;
- nxagentWMStateRec *wmsP = &wmState;
- #endif
-
PropertyPtr pProp, prevProp;
unsigned long n, len, ind;
WindowPtr pWin;
@@ -395,6 +392,10 @@ ProcGetProperty(ClientPtr client)
(!pProp) &&
strcmp(NameForAtom(stuff->property), "WM_STATE") == 0)
{
+ nxagentWMStateRec wmState;
+ nxagentWMStateRec *wmsP = &wmState;
+
+ memset(&wmState, 0, sizeof(nxagentWMStateRec));
wmState.state = 1;
wmState.icon = None;
@@ -498,6 +499,7 @@ ProcGetProperty(ClientPtr client)
{ /* send the event */
xEvent event;
+ memset(&event, 0, sizeof(xEvent));
event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyDelete;
@@ -620,6 +622,7 @@ GetWindowProperty(pWin, property, longOffset, longLength, delete,
{ /* send the event */
xEvent event;
+ memset(&event, 0, sizeof(xEvent));
event.u.u.type = PropertyNotify;
event.u.property.window = pWin->drawable.id;
event.u.property.state = PropertyDelete;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c
index 8d55516fb..36aa3323e 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c
@@ -229,10 +229,9 @@ ProcRenderQueryPictFormats (ClientPtr client)
ndepth * sizeof (xPictDepth) +
nvisual * sizeof (xPictVisual) +
numSubpixel * sizeof (CARD32));
- reply = (xRenderQueryPictFormatsReply *) malloc (rlength);
+ reply = (xRenderQueryPictFormatsReply *) calloc (1, rlength);
if (!reply)
return BadAlloc;
- memset(reply, 0, rlength);
reply->type = X_Reply;
reply->sequenceNumber = client->sequence;
reply->length = (rlength - sizeof(xGenericReply)) >> 2;
diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c
index fa60917e3..f251f3b9f 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c
@@ -240,7 +240,7 @@ fbShmPutImage(dst, pGC, depth, format, w, h, sx, sy, sw, sh, dx, dy, data)
length = nxagentImageLength(sw, sh, format, 0, depth);
- if ((newdata = malloc(length)) != NULL)
+ if ((newdata = calloc(1, length)) != NULL)
{
fbGetImage((DrawablePtr) pPixmap, sx, sy, sw, sh, format, AllPlanes, newdata);
(*pGC->ops->PutImage)(dst, pGC, depth, dx, dy, sw, sh, 0, format, newdata);
@@ -360,6 +360,7 @@ ProcShmPutImage(client)
{
xShmCompletionEvent ev;
+ memset(&ev, 0, sizeof(xShmCompletionEvent));
ev.type = ShmCompletionCode;
ev.drawable = stuff->drawable;
ev.sequenceNumber = client->sequence;