From 6d98e5381e3df544e0f7f4b164dba8bd21f67f48 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 16 Feb 2017 10:06:41 +0000 Subject: Xserver/Xi/chgfctl.c: Fix compiler warning: misleading-indentation. chgfctl.c: In function 'ChangeKbdFeedback': chgfctl.c:359:6: warning: this 'else' clause does not guard... [-Wmisleading-indentation] else ^~~~ chgfctl.c:361:3: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else' kctrl.autoRepeats[inx] = ^~~~~ --- nx-X11/programs/Xserver/Xi/chgfctl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nx-X11/programs/Xserver/Xi/chgfctl.c b/nx-X11/programs/Xserver/Xi/chgfctl.c index 341c794ce..a5ad73d11 100644 --- a/nx-X11/programs/Xserver/Xi/chgfctl.c +++ b/nx-X11/programs/Xserver/Xi/chgfctl.c @@ -358,9 +358,9 @@ ChangeKbdFeedback (client, dev, mask, k, f) kctrl.autoRepeat = defaultKeyboardControl.autoRepeat; else kctrl.autoRepeats[inx] &= ~kmask; - kctrl.autoRepeats[inx] = - (kctrl.autoRepeats[inx] & ~kmask) | - (defaultKeyboardControl.autoRepeats[inx] & kmask); + kctrl.autoRepeats[inx] = + (kctrl.autoRepeats[inx] & ~kmask) | + (defaultKeyboardControl.autoRepeats[inx] & kmask); } else { -- cgit v1.2.3 From 72152baff83c45ae481467481e1678faf8ec4789 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 17 Feb 2017 10:25:03 +0000 Subject: hw/nxagent/NXdispatch.c: Fix compiler warning: misleading-indentation NXdispatch.c: In function 'Dispatch': NXdispatch.c:309:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation] if (!(dispatchException & DE_TERMINATE)) ^~ NXdispatch.c:312:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if' while (!dispatchException) ^~~~~ --- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index 5792a41c5..1c2cd42ac 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -309,7 +309,7 @@ Reply Total Cached Bits In Bits Out Bits/Reply Ratio if (!(dispatchException & DE_TERMINATE)) dispatchException = 0; - while (!dispatchException) + while (!dispatchException) { if (*icheck[0] != *icheck[1]) { -- cgit v1.2.3 From 7aed70f14ad8289e199bb31e7d8b60178ea57bb6 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 17 Feb 2017 12:28:05 +0100 Subject: hw/nxagent/NXxvdisp.c: Fix compiler warnings: misleading-indentation NXxvdisp.c: In function 'ProcXvDispatch': NXxvdisp.c:96:9: warning: this 'else' clause does not guard... [-Wmisleading-indentation] else ^~~~ NXxvdisp.c:99:13: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else' break; ^~~~~ NXxvdisp.c:104:9: warning: this 'else' clause does not guard... [-Wmisleading-indentation] else ^~~~ NXxvdisp.c:107:10: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else' break; ^~~~~ NXxvdisp.c:118:2: warning: this 'else' clause does not guard... [-Wmisleading-indentation] else ^~~~ NXxvdisp.c:121:13: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else' break; ^~~~~ NXxvdisp.c:126:2: warning: this 'else' clause does not guard... [-Wmisleading-indentation] else ^~~~ NXxvdisp.c:129:13: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else' break; ^~~~~ NXxvdisp.c:137:2: warning: this 'else' clause does not guard... [-Wmisleading-indentation] else ^~~~ NXxvdisp.c:140:13: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else' break; ^~~~~ NXxvdisp.c:146:2: warning: this 'else' clause does not guard... [-Wmisleading-indentation] else ^~~~ NXxvdisp.c:149:6: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'else' break; ^~~~~ --- nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c | 28 +++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c b/nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c index ee19c28d0..ea617aa4b 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c @@ -95,16 +95,20 @@ ProcXvDispatch(ClientPtr client) result = (XineramaXvPutVideo(client)); else #endif - result = (ProcXvPutVideo(client)); - break; + { + result = (ProcXvPutVideo(client)); + } + break; case xv_PutStill: #ifdef PANORAMIX if(!noPanoramiXExtension) result = (XineramaXvPutStill(client)); else #endif - result = (ProcXvPutStill(client)); - break; + { + result = (ProcXvPutStill(client)); + } + break; case xv_GetVideo: result = (ProcXvGetVideo(client)); break; case xv_GetStill: result = (ProcXvGetStill(client)); break; case xv_GrabPort: result = (ProcXvGrabPort(client)); break; @@ -117,16 +121,20 @@ ProcXvDispatch(ClientPtr client) result = (XineramaXvStopVideo(client)); else #endif + { result = (ProcXvStopVideo(client)); - break; + } + break; case xv_SetPortAttribute: #ifdef PANORAMIX if(!noPanoramiXExtension) result = (XineramaXvSetPortAttribute(client)); else #endif + { result = (ProcXvSetPortAttribute(client)); - break; + } + break; case xv_GetPortAttribute: result = (ProcXvGetPortAttribute(client)); break; case xv_QueryBestSize: result = (ProcXvQueryBestSize(client)); break; case xv_QueryPortAttributes: result = (ProcXvQueryPortAttributes(client)); break; @@ -136,8 +144,10 @@ ProcXvDispatch(ClientPtr client) result = (XineramaXvPutImage(client)); else #endif + { result = (ProcXvPutImage(client)); - break; + } + break; #ifdef MITSHM case xv_ShmPutImage: #ifdef PANORAMIX @@ -145,8 +155,10 @@ ProcXvDispatch(ClientPtr client) result = (XineramaXvShmPutImage(client)); else #endif + { result = (ProcXvShmPutImage(client)); - break; + } + break; #endif case xv_QueryImageAttributes: result = (ProcXvQueryImageAttributes(client)); break; case xv_ListImageFormats: result = (ProcXvListImageFormats(client)); break; -- cgit v1.2.3 From a2741452473a3dbf2ec24bc944e9b5183b2486f7 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 17 Feb 2017 12:56:53 +0000 Subject: hw/nxagent/Events.c: Fix compiler warnings (with NX_DEBUG_INPUT): format. Events.c: In function 'nxagentDumpInputDevicesState': Events.c:4662:58: warning: format '%p' expects argument of type 'void *', but argument 3 has type 'DeviceIntPtr {aka struct _DeviceIntRec *}' [-Wformat=] fprintf(stderr, "\nKeyboard device state: \n\tdevice [%p]\n\tlast grab time [%lu]" ^ Events.c:4662:82: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'CARD32 {aka unsigned int}' [-Wformat=] fprintf(stderr, "\nKeyboard device state: \n\tdevice [%p]\n\tlast grab time [%lu]" ^ Events.c:4662:19: warning: format '%p' expects argument of type 'void *', but argument 7 has type 'GrabPtr {aka struct _GrabRec *}' [-Wformat=] fprintf(stderr, "\nKeyboard device state: \n\tdevice [%p]\n\tlast grab time [%lu]" ^ Events.c:4675:66: warning: format '%p' expects argument of type 'void *', but argument 3 has type 'WindowPtr {aka struct _Window *}' [-Wformat=] fprintf(stderr, "\nKeyboard grab state: \n\twindow pointer [%p]" ^ Events.c:4689:59: warning: format '%p' expects argument of type 'void *', but argument 3 has type 'DeviceIntPtr {aka struct _DeviceIntRec *}' [-Wformat=] fprintf(stderr, "\nPassive grab state: \n\tdevice [%p]\n\towner events flag [%s]" ^ Events.c:4689:23: warning: format '%lx' expects argument of type 'long unsigned int', but argument 10 has type 'Mask {aka unsigned int}' [-Wformat=] fprintf(stderr, "\nPassive grab state: \n\tdevice [%p]\n\towner events flag [%s]" ^ Events.c:4722:57: warning: format '%p' expects argument of type 'void *', but argument 3 has type 'DeviceIntPtr {aka struct _DeviceIntRec *}' [-Wformat=] fprintf(stderr, "\nPointer device state: \n\tdevice [%p]\n\tlast grab time [%lu]" ^ Events.c:4722:81: warning: format '%lu' expects argument of type 'long unsigned int', but argument 4 has type 'CARD32 {aka unsigned int}' [-Wformat=] fprintf(stderr, "\nPointer device state: \n\tdevice [%p]\n\tlast grab time [%lu]" ^ Events.c:4722:19: warning: format '%p' expects argument of type 'void *', but argument 7 has type 'GrabPtr {aka struct _GrabRec *}' [-Wformat=] fprintf(stderr, "\nPointer device state: \n\tdevice [%p]\n\tlast grab time [%lu]" ^ Events.c:4735:65: warning: format '%p' expects argument of type 'void *', but argument 3 has type 'WindowPtr {aka struct _Window *}' [-Wformat=] fprintf(stderr, "\nPointer grab state: \n\twindow pointer [%p]" ^ Events.c:4750:61: warning: format '%p' expects argument of type 'void *', but argument 3 has type 'DeviceIntPtr {aka struct _DeviceIntRec *}' [-Wformat=] fprintf(stderr, "\nPassive grab state: \n\tdevice [%p]\n\towner events flag [%s]" ^ Events.c:4750:25: warning: format '%lx' expects argument of type 'long unsigned int', but argument 10 has type 'Mask {aka unsigned int}' [-Wformat=] fprintf(stderr, "\nPassive grab state: \n\tdevice [%p]\n\towner events flag [%s]" ^ --- nx-X11/programs/Xserver/hw/nxagent/Events.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 61d39ee98..c186c1508 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -4664,12 +4664,12 @@ void nxagentDumpInputDevicesState(void) } } - fprintf(stderr, "\nKeyboard device state: \n\tdevice [%p]\n\tlast grab time [%lu]" + fprintf(stderr, "\nKeyboard device state: \n\tdevice [%p]\n\tlast grab time [%u]" "\n\tfrozen [%s]\n\tstate [%s]\n\tother [%p]\n\tevent count [%d]" - "\n\tfrom passive grab [%s]\n\tactivating key [%d]", dev, + "\n\tfrom passive grab [%s]\n\tactivating key [%d]", (void *)dev, dev -> grabTime.milliseconds, dev -> sync.frozen ? "Yes": "No", nxagentGrabStateToString(dev -> sync.state), - dev -> sync.other, dev -> sync.evcount, + (void *)dev -> sync.other, dev -> sync.evcount, dev -> fromPassiveGrab ? "Yes" : "No", dev -> activatingKey); @@ -4679,7 +4679,7 @@ void nxagentDumpInputDevicesState(void) { fprintf(stderr, "\nKeyboard grab state: \n\twindow pointer [%p]" "\n\towner events flag [%s]\n\tgrab mode [%s]", - grab -> window, grab -> ownerEvents ? "True" : "False", + (void *)grab -> window, grab -> ownerEvents ? "True" : "False", grab -> keyboardMode ? "asynchronous" : "synchronous"); /* @@ -4693,8 +4693,8 @@ void nxagentDumpInputDevicesState(void) { fprintf(stderr, "\nPassive grab state: \n\tdevice [%p]\n\towner events flag [%s]" "\n\tpointer grab mode [%s]\n\tkeyboard grab mode [%s]\n\tevent type [%d]" - "\n\tmodifiers [%x]\n\tbutton/key [%u]\n\tevent mask [%lx]", - grab -> device, grab -> ownerEvents ? "True" : "False", + "\n\tmodifiers [%x]\n\tbutton/key [%u]\n\tevent mask [%x]", + (void *)grab -> device, grab -> ownerEvents ? "True" : "False", grab -> pointerMode ? "asynchronous" : "synchronous", grab -> keyboardMode ? "asynchronous" : "synchronous", grab -> type, grab -> modifiersDetail.exact, @@ -4724,12 +4724,12 @@ void nxagentDumpInputDevicesState(void) } } - fprintf(stderr, "\nPointer device state: \n\tdevice [%p]\n\tlast grab time [%lu]" + fprintf(stderr, "\nPointer device state: \n\tdevice [%p]\n\tlast grab time [%u]" "\n\tfrozen [%s]\n\tstate [%s]\n\tother [%p]\n\tevent count [%d]" - "\n\tfrom passive grab [%s]\n\tactivating button [%d]", dev, + "\n\tfrom passive grab [%s]\n\tactivating button [%d]", (void *)dev, dev -> grabTime.milliseconds, dev -> sync.frozen ? "Yes" : "No", nxagentGrabStateToString(dev -> sync.state), - dev -> sync.other, dev -> sync.evcount, + (void *)dev -> sync.other, dev -> sync.evcount, dev -> fromPassiveGrab ? "Yes" : "No", dev -> activatingKey); @@ -4739,7 +4739,7 @@ void nxagentDumpInputDevicesState(void) { fprintf(stderr, "\nPointer grab state: \n\twindow pointer [%p]" "\n\towner events flag [%s]\n\tgrab mode [%s]", - grab -> window, grab -> ownerEvents ? "True" : "False", + (void *)grab -> window, grab -> ownerEvents ? "True" : "False", grab -> pointerMode ? "asynchronous" : "synchronous"); if (grab -> window != pWin) @@ -4754,8 +4754,8 @@ void nxagentDumpInputDevicesState(void) { fprintf(stderr, "\nPassive grab state: \n\tdevice [%p]\n\towner events flag [%s]" "\n\tpointer grab mode [%s]\n\tkeyboard grab mode [%s]\n\tevent type [%d]" - "\n\tmodifiers [%x]\n\tbutton/key [%u]\n\tevent mask [%lx]", - grab -> device, grab -> ownerEvents ? "True" : "False", + "\n\tmodifiers [%x]\n\tbutton/key [%u]\n\tevent mask [%x]", + (void *)grab -> device, grab -> ownerEvents ? "True" : "False", grab -> pointerMode ? "asynchronous" : "synchronous", grab -> keyboardMode ? "asynchronous" : "synchronous", grab -> type, grab -> modifiersDetail.exact, -- cgit v1.2.3 From 16fbdb2a8d4f8d6c2f3c45829e181109b5991a34 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 17 Feb 2017 13:30:13 +0000 Subject: Xserver/GL/glx/glxfb.c: Fix compiler warning: pointer-sign. glxfb.c: In function '__glXFBMemSwapBuffers': glxfb.c:117:5: warning: pointer targets in passing argument 10 of 'pGC->ops->PutImage' differ in signedness [-Wpointer-sign] buf); ^~~ glxfb.c:117:5: note: expected 'char *' but argument is of type 'GLubyte * {aka unsigned char *}' --- nx-X11/programs/Xserver/GL/glx/glxfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/GL/glx/glxfb.c b/nx-X11/programs/Xserver/GL/glx/glxfb.c index 7248b6ffb..13f02d448 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxfb.c +++ b/nx-X11/programs/Xserver/GL/glx/glxfb.c @@ -113,7 +113,7 @@ __glXFBMemSwapBuffers(__GLXdrawablePrivate *glxPriv) depth, 0, 0, width, height, pad, ZPixmap, - buf); + (char *)buf); return GL_TRUE; } -- cgit v1.2.3 From a6ffabda67a703f6ba7091db9ad8eed623bc4347 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 17 Feb 2017 13:35:48 +0000 Subject: glx: warning fixes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit commit 63ccaec2c39f4b5742383472c951ee2cd35c9e14 Author: Adam Jackson Date: Tue Oct 19 11:59:23 2010 -0400 render2.c: In function ‘__glXDisp_Map2d’: render2.c:127: warning: ‘u1’ may be used uninitialized in this function render2.c: In function ‘__glXDisp_Map1d’: render2.c:90: warning: ‘u1’ may be used uninitialized in this function Remove unnecessary test, and change memcpy to memmove as all users were doing overlapping copies. Signed-off-by: Adam Jackson Reviewed-by: Daniel Stone Backported-to-NX-by: Mike Gabriel --- nx-X11/programs/Xserver/GL/glx/unpack.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/GL/glx/unpack.h b/nx-X11/programs/Xserver/GL/glx/unpack.h index 7d84ff575..9554ba4b9 100644 --- a/nx-X11/programs/Xserver/GL/glx/unpack.h +++ b/nx-X11/programs/Xserver/GL/glx/unpack.h @@ -52,7 +52,7 @@ ** Fetch a double from potentially unaligned memory. */ #ifdef __GLX_ALIGN64 -#define __GLX_MEM_COPY(dst,src,n) if (src && dst) memcpy(dst,src,n) +#define __GLX_MEM_COPY(dst,src,n) memmove(dst,src,n) #define __GLX_GET_DOUBLE(dst,src) __GLX_MEM_COPY(&dst,src,8) #else #define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src)) -- cgit v1.2.3 From ac6a216c584532e9fa3c4ef90c0e2eb03528ad55 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 17 Mar 2017 14:06:15 +0000 Subject: lib/X11/Xrm.c: Compiler warning fix: logical-not-parentheses Xrm.c: In function 'PutEntry': Xrm.c:900:15: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses] !quarks[2] != table->leaf) ^~ --- nx-X11/lib/src/Xrm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/lib/src/Xrm.c b/nx-X11/lib/src/Xrm.c index e3587d021..c285e4221 100644 --- a/nx-X11/lib/src/Xrm.c +++ b/nx-X11/lib/src/Xrm.c @@ -897,7 +897,7 @@ static void PutEntry( /* bump to loose table, if any */ table = *(prev = &table->next); if (!table || table->name != q || - !quarks[2] != table->leaf) + (!quarks[2]) != table->leaf) break; /* not found */ } } -- cgit v1.2.3 From 8bb1579f40bb74b9dad302e79c124541694b3265 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 14 Dec 2017 08:05:54 +0100 Subject: Xserver/GL/glx/glxcmds.c: Cast small-int values through intptr_t when passed as pointers Picked from this X.org commit: commit b0dd6be2c8703f7062d45ac9fd646550c7d54e3b Author: Jamey Sharp Date: Thu Oct 8 13:38:44 2009 +1100 Cast small-int values through intptr_t when passed as pointers On 64-bit systems, int and pointers don't have the same size, so GCC gives warnings about casts between int and pointer types. However, in the cases covered by this patch, it's always a value that fits in int being stored temporarily as a pointer and then converted back later, which is safe. Casting through the pointer-sized integer type intptr_t convinces the compiler that this is OK. Signed-off-by: Jamey Sharp Signed-off-by: Daniel Stone Backported-to-NX-by: Mike Gabriel (Only appropriate location for backporting: Xserver/GL/glx/glxcmds.c). --- nx-X11/programs/Xserver/GL/glx/glxcmds.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nx-X11/programs/Xserver/GL/glx/glxcmds.c b/nx-X11/programs/Xserver/GL/glx/glxcmds.c index efe5b25e9..602b79099 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxcmds.c +++ b/nx-X11/programs/Xserver/GL/glx/glxcmds.c @@ -1762,7 +1762,7 @@ static int __glXBindSwapBarrierSGIX(__GLXclientState *cl, GLbyte *pc) if (ret == Success) { if (barrier) /* add source for cleanup when drawable is gone */ - AddResource(drawable, __glXSwapBarrierRes, (void *)screen); + AddResource(drawable, __glXSwapBarrierRes, (void *)(intptr_t)screen); else /* delete source */ FreeResourceByType(drawable, __glXSwapBarrierRes, FALSE); -- cgit v1.2.3