diff options
author | Ulrich Sibiller <uli42@gmx.de> | 2017-12-10 23:57:35 +0100 |
---|---|---|
committer | Mihai Moldovan <ionic@ionic.de> | 2017-12-28 00:17:54 +0100 |
commit | 6acbfab33133a92dbd7f128284d26f94bfeb1af2 (patch) | |
tree | a270c581d3268b20ef8527cffeb8ad91b26b9cf7 /nx-X11/programs | |
parent | bc5f9a2363cb865fa1a8a1427d9320514e7d1889 (diff) | |
download | nx-libs-6acbfab33133a92dbd7f128284d26f94bfeb1af2.tar.gz nx-libs-6acbfab33133a92dbd7f128284d26f94bfeb1af2.tar.bz2 nx-libs-6acbfab33133a92dbd7f128284d26f94bfeb1af2.zip |
reduce usage of uninitialised bytes
as reported by valgrind
Diffstat (limited to 'nx-X11/programs')
-rw-r--r-- | nx-X11/programs/Xserver/GL/glx/glxcmds.c | 28 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/Xext/dpms.c | 8 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/Xext/shape.c | 18 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/Xext/xtest.c | 4 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/dix/colormap.c | 6 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/dix/devices.c | 5 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/dix/dispatch.c | 80 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/dix/pixmap.c | 4 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 2 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 17 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/mi/miexpose.c | 16 | ||||
-rw-r--r-- | nx-X11/programs/Xserver/xkb/xkb.c | 2 |
12 files changed, 86 insertions, 104 deletions
diff --git a/nx-X11/programs/Xserver/GL/glx/glxcmds.c b/nx-X11/programs/Xserver/GL/glx/glxcmds.c index 602b79099..353697727 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxcmds.c +++ b/nx-X11/programs/Xserver/GL/glx/glxcmds.c @@ -510,7 +510,7 @@ int DoMakeCurrent( __GLXclientState *cl, ClientPtr client = cl->client; DrawablePtr pDraw; DrawablePtr pRead; - xGLXMakeCurrentReply reply; + xGLXMakeCurrentReply reply = {0}; __GLXpixmap *drawPixmap = NULL; __GLXpixmap *readPixmap = NULL; __GLXcontext *glxc, *prevglxc; @@ -745,7 +745,7 @@ int __glXIsDirect(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc; - xGLXIsDirectReply reply; + xGLXIsDirectReply reply = {0}; __GLXcontext *glxc; /* @@ -775,7 +775,7 @@ int __glXQueryVersion(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; - xGLXQueryVersionReply reply; + xGLXQueryVersionReply reply = {0}; GLuint major, minor; major = req->majorVersion; @@ -921,10 +921,10 @@ int DoGetVisualConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap) { ClientPtr client = cl->client; - xGLXGetVisualConfigsReply reply; + xGLXGetVisualConfigsReply reply = {0}; __GLXscreenInfo *pGlxScreen; __GLcontextModes *modes; - CARD32 buf[__GLX_TOTAL_CONFIG]; + CARD32 buf[__GLX_TOTAL_CONFIG] = {0}; int p; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; @@ -1029,7 +1029,7 @@ int __glXGetVisualConfigs(__GLXclientState *cl, GLbyte *pc) int DoGetFBConfigs(__GLXclientState *cl, unsigned screen, GLboolean do_swap) { ClientPtr client = cl->client; - xGLXGetFBConfigsReply reply; + xGLXGetFBConfigsReply reply = {0}; __GLXscreenInfo *pGlxScreen; CARD32 buf[__GLX_FBCONFIG_ATTRIBS_LENGTH]; int p; @@ -1365,7 +1365,7 @@ int __glXQueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; __GLXcontext *ctx; xGLXQueryContextInfoEXTReq *req; - xGLXQueryContextInfoEXTReply reply; + xGLXQueryContextInfoEXTReply reply = {0}; int nProps; int *sendBuf, *pSendBuf; int nReplyBytes; @@ -1780,7 +1780,7 @@ static int __glXQueryMaxSwapBarriersSGIX(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; xGLXQueryMaxSwapBarriersSGIXReq *req = (xGLXQueryMaxSwapBarriersSGIXReq *) pc; - xGLXQueryMaxSwapBarriersSGIXReply reply; + xGLXQueryMaxSwapBarriersSGIXReply reply = {0}; int screen = req->screen; if (__glXSwapBarrierFuncs && @@ -1810,7 +1810,7 @@ static int __glxQueryHyperpipeNetworkSGIX(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXQueryHyperpipeNetworkSGIXReq * req = (xGLXQueryHyperpipeNetworkSGIXReq *) pc; - xGLXQueryHyperpipeNetworkSGIXReply reply; + xGLXQueryHyperpipeNetworkSGIXReply reply = {0}; int screen = req->screen; void *rdata = NULL; @@ -1851,7 +1851,7 @@ static int __glxDestroyHyperpipeConfigSGIX (__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; xGLXDestroyHyperpipeConfigSGIXReq * req = (xGLXDestroyHyperpipeConfigSGIXReq *) pc; - xGLXDestroyHyperpipeConfigSGIXReply reply; + xGLXDestroyHyperpipeConfigSGIXReply reply = {0}; int screen = req->screen; int success = GLX_BAD_HYPERPIPE_SGIX; int hpId ; @@ -1886,7 +1886,7 @@ static int __glxQueryHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; xGLXQueryHyperpipeConfigSGIXReq * req = (xGLXQueryHyperpipeConfigSGIXReq *) pc; - xGLXQueryHyperpipeConfigSGIXReply reply; + xGLXQueryHyperpipeConfigSGIXReply reply = {0}; int screen = req->screen; void *rdata = NULL; int length; @@ -1930,7 +1930,7 @@ static int __glxHyperpipeConfigSGIX(__GLXclientState *cl, GLbyte *pc) ClientPtr client = cl->client; xGLXHyperpipeConfigSGIXReq * req = (xGLXHyperpipeConfigSGIXReq *) pc; - xGLXHyperpipeConfigSGIXReply reply; + xGLXHyperpipeConfigSGIXReply reply = {0}; int screen = req->screen; void *rdata; @@ -2059,7 +2059,7 @@ int __glXQueryExtensionsString(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc; - xGLXQueryExtensionsStringReply reply; + xGLXQueryExtensionsStringReply reply = {0}; GLuint screen; size_t n, length; const char *ptr; @@ -2104,7 +2104,7 @@ int __glXQueryServerString(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc; - xGLXQueryServerStringReply reply; + xGLXQueryServerStringReply reply = {0}; int name; GLuint screen; size_t n, length; diff --git a/nx-X11/programs/Xserver/Xext/dpms.c b/nx-X11/programs/Xserver/Xext/dpms.c index ea9781353..e05a70621 100644 --- a/nx-X11/programs/Xserver/Xext/dpms.c +++ b/nx-X11/programs/Xserver/Xext/dpms.c @@ -101,7 +101,7 @@ ProcDPMSGetVersion(client) register ClientPtr client; { /* REQUEST(xDPMSGetVersionReq); */ - xDPMSGetVersionReply rep; + xDPMSGetVersionReply rep = {0}; REQUEST_SIZE_MATCH(xDPMSGetVersionReq); @@ -123,7 +123,7 @@ static int ProcDPMSCapable(register ClientPtr client) { /* REQUEST(xDPMSCapableReq); */ - xDPMSCapableReply rep; + xDPMSCapableReply rep = {0}; REQUEST_SIZE_MATCH(xDPMSCapableReq); @@ -144,7 +144,7 @@ ProcDPMSGetTimeouts(client) register ClientPtr client; { /* REQUEST(xDPMSGetTimeoutsReq); */ - xDPMSGetTimeoutsReply rep; + xDPMSGetTimeoutsReply rep = {0}; REQUEST_SIZE_MATCH(xDPMSGetTimeoutsReq); @@ -258,7 +258,7 @@ static int ProcDPMSInfo(register ClientPtr client) { /* REQUEST(xDPMSInfoReq); */ - xDPMSInfoReply rep; + xDPMSInfoReply rep = {0}; REQUEST_SIZE_MATCH(xDPMSInfoReq); diff --git a/nx-X11/programs/Xserver/Xext/shape.c b/nx-X11/programs/Xserver/Xext/shape.c index 693495b57..48a3e952d 100644 --- a/nx-X11/programs/Xserver/Xext/shape.c +++ b/nx-X11/programs/Xserver/Xext/shape.c @@ -266,7 +266,7 @@ RegionPtr CreateBoundingShape (pWin) WindowPtr pWin; { - BoxRec extents; + BoxRec extents = {0}; extents.x1 = -wBorderWidth (pWin); extents.y1 = -wBorderWidth (pWin); @@ -279,7 +279,7 @@ RegionPtr CreateClipShape (pWin) WindowPtr pWin; { - BoxRec extents; + BoxRec extents = {0}; extents.x1 = 0; extents.y1 = 0; @@ -292,7 +292,7 @@ static int ProcShapeQueryVersion (client) register ClientPtr client; { - xShapeQueryVersionReply rep; + xShapeQueryVersionReply rep = {0}; REQUEST_SIZE_MATCH (xShapeQueryVersionReq); memset(&rep, 0, sizeof(xShapeQueryVersionReply)); @@ -713,8 +713,8 @@ ProcShapeQueryExtents (client) { REQUEST(xShapeQueryExtentsReq); WindowPtr pWin; - xShapeQueryExtentsReply rep; - BoxRec extents, *pExtents; + xShapeQueryExtentsReply rep = {0}; + BoxRec extents = {0}, *pExtents; RegionPtr region; REQUEST_SIZE_MATCH (xShapeQueryExtentsReq); @@ -919,8 +919,8 @@ SendShapeNotify (pWin, which) int which; { ShapeEventPtr *pHead, pShapeEvent; - xShapeNotifyEvent se; - BoxRec extents; + xShapeNotifyEvent se = {0}; + BoxRec extents = {0}; RegionPtr region; BYTE shaped; @@ -992,7 +992,7 @@ ProcShapeInputSelected (client) WindowPtr pWin; ShapeEventPtr pShapeEvent, *pHead; int enabled; - xShapeInputSelectedReply rep; + xShapeInputSelectedReply rep = {0}; REQUEST_SIZE_MATCH (xShapeInputSelectedReq); pWin = LookupWindow (stuff->window, client); @@ -1030,7 +1030,7 @@ ProcShapeGetRectangles (client) { REQUEST(xShapeGetRectanglesReq); WindowPtr pWin; - xShapeGetRectanglesReply rep; + xShapeGetRectanglesReply rep = {0}; xRectangle *rects; int nrects, i; RegionPtr region; diff --git a/nx-X11/programs/Xserver/Xext/xtest.c b/nx-X11/programs/Xserver/Xext/xtest.c index d78efd39b..a392599ea 100644 --- a/nx-X11/programs/Xserver/Xext/xtest.c +++ b/nx-X11/programs/Xserver/Xext/xtest.c @@ -111,7 +111,7 @@ static int ProcXTestGetVersion(client) register ClientPtr client; { - xXTestGetVersionReply rep; + xXTestGetVersionReply rep = {0}; REQUEST_SIZE_MATCH(xXTestGetVersionReq); rep.type = X_Reply; @@ -132,7 +132,7 @@ ProcXTestCompareCursor(client) register ClientPtr client; { REQUEST(xXTestCompareCursorReq); - xXTestCompareCursorReply rep; + xXTestCompareCursorReply rep = {0}; WindowPtr pWin; CursorPtr pCursor; diff --git a/nx-X11/programs/Xserver/dix/colormap.c b/nx-X11/programs/Xserver/dix/colormap.c index 7fcde71f3..81b93d2de 100644 --- a/nx-X11/programs/Xserver/dix/colormap.c +++ b/nx-X11/programs/Xserver/dix/colormap.c @@ -474,7 +474,7 @@ FreeColormap (void * value, XID mid) static int TellNoMap (WindowPtr pwin, Colormap *pmid) { - xEvent xE; + xEvent xE = {0}; if (wColormap(pwin) == *pmid) { @@ -502,7 +502,7 @@ int TellLostMap (WindowPtr pwin, void * value) { Colormap *pmid = (Colormap *)value; - xEvent xE; + xEvent xE = {0}; #ifdef PANORAMIX if(!noPanoramiXExtension && pwin->drawable.pScreen->myNum) @@ -527,7 +527,7 @@ int TellGainedMap (WindowPtr pwin, void * value) { Colormap *pmid = (Colormap *)value; - xEvent xE; + xEvent xE = {0}; #ifdef PANORAMIX if(!noPanoramiXExtension && pwin->drawable.pScreen->myNum) diff --git a/nx-X11/programs/Xserver/dix/devices.c b/nx-X11/programs/Xserver/dix/devices.c index 427169222..b93a40d97 100644 --- a/nx-X11/programs/Xserver/dix/devices.c +++ b/nx-X11/programs/Xserver/dix/devices.c @@ -1158,7 +1158,8 @@ ProcGetKeyboardMapping(ClientPtr client) int ProcGetPointerMapping(ClientPtr client) { - xGetPointerMappingReply rep; + xGetPointerMappingReply rep = {0}; + ButtonClassPtr butc = inputInfo.pointer->button; REQUEST_SIZE_MATCH(xReq); @@ -1168,7 +1169,7 @@ ProcGetPointerMapping(ClientPtr client) rep.length = ((unsigned)rep.nElts + (4-1))/4; WriteReplyToClient(client, sizeof(xGetPointerMappingReply), &rep); WriteToClient(client, (int)rep.nElts, &butc->map[1]); - return Success; + return Success; } void diff --git a/nx-X11/programs/Xserver/dix/dispatch.c b/nx-X11/programs/Xserver/dix/dispatch.c index c9ce8981c..6f32f51f3 100644 --- a/nx-X11/programs/Xserver/dix/dispatch.c +++ b/nx-X11/programs/Xserver/dix/dispatch.c @@ -806,7 +806,7 @@ GetGeometry(register ClientPtr client, xGetGeometryReply *rep) int ProcGetGeometry(register ClientPtr client) { - xGetGeometryReply rep; + xGetGeometryReply rep = {0}; int status; if ((status = GetGeometry(client, &rep)) != Success) @@ -821,7 +821,7 @@ ProcGetGeometry(register ClientPtr client) int ProcQueryTree(register ClientPtr client) { - xQueryTreeReply reply; + xQueryTreeReply reply = {0}; int numChildren = 0; register WindowPtr pChild, pWin, pHead; Window *childIDs = (Window *)NULL; @@ -832,7 +832,6 @@ ProcQueryTree(register ClientPtr client) DixReadAccess); if (!pWin) return(BadWindow); - memset(&reply, 0, sizeof(xQueryTreeReply)); reply.type = X_Reply; reply.root = pWin->drawable.pScreen->root->drawable.id; reply.sequenceNumber = client->sequence; @@ -887,8 +886,7 @@ ProcInternAtom(register ClientPtr client) atom = MakeAtom(tchar, stuff->nbytes, !stuff->onlyIfExists); if (atom != BAD_RESOURCE) { - xInternAtomReply reply; - memset(&reply, 0, sizeof(xInternAtomReply)); + xInternAtomReply reply = {0}; reply.type = X_Reply; reply.length = 0; reply.sequenceNumber = client->sequence; @@ -904,15 +902,14 @@ int ProcGetAtomName(register ClientPtr client) { const char *str; - xGetAtomNameReply reply; int len; REQUEST(xResourceReq); REQUEST_SIZE_MATCH(xResourceReq); if ( (str = NameForAtom(stuff->id)) ) { + xGetAtomNameReply reply = {0}; len = strlen(str); - memset(&reply, 0, sizeof(xGetAtomNameReply)); reply.type = X_Reply; reply.length = (len + 3) >> 2; reply.sequenceNumber = client->sequence; @@ -965,8 +962,6 @@ ProcSetSelectionOwner(register ClientPtr client) i++; if (i < NumCurrentSelections) { - xEvent event; - /* If the timestamp in client's request is in the past relative to the time stamp indicating the last time the owner of the selection was set, do not set the selection, just return @@ -977,6 +972,7 @@ ProcSetSelectionOwner(register ClientPtr client) if (CurrentSelections[i].client && (!pWin || (CurrentSelections[i].client != client))) { + xEvent event = {0}; event.u.u.type = SelectionClear; event.u.selectionClear.time = time.milliseconds; event.u.selectionClear.window = CurrentSelections[i].window; @@ -1010,7 +1006,7 @@ ProcSetSelectionOwner(register ClientPtr client) CurrentSelections[i].client = (pWin ? client : NullClient); if (SelectionCallback) { - SelectionInfoRec info; + SelectionInfoRec info = {0}; info.selection = &CurrentSelections[i]; info.kind= SelectionSetOwner; @@ -1144,7 +1140,7 @@ ProcGrabServer(register ClientPtr client) if (ServerGrabCallback) { - ServerGrabInfoRec grabinfo; + ServerGrabInfoRec grabinfo = {0}; grabinfo.client = client; grabinfo.grabstate = SERVER_GRABBED; CallCallbacks(&ServerGrabCallback, (void *)&grabinfo); @@ -1173,7 +1169,7 @@ UngrabServer(ClientPtr client) if (ServerGrabCallback) { - ServerGrabInfoRec grabinfo; + ServerGrabInfoRec grabinfo = {0}; grabinfo.client = client; grabinfo.grabstate = SERVER_UNGRABBED; CallCallbacks(&ServerGrabCallback, (void *)&grabinfo); @@ -1194,7 +1190,7 @@ ProcTranslateCoords(register ClientPtr client) REQUEST(xTranslateCoordsReq); register WindowPtr pWin, pDst; - xTranslateCoordsReply rep; + xTranslateCoordsReply rep = {0}; REQUEST_SIZE_MATCH(xTranslateCoordsReq); pWin = (WindowPtr)SecurityLookupWindow(stuff->srcWid, client, @@ -1205,7 +1201,6 @@ ProcTranslateCoords(register ClientPtr client) DixReadAccess); if (!pDst) return(BadWindow); - memset(&rep, 0, sizeof(xTranslateCoordsReply)); rep.type = X_Reply; rep.length = 0; rep.sequenceNumber = client->sequence; @@ -1227,7 +1222,7 @@ ProcTranslateCoords(register ClientPtr client) while (pWin) { #ifdef SHAPE - BoxRec box; + BoxRec box = {0}; #endif if ((pWin->mapped) && (x >= pWin->drawable.x - wBorderWidth (pWin)) && @@ -1353,13 +1348,12 @@ ProcQueryFont(register ClientPtr client) FONTINFONPROPS(FONTCHARSET(pFont)) * sizeof(xFontProp) + nprotoxcistructs * sizeof(xCharInfo); - reply = (xQueryFontReply *)malloc(rlength); + reply = (xQueryFontReply *)calloc(1, rlength); if(!reply) { return(BadAlloc); } - memset(reply, 0, rlength); reply->type = X_Reply; reply->length = (rlength - sizeof(xGenericReply)) >> 2; reply->sequenceNumber = client->sequence; @@ -1375,7 +1369,7 @@ int ProcQueryTextExtents(register ClientPtr client) { REQUEST(xQueryTextExtentsReq); - xQueryTextExtentsReply reply; + xQueryTextExtentsReply reply = {0}; FontPtr pFont; GC *pGC; ExtentInfoRec info; @@ -2099,7 +2093,7 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, long widthBytesLine, length; Mask plane = 0; char *pBuf; - xGetImageReply xgi; + xGetImageReply xgi = {0}; #ifdef XCSECURITY RegionPtr pVisibleRegion = NULL; #endif @@ -2111,7 +2105,6 @@ DoGetImage(register ClientPtr client, int format, Drawable drawable, } SECURITY_VERIFY_DRAWABLE(pDraw, drawable, client, DixReadAccess); - memset(&xgi, 0, sizeof(xGetImageReply)); if(pDraw->type == DRAWABLE_WINDOW) { if( /* check for being viewable */ @@ -2597,7 +2590,7 @@ ProcAllocColor (register ClientPtr client) { ColormapPtr pmap; int retval; - xAllocColorReply acr; + xAllocColorReply acr = {0}; REQUEST(xAllocColorReq); REQUEST_SIZE_MATCH(xAllocColorReq); @@ -2605,7 +2598,6 @@ ProcAllocColor (register ClientPtr client) RT_COLORMAP, DixWriteAccess); if (pmap) { - memset(&acr, 0, sizeof(xAllocColorReply)); acr.type = X_Reply; acr.length = 0; acr.sequenceNumber = client->sequence; @@ -2648,7 +2640,7 @@ ProcAllocNamedColor (register ClientPtr client) { int retval; - xAllocNamedColorReply ancr; + xAllocNamedColorReply ancr = {0}; ancr.type = X_Reply; ancr.length = 0; @@ -2698,7 +2690,7 @@ ProcAllocColorCells (register ClientPtr client) RT_COLORMAP, DixWriteAccess); if (pcmp) { - xAllocColorCellsReply accr; + xAllocColorCellsReply accr = {0}; int npixels, nmasks, retval; long length; Pixel *ppixels, *pmasks; @@ -2764,7 +2756,7 @@ ProcAllocColorPlanes(register ClientPtr client) RT_COLORMAP, DixWriteAccess); if (pcmp) { - xAllocColorPlanesReply acpr; + xAllocColorPlanesReply acpr = {0}; int npixels, retval; long length; Pixel *ppixels; @@ -2897,7 +2889,7 @@ ProcStoreNamedColor (register ClientPtr client) RT_COLORMAP, DixWriteAccess); if (pcmp) { - xColorItem def; + xColorItem def = {0}; int retval; if(OsLookupColor(pcmp->pScreen->myNum, (char *)&stuff[1], @@ -2933,7 +2925,7 @@ ProcQueryColors(register ClientPtr client) { int count, retval; xrgb *prgbs; - xQueryColorsReply qcr; + xQueryColorsReply qcr = {0}; count = ((client->req_len << 2) - sizeof(xQueryColorsReq)) >> 2; prgbs = (xrgb *)malloc(count * sizeof(xrgb)); @@ -2985,7 +2977,7 @@ ProcLookupColor(register ClientPtr client) RT_COLORMAP, DixReadAccess); if (pcmp) { - xLookupColorReply lcr; + xLookupColorReply lcr = {0}; if(OsLookupColor(pcmp->pScreen->myNum, (char *)&stuff[1], stuff->nbytes, &lcr.exactRed, &lcr.exactGreen, &lcr.exactBlue)) @@ -3023,7 +3015,7 @@ ProcCreateCursor (register ClientPtr client) unsigned char * mskbits; unsigned short width, height; long n; - CursorMetricRec cm; + CursorMetricRec cm = {0}; REQUEST(xCreateCursorReq); @@ -3150,7 +3142,7 @@ ProcFreeCursor (register ClientPtr client) int ProcQueryBestSize (register ClientPtr client) { - xQueryBestSizeReply reply; + xQueryBestSizeReply reply = {0}; register DrawablePtr pDraw; ScreenPtr pScreen; REQUEST(xQueryBestSizeReq); @@ -3242,7 +3234,7 @@ ProcSetScreenSaver (register ClientPtr client) int ProcGetScreenSaver(register ClientPtr client) { - xGetScreenSaverReply rep; + xGetScreenSaverReply rep = {0}; REQUEST_SIZE_MATCH(xReq); rep.type = X_Reply; @@ -3283,7 +3275,7 @@ ProcChangeHosts(register ClientPtr client) int ProcListHosts(register ClientPtr client) { - xListHostsReply reply; + xListHostsReply reply = {0}; int len, nHosts, result; void * pdata; /* REQUEST(xListHostsReq); */ @@ -3399,7 +3391,7 @@ ProcSetFontPath(register ClientPtr client) int ProcGetFontPath(register ClientPtr client) { - xGetFontPathReply reply; + xGetFontPathReply reply = {0}; int stringLens, numpaths; unsigned char *bufferStart; /* REQUEST (xReq); */ @@ -3742,13 +3734,13 @@ ClientPtr NextAvailableClient(void * ospriv) if (ClientStateCallback) { - NewClientInfoRec clientinfo; + NewClientInfoRec clientinfo = {0}; - clientinfo.client = client; - clientinfo.prefix = (xConnSetupPrefix *)NULL; + clientinfo.client = client; + clientinfo.prefix = (xConnSetupPrefix *)NULL; clientinfo.setup = (xConnSetup *) NULL; CallCallbacks((&ClientStateCallback), (void *)&clientinfo); - } + } return(client); } @@ -3796,9 +3788,8 @@ SendConnSetup(register ClientPtr client, char *reason) if (reason) { - xConnSetupPrefix csp; + xConnSetupPrefix csp = {0};; - memset(&csp, 0, sizeof(xConnSetupPrefix)); csp.success = xFalse; csp.lengthReason = strlen(reason); csp.length = (csp.lengthReason + (unsigned)3) >> 2; @@ -3873,13 +3864,13 @@ SendConnSetup(register ClientPtr client, char *reason) client->clientState = ClientStateRunning; if (ClientStateCallback) { - NewClientInfoRec clientinfo; + NewClientInfoRec clientinfo = {0}; - clientinfo.client = client; - clientinfo.prefix = lconnSetupPrefix; + clientinfo.client = client; + clientinfo.prefix = lconnSetupPrefix; clientinfo.setup = (xConnSetup *)lConnectionInfo; CallCallbacks((&ClientStateCallback), (void *)&clientinfo); - } + } return (client->noClientException); } @@ -3921,9 +3912,8 @@ void SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode, XID resId, int errorCode) { - xError rep; + xError rep = {0}; - memset(&rep, 0, sizeof(xError)); rep.type = X_Error; rep.errorCode = errorCode; rep.majorCode = majorCode; diff --git a/nx-X11/programs/Xserver/dix/pixmap.c b/nx-X11/programs/Xserver/dix/pixmap.c index 747120b48..709f413ed 100644 --- a/nx-X11/programs/Xserver/dix/pixmap.c +++ b/nx-X11/programs/Xserver/dix/pixmap.c @@ -126,7 +126,7 @@ AllocatePixmap(ScreenPtr pScreen, int pixDataSize) * the pixmap buffer. This may be a RENDER bug. */ - pPixmap = (PixmapPtr)malloc(pScreen->totalPixmapSize + pixDataSize + 4); + pPixmap = (PixmapPtr)calloc(1, pScreen->totalPixmapSize + pixDataSize + 4); if (!pPixmap) return NullPixmap; ppriv = (DevUnion *)(pPixmap + 1); @@ -144,7 +144,7 @@ AllocatePixmap(ScreenPtr pScreen, int pixDataSize) ppriv->ptr = (void *)NULL; } #else - pPixmap = (PixmapPtr)malloc(sizeof(PixmapRec) + pixDataSize); + pPixmap = (PixmapPtr)calloc(1, sizeof(PixmapRec) + pixDataSize); #endif return pPixmap; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 1c2cd42ac..ca7086d62 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -719,7 +719,7 @@ ProcSetSelectionOwner(register ClientPtr client) i++; if (i < NumCurrentSelections) { - xEvent event; + xEvent event = {0}; /* If the timestamp in client's request is in the past relative to the time stamp indicating the last time the owner of the diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index 44d398304..5df252d34 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -310,7 +310,6 @@ DeleteWindow(void * value, XID wid) { register WindowPtr pParent; register WindowPtr pWin = (WindowPtr)value; - xEvent event; UnmapWindow(pWin, FALSE); @@ -319,7 +318,7 @@ DeleteWindow(void * value, XID wid) pParent = pWin->parent; if (wid && pParent && SubStrSend(pWin, pParent)) { - memset(&event, 0, sizeof(xEvent)); + xEvent event = {0}; event.u.u.type = DestroyNotify; event.u.destroyNotify.window = pWin->drawable.id; DeliverEvents(pWin, &event, 1, NullWindow); @@ -371,8 +370,7 @@ ResizeChildrenWinSize(register WindowPtr pWin, int dx, int dy, int dw, int dh) pSib->winGravity, &cwsx, &cwsy); if (cwsx != pSib->origin.x || cwsy != pSib->origin.y) { - xEvent event; - + xEvent event = {0}; event.u.u.type = GravityNotify; event.u.gravity.window = pSib->drawable.id; event.u.gravity.x = cwsx - wBorderWidth (pSib); @@ -450,7 +448,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP h = pWin->drawable.height, bw = pWin->borderWidth; int action, smode = Above; - xEvent event; + xEvent event = {0}; if ((pWin->drawable.class == InputOnly) && (mask & IllegalInputOnlyConfigureMask)) return(BadMatch); @@ -607,8 +605,7 @@ ConfigureWindow(register WindowPtr pWin, register Mask mask, XID *vlist, ClientP || (h != pWin->drawable.height); if (size_change && ((pWin->eventMask|wOtherEventMasks(pWin)) & ResizeRedirectMask)) { - xEvent eventT; - memset(&eventT, 0, sizeof(xEvent)); + xEvent eventT = {0}; eventT.u.u.type = ResizeRequest; eventT.u.resizeRequest.window = pWin->drawable.id; eventT.u.resizeRequest.width = w; @@ -723,7 +720,7 @@ ReparentWindow(register WindowPtr pWin, register WindowPtr pParent, { WindowPtr pPrev, pPriorParent; Bool WasMapped = (Bool)(pWin->mapped); - xEvent event; + xEvent event = {0}; int bw = wBorderWidth (pWin); register ScreenPtr pScreen; @@ -736,7 +733,6 @@ ReparentWindow(register WindowPtr pWin, register WindowPtr pParent, if (WasMapped) UnmapWindow(pWin, FALSE); - memset(&event, 0, sizeof(xEvent)); event.u.u.type = ReparentNotify; event.u.reparent.window = pWin->drawable.id; event.u.reparent.parent = pParent->drawable.id; @@ -949,7 +945,6 @@ int UnmapWindow(register WindowPtr pWin, Bool fromConfigure) { register WindowPtr pParent; - xEvent event; Bool wasRealized = (Bool)pWin->realized; Bool wasViewable = (Bool)pWin->viewable; ScreenPtr pScreen = pWin->drawable.pScreen; @@ -967,7 +962,7 @@ UnmapWindow(register WindowPtr pWin, Bool fromConfigure) return(Success); if (SubStrSend(pWin, pParent)) { - memset(&event, 0, sizeof(xEvent)); + xEvent event = {0}; event.u.u.type = UnmapNotify; event.u.unmapNotify.window = pWin->drawable.id; event.u.unmapNotify.fromConfigure = fromConfigure; diff --git a/nx-X11/programs/Xserver/mi/miexpose.c b/nx-X11/programs/Xserver/mi/miexpose.c index c39221000..db7fdf010 100644 --- a/nx-X11/programs/Xserver/mi/miexpose.c +++ b/nx-X11/programs/Xserver/mi/miexpose.c @@ -395,7 +395,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor) numRects = RegionNumRects(pRgn); pBox = RegionRects(pRgn); - if(!(pEvent = (xEvent *)malloc(numRects * sizeof(xEvent)))) + if(!(pEvent = (xEvent *)calloc(numRects, sizeof(xEvent)))) return; pe = pEvent; @@ -417,8 +417,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor) } else { - xEvent event; - memset(&event, 0, sizeof(xEvent)); + xEvent event = {0}; event.u.u.type = NoExpose; event.u.noExposure.drawable = drawable; event.u.noExposure.majorEvent = major; @@ -442,9 +441,8 @@ miSendExposures(pWin, pRgn, dx, dy) pBox = RegionRects(pRgn); numRects = RegionNumRects(pRgn); - if(!(pEvent = (xEvent *) malloc(numRects * sizeof(xEvent)))) + if(!(pEvent = (xEvent *) calloc(numRects, sizeof(xEvent)))) return; - memset(pEvent, 0, numRects * sizeof(xEvent)); for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++) { @@ -658,7 +656,7 @@ int what; BITS32 gcmask, index, mask; RegionRec prgnWin; DDXPointRec oldCorner; - BoxRec box; + BoxRec box = {0}; WindowPtr pBgWin; GCPtr pGC; register int i; @@ -705,8 +703,7 @@ int what; } } - prect = (xRectangle *)malloc(RegionNumRects(prgn) * - sizeof(xRectangle)); + prect = (xRectangle *)calloc(RegionNumRects(prgn), sizeof(xRectangle)); if (!prect) return; @@ -892,8 +889,7 @@ miClearDrawable(pDraw, pGC) { XID fg = pGC->fgPixel; XID bg = pGC->bgPixel; - xRectangle rect; - + xRectangle rect = {0}; rect.x = 0; rect.y = 0; rect.width = pDraw->width; diff --git a/nx-X11/programs/Xserver/xkb/xkb.c b/nx-X11/programs/Xserver/xkb/xkb.c index 6798f2dda..10df6c372 100644 --- a/nx-X11/programs/Xserver/xkb/xkb.c +++ b/nx-X11/programs/Xserver/xkb/xkb.c @@ -600,7 +600,7 @@ ProcXkbLatchLockState(ClientPtr client) int ProcXkbGetControls(ClientPtr client) { - xkbGetControlsReply rep; + xkbGetControlsReply rep = {0}; XkbControlsPtr xkb; DeviceIntPtr dev; |