FreeBSD/usr.sbin/bluetooth/btpand/sdp.c
/*
 * _sdp_get_uint16(ptr, limit, value)
 *
 *	examine SDP data stream at ptr for a uint16_t, and
 *	extract to given storage, advancing ptr.
 *	limit is the first address past the end of valid data.
 */
_sdp_get_uint16(ptr, limit, value)
examine SDP data stream at ptr for a uint16_t, and
extract to given storage, advancing ptr.
limit is the first address past the end of valid data.
_sdp_get_uint16 ( ptr limit value ) examine SDP data stream at ptr for a uint16_t and extract to given storage advancing ptr . limit is the first address past the end of valid data .
bool
_sdp_get_uint16(uint8_t **ptr, uint8_t *limit, uint16_t *value)
{
	uint8_t *p = *ptr;
	uint16_t v;
	if (p + 1 > limit)
		return false;
	switch (*p++) {
	case SDP_DATA_UINT16:
		if (p + 2 > limit)
			return false;
		v = be16dec(p);
		p += 2;
		break;
	default:
		return false;
	}
	*value = v;
	*ptr = p;
	return true;
}
bool _sdp_get_uint16 ( uint8_t * * ptr , uint8_t * limit , uint16_t * value ) { uint8_t * p = * ptr ; uint16_t v ; if ( p + 1 > limit ) return false ; switch ( * p ++ ) { case SDP_DATA_UINT16 : if ( p + 2 > limit ) return false ; v = be16dec ( p ) ; p += 2 ; break ; default : return false ; } * value = v ; * ptr = p ; return true ; }
_sdp_get_uint16(ptr, limit, value)
      examine SDP data stream at ptr for a uint16_t, and
      extract to given storage, advancing ptr.
_sdp_get_uint16 ( ptr limit value ) examine SDP data stream at ptr for a uint16_t and extract to given storage advancing ptr .