[PATCH 14/23] Fix some error reporting style issues

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/modules/module-device-manager.c |  4 ++--
 src/modules/module-intended-roles.c |  4 ++--
 src/modules/module-stream-restore.c |  2 +-
 src/pulsecore/sink-input.c          | 10 +++++-----
 src/pulsecore/sink-input.h          |  4 ++--
 src/pulsecore/source-output.c       | 10 +++++-----
 src/pulsecore/source-output.h       |  4 ++--
 7 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/modules/module-device-manager.c b/src/modules/module-device-manager.c
index bfdb439..9a9870e 100644
--- a/src/modules/module-device-manager.c
+++ b/src/modules/module-device-manager.c
@@ -966,7 +966,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n
                 pa_sink *sink;
 
                 if ((sink = pa_idxset_get_by_index(u->core->sinks, device_index))) {
-                    if (!pa_sink_input_new_data_set_sink(new_data, sink, false))
+                    if (pa_sink_input_new_data_set_sink(new_data, sink, false) < 0)
                         pa_log_debug("Not restoring device for stream because no supported format was found");
                 }
             }
@@ -1006,7 +1006,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou
                 pa_source *source;
 
                 if ((source = pa_idxset_get_by_index(u->core->sources, device_index)))
-                    if (!pa_source_output_new_data_set_source(new_data, source, false))
+                    if (pa_source_output_new_data_set_source(new_data, source, false) < 0)
                         pa_log_debug("Not restoring device for stream because no supported format was found");
             }
         }
diff --git a/src/modules/module-intended-roles.c b/src/modules/module-intended-roles.c
index a9704d1..a8cb862 100644
--- a/src/modules/module-intended-roles.c
+++ b/src/modules/module-intended-roles.c
@@ -95,7 +95,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n
 
     /* Prefer the default sink over any other sink, just in case... */
     if ((def = pa_namereg_get_default_sink(c)))
-        if (role_match(def->proplist, role) && pa_sink_input_new_data_set_sink(new_data, def, false))
+        if (role_match(def->proplist, role) && pa_sink_input_new_data_set_sink(new_data, def, false) >= 0)
             return PA_HOOK_OK;
 
     /* @todo: favour the highest priority device, not the first one we find? */
@@ -106,7 +106,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n
         if (!PA_SINK_IS_LINKED(pa_sink_get_state(s)))
             continue;
 
-        if (role_match(s->proplist, role) && pa_sink_input_new_data_set_sink(new_data, s, false))
+        if (role_match(s->proplist, role) && pa_sink_input_new_data_set_sink(new_data, s, false) >= 0)
             return PA_HOOK_OK;
     }
 
diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c
index 7eb79ab..3e50080 100644
--- a/src/modules/module-stream-restore.c
+++ b/src/modules/module-stream-restore.c
@@ -1442,7 +1442,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n
            same time, in which case we want to make sure we don't
            interfere with that */
         if (s && PA_SINK_IS_LINKED(pa_sink_get_state(s)))
-            if (pa_sink_input_new_data_set_sink(new_data, s, true))
+            if (pa_sink_input_new_data_set_sink(new_data, s, true) >= 0)
                 pa_log_info("Restoring device for stream %s.", name);
 
         entry_free(e);
diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c
index eae450f..69d59c9 100644
--- a/src/pulsecore/sink-input.c
+++ b/src/pulsecore/sink-input.c
@@ -183,8 +183,8 @@ void pa_sink_input_new_data_set_muted(pa_sink_input_new_data *data, bool mute) {
     data->muted = !!mute;
 }
 
-bool pa_sink_input_new_data_set_sink(pa_sink_input_new_data *data, pa_sink *s, bool save) {
-    bool ret = true;
+int pa_sink_input_new_data_set_sink(pa_sink_input_new_data *data, pa_sink *s, bool save) {
+    int ret = 0;
     pa_idxset *formats = NULL;
 
     pa_assert(data);
@@ -209,14 +209,14 @@ bool pa_sink_input_new_data_set_sink(pa_sink_input_new_data *data, pa_sink *s, b
             /* Sink doesn't support any of the formats requested by the client */
             if (formats)
                 pa_idxset_free(formats, (pa_free_cb_t) pa_format_info_free);
-            ret = false;
+            ret = -PA_ERR_NOTSUPPORTED;
         }
     }
 
     return ret;
 }
 
-bool pa_sink_input_new_data_set_formats(pa_sink_input_new_data *data, pa_idxset *formats) {
+int pa_sink_input_new_data_set_formats(pa_sink_input_new_data *data, pa_idxset *formats) {
     pa_assert(data);
     pa_assert(formats);
 
@@ -230,7 +230,7 @@ bool pa_sink_input_new_data_set_formats(pa_sink_input_new_data *data, pa_idxset
         return pa_sink_input_new_data_set_sink(data, data->sink, data->save_sink);
     }
 
-    return true;
+    return 0;
 }
 
 void pa_sink_input_new_data_done(pa_sink_input_new_data *data) {
diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h
index 4035d44..546afc0 100644
--- a/src/pulsecore/sink-input.h
+++ b/src/pulsecore/sink-input.h
@@ -328,8 +328,8 @@ void pa_sink_input_new_data_set_volume(pa_sink_input_new_data *data, const pa_cv
 void pa_sink_input_new_data_add_volume_factor(pa_sink_input_new_data *data, const char *key, const pa_cvolume *volume_factor);
 void pa_sink_input_new_data_add_volume_factor_sink(pa_sink_input_new_data *data, const char *key, const pa_cvolume *volume_factor);
 void pa_sink_input_new_data_set_muted(pa_sink_input_new_data *data, bool mute);
-bool pa_sink_input_new_data_set_sink(pa_sink_input_new_data *data, pa_sink *s, bool save);
-bool pa_sink_input_new_data_set_formats(pa_sink_input_new_data *data, pa_idxset *formats);
+int pa_sink_input_new_data_set_sink(pa_sink_input_new_data *data, pa_sink *s, bool save);
+int pa_sink_input_new_data_set_formats(pa_sink_input_new_data *data, pa_idxset *formats);
 void pa_sink_input_new_data_done(pa_sink_input_new_data *data);
 
 /* To be called by the implementing module only */
diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c
index 75d9fa7..f7a1c96 100644
--- a/src/pulsecore/source-output.c
+++ b/src/pulsecore/source-output.c
@@ -127,8 +127,8 @@ void pa_source_output_new_data_set_muted(pa_source_output_new_data *data, bool m
     data->muted = !!mute;
 }
 
-bool pa_source_output_new_data_set_source(pa_source_output_new_data *data, pa_source *s, bool save) {
-    bool ret = true;
+int pa_source_output_new_data_set_source(pa_source_output_new_data *data, pa_source *s, bool save) {
+    int ret = 0;
     pa_idxset *formats = NULL;
 
     pa_assert(data);
@@ -153,14 +153,14 @@ bool pa_source_output_new_data_set_source(pa_source_output_new_data *data, pa_so
             /* Source doesn't support any of the formats requested by the client */
             if (formats)
                 pa_idxset_free(formats, (pa_free_cb_t) pa_format_info_free);
-            ret = false;
+            ret = -PA_ERR_NOTSUPPORTED;
         }
     }
 
     return ret;
 }
 
-bool pa_source_output_new_data_set_formats(pa_source_output_new_data *data, pa_idxset *formats) {
+int pa_source_output_new_data_set_formats(pa_source_output_new_data *data, pa_idxset *formats) {
     pa_assert(data);
     pa_assert(formats);
 
@@ -174,7 +174,7 @@ bool pa_source_output_new_data_set_formats(pa_source_output_new_data *data, pa_i
         return pa_source_output_new_data_set_source(data, data->source, data->save_source);
     }
 
-    return true;
+    return 0;
 }
 
 void pa_source_output_new_data_done(pa_source_output_new_data *data) {
diff --git a/src/pulsecore/source-output.h b/src/pulsecore/source-output.h
index e810eed..3012ea4 100644
--- a/src/pulsecore/source-output.h
+++ b/src/pulsecore/source-output.h
@@ -284,8 +284,8 @@ void pa_source_output_new_data_set_volume(pa_source_output_new_data *data, const
 void pa_source_output_new_data_apply_volume_factor(pa_source_output_new_data *data, const pa_cvolume *volume_factor);
 void pa_source_output_new_data_apply_volume_factor_source(pa_source_output_new_data *data, const pa_cvolume *volume_factor);
 void pa_source_output_new_data_set_muted(pa_source_output_new_data *data, bool mute);
-bool pa_source_output_new_data_set_source(pa_source_output_new_data *data, pa_source *s, bool save);
-bool pa_source_output_new_data_set_formats(pa_source_output_new_data *data, pa_idxset *formats);
+int pa_source_output_new_data_set_source(pa_source_output_new_data *data, pa_source *s, bool save);
+int pa_source_output_new_data_set_formats(pa_source_output_new_data *data, pa_idxset *formats);
 void pa_source_output_new_data_done(pa_source_output_new_data *data);
 
 /* To be called by the implementing module only */
-- 
1.8.3.1



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux