[uClibc-cvs] svn commit: trunk/uClibc/include/rpc

mjn3 at uclibc.org mjn3 at uclibc.org
Mon May 2 13:49:28 UTC 2005


Author: mjn3
Date: 2005-05-02 07:49:28 -0600 (Mon, 02 May 2005)
New Revision: 10230

Log:
Replace IXDR_GET_LONG/IXDR_PUT_LONG so that they build with newer gcc.  Note the comment in the code.

Modified:
   trunk/uClibc/include/rpc/xdr.h


Changeset:
Modified: trunk/uClibc/include/rpc/xdr.h
===================================================================
--- trunk/uClibc/include/rpc/xdr.h	2005-05-02 13:48:27 UTC (rev 10229)
+++ trunk/uClibc/include/rpc/xdr.h	2005-05-02 13:49:28 UTC (rev 10230)
@@ -273,10 +273,20 @@
  * and shouldn't be used any longer. Code which use this defines or longs
  * in the RPC code will not work on 64bit Solaris platforms !
  */
+/* #define IXDR_GET_LONG(buf) \ */
+/* 	((long)ntohl((u_long)*(*(u_int32_t**)&(buf))++)) */
+/* #define IXDR_PUT_LONG(buf, v) \ */
+/* 	(*(*(u_int32_t**)&(buf))++ = (long)htonl((u_long)(v))) */
+
+/* WARNING: These macros are not safe against side effects for the 'buf'
+ * argument.  But the old versions they're replacing took the address of
+ * 'buf' and were probably not safe in that situation either. */
 #define IXDR_GET_LONG(buf) \
-	((long)ntohl((u_long)*(*(u_int32_t**)&(buf))++))
+	((long) ntohl((u_long) (((u_int32_t *)(buf = (void *)(((char *) buf) + sizeof(u_int32_t))))[-1]) ))
 #define IXDR_PUT_LONG(buf, v) \
-	(*(*(u_int32_t**)&(buf))++ = (long)htonl((u_long)(v)))
+	(((u_int32_t *)(buf = (void *)(((char *) buf) + sizeof(u_int32_t))))[-1]) = (long)htonl((u_long)(v))
+
+
 #define IXDR_GET_U_LONG(buf)	      ((u_long)IXDR_GET_LONG(buf))
 #define IXDR_PUT_U_LONG(buf, v)	      IXDR_PUT_LONG(buf, (long)(v))
 




More information about the uClibc-cvs mailing list