From b1e47df72c0bb8fd802a96911dc479bd8dfd8a0a Mon Sep 17 00:00:00 2001 From: Tanu Kaskinen Date: Fri, 11 Jan 2013 22:11:04 +0200 Subject: [PATCH] bluetooth: Convert booleans to stdbool. --- src/modules/bluetooth/bluetooth-util.c | 12 +++---- src/modules/bluetooth/bluetooth-util.h | 6 ++-- .../bluetooth/module-bluetooth-device.c | 32 +++++++++---------- .../bluetooth/module-bluetooth-policy.c | 10 +++--- .../bluetooth/module-bluetooth-proximity.c | 22 ++++++------- 5 files changed, 41 insertions(+), 41 deletions(-) diff --git a/src/modules/bluetooth/bluetooth-util.c b/src/modules/bluetooth/bluetooth-util.c index d78505f6..92254f2a 100644 --- a/src/modules/bluetooth/bluetooth-util.c +++ b/src/modules/bluetooth/bluetooth-util.c @@ -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) { diff --git a/src/modules/bluetooth/bluetooth-util.h b/src/modules/bluetooth/bluetooth-util.h index b7c59730..6423f88f 100644 --- a/src/modules/bluetooth/bluetooth-util.h +++ b/src/modules/bluetooth/bluetooth-util.h @@ -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 diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index c2ac15fd..becf7165 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -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; diff --git a/src/modules/bluetooth/module-bluetooth-policy.c b/src/modules/bluetooth/module-bluetooth-policy.c index f0bffe9d..fc605b3e 100644 --- a/src/modules/bluetooth/module-bluetooth-policy.c +++ b/src/modules/bluetooth/module-bluetooth-policy.c @@ -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= " "hfgw="); @@ -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; diff --git a/src/modules/bluetooth/module-bluetooth-proximity.c b/src/modules/bluetooth/module-bluetooth-proximity.c index 7d69e824..7f90951a 100644 --- a/src/modules/bluetooth/module-bluetooth-proximity.c +++ b/src/modules/bluetooth/module-bluetooth-proximity.c @@ -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= " "hci= " @@ -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); } -- 2.39.2