From 1529b32174867acaffc952b77cb404180fad17f1 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 3 Aug 2020 16:25:00 +0200 Subject: Atoms.c: fix strlen(NULL) FIX PVS Studio finding "V575 The potential null pointer is passed into 'strlen' function. Inspect the first argument" --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index c15674f5e..af8b31dfd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -417,7 +417,7 @@ static void nxagentWriteAtom(Atom local, XlibAtom remote, const char *string) privAtomMap[privLastAtom].local = local; privAtomMap[privLastAtom].remote = remote; privAtomMap[privLastAtom].string = s; - privAtomMap[privLastAtom].length = strlen(s); + privAtomMap[privLastAtom].length = s ? strlen(s) : 0; privLastAtom++; } -- cgit v1.2.3 From e991dbae988766707e9506ec08d5682416f6eb4a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 3 Aug 2020 16:26:12 +0200 Subject: Atoms.c: cosmetics in nxagentWriteAtom() --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index af8b31dfd..2daad061e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -405,12 +405,13 @@ static void nxagentWriteAtom(Atom local, XlibAtom remote, const char *string) #ifdef WARNING if (s == NULL) { - fprintf(stderr, "nxagentWriteAtom: Malloc failed.\n"); + fprintf(stderr, "%s: Malloc failed.\n", __func__); } #endif if (privLastAtom == privAtomMapSize) { + /* will issue a fatal error, therefore no further check here */ nxagentExpandCache(); } -- cgit v1.2.3 From 36d7e152f1bb977517d0c6f764781d287cf01c26 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 3 Aug 2020 16:27:41 +0200 Subject: Atoms.c: silence PVS Studio warning "V701 realloc() possible leak: when realloc() fails in allocating memory, original pointer 'privAtomMap' is lost. Consider assigning realloc() to a temporary pointer." --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index 2daad061e..61953e2a6 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -385,12 +385,16 @@ static void nxagentExpandCache(void) { privAtomMapSize += NXAGENT_ATOM_MAP_SIZE_INCREMENT; - privAtomMap = realloc(privAtomMap, privAtomMapSize * sizeof(AtomMap)); + AtomMap * newmap = realloc(privAtomMap, privAtomMapSize * sizeof(AtomMap)); - if (privAtomMap == NULL) + if (newmap == NULL) { FatalError("nxagentExpandCache: realloc failed\n"); } + else + { + privAtomMap = newmap; + } } /* -- cgit v1.2.3 From 28fef3bc06e9325202920fc21f42d2506e8f2b2e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 3 Aug 2020 16:38:19 +0200 Subject: Colormap.c: fix parentheses PVS Studio: "V592 The expression was enclosed by parentheses twice: '((* pRed * (limg + 1)))'. One pair of parentheses is unnecessary or misprint is present." --- nx-X11/programs/Xserver/hw/nxagent/Colormap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c index 9308390fe..099c76af4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c @@ -482,7 +482,7 @@ void nxagentResolveColor(unsigned short *pRed, unsigned short *pGreen, unsigned int limg = pVisual->ColormapEntries - 1; /* rescale to gray then [0..limg] then [0..65535] then rgb bits */ *pRed = (30L * *pRed + 59L * *pGreen + 11L * *pBlue) / 100; - *pRed = ((((*pRed * (limg + 1))) >> 16) * 65535) / limg; + *pRed = (((*pRed * (limg + 1)) >> 16) * 65535) / limg; *pBlue = *pGreen = *pRed = ((*pRed >> shift) * 65535) / lim; } else -- cgit v1.2.3 From 5735e164e9625137c7d3209428eafab33300df94 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 3 Aug 2020 16:40:49 +0200 Subject: Colormap.c: remove unneccessary check success would always be true at the beginning of the loop as it is part of the loop condition. Finding from PVS Studio: "V560 A part of conditional expression is always true: success." --- nx-X11/programs/Xserver/hw/nxagent/Colormap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c index 099c76af4..c173f322c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Colormap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Colormap.c @@ -573,7 +573,7 @@ Bool nxagentReconnectAllColormap(void *p0) for (int cid = 0; (cid < MAXCLIENTS) && success; cid++) { - if (clients[cid] && success) + if (clients[cid]) { FindClientResourcesByType(clients[cid], RT_COLORMAP, nxagentReconnectColormap, &success); } -- cgit v1.2.3 From 41bf839792be7c20447251fd679b6132775749db Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 3 Aug 2020 17:02:29 +0200 Subject: Keyboard.c: simplify code Based on PVS Studio finding: "V547 Expression 'data' is always true." --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 00db6ce2a..8f29d66b8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -1425,11 +1425,9 @@ static void nxagentXkbGetRemoteNames(void) if ((after > 0) || (type != XA_STRING) || (format != 8)) { - if (data) - { - SAFE_XFree(data); - return; - } + /* data non-null - has been checked above */ + SAFE_XFree(data); + return; } char *name = data; -- cgit v1.2.3 From 5871100dd5db7f05e3f67cd90fda25dc9a68a29d Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 3 Aug 2020 17:08:30 +0200 Subject: NXpicture.c: remove unneccessary check Code can only be reached if pPicture is non-NULL. Besides, pPicture will be accessed later anyway, regardless of this check. Finding of PVS Studio: "V547 Expression 'pPicture != NULL' is always true." --- nx-X11/programs/Xserver/hw/nxagent/NXpicture.c | 27 ++++++++++++-------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c index 159a7b55d..ae9de652a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c @@ -320,27 +320,24 @@ static PicturePtr createSourcePicture(void) if (!pPicture) return 0; - if (pPicture != NULL) - { - DevUnion *ppriv = (DevUnion *) (pPicture + 1); + DevUnion *ppriv = (DevUnion *) (pPicture + 1); - for (int i = 0; i < picturePrivateCount; ++i) - { - /* - * Other privates are inaccessible. - */ + for (int i = 0; i < picturePrivateCount; ++i) + { + /* + * Other privates are inaccessible. + */ - ppriv[i].ptr = NULL; - } + ppriv[i].ptr = NULL; + } - char *privPictureRecAddr = (char *) &ppriv[picturePrivateCount]; + char *privPictureRecAddr = (char *) &ppriv[picturePrivateCount]; - ppriv[nxagentPicturePrivateIndex].ptr = (void *) privPictureRecAddr; + ppriv[nxagentPicturePrivateIndex].ptr = (void *) privPictureRecAddr; - pPicture -> devPrivates = ppriv; + pPicture -> devPrivates = ppriv; - nxagentPicturePriv(pPicture) -> picture = 0; - } + nxagentPicturePriv(pPicture) -> picture = 0; pPicture->pDrawable = 0; pPicture->pFormat = 0; -- cgit v1.2.3 From db134de3b9cefa6e0d76fe57f2feabe79ba9216c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 4 Jan 2021 16:17:36 +0100 Subject: Atoms.c: add explanation for PVS Studio warning "V575 The potential null pointer is passed into 'strlen' function. Inspect the first argument. Check lines: 420, 403." --- nx-X11/programs/Xserver/hw/nxagent/Atoms.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c index 61953e2a6..ea7ad7599 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.c @@ -409,6 +409,9 @@ static void nxagentWriteAtom(Atom local, XlibAtom remote, const char *string) #ifdef WARNING if (s == NULL) { + /* we only warn here, because s being NULL ist not problem, it + will only result in NULL being stored in the privAtomMap, which + is perfectly legal. */ fprintf(stderr, "%s: Malloc failed.\n", __func__); } #endif -- cgit v1.2.3 From 67c7513bfc18c5bcb94ea152823601970a18d7f3 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 4 Jan 2021 16:28:27 +0100 Subject: Display.c: prevent PVS Studio realloc warning "V701 realloc() possible leak: when realloc() fails in allocating memory, original pointer 'nxagentDefaultColormaps' is lost. Consider assigning realloc() to a temporary pointer." --- nx-X11/programs/Xserver/hw/nxagent/Display.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index 15112312f..9931bdd77 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -2577,12 +2577,18 @@ Bool nxagentReconnectDisplay(void *p0) nxagentNumDefaultColormaps = nxagentNumVisuals; - nxagentDefaultColormaps = (Colormap *) realloc(nxagentDefaultColormaps, - nxagentNumDefaultColormaps * sizeof(Colormap)); - - if (nxagentDefaultColormaps == NULL) { - FatalError("Can't allocate memory for the default colormaps\n"); + Colormap * tmp = (Colormap *) realloc(nxagentDefaultColormaps, + nxagentNumDefaultColormaps * sizeof(Colormap)); + if (tmp == NULL) + { + SAFE_free(nxagentDefaultColormaps); + FatalError("Can't allocate memory for the default colormaps\n"); + } + else + { + nxagentDefaultColormaps = tmp; + } } reconnectDisplayState = ALLOC_DEF_COLORMAP; -- cgit v1.2.3 From e664d82019ef2a876cc325c746b4e7521b9c1910 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 4 Jan 2021 16:35:07 +0100 Subject: Drawable.c: Prevent PVS Studio warning "V560 A part of conditional expression is always true: oldStatus == NotSynchronized." --- nx-X11/programs/Xserver/hw/nxagent/Drawable.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index ca1b09dd3..2facf1df3 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c @@ -1605,9 +1605,11 @@ void nxagentUnmarkCorruptedRegion(DrawablePtr pDrawable, RegionPtr pRegion) * If the drawable becomes synchronized, the counter reporting the * number of corrupted drawables must be decreased. Moreover the * corrupted timestamp must be reset. + * Note: oldstatus has been checked above and is always + * "NotSynchronized" here. */ - if (oldStatus == NotSynchronized && + if (/*oldStatus == NotSynchronized &&*/ nxagentDrawableStatus(pDrawable) == Synchronized) { if (pDrawable -> type == DRAWABLE_PIXMAP) -- cgit v1.2.3 From 7443fea69f89fda3c36e99dc5ff07731020e8891 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 4 Jan 2021 17:18:43 +0100 Subject: Keyboard.c: fix possible NULL pointer dereference found by PVS Studio: "V522 There might be dereferencing of a potential null pointer 'keymap'." --- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 8f29d66b8..731844874 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -435,6 +435,11 @@ N/A int len = (max_keycode - min_keycode + 1) * mapWidth; keymap = (KeySym *)malloc(len * sizeof(KeySym)); + if (keymap == NULL) + { + XFreeModifiermap(modifier_keymap); + return -1; + } for(int i = 0; i < len; ++i) { keymap[i] = keymap64[i]; -- cgit v1.2.3 From 948bbe50a96c5563a2783f2d9c86a83ded707143 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 4 Jan 2021 17:28:53 +0100 Subject: NXglyph.c: check for malloc error "V575 The potential null pointer is passed into 'memcpy' function. Inspect the first argument." --- nx-X11/programs/Xserver/hw/nxagent/NXglyph.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c b/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c index 022ef09f4..8c35af4c4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXglyph.c @@ -296,6 +296,13 @@ miGlyphs (CARD8 op, else { nxagentGlyphsExtents = (BoxPtr) malloc(sizeof(BoxRec)); + if (!nxagentGlyphsExtents) + { + #ifdef WARNING + fprintf(stderr, "WARNING! Cannot allocate GlyphExtents\n"); + #endif + return; + } GlyphExtents (nlist, list, glyphs, &extents); -- cgit v1.2.3 From 8bb77997f8e7828846d68a02e8e1f00571f3a4f5 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 4 Jan 2021 18:04:29 +0100 Subject: Reconnect.c: fix possible realloc() memory loss "V701 realloc() possible leak: when realloc() fails in allocating memory, original pointer 'nxagentReconnectErrorMessage' is lost. Consider assigning realloc() to a temporary pointer." --- nx-X11/programs/Xserver/hw/nxagent/Reconnect.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c index d0f83e7bd..e6d3ce6ec 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c @@ -788,12 +788,16 @@ void nxagentSetReconnectError(int id, char *format, ...) size = (size ? size * 2 : NXAGENT_RECONNECT_DEFAULT_MESSAGE_SIZE); } - nxagentReconnectErrorMessage = realloc(nxagentReconnectErrorMessage, size); + char *tmp = realloc(nxagentReconnectErrorMessage, size); - if (nxagentReconnectErrorMessage == NULL) + if (tmp == NULL) { FatalError("realloc failed"); } + else + { + nxagentReconnectErrorMessage = tmp; + } } return; -- cgit v1.2.3 From c1cae3c66a7ac5b351605111c936342e21578aa4 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 4 Jan 2021 18:13:49 +0100 Subject: Render.c: Init BoxRec PVS Studio: "V614 Potentially uninitialized variable 'glyphBox.*' used." --- nx-X11/programs/Xserver/hw/nxagent/Render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Render.c b/nx-X11/programs/Xserver/hw/nxagent/Render.c index 28e2d77fc..98d7aef67 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Render.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Render.c @@ -1248,7 +1248,7 @@ void nxagentGlyphs(CARD8 op, PicturePtr pSrc, PicturePtr pDst, PictFormatPtr maskFormat, INT16 xSrc, INT16 ySrc, int nlists, XGlyphElt8 *elts, int sizeID, GlyphPtr *glyphsBase) { - BoxRec glyphBox; + BoxRec glyphBox = {0}; XGlyphElt8 *elements; -- cgit v1.2.3 From 1251e8347e60edf54a64d64e2059c35e28bd234a Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 4 Jan 2021 18:58:55 +0100 Subject: Rootless.c: prevent PVS error "V547 Expression 'wmHints.input == 1' is always true." --- nx-X11/programs/Xserver/hw/nxagent/Rootless.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c index 3bd0b7c25..9bcd90130 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c @@ -502,7 +502,8 @@ int nxagentExportProperty(WindowPtr pWin, nxagentPropWMHints propHints = { .flags = wmHints.flags, - .input = (wmHints.input == True ? 1 : 0), + /*.input = (wmHints.input == True ? 1 : 0), is always True*/ + .input = 1, .initialState = wmHints.initial_state, .iconPixmap = wmHints.icon_pixmap, .iconWindow = wmHints.icon_window, -- cgit v1.2.3 From a57097ad005244043262fce395de0e3914fec2d1 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 4 Jan 2021 19:01:55 +0100 Subject: Splash.c: remove unneccessary check PVs finding: "V547 Expression '!nxagentWMPassed' is always true." --- nx-X11/programs/Xserver/hw/nxagent/Splash.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Splash.c b/nx-X11/programs/Xserver/hw/nxagent/Splash.c index ea82513e6..37f965f04 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Splash.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Splash.c @@ -332,15 +332,10 @@ void nxagentRemoveSplashWindow(void) fprintf(stderr, "%s: Destroying the splash window.\n", __func__); #endif - if (!nxagentWMPassed) - { - #ifdef NXAGENT_ONSTART - XSetSelectionOwner(nxagentDisplay, nxagentReadyAtom, - nxagentDefaultWindows[0], CurrentTime); - #endif - - nxagentWMPassed = True; - } + #ifdef NXAGENT_ONSTART + XSetSelectionOwner(nxagentDisplay, nxagentReadyAtom, + nxagentDefaultWindows[0], CurrentTime); + #endif if (nxagentSplashWindow != None) { -- cgit v1.2.3 From 6214c71b32aa3562aeff08ffa63e67323a2cc05b Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 4 Jan 2021 19:07:06 +0100 Subject: Screen.c: check for malloc failures PVS finding: "V522 There might be dereferencing of a potential null pointer" --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 86f88bb7b..cff0eb76a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -1156,6 +1156,14 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) */ DepthPtr depths = (DepthPtr) malloc(nxagentNumDepths * sizeof(DepthRec)); + if (!depths) + { + #ifdef WARNING + fprintf(stderr, "WARNING: Could not allocate depths array\n"); + #endif + /* FIXME: free data allocated above */ + return False; + } for (int i = 0; i < nxagentNumDepths; i++) { @@ -1177,6 +1185,14 @@ Bool nxagentOpenScreen(ScreenPtr pScreen, int argc, char *argv[]) int numDepths = nxagentNumDepths; VisualPtr visuals = (VisualPtr) malloc(nxagentNumVisuals * sizeof(VisualRec)); + if (!visuals) + { + #ifdef WARNING + fprintf(stderr, "WARNING: Could not allocate visual array\n"); + #endif + /* FIXME: free data allocated above */ + return False; + } int defaultVisualIndex = 0; @@ -3058,6 +3074,14 @@ void nxagentShadowAdaptDepth(unsigned int width, unsigned int height, unsigned char *cBuffer = malloc(length); unsigned char *icBuffer = cBuffer; + if (!cBuffer) + { + #ifdef WARNING + fprintf(stderr, "WARNING: could not allocate cBuffer\n"); + #endif + return; + } + Visual *pVisual = nxagentImageVisual((DrawablePtr) nxagentShadowPixmapPtr, nxagentShadowDepth); if (pVisual == NULL) @@ -4203,6 +4227,13 @@ void nxagentSaveAreas(PixmapPtr pPixmap, RegionPtr prgnSave, int xorg, int yorg, int nRects = RegionNumRects(&cleanRegion); int size = nRects * sizeof(XRectangle); XRectangle *pRects = (XRectangle *) malloc(size); + if (!pRects) + { + #ifdef WARNING + fprintf(stderr, "Could not allocate pRects\n"); + #endif + return; + } BoxPtr pBox = RegionRects(&cleanRegion); for (int i = nRects; i-- > 0;) @@ -4336,6 +4367,14 @@ void nxagentRestoreAreas(PixmapPtr pPixmap, RegionPtr prgnRestore, int xorg, int nRects = RegionNumRects(clipRegion); int size = nRects * sizeof(XRectangle); XRectangle *pRects = (XRectangle *) malloc(size); + if (!pRects) + { + #ifdef WARNING + fprintf(stderr, "Could not allocate pRects\n"); + #endif + return; + } + BoxPtr pBox = RegionRects(clipRegion); for (int i = nRects; i-- > 0;) -- cgit v1.2.3 From 5ad0b4dde3b686d369d222976e947dcd83058757 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 4 Jan 2021 19:44:37 +0100 Subject: Window.c: check for malloc failure PVS finding: "V522 There might be dereferencing of a potential null pointer 'nxagentConfiguredWindowList'." --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index a30eac589..367c15841 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -3659,6 +3659,14 @@ void nxagentAddStaticResizedWindow(WindowPtr pWin, unsigned long sequence, int o StaticResizedWindowStruct *tmp = nxagentStaticResizedWindowList; nxagentStaticResizedWindowList = malloc(sizeof(StaticResizedWindowStruct)); + if (!nxagentStaticResizedWindowList) + { + #ifdef WARNING + fprintf(stderr, "WARNING: could not allocate memory for nxagentStaticResizedWindowList\n"); + #endif + nxagentStaticResizedWindowList = tmp; + return; + } nxagentStaticResizedWindowList -> next = tmp; nxagentStaticResizedWindowList -> prev = NULL; -- cgit v1.2.3 From 4d95e29b87217ac12de97bf4031603c36055b6ac Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 4 Jan 2021 19:50:31 +0100 Subject: Window.c: check for malloc failure PVS finding: "V522 There might be dereferencing of a potential null pointer 'props'" --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 35 ++++++++++++++++++----------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 367c15841..811b5b565 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -3090,27 +3090,36 @@ static void nxagentReconnectWindow(void * param0, XID param1, void * data_buffer (void*)pWin, pWin -> drawable.id, nxagentWindow(pWin)); #endif + /* FIXME: use XAllocSizeHints() */ #ifdef _XSERVER64 data64 = (unsigned char *) malloc(sizeof(XSizeHints) + 4); + if (data64) + { + for (int i = 0; i < 4; i++) + { + *(data64 + i) = *(data + i); + } - for (int i = 0; i < 4; i++) - { - *(data64 + i) = *(data + i); - } - - *(((int *) data64) + 1) = 0; + *(((int *) data64) + 1) = 0; - for (int i = 8; i < sizeof(XSizeHints) + 4; i++) - { - *(data64 + i) = *(data + i - 4); - } + for (int i = 8; i < sizeof(XSizeHints) + 4; i++) + { + *(data64 + i) = *(data + i - 4); + } - XSizeHints *props = (XSizeHints *) data64; + XSizeHints *props = (XSizeHints *) data64; #else - XSizeHints *props = (XSizeHints *) data; + XSizeHints *props = (XSizeHints *) data; #endif /* _XSERVER64 */ - hints = *props; + hints = *props; + } + else + { + #ifdef WARNING + fprintf(stderr, "%s: Failed to alloc memory for XSizeHints\n", __func__); + #endif + } } else { -- cgit v1.2.3 From 35556cac95b2c637d9b3ee754084aa12edbb3e91 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Sun, 8 Nov 2020 17:01:57 +0100 Subject: NXDispatch.c: remove double nxagentFreeAtomMap() --- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 1 - 1 file changed, 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 12a44dbe0..a8739fa3f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -581,7 +581,6 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio } saveAgentState("TERMINATED"); - nxagentFreeAtomMap(); nxagentFreeFontData(); #endif /* NXAGENT_SERVER */ -- cgit v1.2.3 From eef306c2d8b5139bdb065adb8ce61ac1caf06b6c Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 9 Nov 2020 22:54:49 +0100 Subject: manpage: document defaults for options -defer and -tile --- nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 index 111224264..72a885638 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 +++ b/nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 @@ -539,7 +539,9 @@ allowed to change the keyboard settings through XKEYBOARD. .TP 8 .B \-tile WxH maximum size of the tile used when sending an image to the remote -display (minimum allowed: 32x32; no default) +display (minimum allowed: 32x32). The default depends on the link +type: 64x64 for \fImodem\fR and \fIisdn\fR, 4096x4096 for all other +link types) .TP 8 .B \-irlimit maximum image data rate to the encoder input in kB/s. The default is no limit. @@ -755,21 +757,29 @@ The default value can be set via the command line (\-defer). The value provided as nx/nx option is set when resuming a session, thus it overrides the command line default. +The default depends on the link type (see man nxproxy). + Each defer level adds the following rules to the previous ones: .RS 8 .TP 8 .I 0 Eager encoding. + +Default for link speed \fIlan\fR and \fIlocal\fR. .TP 8 .I 1 No data is put or copied on pixmaps, marking them always as corrupted and synchronizing them on demand, i.e. when a copy area to a window is requested, the source is synchronized before copying it. + +Default for link speed \fIwan\fR. .TP 8 .I 2 The put images over the windows are skipped marking the destination as corrupted. The same happens for copy area and composite operations, spreading the corrupted regions of involved drawables. + +Default for link speed \fIadsl\fR, \fIisdn\fR and \fImodem\fR. .RE .TP 8 -- cgit v1.2.3 From f64fac47e9b2c3a6cdb49911b25b6f22f811f2f0 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 9 Nov 2020 21:17:45 +0100 Subject: Handlers.c: use the same boolean values as in NXdispatch.c although there is no functional difference... --- nx-X11/programs/Xserver/hw/nxagent/Handlers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c index d00b13d77..b573d0a66 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c @@ -1017,7 +1017,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) nxagentDispatch.in = nxagentBytesIn; nxagentDispatch.out = nxagentBytesOut; - isItTimeToYield = 1; + isItTimeToYield = TRUE; } #ifdef DEBUG else @@ -1126,7 +1126,7 @@ void nxagentDispatchHandler(ClientPtr client, int in, int out) nxagentDispatch.in = nxagentBytesIn; nxagentDispatch.out = nxagentBytesOut; - isItTimeToYield = 1; + isItTimeToYield = TRUE; } #ifdef DEBUG else -- cgit v1.2.3 From d1136ea2fc57e38c94608ad889f70fc3c517055e Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Wed, 30 Dec 2020 13:22:05 +0100 Subject: Client.h: conditionally add unused field --- nx-X11/programs/Xserver/hw/nxagent/Client.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Client.h b/nx-X11/programs/Xserver/hw/nxagent/Client.h index ac2f34e8b..574466602 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Client.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Client.h @@ -44,10 +44,15 @@ enum ClientHint JAVA_WINDOW }; +/* client byte counting is currently unused */ +#undef COUNT_CLIENT_BYTES + typedef struct _PrivClientRec { int clientState; +#ifdef COUNT_CLIENT_BYTES long clientBytes; +#endif enum ClientHint clientHint; char *clientInfoString; } PrivClientRec; @@ -59,8 +64,6 @@ extern int nxagentClientPrivateIndex; extern void nxagentClientStateCallback(CallbackListPtr *callbacks, void *data, void *args); -#undef COUNT_CLIENT_BYTES - #ifdef COUNT_CLIENT_BYTES #define nxagentClientAddBytes(pClient, size) \ (nxagentClientPriv(pClient) -> clientBytes += (size)) -- cgit v1.2.3 From cc781ae2edb414c2c591ab578636debc3515ed1d Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 31 Dec 2020 00:07:15 +0100 Subject: Screen.c: clarify that characters are compared --- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index cff0eb76a..173d2fb82 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -2530,9 +2530,9 @@ int nxagentShadowInit(ScreenPtr pScreen, WindowPtr pWin) if (nxagentKeyboard != NULL) { int i; - for (i = 0; nxagentKeyboard[i] != '/' && nxagentKeyboard[i] != 0; i++); + for (i = 0; nxagentKeyboard[i] != '/' && nxagentKeyboard[i] != '\0'; i++); - if(nxagentKeyboard[i] == 0 || nxagentKeyboard[i + 1] == 0 || i == 0) + if(nxagentKeyboard[i] == '\0' || nxagentKeyboard[i + 1] == '\0' || i == 0) { #ifdef WARNING fprintf(stderr,"WARNING! Wrong keyboard type: %s.\n", nxagentKeyboard); -- cgit v1.2.3 From 7aec57a404b4252e47db9b0efe03f01a07c56453 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Thu, 31 Dec 2020 01:45:36 +0100 Subject: Handlers.c: add FIXME --- nx-X11/programs/Xserver/hw/nxagent/Handlers.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c index b573d0a66..639e3429e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c @@ -123,6 +123,9 @@ Bool nxagentXdmcpAlertUp = False; int nxagentBuffer; Bool nxagentBlocking; + +/* FIXME: nxagentCongestion is checked as a Boolean and as an Integer + (>= 4) at the same time which is weird at least */ int nxagentCongestion; double nxagentBytesIn; -- cgit v1.2.3 From 0a06ee77a2ffd2b1dc5f1d6ebe93789be12f259f Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 4 Jan 2021 14:11:31 +0100 Subject: nxagent: Drop unused nxagentRootTileWindow --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 2 -- nx-X11/programs/Xserver/hw/nxagent/Window.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index a9a79cebd..8e2313eac 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -131,8 +131,6 @@ extern Bool nxagentOnce; -extern WindowPtr nxagentRootTileWindow; - extern int nxagentLastClipboardClient; #ifdef NX_DEBUG_INPUT diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 811b5b565..d5b0c1b6a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -110,8 +110,6 @@ extern WindowPtr nxagentViewportFrameRight; extern WindowPtr nxagentViewportFrameAbove; extern WindowPtr nxagentViewportFrameBelow; -extern WindowPtr nxagentRootTileWindow; - extern Bool nxagentReportPrivateWindowIds; #define RECTLIMIT 25 -- cgit v1.2.3 From 12b96fd9abb9289039cb71a03703dcfc503f61e1 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 4 Jan 2021 14:12:05 +0100 Subject: fix formatting and spelling in various files --- nx-X11/programs/Xserver/hw/nxagent/Args.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Atoms.h | 2 +- nx-X11/programs/Xserver/hw/nxagent/Display.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/GC.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/NXpicture.c | 13 ++++++------- nx-X11/programs/Xserver/hw/nxagent/Rootless.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Split.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Window.c | 2 +- nxcomp/include/NX.h | 2 +- nxcomp/src/Control.h | 2 +- nxcomp/src/Message.h | 2 +- nxproxy/man/nxproxy.1 | 2 +- 12 files changed, 17 insertions(+), 18 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c index d5d13ea56..f24d15c55 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c @@ -2319,7 +2319,7 @@ void nxagentSetDeferLevel(void) nxagentChangeOption(Streaming, False); } - switch (nxagentOption(LinkType)) + switch (nxagentOption(LinkType)) { case LINK_TYPE_MODEM: case LINK_TYPE_ISDN: { deferLevel = 2; tileWidth = 64; tileHeight = 64; break; } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h index a39c53c07..9006b2253 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Atoms.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Atoms.h @@ -58,7 +58,7 @@ void nxagentWMDetect(void); #ifdef XlibAtom /* - * only provide these protoypes if the including file knows about Xlib + * only provide these prototypes if the including file knows about Xlib * types. This allows us including Atoms.h without having to use the * Xlib type magic of Agent.h */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index 9931bdd77..cc9d35ac6 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -767,7 +767,7 @@ static void nxagentDisplayFlushHandler(Display *disp, int length) * Error flag after the _NXDisplayErrorPredicate returns true. The * function can be used to activate additional checks, besides the * normal failures detected by Xlib on the display socket. For exam- - * ple, the application can set the funciton to verify if an inter- + * ple, the application can set the function to verify if an inter- * rupt was received or if any other event occurred mandating the + end of the session." */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/GC.c b/nx-X11/programs/Xserver/hw/nxagent/GC.c index 2aa404910..b956bb8df 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GC.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GC.c @@ -1127,7 +1127,7 @@ static void nxagentReconnectClip(GCPtr pGC, int type, void * pValue, int nRects) /* * Originally, the clip origin area were 0,0 but it didn't * work with kedit and family, because it got the clip mask of - * the pixmap all traslated. + * the pixmap all translated. */ XSetClipRectangles(nxagentDisplay, nxagentGC(pGC), pGC -> clipOrg.x, pGC -> clipOrg.y, diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c index ae9de652a..5bda3c9ef 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXpicture.c @@ -528,13 +528,12 @@ void nxagentReconnectPictFormat(void *p0, XID x1, void *p2) } /* - * The set of picture formats may change considerably - * between different X servers. This poses a problem - * while migrating NX sessions, because a requisite to - * successfully reconnect the session is that all pic- - * ture formats have to be available on the new X server. - * To reduce such problems, we use a limited set of - * pictures available on the most X servers. + * The set of picture formats may change considerably between + * different X servers. This poses a problem while migrating NX + * sessions, because a requisite to successfully reconnect the session + * is that all picture formats have to be available on the new X + * server. To reduce such problems, we use a limited set of pictures + * available on the most X servers. */ void nxagentPictureCreateDefaultFormats(ScreenPtr pScreen, FormatInitRec *formats, int *nformats) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c index 9bcd90130..72cb13042 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c @@ -1245,7 +1245,7 @@ void nxagentFreePropertyList(void) /* * We are trying to distinguish notifications generated by an external - * client from those genarated by our own requests. + * client from those generated by our own requests. */ Bool nxagentNotifyMatchChangeProperty(void *p) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Split.c b/nx-X11/programs/Xserver/hw/nxagent/Split.c index 2e2b130fe..99cc3a280 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Split.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Split.c @@ -112,7 +112,7 @@ SplitResourcePtr nxagentAllocSplitResource(void) fprintf(stderr, "nxagentAllocSplitResource: PANIC! No more resources for the next split.\n"); #endif /* -FIXME: Must deal with the case all resources are exausted. +FIXME: Must deal with the case all resources are exhausted. */ FatalError("nxagentAllocSplitResource: PANIC! No more resources for the next split.\n"); } diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index d5b0c1b6a..841ee3888 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -1530,7 +1530,7 @@ void nxagentConfigureWindow(WindowPtr pWin, unsigned int mask) * position in the window tree, and pPriorParent is its previous * parent. This function can be NULL. * - * We simply pass this pver to the real X server. + * We simply pass this over to the real X server. */ void nxagentReparentWindow(WindowPtr pWin, WindowPtr pOldParent) { diff --git a/nxcomp/include/NX.h b/nxcomp/include/NX.h index cc1cfb280..088e265e0 100644 --- a/nxcomp/include/NX.h +++ b/nxcomp/include/NX.h @@ -342,7 +342,7 @@ extern int NXTransFlush(int fd); * connection. * * NX_CHANNEL_SLAVE: The channel will forward data to a remote slave - * command (see NX_SLAVE_CMD envrionment variable) + * command (see NX_SLAVE_CMD environment variable) * * Only a proxy running at the NX server/X client side will be able * to create a X, CUPS, SMB, MEDIA and HTTP channel. A proxy running diff --git a/nxcomp/src/Control.h b/nxcomp/src/Control.h index 764fca2c1..21edae77c 100644 --- a/nxcomp/src/Control.h +++ b/nxcomp/src/Control.h @@ -144,7 +144,7 @@ class Control T_session_mode SessionMode; // - // Either immediate or defferred flushes. + // Either immediate or deferred flushes. // T_flush_policy FlushPolicy; diff --git a/nxcomp/src/Message.h b/nxcomp/src/Message.h index 30883f101..f3a588104 100644 --- a/nxcomp/src/Message.h +++ b/nxcomp/src/Message.h @@ -566,7 +566,7 @@ class MessageStore // it can contain valid data that must be // explicitly deallocated if not needed. // Note also that you cannot count on the - // initialization made in costructor. + // initialization made in constructor. // temporary_ = message; diff --git a/nxproxy/man/nxproxy.1 b/nxproxy/man/nxproxy.1 index 9a145d2c0..c22f15a48 100644 --- a/nxproxy/man/nxproxy.1 +++ b/nxproxy/man/nxproxy.1 @@ -109,7 +109,7 @@ Remote port used for the connection. .TP 8 .B retry= -Number of connection atempts. +Number of connection attempts. .TP 8 .B root= -- cgit v1.2.3 From 669299de3594e46fd67a84066be4b78f83cb6f00 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Mon, 4 Jan 2021 14:57:32 +0100 Subject: Window.c: suppress warning This used to be printed only in TEST mode. Some while ago I had changed that to WARNING (because it is a warning...). However, this happens e.g. when running the xscreensaver vfeedback module and it does not look like it is a problem at all. So let's suppress this warning again and leave it to the TEST mode as it used to be. --- nx-X11/programs/Xserver/hw/nxagent/Window.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index 841ee3888..d95f8f3ed 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -3922,7 +3922,7 @@ StoringPixmapPtr nxagentFindItemBSPixmapList(unsigned long pixmapId) } } - #ifdef WARNING + #ifdef TEST fprintf(stderr, "%s: WARNING! Item not found.\n", __func__); #endif -- cgit v1.2.3 From 1b80750f69a848c1c00c15c537707acca4e68684 Mon Sep 17 00:00:00 2001 From: Ulrich Sibiller Date: Fri, 15 Jan 2021 18:24:26 +0100 Subject: Display.c: fix and reformat broken comment --- nx-X11/programs/Xserver/hw/nxagent/Display.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index cc9d35ac6..89d49edf1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -758,18 +758,17 @@ static void nxagentDisplayFlushHandler(Display *disp, int length) } /* - * From the changelog for nx-X11-3.0.0-4: - * "Added the _NXDisplayErrorPredicate function in XlibInt.c. It is - * actually a pointer to a function called whenever Xlib is going to - * perform a network operation. If the function returns true, the - * call will be aborted and Xlib will return the control to the ap- - * plication. It is up to the application to set the XlibDisplayIO- - * Error flag after the _NXDisplayErrorPredicate returns true. The - * function can be used to activate additional checks, besides the - * normal failures detected by Xlib on the display socket. For exam- - * ple, the application can set the function to verify if an inter- - * rupt was received or if any other event occurred mandating the - + end of the session." + * From the changelog for nx-X11-3.0.0-4: "Added the + * _NXDisplayErrorPredicate function in XlibInt.c. It is actually a + * pointer to a function called whenever Xlib is going to perform a + * network operation. If the function returns true, the call will be + * aborted and Xlib will return the control to the application. It is + * up to the application to set the XlibDisplayIO- Error flag after + * the _NXDisplayErrorPredicate returns true. The function can be used + * to activate additional checks, besides the normal failures detected + * by Xlib on the display socket. For example, the application can set + * the function to verify if an interrupt was received or if any other + * event occurred mandating the end of the session." */ static int nxagentDisplayErrorPredicate(Display *disp, int error) { -- cgit v1.2.3