コード例 #1
0
ファイル: xdr_rec.c プロジェクト: marayl/openxdr
/*
 * The routines defined below are the xdr ops which will go into the
 * xdr handle filled in by xdrrec_create.
 */
static bool_t
xdrrec_getint32(XDR *xdrs, int32_t *ip)
{
	/* LINTED pointer cast */
	RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
	/* LINTED pointer cast */
	int32_t *buflp = (int32_t *)(rstrm->in_finger);
	int32_t mylong;

	/* first try the inline, fast case */
	if ((rstrm->fbtbc >= (int)sizeof (int32_t)) &&
		((u_int)(rstrm->in_boundry - (caddr_t)buflp) >=
					(u_int)sizeof (int32_t))) {
		/*
		 * Check if buflp is longword aligned.  If not, align it.
		 */
		if (((uintptr_t)buflp) & ((int)sizeof (int32_t) - 1)) {
			align_instream(rstrm);
			/* LINTED pointer cast */
			buflp = (int32_t *)(rstrm->in_finger);
		}
		*ip = (int32_t)xdr_ntoh32((uint32_t)(*buflp));
		rstrm->fbtbc -= (int)sizeof (int32_t);
		rstrm->in_finger += sizeof (int32_t);
	} else {
		if (!xdrrec_getbytes(xdrs, (caddr_t)&mylong, sizeof (int32_t)))
			return (FALSE);
		*ip = (int32_t)xdr_ntoh32((uint32_t)mylong);
	}
	return (TRUE);
}
コード例 #2
0
ファイル: xdr_rec.c プロジェクト: EmuxEvans/CompositeFreeRTOS
static bool_t
xdrrec_getlong (XDR *xdrs, long *lp)
{
	register RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private);
	register int32_t *buflp = (int32_t *) (rstrm->in_finger);
	int32_t mylong;

	/* first try the inline, fast case */
	if ((rstrm->fbtbc >= BYTES_PER_XDR_UNIT) &&
		((rstrm->in_boundry - (char *) buflp) >= BYTES_PER_XDR_UNIT)) {
		*lp = (int32_t) ntohl(*buflp);
		rstrm->fbtbc -= BYTES_PER_XDR_UNIT;
		rstrm->in_finger += BYTES_PER_XDR_UNIT;
	} else {
		if (!xdrrec_getbytes(xdrs, (char*) & mylong, BYTES_PER_XDR_UNIT))
			return (FALSE);

		*lp = (int32_t) ntohl(mylong);
	}
	return (TRUE);
}
コード例 #3
0
ファイル: xdr_rec.c プロジェクト: mihaicarabas/dragonfly
static bool_t
xdrrec_getlong(XDR *xdrs, long *lp)
{
	RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
	int32_t *buflp = (int32_t *)(void *)(rstrm->in_finger);
	int32_t mylong;

	/* first try the inline, fast case */
	if ((rstrm->fbtbc >= sizeof(int32_t)) &&
		(((long)rstrm->in_boundry - (long)buflp) >= sizeof(int32_t))) {
		*lp = (long)ntohl((u_int32_t)(*buflp));
		rstrm->fbtbc -= sizeof(int32_t);
		rstrm->in_finger += sizeof(int32_t);
	} else {
		if (! xdrrec_getbytes(xdrs, (char *)(void *)&mylong,
		    sizeof(int32_t)))
			return (FALSE);
		*lp = (long)ntohl((u_int32_t)mylong);
	}
	return (TRUE);
}
コード例 #4
0
ファイル: xdr_rec.c プロジェクト: andreiw/polaris
static bool_t
xdrrec_getint32(XDR *xdrs, int32_t *ip)
{
	RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
	int32_t *bufip = (int32_t *)(rstrm->in_finger);
	int32_t myint;

	/* first try the inline, fast case */
	if ((rstrm->fbtbc >= sizeof (int32_t)) &&
		(((ptrdiff_t)rstrm->in_boundry
		    - (ptrdiff_t)bufip) >= sizeof (int32_t))) {
		*ip = (int32_t)ntohl((uint32_t)(*bufip));
		rstrm->fbtbc -= sizeof (int32_t);
		rstrm->in_finger += sizeof (int32_t);
	} else {
		if (!xdrrec_getbytes(xdrs, (caddr_t)&myint, sizeof (int32_t)))
			return (FALSE);
		*ip = (int32_t)ntohl((uint32_t)myint);
	}
	return (TRUE);
}
コード例 #5
0
ファイル: xdr_rec.c プロジェクト: khallock/LDM
static bool_t
xdrrec_getlong(
	XDR *xdrs,
	uint32_t *lp)
{
	register RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
	register uint32_t *buflp = (uint32_t *)(rstrm->in_finger);
	uint32_t mylong;

	/* first try the inline, fast case */
	if ((rstrm->fbtbc >= sizeof(uint32_t)) &&
		(((char*)rstrm->in_boundry - (char*)buflp) >= sizeof(uint32_t))) {
		*lp = ntohl(*buflp);
		rstrm->fbtbc -= sizeof(uint32_t);
		rstrm->in_finger += sizeof(uint32_t);
	} else {
		if (! xdrrec_getbytes(xdrs, (char*)&mylong, sizeof(uint32_t)))
			return (FALSE);
		*lp = (uint32_t)ntohl(mylong);
	}
	return (TRUE);
}