Subject: Fix compilation errors in nxcomp (nx-libs) when macros TEST/DEBUG/... are defined (developer support)

From: Nito Martinez <[email-masked]>
Date: Fri, 08 May 2015 00:35:09 +0200

Package: nx-libs
Version: 3.5.0.28

Description:

The attached patch fixes some compilation errors when the following 
macros are enabled: (TEST/DEBUG/DUMP). See the lines:

#undef TEST
#undef DEBUG
...

and the conditinal ifdefs

#ifdef TEST
#ifdef DEBUG
...

which are normally not compiled.

During debugging and testing when these macros gets activated, there are 
some compilation errors, which need to be manually fixed each time the 
Macros are enabled. This patch tries to leverage that error.

The patch does not affect code outside of those ifdef, and only provides 
developer support.

Regards,

Nito

diff --git a/nxcomp/Agent.h b/nxcomp/Agent.h
index fac5acd..1a59412 100644
--- a/nxcomp/Agent.h
+++ b/nxcomp/Agent.h
@@ -205,7 +205,7 @@ class Agent
   {
     #if defined(TEST) || defined(INFO)
     *logofs << "Agent: proxyCanRead() is "
-            << ((int) FD_ISSET(proxy -> getFd(), readSet)
+            << ((int) FD_ISSET(proxy -> getFd(), readSet))
             << ".\n" << logofs_flush;
     #endif
 
diff --git a/nxcomp/ClearArea.cpp b/nxcomp/ClearArea.cpp
index 7b693c7..81beb1e 100644
--- a/nxcomp/ClearArea.cpp
+++ b/nxcomp/ClearArea.cpp
@@ -92,7 +92,7 @@ void ClearAreaStore::dumpIdentity(const Message *message) const
 
   ClearAreaMessage *clearArea = (ClearAreaMessage *) message;
 
-  *logofs << name() << ": Identity exposures " << clearArea -> (unsigned int) exposures 
+  *logofs << name() << ": Identity exposures " << (unsigned int) clearArea -> exposures
           << ", window " << clearArea -> window  << ", x " << clearArea -> x
           << ", y " << clearArea -> y << ", width  " << clearArea -> width
           << ", height " << clearArea -> height << ", size " << clearArea -> size_
diff --git a/nxcomp/Proxy.cpp b/nxcomp/Proxy.cpp
index 7258fcf..b4b23a9 100644
--- a/nxcomp/Proxy.cpp
+++ b/nxcomp/Proxy.cpp
@@ -5169,7 +5169,7 @@ char *Proxy::handleSaveAllStores(const char *savePath) const
 
   *(cacheDumpName + DEFAULT_STRING_LENGTH - 1) = '\0';
 
-  mode_t fileMode = umask(0077);
+  fileMode = umask(0077);
 
   cacheDump = new ofstream(cacheDumpName, ios::out);
 
diff --git a/nxcomp/ServerChannel.cpp b/nxcomp/ServerChannel.cpp
index 52551e7..7f3ef07 100644
--- a/nxcomp/ServerChannel.cpp
+++ b/nxcomp/ServerChannel.cpp
@@ -5475,7 +5475,7 @@ int ServerChannel::handleColormap(unsigned char &opcode, unsigned char *&buffer,
     *logofs << "handleColormap: Dumping colormap entries:\n"
             << logofs_flush;
 
-    const unsigned char *p = unpackState_[resource] -> colormap -> data;
+    const unsigned int *p = unpackState_[resource] -> colormap -> data;
 
     for (unsigned int i = 0; i < unpackState_[resource] ->
              colormap -> entries; i++)