Commit 7977b9f8 authored by Ulrich Sibiller's avatar Ulrich Sibiller

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; ^~~~~~
parent a93e2507
...@@ -674,7 +674,14 @@ Bool nxagentDisconnectAllPixmaps(void) ...@@ -674,7 +674,14 @@ Bool nxagentDisconnectAllPixmaps(void)
#endif #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]) if (clients[i])
{ {
...@@ -837,7 +844,13 @@ Bool nxagentReconnectAllPixmaps(void *p0) ...@@ -837,7 +844,13 @@ Bool nxagentReconnectAllPixmaps(void *p0)
#endif #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) if (clients[i] != NULL)
{ {
......
...@@ -519,6 +519,7 @@ Bool nxagentReconnectSession(void) ...@@ -519,6 +519,7 @@ Bool nxagentReconnectSession(void)
nxagentEmptyBSPixmapList(); nxagentEmptyBSPixmapList();
/* FIXME: nxagentReconnectAllPixmaps will always return 1 */
if (nxagentReconnectAllPixmaps(reconnectLossyLevel[PIXMAP_STEP]) == 0) if (nxagentReconnectAllPixmaps(reconnectLossyLevel[PIXMAP_STEP]) == 0)
{ {
failedStep = PIXMAP_STEP; failedStep = PIXMAP_STEP;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment