mirror of
git://sourceware.org/git/glibc.git
synced 2025-04-12 14:21:18 +08:00
2005-03-21 Thorsten Kukuk <kukuk@suse.de>
[BZ #1098] * sunrpc/xdr_stdio.c (xdrstdio_getlong, xdrstdio_putlong): Convert correctly between long/int on 64bit big-endian.
This commit is contained in:
parent
931ab41106
commit
a8f2e5659f
@ -108,20 +108,20 @@ xdrstdio_destroy (XDR *xdrs)
|
||||
static bool_t
|
||||
xdrstdio_getlong (XDR *xdrs, long *lp)
|
||||
{
|
||||
int32_t mycopy;
|
||||
u_int32_t mycopy;
|
||||
|
||||
if (fread ((caddr_t) & mycopy, 4, 1, (FILE *) xdrs->x_private) != 1)
|
||||
if (fread ((caddr_t) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1)
|
||||
return FALSE;
|
||||
*lp = (int32_t) ntohl (mycopy);
|
||||
*lp = (long) ntohl (mycopy);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrstdio_putlong (XDR *xdrs, const long *lp)
|
||||
{
|
||||
long mycopy = htonl (*lp);
|
||||
lp = &mycopy;
|
||||
if (fwrite ((caddr_t) lp, 4, 1, (FILE *) xdrs->x_private) != 1)
|
||||
int32_t mycopy = htonl ((u_int32_t) *lp);
|
||||
|
||||
if (fwrite ((caddr_t) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1)
|
||||
return FALSE;
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user