aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2020-01-09 21:44:30 +0100
committerUlrich Sibiller <uli42@gmx.de>2020-01-09 21:51:57 +0100
commit7977b9f8f1c6b0ab9a37ce33fc53b8ef36400262 (patch)
tree4431e26cb4f061dbe394e38d06cc212499d643de
parenta93e25077c84f08a1aeea88968c3629909961a92 (diff)
downloadnx-libs-7977b9f8f1c6b0ab9a37ce33fc53b8ef36400262.tar.gz
nx-libs-7977b9f8f1c6b0ab9a37ce33fc53b8ef36400262.tar.bz2
nx-libs-7977b9f8f1c6b0ab9a37ce33fc53b8ef36400262.zip
Pixmap.c: fix variable shadowing
Pixmap.c: In function ‘nxagentDisconnectAllPixmaps’: Pixmap.c:677:19: warning: declaration of ‘r’ shadows a previous local [-Wshadow=compatible-local] for (int i = 0, r = 1; i < MAXCLIENTS; r = 1, i++) ^ Pixmap.c:652:7: note: shadowed declaration is here int r = 1; ^ Pixmap.c: In function ‘nxagentReconnectAllPixmaps’: Pixmap.c:840:19: warning: declaration of ‘result’ shadows a previous local [-Wshadow=compatible-local] for (int i = 0, result = 1; i < MAXCLIENTS; result = 1, i++) ^~~~~~ Pixmap.c:807:8: note: shadowed declaration is here Bool result = 1; ^~~~~~
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Pixmap.c17
-rw-r--r--nx-X11/programs/Xserver/hw/nxagent/Reconnect.c1
2 files changed, 16 insertions, 2 deletions
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c
index 695d14618..bb0e7302a 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c
@@ -674,7 +674,14 @@ Bool nxagentDisconnectAllPixmaps(void)
#endif
- for (int i = 0, r = 1; i < MAXCLIENTS; r = 1, i++)
+ /*
+ * FIXME: This is a bit cumbersome:
+ * - as stated below nxagentDisconnectPixmap will not modify r, so the result will stay at 1
+ * - at the end of each iteration r will be set to 1 anyway.
+ * So at the end of the loop r will always be 1. So the whole function will always return 1...
+ */
+ r = 1;
+ for (int i = 0; i < MAXCLIENTS; r = 1, i++)
{
if (clients[i])
{
@@ -837,7 +844,13 @@ Bool nxagentReconnectAllPixmaps(void *p0)
#endif
- for (int i = 0, result = 1; i < MAXCLIENTS; result = 1, i++)
+ /*
+ * FIXME: This is a bit cumbersome: at the end of each iteration
+ * result will be reset to 1. Therefore at loop exit result will
+ * always be 1 meaning the whole function will always return 1...
+ */
+ result = 1;
+ for (int i = 0; i < MAXCLIENTS; result = 1, i++)
{
if (clients[i] != NULL)
{
diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
index 86d3ba502..ff7033c6c 100644
--- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
+++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c
@@ -519,6 +519,7 @@ Bool nxagentReconnectSession(void)
nxagentEmptyBSPixmapList();
+ /* FIXME: nxagentReconnectAllPixmaps will always return 1 */
if (nxagentReconnectAllPixmaps(reconnectLossyLevel[PIXMAP_STEP]) == 0)
{
failedStep = PIXMAP_STEP;