]> code.delx.au - pulseaudio/commitdiff
bluetooth: Convert booleans to stdbool.
authorTanu Kaskinen <tanuk@iki.fi>
Fri, 11 Jan 2013 20:11:04 +0000 (22:11 +0200)
committerTanu Kaskinen <tanuk@iki.fi>
Fri, 11 Jan 2013 20:11:04 +0000 (22:11 +0200)
src/modules/bluetooth/bluetooth-util.c
src/modules/bluetooth/bluetooth-util.h
src/modules/bluetooth/module-bluetooth-device.c
src/modules/bluetooth/module-bluetooth-policy.c
src/modules/bluetooth/module-bluetooth-proximity.c

index d78505f678746b527b26022378de02c2185b7528..92254f2a3c7163e4d671d0205ac2756d99bb8b5d 100644 (file)
@@ -70,7 +70,7 @@ struct pa_bluetooth_discovery {
     pa_hashmap *devices;
     pa_hashmap *transports;
     pa_hook hooks[PA_BLUETOOTH_HOOK_MAX];
-    pa_bool_t filter_added;
+    bool filter_added;
 };
 
 static void get_properties_reply(DBusPendingCall *pending, void *userdata);
@@ -411,7 +411,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;
+                bool has_audio = false;
 
                 while (dbus_message_iter_get_arg_type(&ai) != DBUS_TYPE_INVALID) {
                     pa_bluetooth_uuid *node;
@@ -599,7 +599,7 @@ static int parse_audio_property(pa_bluetooth_device *d, const char *interface, D
     return 0;
 }
 
-static void run_callback(pa_bluetooth_device *d, pa_bool_t dead) {
+static void run_callback(pa_bluetooth_device *d, bool dead) {
     pa_assert(d);
 
     if (d->device_info_valid != 1)
@@ -1257,7 +1257,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;
+    bool nrec = false;
     enum profile p;
     DBusMessageIter args, props;
     DBusMessage *r;
@@ -1808,7 +1808,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;
+    bool space = false;
 
     pa_assert(name);
 
@@ -1837,7 +1837,7 @@ char *pa_bluetooth_cleanup_name(const char *name) {
     return t;
 }
 
-pa_bool_t pa_bluetooth_uuid_has(pa_bluetooth_uuid *uuids, const char *uuid) {
+bool pa_bluetooth_uuid_has(pa_bluetooth_uuid *uuids, const char *uuid) {
     pa_assert(uuid);
 
     while (uuids) {
index b7c59730de8620d8fec57cca07b0629262c455e7..6423f88fc15ae0c0b2be6b760877a355c0c28da3 100644 (file)
@@ -99,7 +99,7 @@ struct pa_bluetooth_transport {
     int config_size;
 
     pa_bluetooth_transport_state_t state;
-    pa_bool_t nrec;
+    bool nrec;
     uint16_t microphone_gain; /* Used for HSP/HFP */
     uint16_t speaker_gain; /* Used for HSP/HFP */
 };
@@ -115,7 +115,7 @@ typedef enum pa_bt_audio_state {
 
 struct pa_bluetooth_device {
     pa_bluetooth_discovery *discovery;
-    pa_bool_t dead;
+    bool dead;
 
     int device_info_valid;      /* 0: no results yet; 1: good results; -1: bad results ... */
 
@@ -158,7 +158,7 @@ const char* pa_bluetooth_get_form_factor(uint32_t class);
 
 char *pa_bluetooth_cleanup_name(const char *name);
 
-pa_bool_t pa_bluetooth_uuid_has(pa_bluetooth_uuid *uuids, const char *uuid);
+bool pa_bluetooth_uuid_has(pa_bluetooth_uuid *uuids, const char *uuid);
 const char *pa_bt_profile_to_string(enum profile profile);
 
 #endif
index c2ac15fdfb008cc9c60b9c6dc9a4e3b9eed4eda3..becf716540f6cd00de8657af135c9093450cd932 100644 (file)
@@ -104,7 +104,7 @@ static const char* const valid_modargs[] = {
 
 struct a2dp_info {
     sbc_t sbc;                           /* Codec data */
-    pa_bool_t sbc_initialized;           /* Keep track if the encoder is initialized */
+    bool sbc_initialized;                /* Keep track if the encoder is initialized */
     size_t codesize, frame_length;       /* SBC Codesize, frame_length. We simply cache those values here */
 
     void* buffer;                        /* Codec transfer buffer */
@@ -150,7 +150,7 @@ struct userdata {
     pa_hook_slot *transport_speaker_changed_slot;
 
     pa_bluetooth_discovery *discovery;
-    pa_bool_t auto_connect;
+    bool auto_connect;
 
     pa_card *card;
     pa_sink *sink;
@@ -351,7 +351,7 @@ static void bt_transport_release(struct userdata *u) {
     teardown_stream(u);
 }
 
-static int bt_transport_acquire(struct userdata *u, pa_bool_t optional) {
+static int bt_transport_acquire(struct userdata *u, bool optional) {
     pa_assert(u->transport);
 
     if (u->transport_acquired)
@@ -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;
+    bool failed = false;
     int r;
 
     pa_assert(u->sink == PA_SINK(o));
@@ -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;
+    bool failed = false;
     int r;
 
     pa_assert(u->source == PA_SOURCE(o));
@@ -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;
+        bool found_tstamp = false;
         pa_usec_t tstamp;
 
         memset(&m, 0, sizeof(m));
@@ -854,7 +854,7 @@ static int a2dp_process_push(struct userdata *u) {
     memchunk.index = memchunk.length = 0;
 
     for (;;) {
-        pa_bool_t found_tstamp = false;
+        bool found_tstamp = false;
         pa_usec_t tstamp;
         struct a2dp_info *a2dp;
         struct rtp_header *header;
@@ -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;
+    bool 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;
+        bool disable_timer = true;
 
         pollfd = u->rtpoll_item ? pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL) : NULL;
 
@@ -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) {
-    pa_bool_t acquire = false;
-    pa_bool_t release = false;
+    bool acquire = false;
+    bool release = false;
     enum profile profile;
     pa_bluetooth_transport_state_t state;
 
@@ -1372,7 +1372,7 @@ static void source_set_volume_cb(pa_source *s) {
 }
 
 /* Run from main thread */
-static char *get_name(const char *type, pa_modargs *ma, const char *device_id, pa_bool_t *namereg_fail) {
+static char *get_name(const char *type, pa_modargs *ma, const char *device_id, bool *namereg_fail) {
     char *t;
     const char *n;
 
@@ -1400,7 +1400,7 @@ static char *get_name(const char *type, pa_modargs *ma, const char *device_id, p
     return pa_sprintf_malloc("bluez_%s.%s", type, n);
 }
 
-static int sco_over_pcm_state_update(struct userdata *u, pa_bool_t changed) {
+static int sco_over_pcm_state_update(struct userdata *u, bool changed) {
     pa_assert(u);
     pa_assert(USE_SCO_OVER_PCM(u));
 
@@ -1592,7 +1592,7 @@ static int add_sink(struct userdata *u) {
         pa_proplist_free(p);
     } else {
         pa_sink_new_data data;
-        pa_bool_t b;
+        bool b;
 
         pa_sink_new_data_init(&data);
         data.driver = __FILE__;
@@ -1662,7 +1662,7 @@ static int add_source(struct userdata *u) {
         pa_proplist_sets(u->source->proplist, "bluetooth.protocol", pa_bt_profile_to_string(u->profile));
     } else {
         pa_source_new_data data;
-        pa_bool_t b;
+        bool b;
 
         pa_source_new_data_init(&data);
         data.driver = __FILE__;
@@ -2253,7 +2253,7 @@ static pa_card_profile *create_card_profile(struct userdata *u, const char *uuid
 /* Run from main thread */
 static int add_card(struct userdata *u) {
     pa_card_new_data data;
-    pa_bool_t b;
+    bool b;
     pa_card_profile *p;
     enum profile *d;
     const char *ff;
index f0bffe9db97c10cef8661e36b9fa14e27a988ea1..fc605b3efe61e82a5e88421a5ecbcfad8897e69b 100644 (file)
@@ -38,7 +38,7 @@
 PA_MODULE_AUTHOR("Frédéric Dalleau");
 PA_MODULE_DESCRIPTION("When a bluetooth sink or source is added, load module-loopback");
 PA_MODULE_VERSION(PACKAGE_VERSION);
-PA_MODULE_LOAD_ONCE(TRUE);
+PA_MODULE_LOAD_ONCE(true);
 PA_MODULE_USAGE(
         "a2dp_source=<Handle a2dp_source card profile (sink role)?> "
         "hfgw=<Handle hfgw card profile (headset role)?>");
@@ -159,7 +159,7 @@ static void set_port_profile(pa_card *card, pa_device_port *port) {
 
         pa_log_debug("Setting card '%s' to profile '%s'", card->name, profile->name);
 
-        if (pa_card_set_profile(card, profile->name, FALSE) != 0)
+        if (pa_card_set_profile(card, profile->name, false) != 0)
             pa_log_warn("Could not set profile '%s'", profile->name);
 
         return;
@@ -170,7 +170,7 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port
     pa_card *card;
     const char *s;
     uint32_t state;
-    pa_bool_t is_active_profile;
+    bool is_active_profile;
     pa_device_port *port2;
 
     PA_IDXSET_FOREACH(card, c->cards, state)
@@ -233,13 +233,13 @@ int pa__init(pa_module *m) {
 
     m->userdata = u = pa_xnew0(struct userdata, 1);
 
-    u->enable_a2dp_source = TRUE;
+    u->enable_a2dp_source = true;
     if (pa_modargs_get_value_boolean(ma, "a2dp_source", &u->enable_a2dp_source) < 0) {
         pa_log("Failed to parse a2dp_source argument.");
         goto fail;
     }
 
-    u->enable_hfgw = TRUE;
+    u->enable_hfgw = true;
     if (pa_modargs_get_value_boolean(ma, "hfgw", &u->enable_hfgw) < 0) {
         pa_log("Failed to parse hfgw argument.");
         goto fail;
index 7d69e824e059df8409490bad647a64666f4a90d6..7f90951ae7aaf9efad28a48b269f348141aff6e9 100644 (file)
@@ -49,7 +49,7 @@
 PA_MODULE_AUTHOR("Lennart Poettering");
 PA_MODULE_DESCRIPTION("Bluetooth Proximity Volume Control");
 PA_MODULE_VERSION(PACKAGE_VERSION);
-PA_MODULE_LOAD_ONCE(TRUE);
+PA_MODULE_LOAD_ONCE(true);
 PA_MODULE_USAGE(
         "sink=<sink name> "
         "hci=<hci device> "
@@ -91,8 +91,8 @@ struct userdata {
     unsigned n_found;
     unsigned n_unknown;
 
-    pa_bool_t muted:1;
-    pa_bool_t filter_added:1;
+    bool muted:1;
+    bool filter_added:1;
 };
 
 static void update_volume(struct userdata *u) {
@@ -101,7 +101,7 @@ static void update_volume(struct userdata *u) {
     if (u->muted && u->n_found > 0) {
         pa_sink *s;
 
-        u->muted = FALSE;
+        u->muted = false;
 
         if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK))) {
             pa_log_warn("Sink device '%s' not available for unmuting.", pa_strnull(u->sink_name));
@@ -109,12 +109,12 @@ static void update_volume(struct userdata *u) {
         }
 
         pa_log_info("Found %u BT devices, unmuting.", u->n_found);
-        pa_sink_set_mute(s, FALSE, FALSE);
+        pa_sink_set_mute(s, false, false);
 
     } else if (!u->muted && (u->n_found+u->n_unknown) <= 0) {
         pa_sink *s;
 
-        u->muted = TRUE;
+        u->muted = true;
 
         if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK))) {
             pa_log_warn("Sink device '%s' not available for muting.", pa_strnull(u->sink_name));
@@ -122,7 +122,7 @@ static void update_volume(struct userdata *u) {
         }
 
         pa_log_info("No BT devices found, muting.");
-        pa_sink_set_mute(s, TRUE, FALSE);
+        pa_sink_set_mute(s, true, false);
 
     } else
         pa_log_info("%u devices now active, %u with unknown state.", u->n_found, u->n_unknown);
@@ -325,7 +325,7 @@ finish:
     return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
 }
 
-static int update_matches(struct userdata *u, pa_bool_t add) {
+static int update_matches(struct userdata *u, bool add) {
     char *filter1, *filter2;
     DBusError e;
     int r = -1;
@@ -360,7 +360,7 @@ static int update_matches(struct userdata *u, pa_bool_t add) {
 
     if (add) {
         pa_assert_se(dbus_connection_add_filter(pa_dbus_connection_get(u->dbus_connection), filter_func, u, NULL));
-        u->filter_added = TRUE;
+        u->filter_added = true;
     } else if (u->filter_added)
         dbus_connection_remove_filter(pa_dbus_connection_get(u->dbus_connection), filter_func, u);
 
@@ -401,7 +401,7 @@ int pa__init(pa_module*m) {
         goto fail;
     }
 
-    if (update_matches(u, TRUE) < 0)
+    if (update_matches(u, true) < 0)
         goto fail;
 
     pa_assert_se(msg = dbus_message_new_method_call("org.bluez", u->hci_path, "org.bluez.Adapter", "ListBondings"));
@@ -476,7 +476,7 @@ void pa__done(pa_module*m) {
     }
 
     if (u->dbus_connection) {
-        update_matches(u, FALSE);
+        update_matches(u, false);
         pa_dbus_connection_unref(u->dbus_connection);
     }