[PATCH v0 4/7] bluetooth: Use stdbool for pa_bool_t

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

 



From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx>

Use lowercase true/false instead of TRUE/FALSE for pa_bool_t.
---
 src/modules/bluetooth/bluetooth-util.c            | 44 +++++++-------
 src/modules/bluetooth/module-bluetooth-device.c   | 70 +++++++++++------------
 src/modules/bluetooth/module-bluetooth-discover.c |  2 +-
 3 files changed, 58 insertions(+), 58 deletions(-)

diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c
index aa69b57..066c82c 100644
--- a/src/modules/bluetooth/bluetooth-util.c
+++ b/src/modules/bluetooth/bluetooth-util.c
@@ -174,7 +174,7 @@ static pa_bluetooth_device* device_new(pa_bluetooth_discovery *discovery, const
     d = pa_xnew0(pa_bluetooth_device, 1);
 
     d->discovery = discovery;
-    d->dead = FALSE;
+    d->dead = false;
 
     d->device_info_valid = 0;
 
@@ -240,13 +240,13 @@ static pa_bool_t device_is_audio_ready(const pa_bluetooth_device *d) {
     pa_assert(d);
 
     if (!d->device_info_valid || d->audio_state == PA_BT_AUDIO_STATE_INVALID)
-        return FALSE;
+        return false;
 
     for (i = 0; i < PA_BLUETOOTH_PROFILE_COUNT; i++)
         if (d->profile_state[i] != PA_BT_AUDIO_STATE_INVALID)
-            return TRUE;
+            return true;
 
-    return FALSE;
+    return false;
 }
 
 static const char *check_variant_property(DBusMessageIter *i) {
@@ -426,7 +426,7 @@ static int parse_device_property(pa_bluetooth_device *d, DBusMessageIter *i) {
 
             if (dbus_message_iter_get_arg_type(&ai) == DBUS_TYPE_STRING && pa_streq(key, "UUIDs")) {
                 DBusMessage *m;
-                pa_bool_t has_audio = FALSE;
+                pa_bool_t has_audio = false;
 
                 while (dbus_message_iter_get_arg_type(&ai) != DBUS_TYPE_INVALID) {
                     pa_bluetooth_uuid *node;
@@ -452,22 +452,22 @@ static int parse_device_property(pa_bluetooth_device *d, DBusMessageIter *i) {
                         pa_assert_se(m = dbus_message_new_method_call("org.bluez", d->path, "org.bluez.HandsfreeGateway",
                                                                       "GetProperties"));
                         send_and_add_to_pending(d->discovery, m, get_properties_reply, d);
-                        has_audio = TRUE;
+                        has_audio = true;
                     } else if (strcasecmp(HSP_HS_UUID, value) == 0 || strcasecmp(HFP_HS_UUID, value) == 0) {
                         pa_assert_se(m = dbus_message_new_method_call("org.bluez", d->path, "org.bluez.Headset",
                                                                       "GetProperties"));
                         send_and_add_to_pending(d->discovery, m, get_properties_reply, d);
-                        has_audio = TRUE;
+                        has_audio = true;
                     } else if (strcasecmp(A2DP_SINK_UUID, value) == 0) {
                         pa_assert_se(m = dbus_message_new_method_call("org.bluez", d->path, "org.bluez.AudioSink",
                                                                       "GetProperties"));
                         send_and_add_to_pending(d->discovery, m, get_properties_reply, d);
-                        has_audio = TRUE;
+                        has_audio = true;
                     } else if (strcasecmp(A2DP_SOURCE_UUID, value) == 0) {
                         pa_assert_se(m = dbus_message_new_method_call("org.bluez", d->path, "org.bluez.AudioSource",
                                                                       "GetProperties"));
                         send_and_add_to_pending(d->discovery, m, get_properties_reply, d);
-                        has_audio = TRUE;
+                        has_audio = true;
                     }
 
                     dbus_message_iter_next(&ai);
@@ -630,7 +630,7 @@ static void remove_all_devices(pa_bluetooth_discovery *y) {
     pa_assert(y);
 
     while ((d = pa_hashmap_steal_first(y->devices))) {
-        run_callback(d, TRUE);
+        run_callback(d, true);
         device_free(d);
     }
 }
@@ -746,7 +746,7 @@ static void get_properties_reply(DBusPendingCall *pending, void *userdata) {
 
 finish:
     if (d != NULL && old_any_connected != pa_bluetooth_device_any_audio_connected(d))
-        run_callback(d, FALSE);
+        run_callback(d, false);
 
 finish2:
     dbus_message_unref(r);
@@ -938,7 +938,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
         pa_log_debug("Device %s removed", path);
 
         if ((d = pa_hashmap_remove(y->devices, path))) {
-            run_callback(d, TRUE);
+            run_callback(d, true);
             device_free(d);
         }
 
@@ -996,7 +996,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
                 goto fail;
 
             if (old_any_connected != pa_bluetooth_device_any_audio_connected(d))
-                run_callback(d, FALSE);
+                run_callback(d, false);
         }
 
         return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
@@ -1271,7 +1271,7 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
     const char *sender, *path, *dev_path = NULL, *uuid = NULL;
     uint8_t *config = NULL;
     int size = 0;
-    pa_bool_t nrec = FALSE;
+    pa_bool_t nrec = false;
     enum profile p;
     DBusMessageIter args, props;
     DBusMessage *r;
@@ -1372,7 +1372,7 @@ static DBusMessage *endpoint_set_configuration(DBusConnection *conn, DBusMessage
     pa_assert_se(r = dbus_message_new_method_return(m));
 
     if (old_any_connected != pa_bluetooth_device_any_audio_connected(d))
-        run_callback(d, FALSE);
+        run_callback(d, false);
 
     return r;
 
@@ -1410,7 +1410,7 @@ static DBusMessage *endpoint_clear_configuration(DBusConnection *c, DBusMessage
         pa_hook_fire(&y->hooks[PA_BLUETOOTH_HOOK_TRANSPORT_STATE_CHANGED], t);
 
         if (old_any_connected != pa_bluetooth_device_any_audio_connected(t->device))
-            run_callback(t->device, FALSE);
+            run_callback(t->device, false);
 
         transport_free(t);
     }
@@ -1678,7 +1678,7 @@ pa_bluetooth_discovery* pa_bluetooth_discovery_get(pa_core *c) {
         goto fail;
     }
 
-    y->filter_added = TRUE;
+    y->filter_added = true;
 
     if (pa_dbus_add_matches(
                 conn, &err,
@@ -1822,7 +1822,7 @@ const char*pa_bluetooth_get_form_factor(uint32_t class) {
 
 char *pa_bluetooth_cleanup_name(const char *name) {
     char *t, *s, *d;
-    pa_bool_t space = FALSE;
+    pa_bool_t space = false;
 
     pa_assert(name);
 
@@ -1834,13 +1834,13 @@ char *pa_bluetooth_cleanup_name(const char *name) {
     for (s = d = t; *s; s++) {
 
         if (*s <= 32 || *s >= 127 || *s == '_') {
-            space = TRUE;
+            space = true;
             continue;
         }
 
         if (space) {
             *(d++) = ' ';
-            space = FALSE;
+            space = false;
         }
 
         *(d++) = *s;
@@ -1856,10 +1856,10 @@ pa_bool_t pa_bluetooth_uuid_has(pa_bluetooth_uuid *uuids, const char *uuid) {
 
     while (uuids) {
         if (strcasecmp(uuids->uuid, uuid) == 0)
-            return TRUE;
+            return true;
 
         uuids = uuids->next;
     }
 
-    return FALSE;
+    return false;
 }
diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 6962c7a..c2ac15f 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -63,7 +63,7 @@
 PA_MODULE_AUTHOR("Joao Paulo Rechi Vita");
 PA_MODULE_DESCRIPTION("Bluetooth audio sink and source");
 PA_MODULE_VERSION(PACKAGE_VERSION);
-PA_MODULE_LOAD_ONCE(FALSE);
+PA_MODULE_LOAD_ONCE(false);
 PA_MODULE_USAGE(
         "name=<name for the card/sink/source, to be prefixed> "
         "card_name=<name for the card> "
@@ -309,11 +309,11 @@ static void setup_stream(struct userdata *u) {
         u->read_smoother = pa_smoother_new(
                 PA_USEC_PER_SEC,
                 PA_USEC_PER_SEC*2,
-                TRUE,
-                TRUE,
+                true,
+                true,
                 10,
                 pa_rtclock_now(),
-                TRUE);
+                true);
 }
 
 static void teardown_stream(struct userdata *u) {
@@ -378,7 +378,7 @@ static int bt_transport_acquire(struct userdata *u, pa_bool_t optional) {
 /* Run from IO thread */
 static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
     struct userdata *u = PA_SINK(o)->userdata;
-    pa_bool_t failed = FALSE;
+    pa_bool_t failed = false;
     int r;
 
     pa_assert(u->sink == PA_SINK(o));
@@ -412,7 +412,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
                     /* Resume the device if the source was suspended as well */
                     if (!u->source || !PA_SOURCE_IS_OPENED(u->source->thread_info.state)) {
                         if (bt_transport_acquire(u, false) < 0)
-                            failed = TRUE;
+                            failed = true;
                         else
                             setup_stream(u);
                     }
@@ -456,7 +456,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse
 /* Run from IO thread */
 static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) {
     struct userdata *u = PA_SOURCE(o)->userdata;
-    pa_bool_t failed = FALSE;
+    pa_bool_t failed = false;
     int r;
 
     pa_assert(u->source == PA_SOURCE(o));
@@ -489,7 +489,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off
                     /* Resume the device if the sink was suspended as well */
                     if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state)) {
                         if (bt_transport_acquire(u, false) < 0)
-                            failed = TRUE;
+                            failed = true;
                         else
                             setup_stream(u);
                     }
@@ -627,7 +627,7 @@ static int hsp_process_push(struct userdata *u) {
         struct cmsghdr *cm;
         uint8_t aux[1024];
         struct iovec iov;
-        pa_bool_t found_tstamp = FALSE;
+        pa_bool_t found_tstamp = false;
         pa_usec_t tstamp;
 
         memset(&m, 0, sizeof(m));
@@ -670,7 +670,7 @@ static int hsp_process_push(struct userdata *u) {
                 struct timeval *tv = (struct timeval*) CMSG_DATA(cm);
                 pa_rtclock_from_wallclock(tv);
                 tstamp = pa_timeval_load(tv);
-                found_tstamp = TRUE;
+                found_tstamp = true;
                 break;
             }
 
@@ -680,7 +680,7 @@ static int hsp_process_push(struct userdata *u) {
         }
 
         pa_smoother_put(u->read_smoother, tstamp, pa_bytes_to_usec(u->read_index, &u->sample_spec));
-        pa_smoother_resume(u->read_smoother, tstamp, TRUE);
+        pa_smoother_resume(u->read_smoother, tstamp, true);
 
         pa_source_post(u->source, &memchunk);
 
@@ -854,7 +854,7 @@ static int a2dp_process_push(struct userdata *u) {
     memchunk.index = memchunk.length = 0;
 
     for (;;) {
-        pa_bool_t found_tstamp = FALSE;
+        pa_bool_t found_tstamp = false;
         pa_usec_t tstamp;
         struct a2dp_info *a2dp;
         struct rtp_header *header;
@@ -898,7 +898,7 @@ static int a2dp_process_push(struct userdata *u) {
         }
 
         pa_smoother_put(u->read_smoother, tstamp, pa_bytes_to_usec(u->read_index, &u->sample_spec));
-        pa_smoother_resume(u->read_smoother, tstamp, TRUE);
+        pa_smoother_resume(u->read_smoother, tstamp, true);
 
         p = (uint8_t*) a2dp->buffer + sizeof(*header) + sizeof(*payload);
         to_decode = l - sizeof(*header) - sizeof(*payload);
@@ -980,7 +980,7 @@ static void thread_func(void *userdata) {
     struct userdata *u = userdata;
     unsigned do_write = 0;
     unsigned pending_read_bytes = 0;
-    pa_bool_t writable = FALSE;
+    pa_bool_t writable = false;
 
     pa_assert(u);
     pa_assert(u->transport);
@@ -999,7 +999,7 @@ static void thread_func(void *userdata) {
     for (;;) {
         struct pollfd *pollfd;
         int ret;
-        pa_bool_t disable_timer = TRUE;
+        pa_bool_t disable_timer = true;
 
         pollfd = u->rtpoll_item ? pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL) : NULL;
 
@@ -1036,7 +1036,7 @@ static void thread_func(void *userdata) {
 
             if (pollfd) {
                 if (pollfd->revents & POLLOUT)
-                    writable = TRUE;
+                    writable = true;
 
                 if ((!u->source || !PA_SOURCE_IS_LINKED(u->source->thread_info.state)) && do_write <= 0 && writable) {
                     pa_usec_t time_passed;
@@ -1098,7 +1098,7 @@ static void thread_func(void *userdata) {
                         pa_log("Broken kernel: we got EAGAIN on write() after POLLOUT!");
 
                     do_write -= n_written;
-                    writable = FALSE;
+                    writable = false;
                 }
 
                 if ((!u->source || !PA_SOURCE_IS_LINKED(u->source->thread_info.state)) && do_write <= 0) {
@@ -1117,7 +1117,7 @@ static void thread_func(void *userdata) {
                         sleep_for = PA_USEC_PER_MSEC * 500;
 
                     pa_rtpoll_set_timer_relative(u->rtpoll, sleep_for);
-                    disable_timer = FALSE;
+                    disable_timer = false;
                 }
             }
         }
@@ -1130,7 +1130,7 @@ static void thread_func(void *userdata) {
             pollfd->events = (short) (((u->sink && PA_SINK_IS_LINKED(u->sink->thread_info.state) && !writable) ? POLLOUT : 0) |
                                       (u->source && PA_SOURCE_IS_LINKED(u->source->thread_info.state) ? POLLIN : 0));
 
-        if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) {
+        if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) {
             pa_log_debug("pa_rtpoll_run failed with: %d", ret);
             goto fail;
         }
@@ -1160,7 +1160,7 @@ io_fail:
 
         do_write = 0;
         pending_read_bytes = 0;
-        writable = FALSE;
+        writable = false;
 
         teardown_stream(u);
     }
@@ -1196,8 +1196,8 @@ static pa_port_available_t transport_state_to_availability_merged(pa_bluetooth_t
 
 /* Run from main thread */
 static void handle_transport_state_change(struct userdata *u, struct pa_bluetooth_transport *transport) {
-    bool acquire = FALSE;
-    bool release = FALSE;
+    pa_bool_t acquire = false;
+    pa_bool_t release = false;
     enum profile profile;
     pa_bluetooth_transport_state_t state;
 
@@ -1289,12 +1289,12 @@ static void handle_transport_state_change(struct userdata *u, struct pa_bluetoot
         if (bt_transport_acquire(u, true) >= 0) {
             if (u->source) {
                 pa_log_debug("Resuming source %s, because the bluetooth audio state changed to 'playing'.", u->source->name);
-                pa_source_suspend(u->source, FALSE, PA_SUSPEND_IDLE|PA_SUSPEND_USER);
+                pa_source_suspend(u->source, false, PA_SUSPEND_IDLE|PA_SUSPEND_USER);
             }
 
             if (u->sink) {
                 pa_log_debug("Resuming sink %s, because the bluetooth audio state changed to 'playing'.", u->sink->name);
-                pa_sink_suspend(u->sink, FALSE, PA_SUSPEND_IDLE|PA_SUSPEND_USER);
+                pa_sink_suspend(u->sink, false, PA_SUSPEND_IDLE|PA_SUSPEND_USER);
             }
         }
 
@@ -1307,12 +1307,12 @@ static void handle_transport_state_change(struct userdata *u, struct pa_bluetoot
         /* Remote side closed the stream so we consider it PA_SUSPEND_USER */
         if (u->source) {
             pa_log_debug("Suspending source %s, because the remote end closed the stream.", u->source->name);
-            pa_source_suspend(u->source, TRUE, PA_SUSPEND_USER);
+            pa_source_suspend(u->source, true, PA_SUSPEND_USER);
         }
 
         if (u->sink) {
             pa_log_debug("Suspending sink %s, because the remote end closed the stream.", u->sink->name);
-            pa_sink_suspend(u->sink, TRUE, PA_SUSPEND_USER);
+            pa_sink_suspend(u->sink, true, PA_SUSPEND_USER);
         }
     }
 }
@@ -1386,15 +1386,15 @@ static char *get_name(const char *type, pa_modargs *ma, const char *device_id, p
     pa_xfree(t);
 
     if (n) {
-        *namereg_fail = TRUE;
+        *namereg_fail = true;
         return pa_xstrdup(n);
     }
 
     if ((n = pa_modargs_get_value(ma, "name", NULL)))
-        *namereg_fail = TRUE;
+        *namereg_fail = true;
     else {
         n = device_id;
-        *namereg_fail = FALSE;
+        *namereg_fail = false;
     }
 
     return pa_sprintf_malloc("bluez_%s.%s", type, n);
@@ -1444,7 +1444,7 @@ static pa_hook_result_t sink_state_changed_cb(pa_core *c, pa_sink *s, struct use
     if (!USE_SCO_OVER_PCM(u) || s != u->hsp.sco_sink)
         return PA_HOOK_OK;
 
-    sco_over_pcm_state_update(u, TRUE);
+    sco_over_pcm_state_update(u, true);
 
     return PA_HOOK_OK;
 }
@@ -1457,7 +1457,7 @@ static pa_hook_result_t source_state_changed_cb(pa_core *c, pa_source *s, struct
     if (!USE_SCO_OVER_PCM(u) || s != u->hsp.sco_source)
         return PA_HOOK_OK;
 
-    sco_over_pcm_state_update(u, TRUE);
+    sco_over_pcm_state_update(u, true);
 
     return PA_HOOK_OK;
 }
@@ -1744,7 +1744,7 @@ static void bt_transport_config_a2dp(struct userdata *u) {
         sbc_reinit(&a2dp->sbc, 0);
     else
         sbc_init(&a2dp->sbc, 0);
-    a2dp->sbc_initialized = TRUE;
+    a2dp->sbc_initialized = true;
 
     switch (config->frequency) {
         case SBC_SAMPLING_FREQ_16000:
@@ -1989,7 +1989,7 @@ static int start_thread(struct userdata *u) {
     pa_thread_mq_init(&u->thread_mq, u->core->mainloop, u->rtpoll);
 
     if (USE_SCO_OVER_PCM(u)) {
-        if (sco_over_pcm_state_update(u, FALSE) < 0) {
+        if (sco_over_pcm_state_update(u, false) < 0) {
             char *k;
 
             if (u->sink) {
@@ -2335,7 +2335,7 @@ static int add_card(struct userdata *u) {
     if (*d != PROFILE_OFF && !device->transports[*d]) {
         pa_log_warn("Default profile not connected, selecting off profile");
         u->card->active_profile = pa_hashmap_get(u->card->profiles, "off");
-        u->card->save_profile = FALSE;
+        u->card->save_profile = false;
     }
 
     d = PA_CARD_PROFILE_DATA(u->card->active_profile);
@@ -2480,7 +2480,7 @@ int pa__init(pa_module* m) {
         goto fail;
     }
 
-    u->auto_connect = TRUE;
+    u->auto_connect = true;
     if (pa_modargs_get_value_boolean(ma, "auto_connect", &u->auto_connect)) {
         pa_log("Failed to parse auto_connect= argument");
         goto fail;
diff --git a/src/modules/bluetooth/module-bluetooth-discover.c b/src/modules/bluetooth/module-bluetooth-discover.c
index f6e3b83..eb59beb 100644
--- a/src/modules/bluetooth/module-bluetooth-discover.c
+++ b/src/modules/bluetooth/module-bluetooth-discover.c
@@ -42,7 +42,7 @@ PA_MODULE_DESCRIPTION("Detect available bluetooth audio devices and load bluetoo
 PA_MODULE_VERSION(PACKAGE_VERSION);
 PA_MODULE_USAGE("sco_sink=<name of sink> "
                 "sco_source=<name of source> ");
-PA_MODULE_LOAD_ONCE(TRUE);
+PA_MODULE_LOAD_ONCE(true);
 
 static const char* const valid_modargs[] = {
     "sco_sink",
-- 
1.7.11.7



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

  Powered by Linux