From 316c8fb2e5f1fd6500d9e2c2905d5de3fe3d0f63 Mon Sep 17 00:00:00 2001 From: alexpeshkoff Date: Wed, 21 Mar 2007 10:51:34 +0000 Subject: [PATCH] Fixed alignment issue in remote on sparc --- src/remote/protocol.cpp | 2 +- src/remote/xdr.cpp | 27 ++++++++++++--------------- src/remote/xdr_proto.h | 2 +- 3 files changed, 14 insertions(+), 17 deletions(-) diff --git a/src/remote/protocol.cpp b/src/remote/protocol.cpp index ca45ba697f..fa337b4ad7 100644 --- a/src/remote/protocol.cpp +++ b/src/remote/protocol.cpp @@ -1113,7 +1113,7 @@ static bool_t xdr_datum( XDR* xdrs, DSC* desc, BLOB_PTR* buffer) case dtype_int64: fb_assert(desc->dsc_length >= sizeof(SINT64)); - if (!xdr_hyper(xdrs, (SINT64 *) p)) + if (!xdr_hyper(xdrs, p)) return FALSE; break; diff --git a/src/remote/xdr.cpp b/src/remote/xdr.cpp index fa29c41353..85c0538e85 100644 --- a/src/remote/xdr.cpp +++ b/src/remote/xdr.cpp @@ -119,7 +119,7 @@ static const XDR::xdr_ops mem_ops = static SCHAR zeros[4] = { 0, 0, 0, 0 }; -bool_t xdr_hyper( XDR * xdrs, SINT64 * pi64) +bool_t xdr_hyper( XDR * xdrs, void * pi64) { /************************************** * @@ -141,23 +141,20 @@ bool_t xdr_hyper( XDR * xdrs, SINT64 * pi64) * Handles "swapping" of the 2 long's to be "Endian" sensitive. * **************************************/ - union { - SINT64 temp_int64; - SLONG temp_long[2]; - } temp; + SLONG temp_long[2]; switch (xdrs->x_op) { case XDR_ENCODE: - temp.temp_int64 = *pi64; + memcpy(temp_long, pi64, sizeof temp_long); #ifndef WORDS_BIGENDIAN - if ((*xdrs->x_ops->x_putlong) (xdrs, &temp.temp_long[1]) && - (*xdrs->x_ops->x_putlong) (xdrs, &temp.temp_long[0])) + if ((*xdrs->x_ops->x_putlong) (xdrs, &temp_long[1]) && + (*xdrs->x_ops->x_putlong) (xdrs, &temp_long[0])) { return TRUE; } #else - if ((*xdrs->x_ops->x_putlong) (xdrs, &temp.temp_long[0]) && - (*xdrs->x_ops->x_putlong) (xdrs, &temp.temp_long[1])) + if ((*xdrs->x_ops->x_putlong) (xdrs, &temp_long[0]) && + (*xdrs->x_ops->x_putlong) (xdrs, &temp_long[1])) { return TRUE; } @@ -166,19 +163,19 @@ bool_t xdr_hyper( XDR * xdrs, SINT64 * pi64) case XDR_DECODE: #ifndef WORDS_BIGENDIAN - if (!(*xdrs->x_ops->x_getlong) (xdrs, &temp.temp_long[1]) || - !(*xdrs->x_ops->x_getlong) (xdrs, &temp.temp_long[0])) + if (!(*xdrs->x_ops->x_getlong) (xdrs, &temp_long[1]) || + !(*xdrs->x_ops->x_getlong) (xdrs, &temp_long[0])) { return FALSE; } #else - if (!(*xdrs->x_ops->x_getlong) (xdrs, &temp.temp_long[0]) || - !(*xdrs->x_ops->x_getlong) (xdrs, &temp.temp_long[1])) + if (!(*xdrs->x_ops->x_getlong) (xdrs, &temp_long[0]) || + !(*xdrs->x_ops->x_getlong) (xdrs, &temp_long[1])) { return FALSE; } #endif - *pi64 = temp.temp_int64; + memcpy(pi64, temp_long, sizeof temp_long); return TRUE; case XDR_FREE: diff --git a/src/remote/xdr_proto.h b/src/remote/xdr_proto.h index 58e01a2508..e691e71b17 100644 --- a/src/remote/xdr_proto.h +++ b/src/remote/xdr_proto.h @@ -47,7 +47,7 @@ bool_t xdr_u_long (XDR *, ULONG *); bool_t xdr_u_short (XDR *, u_short *); int xdr_union (XDR *, enum xdr_op *, SCHAR *, struct xdr_discrim *, xdrproc_t); bool_t xdr_wrapstring (XDR *, SCHAR **); -bool_t xdr_hyper(XDR *, SINT64 *); +bool_t xdr_hyper(XDR *, void *); #endif /* REMOTE_XDR_PROTO_H */