mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	Use errno for result errors
Make new enumeration for data transport status and use errno style error numbers for errors.
This commit is contained in:
		
							parent
							
								
									dda28b1589
								
							
						
					
					
						commit
						6fb0f580ea
					
				
					 86 changed files with 2019 additions and 1988 deletions
				
			
		| 
						 | 
				
			
			@ -125,24 +125,24 @@ static int impl_get_interface(struct spa_handle *handle, uint32_t interface_id,
 | 
			
		|||
{
 | 
			
		||||
	struct impl *impl;
 | 
			
		||||
 | 
			
		||||
	spa_return_val_if_fail(handle != NULL, SPA_RESULT_INVALID_ARGUMENTS);
 | 
			
		||||
	spa_return_val_if_fail(interface != NULL, SPA_RESULT_INVALID_ARGUMENTS);
 | 
			
		||||
	spa_return_val_if_fail(handle != NULL, -EINVAL);
 | 
			
		||||
	spa_return_val_if_fail(interface != NULL, -EINVAL);
 | 
			
		||||
 | 
			
		||||
	impl = (struct impl *) handle;
 | 
			
		||||
 | 
			
		||||
	if (interface_id == impl->type.type_map)
 | 
			
		||||
		*interface = &impl->map;
 | 
			
		||||
	else
 | 
			
		||||
		return SPA_RESULT_UNKNOWN_INTERFACE;
 | 
			
		||||
		return -ENOENT;
 | 
			
		||||
 | 
			
		||||
	return SPA_RESULT_OK;
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int impl_clear(struct spa_handle *handle)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl;
 | 
			
		||||
 | 
			
		||||
	spa_return_val_if_fail(handle != NULL, SPA_RESULT_INVALID_ARGUMENTS);
 | 
			
		||||
	spa_return_val_if_fail(handle != NULL, -EINVAL);
 | 
			
		||||
 | 
			
		||||
	impl = (struct impl *) handle;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -151,7 +151,7 @@ static int impl_clear(struct spa_handle *handle)
 | 
			
		|||
	if (impl->strings.data)
 | 
			
		||||
		free(impl->strings.data);
 | 
			
		||||
 | 
			
		||||
	return SPA_RESULT_OK;
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
| 
						 | 
				
			
			@ -163,8 +163,8 @@ impl_init(const struct spa_handle_factory *factory,
 | 
			
		|||
{
 | 
			
		||||
	struct impl *impl;
 | 
			
		||||
 | 
			
		||||
	spa_return_val_if_fail(factory != NULL, SPA_RESULT_INVALID_ARGUMENTS);
 | 
			
		||||
	spa_return_val_if_fail(handle != NULL, SPA_RESULT_INVALID_ARGUMENTS);
 | 
			
		||||
	spa_return_val_if_fail(factory != NULL, -EINVAL);
 | 
			
		||||
	spa_return_val_if_fail(handle != NULL, -EINVAL);
 | 
			
		||||
 | 
			
		||||
	handle->get_interface = impl_get_interface;
 | 
			
		||||
	handle->clear = impl_clear;
 | 
			
		||||
| 
						 | 
				
			
			@ -175,7 +175,7 @@ impl_init(const struct spa_handle_factory *factory,
 | 
			
		|||
 | 
			
		||||
	init_type(&impl->type, &impl->map);
 | 
			
		||||
 | 
			
		||||
	return SPA_RESULT_OK;
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct spa_interface_info impl_interfaces[] = {
 | 
			
		||||
| 
						 | 
				
			
			@ -185,19 +185,21 @@ static const struct spa_interface_info impl_interfaces[] = {
 | 
			
		|||
static int
 | 
			
		||||
impl_enum_interface_info(const struct spa_handle_factory *factory,
 | 
			
		||||
			 const struct spa_interface_info **info,
 | 
			
		||||
			 uint32_t index)
 | 
			
		||||
			 uint32_t *index)
 | 
			
		||||
{
 | 
			
		||||
	spa_return_val_if_fail(factory != NULL, SPA_RESULT_INVALID_ARGUMENTS);
 | 
			
		||||
	spa_return_val_if_fail(info != NULL, SPA_RESULT_INVALID_ARGUMENTS);
 | 
			
		||||
	spa_return_val_if_fail(factory != NULL, -EINVAL);
 | 
			
		||||
	spa_return_val_if_fail(info != NULL, -EINVAL);
 | 
			
		||||
	spa_return_val_if_fail(index != NULL, -EINVAL);
 | 
			
		||||
 | 
			
		||||
	switch (index) {
 | 
			
		||||
	switch (*index) {
 | 
			
		||||
	case 0:
 | 
			
		||||
		*info = &impl_interfaces[index];
 | 
			
		||||
		*info = &impl_interfaces[*index];
 | 
			
		||||
		break;
 | 
			
		||||
	default:
 | 
			
		||||
		return SPA_RESULT_ENUM_END;
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
	return SPA_RESULT_OK;
 | 
			
		||||
	(*index)++;
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct spa_handle_factory type_map_factory = {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue