mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04: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
|
|
@ -87,12 +87,12 @@ static int do_add_source(struct spa_loop *loop, struct spa_source *source)
|
|||
data->n_sources++;
|
||||
data->rebuild_fds = true;
|
||||
|
||||
return SPA_RESULT_OK;
|
||||
return 9;
|
||||
}
|
||||
|
||||
static int do_update_source(struct spa_source *source)
|
||||
{
|
||||
return SPA_RESULT_OK;
|
||||
return 9;
|
||||
}
|
||||
|
||||
static void do_remove_source(struct spa_source *source)
|
||||
|
|
@ -112,12 +112,12 @@ static void handle_monitor(struct data *data, struct spa_monitor *monitor)
|
|||
if (monitor->info)
|
||||
spa_debug_dict(monitor->info);
|
||||
|
||||
for (index = 0;; index++) {
|
||||
for (index = 0;;) {
|
||||
struct spa_monitor_item *item;
|
||||
|
||||
if ((res = spa_monitor_enum_items(monitor, &item, index)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
printf("spa_monitor_enum_items: got error %d\n", res);
|
||||
if ((res = spa_monitor_enum_items(monitor, &item, &index)) <= 0) {
|
||||
if (res != 0)
|
||||
printf("spa_monitor_enum_items: %s\n", spa_strerror(res));
|
||||
break;
|
||||
}
|
||||
inspect_item(data, item);
|
||||
|
|
@ -198,22 +198,22 @@ int main(int argc, char *argv[])
|
|||
return -1;
|
||||
}
|
||||
|
||||
for (fidx = 0;; fidx++) {
|
||||
for (fidx = 0;;) {
|
||||
const struct spa_handle_factory *factory;
|
||||
uint32_t iidx;
|
||||
|
||||
if ((res = enum_func(&factory, fidx)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
if ((res = enum_func(&factory, &fidx)) <= 0) {
|
||||
if (res != 0)
|
||||
printf("can't enumerate factories: %d\n", res);
|
||||
break;
|
||||
}
|
||||
|
||||
for (iidx = 0;; iidx++) {
|
||||
for (iidx = 0;;) {
|
||||
const struct spa_interface_info *info;
|
||||
|
||||
if ((res =
|
||||
spa_handle_factory_enum_interface_info(factory, &info, iidx)) < 0) {
|
||||
if (res != SPA_RESULT_ENUM_END)
|
||||
spa_handle_factory_enum_interface_info(factory, &info, &iidx)) <= 0) {
|
||||
if (res != 0)
|
||||
printf("can't enumerate interfaces: %d\n", res);
|
||||
break;
|
||||
}
|
||||
|
|
@ -226,14 +226,14 @@ int main(int argc, char *argv[])
|
|||
if ((res =
|
||||
spa_handle_factory_init(factory, handle, NULL, data.support,
|
||||
data.n_support)) < 0) {
|
||||
printf("can't make factory instance: %d\n", res);
|
||||
printf("can't make factory instance: %s\n", strerror(res));
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((res =
|
||||
spa_handle_get_interface(handle, data.type.monitor.Monitor,
|
||||
&interface)) < 0) {
|
||||
printf("can't get interface: %d\n", res);
|
||||
printf("can't get interface: %s\n", strerror(res));
|
||||
continue;
|
||||
}
|
||||
handle_monitor(&data, interface);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue