]> git.saurik.com Git - apple/libinfo.git/blobdiff - rpc.subproj/rpc_callmsg.c
Libinfo-392.tar.gz
[apple/libinfo.git] / rpc.subproj / rpc_callmsg.c
index 4ab6b5f9930cf43a12b0a9ca5afc249c44aa583e..789fd00740f25d63d154e13d3c5de8fcb777e134 100644 (file)
@@ -3,22 +3,21 @@
  *
  * @APPLE_LICENSE_HEADER_START@
  * 
- * Copyright (c) 1999-2003 Apple Computer, Inc.  All Rights Reserved.
- * 
- * This file contains Original Code and/or Modifications of Original Code
- * as defined in and that are subject to the Apple Public Source License
- * Version 2.0 (the 'License'). You may not use this file except in
- * compliance with the License. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
+ * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
+ * Reserved.  This file contains Original Code and/or Modifications of
+ * Original Code as defined in and that are subject to the Apple Public
+ * Source License Version 1.1 (the "License").  You may not use this file
+ * except in compliance with the License.  Please obtain a copy of the
+ * License at http://www.apple.com/publicsource and read it before using
+ * this file.
  * 
  * The Original Code and all software distributed under the License are
- * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
- * Please see the License for the specific language governing rights and
- * limitations under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE OR NON- INFRINGEMENT.  Please see the
+ * License for the specific language governing rights and limitations
+ * under the License.
  * 
  * @APPLE_LICENSE_HEADER_END@
  */
@@ -80,7 +79,11 @@ xdr_callmsg(xdrs, cmsg)
        register XDR *xdrs;
        register struct rpc_msg *cmsg;
 {
+#ifdef __LP64__
+       int *buf;
+#else
        register long *buf;
+#endif
        register struct opaque_auth *oa;
 
        if (xdrs->x_op == XDR_ENCODE) {
@@ -90,10 +93,17 @@ xdr_callmsg(xdrs, cmsg)
                if (cmsg->rm_call.cb_verf.oa_length > MAX_AUTH_BYTES) {
                        return (FALSE);
                }
+#ifdef __LP64__
+               buf = (int *)XDR_INLINE(xdrs, 8 * BYTES_PER_XDR_UNIT
+                                                                + RNDUP(cmsg->rm_call.cb_cred.oa_length)
+                                                                + 2 * BYTES_PER_XDR_UNIT
+                                                                + RNDUP(cmsg->rm_call.cb_verf.oa_length));
+#else
                buf = (long *)XDR_INLINE(xdrs, 8 * BYTES_PER_XDR_UNIT
-                       + RNDUP(cmsg->rm_call.cb_cred.oa_length)
-                       + 2 * BYTES_PER_XDR_UNIT
-                       + RNDUP(cmsg->rm_call.cb_verf.oa_length));
+                                                                + RNDUP(cmsg->rm_call.cb_cred.oa_length)
+                                                                + 2 * BYTES_PER_XDR_UNIT
+                                                                + RNDUP(cmsg->rm_call.cb_verf.oa_length));
+#endif
                if (buf != NULL) {
                        IXDR_PUT_LONG(buf, cmsg->rm_xid);
                        IXDR_PUT_ENUM(buf, cmsg->rm_direction);
@@ -112,7 +122,11 @@ xdr_callmsg(xdrs, cmsg)
                        IXDR_PUT_LONG(buf, oa->oa_length);
                        if (oa->oa_length) {
                                bcopy(oa->oa_base, (caddr_t)buf, oa->oa_length);
+#ifdef __LP64__
+                               buf += RNDUP(oa->oa_length) / sizeof (int);
+#else
                                buf += RNDUP(oa->oa_length) / sizeof (long);
+#endif
                        }
                        oa = &cmsg->rm_call.cb_verf;
                        IXDR_PUT_ENUM(buf, oa->oa_flavor);
@@ -120,6 +134,7 @@ xdr_callmsg(xdrs, cmsg)
                        if (oa->oa_length) {
                                bcopy(oa->oa_base, (caddr_t)buf, oa->oa_length);
                                /* no real need....
+                               * N.B. Fix this for __LP64__ if it is uncommented *
                                buf += RNDUP(oa->oa_length) / sizeof (long);
                                */
                        }
@@ -127,7 +142,11 @@ xdr_callmsg(xdrs, cmsg)
                }
        }
        if (xdrs->x_op == XDR_DECODE) {
+#ifdef __LP64__
+               buf = (int *)XDR_INLINE(xdrs, 8 * BYTES_PER_XDR_UNIT);
+#else
                buf = (long *)XDR_INLINE(xdrs, 8 * BYTES_PER_XDR_UNIT);
+#endif
                if (buf != NULL) {
                        cmsg->rm_xid = IXDR_GET_LONG(buf);
                        cmsg->rm_direction = IXDR_GET_ENUM(buf, enum msg_type);
@@ -152,7 +171,11 @@ xdr_callmsg(xdrs, cmsg)
                                        oa->oa_base = (caddr_t)
                                                mem_alloc(oa->oa_length);
                                }
+#ifdef __LP64__
+                               buf = (int *)XDR_INLINE(xdrs, RNDUP(oa->oa_length));
+#else
                                buf = (long *)XDR_INLINE(xdrs, RNDUP(oa->oa_length));
+#endif
                                if (buf == NULL) {
                                        if (xdr_opaque(xdrs, oa->oa_base,
                                            oa->oa_length) == FALSE) {
@@ -162,13 +185,17 @@ xdr_callmsg(xdrs, cmsg)
                                        bcopy((caddr_t)buf, oa->oa_base,
                                            oa->oa_length);
                                        /* no real need....
-                                       buf += RNDUP(oa->oa_length) /
-                                               sizeof (long);
+                                       * N.B. Fix this for __LP64__ if it is uncommented *
+                                       buf += RNDUP(oa->oa_length) / sizeof (long);
                                        */
                                }
                        }
                        oa = &cmsg->rm_call.cb_verf;
+#ifdef __LP64__
+                       buf = (int *)XDR_INLINE(xdrs, 2 * BYTES_PER_XDR_UNIT);
+#else
                        buf = (long *)XDR_INLINE(xdrs, 2 * BYTES_PER_XDR_UNIT);
+#endif
                        if (buf == NULL) {
                                if (xdr_enum(xdrs, &oa->oa_flavor) == FALSE ||
                                    xdr_u_int(xdrs, &oa->oa_length) == FALSE) {
@@ -186,7 +213,11 @@ xdr_callmsg(xdrs, cmsg)
                                        oa->oa_base = (caddr_t)
                                                mem_alloc(oa->oa_length);
                                }
+#ifdef __LP64__
+                               buf = (int *)XDR_INLINE(xdrs, RNDUP(oa->oa_length));
+#else
                                buf = (long *)XDR_INLINE(xdrs, RNDUP(oa->oa_length));
+#endif
                                if (buf == NULL) {
                                        if (xdr_opaque(xdrs, oa->oa_base,
                                            oa->oa_length) == FALSE) {
@@ -196,8 +227,8 @@ xdr_callmsg(xdrs, cmsg)
                                        bcopy((caddr_t)buf, oa->oa_base,
                                            oa->oa_length);
                                        /* no real need...
-                                       buf += RNDUP(oa->oa_length) /
-                                               sizeof (long);
+                                       * N.B. Fix this for __LP64__ if it is uncommented *
+                                       buf += RNDUP(oa->oa_length) / sizeof (long);
                                        */
                                }
                        }