src/atsc3_utils.c
block_t* block_Duplicate_to_size(block_t* src, uint32_t target_len) {
	if(!__block_check_bounaries(__FUNCTION__, src)) return NULL;

	uint32_t to_alloc_size = __CLIP(target_len, 8, src->p_size);

	block_t* dest = block_Alloc(to_alloc_size);
	memcpy(dest->p_buffer, src->p_buffer, to_alloc_size);
	dest->i_pos = to_alloc_size;

	return dest;
}
/**
 *
 * this will return a new block starting 0 up to target_len
 */
this will return a new block starting 0 up to target_len
this will return a new block starting 0 up to target_len
block_t* block_Duplicate_to_size(block_t* src, uint32_t target_len) {
	if(!__block_check_bounaries(__FUNCTION__, src)) return NULL;
	uint32_t to_alloc_size = __CLIP(target_len, 8, src->p_size);
	block_t* dest = block_Alloc(to_alloc_size);
	memcpy(dest->p_buffer, src->p_buffer, to_alloc_size);
	dest->i_pos = to_alloc_size;
	return dest;
}
block_t * block_Duplicate_to_size ( block_t * src , uint32_t target_len ) { if ( ! __block_check_bounaries ( __FUNCTION__ , src ) ) return NULL ; uint32_t to_alloc_size = __CLIP ( target_len , 8 , src -> p_size ) ; block_t * dest = block_Alloc ( to_alloc_size ) ; memcpy ( dest -> p_buffer , src -> p_buffer , to_alloc_size ) ; dest -> i_pos = to_alloc_size ; return dest ; }
this will return a new block starting 0 up to target_len
this will return a new block starting 0 up to target_len