Ejemplo n.º 1
0
 int buffer_next_int32(xrtp_buffer_t * buf, int32 * ret){

    if(buf->pos + sizeof(int32) > buf->len){

       return 0;
    }

    if(HOST_BYTEORDER == BIGEND_ORDER)
       *ret = RIVALS(&(buf->data), buf->pos);
    else
       *ret = IVALS(&(buf->data), buf->pos);

    buffer_log(("buffer_next_int32: (%d) at buf[%d]@%d\n", *ret, buf->pos, (int)buf->data));

    buf->pos += sizeof(int32);

    return sizeof(int32);
 }
Ejemplo n.º 2
0
bool prs_int32(const char *name, prs_struct *ps, int depth, int32 *data32)
{
	char *q = prs_mem_get(ps, sizeof(int32));
	if (q == NULL)
		return False;

	if (UNMARSHALLING(ps)) {
		if (ps->bigendian_data)
			*data32 = RIVALS(q,0);
		else
			*data32 = IVALS(q,0);
	} else {
		if (ps->bigendian_data)
			RSIVALS(q,0,*data32);
		else
			SIVALS(q,0,*data32);
	}

	DEBUGADD(5,("%s%04x %s: %08x\n", tab_depth(5,depth), ps->data_offset, name, *data32));

	ps->data_offset += sizeof(int32);

	return True;
}