8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-24 00:03:03 +01:00

Fixed alignment issue in remote on sparc

This commit is contained in:
alexpeshkoff 2007-03-21 10:51:34 +00:00
parent 4f633a6e6c
commit 316c8fb2e5
3 changed files with 14 additions and 17 deletions

View File

@ -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;

View File

@ -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:

View File

@ -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 */