This patch avoids the gcc warnings ../../libSM-1.1.0/src/sm_client.c:269: warning: null argument where non-null required (arg 2) ../../libSM-1.1.0/src/sm_client.c:269: warning: null argument where non-null required (arg 2) ../../libSM-1.1.0/src/sm_client.c:269: warning: statement with no effect It is better to avoid dubious constructs such as if (NULL) memcpy (_pBuf, NULL, _len) in particular if they may generate warnings. libICE and libSM are two of the libraries that still could need ANSIfication, I'd offer some help if you tell me to do so. diff -ur libSM-1.1.0.orig/src/SMlibint.h libSM-1.1.0/src/SMlibint.h --- libSM-1.1.0.orig/src/SMlibint.h 2008-05-12 23:30:18.000000000 +0200 +++ libSM-1.1.0/src/SMlibint.h 2008-10-08 00:00:56.000000000 +0200 @@ -207,10 +207,9 @@ #define STORE_ARRAY8(_pBuf, _len, _array8) \ { \ STORE_CARD32 (_pBuf, _len); \ - memcpy (_pBuf, _array8, _len); \ - _pBuf += _len; \ - if (PAD64 (4 + _len)) \ - _pBuf += PAD64 (4 + _len); \ + if (_len) \ + memcpy (_pBuf, _array8, _len); \ + _pBuf += _len + PAD64 (4 + _len); \ } #define STORE_LISTOF_PROPERTY(_pBuf, _count, _props) \ @@ -243,9 +242,7 @@ _array8 = (char *) malloc (_len + 1); \ memcpy (_array8, _pBuf, _len); \ _array8[_len] = '\0'; \ - _pBuf += _len; \ - if (PAD64 (4 + _len)) \ - _pBuf += PAD64 (4 + _len); \ + _pBuf += _len + PAD64 (4 + _len); \ } #define EXTRACT_ARRAY8_AS_STRING(_pBuf, _swap, _string) \ @@ -255,9 +252,7 @@ _string = (char *) malloc (_len + 1); \ memcpy (_string, _pBuf, _len); \ _string[_len] = '\0'; \ - _pBuf += _len; \ - if (PAD64 (4 + _len)) \ - _pBuf += PAD64 (4 + _len); \ + _pBuf += _len + PAD64 (4 + _len); \ } #define EXTRACT_LISTOF_PROPERTY(_pBuf, _swap, _count, _props) \ @@ -289,9 +284,7 @@ { \ CARD32 _len; \ EXTRACT_CARD32 (_pBuf, _swap, _len); \ - _pBuf += _len; \ - if (PAD64 (4 + _len)) \ - _pBuf += PAD64 (4 + _len); \ + _pBuf += _len + PAD64 (4 + _len); \ } #define SKIP_LISTOF_PROPERTY(_pBuf, _swap) \ diff -ur libSM-1.1.0.orig/src/sm_client.c libSM-1.1.0/src/sm_client.c --- libSM-1.1.0.orig/src/sm_client.c 2008-05-12 23:30:18.000000000 +0200 +++ libSM-1.1.0/src/sm_client.c 2008-10-07 23:52:54.000000000 +0200 @@ -200,7 +200,9 @@ * Now register the client */ - len = previousId ? strlen (previousId) : 0; + if (!previousId) + previousId = ""; + len = strlen (previousId); extra = ARRAY8_BYTES (len); IceGetHeaderExtra (iceConn, _SmcOpcode, SM_RegisterClient, @@ -266,7 +268,7 @@ SIZEOF (smRegisterClientMsg), WORD64COUNT (extra), smRegisterClientMsg, pMsg, pData); - STORE_ARRAY8 (pData, 0, NULL); + STORE_ARRAY8 (pData, 0, ""); IceFlush (iceConn);