treewide: replace strcmp() == 0 with spa_streq()

This change is only done in source files for now, header files will be done
separately.
This commit is contained in:
Peter Hutterer 2021-05-18 11:36:13 +10:00
parent d8a9534a9a
commit 7697ed0757
130 changed files with 817 additions and 675 deletions

View file

@ -26,6 +26,8 @@
#include "alsa-mixer.h"
#include "alsa-ucm.h"
#include <spa/utils/string.h>
int _acp_log_level = 1;
acp_log_func _acp_log_func;
void *_acp_log_data;
@ -938,7 +940,7 @@ uint32_t acp_card_find_best_profile_index(struct acp_card *card, const char *nam
struct acp_card_profile *p = profiles[i];
if (name) {
if (strcmp(name, p->name) == 0)
if (spa_streq(name, p->name))
best = i;
} else if (p->flags & ACP_PROFILE_OFF) {
off = i;
@ -1442,7 +1444,7 @@ static const char *acp_dict_lookup(const struct acp_dict *dict, const char *key)
{
const struct acp_dict_item *it;
acp_dict_for_each(it, dict) {
if (strcmp(key, it->key) == 0)
if (spa_streq(key, it->key))
return it->value;
}
return NULL;
@ -1478,19 +1480,19 @@ struct acp_card *acp_card_new(uint32_t index, const struct acp_dict *props)
if (props) {
if ((s = acp_dict_lookup(props, "api.alsa.use-ucm")) != NULL)
impl->use_ucm = (strcmp(s, "true") == 0 || atoi(s) == 1);
impl->use_ucm = (spa_streq(s, "true") || atoi(s) == 1);
if ((s = acp_dict_lookup(props, "api.alsa.soft-mixer")) != NULL)
impl->soft_mixer = (strcmp(s, "true") == 0 || atoi(s) == 1);
impl->soft_mixer = (spa_streq(s, "true") || atoi(s) == 1);
if ((s = acp_dict_lookup(props, "api.alsa.ignore-dB")) != NULL)
ignore_dB = (strcmp(s, "true") == 0 || atoi(s) == 1);
ignore_dB = (spa_streq(s, "true") || atoi(s) == 1);
if ((s = acp_dict_lookup(props, "device.profile-set")) != NULL)
profile_set = s;
if ((s = acp_dict_lookup(props, "device.profile")) != NULL)
profile = s;
if ((s = acp_dict_lookup(props, "api.acp.auto-profile")) != NULL)
impl->auto_profile = (strcmp(s, "true") == 0 || atoi(s) == 1);
impl->auto_profile = (spa_streq(s, "true") || atoi(s) == 1);
if ((s = acp_dict_lookup(props, "api.acp.auto-port")) != NULL)
impl->auto_port = (strcmp(s, "true") == 0 || atoi(s) == 1);
impl->auto_port = (spa_streq(s, "true") || atoi(s) == 1);
}
impl->ucm.default_sample_spec.format = PA_SAMPLE_S16NE;
@ -1715,7 +1717,7 @@ uint32_t acp_device_find_best_port_index(struct acp_device *dev, const char *nam
struct acp_port *p = ports[i];
if (name) {
if (strcmp(name, p->name) == 0)
if (spa_streq(name, p->name))
best = i;
} else if (p->available == ACP_AVAILABLE_YES) {
if (best == ACP_INVALID_INDEX || p->priority > ports[best]->priority)

View file

@ -36,6 +36,7 @@
#include <spa/node/node.h>
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/support/loop.h>
#include <spa/support/plugin.h>
#include <spa/support/i18n.h>
@ -880,7 +881,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Device))
*interface = &this->device;
else
return -ENOENT;
@ -958,9 +959,9 @@ impl_init(const struct spa_handle_factory *factory,
if ((str = spa_dict_lookup(info, SPA_KEY_API_ALSA_PATH)) != NULL)
snprintf(this->props.device, sizeof(this->props.device), "%s", str);
if ((str = spa_dict_lookup(info, "api.acp.auto-port")) != NULL)
this->props.auto_port = strcmp(str, "true") == 0 || atoi(str) != 0;
this->props.auto_port = spa_streq(str, "true") || atoi(str) != 0;
if ((str = spa_dict_lookup(info, "api.acp.auto-profile")) != NULL)
this->props.auto_profile = strcmp(str, "true") == 0 || atoi(str) != 0;
this->props.auto_profile = spa_streq(str, "true") || atoi(str) != 0;
items = alloca((info->n_items) * sizeof(*items));
spa_dict_for_each(it, info)

View file

@ -36,6 +36,7 @@
#include <spa/node/node.h>
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/support/loop.h>
#include <spa/support/plugin.h>
#include <spa/monitor/device.h>
@ -492,7 +493,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Device))
*interface = &this->device;
else
return -ENOENT;

View file

@ -32,6 +32,7 @@
#include <spa/monitor/device.h>
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/param/audio/format.h>
#include <spa/pod/filter.h>
#include <spa/debug/pod.h>
@ -694,7 +695,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct state *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;
@ -807,11 +808,11 @@ impl_init(const struct spa_handle_factory *factory,
} else if (!strcmp(k, "api.alsa.start-delay")) {
this->default_start_delay = atoi(s);
} else if (!strcmp(k, "api.alsa.disable-mmap")) {
this->disable_mmap = (strcmp(s, "true") == 0 || atoi(s) == 1);
this->disable_mmap = (spa_streq(s, "true") || atoi(s) == 1);
} else if (!strcmp(k, "api.alsa.disable-batch")) {
this->disable_batch = (strcmp(s, "true") == 0 || atoi(s) == 1);
this->disable_batch = (spa_streq(s, "true") || atoi(s) == 1);
} else if (!strcmp(k, "api.alsa.use-chmap")) {
this->props.use_chmap = (strcmp(s, "true") == 0 || atoi(s) == 1);
this->props.use_chmap = (spa_streq(s, "true") || atoi(s) == 1);
}
}
return 0;

View file

@ -32,6 +32,7 @@
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/list.h>
#include <spa/utils/string.h>
#include <spa/monitor/device.h>
#include <spa/param/audio/format.h>
#include <spa/pod/filter.h>
@ -716,7 +717,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct state *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;
@ -825,11 +826,11 @@ impl_init(const struct spa_handle_factory *factory,
} else if (!strcmp(k, "api.alsa.headroom")) {
this->default_headroom = atoi(s);
} else if (!strcmp(k, "api.alsa.disable-mmap")) {
this->disable_mmap = (strcmp(s, "true") == 0 || atoi(s) == 1);
this->disable_mmap = (spa_streq(s, "true") || atoi(s) == 1);
} else if (!strcmp(k, "api.alsa.disable-batch")) {
this->disable_batch = (strcmp(s, "true") == 0 || atoi(s) == 1);
this->disable_batch = (spa_streq(s, "true") || atoi(s) == 1);
} else if (!strcmp(k, "api.alsa.use-chmap")) {
this->props.use_chmap = (strcmp(s, "true") == 0 || atoi(s) == 1);
this->props.use_chmap = (spa_streq(s, "true") || atoi(s) == 1);
}
}
return 0;

View file

@ -32,6 +32,7 @@
#include <spa/node/keys.h>
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/utils/list.h>
#include <spa/monitor/device.h>
#include <spa/param/audio/format.h>
@ -799,7 +800,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct seq_state *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -138,7 +138,7 @@ static uint32_t get_card_id(struct impl *this, struct udev_device *dev)
if (udev_device_get_property_value(dev, "ACP_IGNORE"))
return SPA_ID_INVALID;
if ((str = udev_device_get_property_value(dev, "SOUND_CLASS")) && strcmp(str, "modem") == 0)
if ((str = udev_device_get_property_value(dev, "SOUND_CLASS")) && spa_streq(str, "modem"))
return SPA_ID_INVALID;
if ((str = udev_device_get_property_value(dev, "SOUND_INITIALIZED")) == NULL)
@ -553,9 +553,9 @@ static void impl_on_fd_events(struct spa_source *source)
start_inotify(this);
if (strcmp(action, "change") == 0) {
if (spa_streq(action, "change")) {
process_device(this, ACTION_ADD, dev);
} else if (strcmp(action, "remove") == 0) {
} else if (spa_streq(action, "remove")) {
process_device(this, ACTION_REMOVE, dev);
}
udev_device_unref(dev);
@ -705,7 +705,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Device))
*interface = &this->device;
else
return -ENOENT;
@ -768,7 +768,7 @@ impl_init(const struct spa_handle_factory *factory,
if (info) {
if ((str = spa_dict_lookup(info, "alsa.use-acp")) != NULL)
this->use_acp = strcmp(str, "true") == 0 || atoi(str) != 0;
this->use_acp = spa_streq(str, "true") || atoi(str) != 0;
}
return 0;

View file

@ -32,6 +32,7 @@
#include <spa/node/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/result.h>
#include <spa/utils/string.h>
#include <spa/buffer/alloc.h>
#include <spa/pod/parser.h>
#include <spa/pod/filter.h>
@ -1096,7 +1097,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -32,6 +32,7 @@
#include <spa/utils/result.h>
#include <spa/utils/list.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/buffer/alloc.h>
#include <spa/node/io.h>
@ -1190,7 +1191,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -32,6 +32,7 @@
#include <spa/utils/list.h>
#include <spa/utils/names.h>
#include <spa/utils/json.h>
#include <spa/utils/string.h>
#include <spa/node/keys.h>
#include <spa/node/node.h>
#include <spa/node/io.h>
@ -1312,7 +1313,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;
@ -1336,7 +1337,7 @@ static uint32_t channel_from_name(const char *name)
{
int i;
for (i = 0; spa_type_audio_channel[i].name; i++) {
if (strcmp(name, spa_debug_type_short_name(spa_type_audio_channel[i].name)) == 0)
if (spa_streq(name, spa_debug_type_short_name(spa_type_audio_channel[i].name)))
return spa_type_audio_channel[i].type;
}
return SPA_AUDIO_CHANNEL_UNKNOWN;
@ -1391,18 +1392,18 @@ impl_init(const struct spa_handle_factory *factory,
for (i = 0; info && i < info->n_items; i++) {
const char *k = info->items[i].key;
const char *s = info->items[i].value;
if (strcmp(k, "channelmix.normalize") == 0 &&
(strcmp(s, "true") == 0 || atoi(s) != 0))
if (spa_streq(k, "channelmix.normalize") &&
(spa_streq(s, "true") || atoi(s) != 0))
this->mix.options |= CHANNELMIX_OPTION_NORMALIZE;
if (strcmp(k, "channelmix.mix-lfe") == 0 &&
(strcmp(s, "true") == 0 || atoi(s) != 0))
if (spa_streq(k, "channelmix.mix-lfe") &&
(spa_streq(s, "true") || atoi(s) != 0))
this->mix.options |= CHANNELMIX_OPTION_MIX_LFE;
if (strcmp(k, "channelmix.upmix") == 0 &&
(strcmp(s, "true") == 0 || atoi(s) != 0))
if (spa_streq(k, "channelmix.upmix") &&
(spa_streq(s, "true") || atoi(s) != 0))
this->mix.options |= CHANNELMIX_OPTION_UPMIX;
if (strcmp(k, "channelmix.lfe-cutoff") == 0)
if (spa_streq(k, "channelmix.lfe-cutoff"))
this->mix.lfe_cutoff = atoi(s);
if (strcmp(k, SPA_KEY_AUDIO_POSITION) == 0)
if (spa_streq(k, SPA_KEY_AUDIO_POSITION))
this->props.n_channels = parse_position(this->props.channel_map, s, strlen(s));
}
this->props.channel.n_volumes = this->props.n_channels;

View file

@ -32,6 +32,7 @@
#include <spa/support/cpu.h>
#include <spa/utils/list.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/node/io.h>
#include <spa/node/utils.h>
@ -952,7 +953,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -33,6 +33,7 @@
#include <spa/utils/result.h>
#include <spa/utils/list.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/node/io.h>
#include <spa/node/utils.h>
@ -1336,7 +1337,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;
@ -1384,7 +1385,7 @@ impl_init(const struct spa_handle_factory *factory,
this->monitor_channel_volumes = false;
if (info) {
if ((str = spa_dict_lookup(info, "monitor.channel-volumes")) != NULL)
this->monitor_channel_volumes = strcmp(str, "true") == 0 || atoi(str) == 1;
this->monitor_channel_volumes = spa_streq(str, "true") || atoi(str) == 1;
}
this->node.iface = SPA_INTERFACE_INIT(

View file

@ -30,6 +30,7 @@
#include <spa/support/log.h>
#include <spa/utils/list.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/node/io.h>
#include <spa/node/utils.h>
@ -947,7 +948,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;
@ -1006,11 +1007,11 @@ impl_init(const struct spa_handle_factory *factory,
if ((str = spa_dict_lookup(info, "resample.quality")) != NULL)
this->props.quality = atoi(str);
if ((str = spa_dict_lookup(info, "resample.peaks")) != NULL)
this->peaks = strcmp(str, "true") == 0 || atoi(str) == 1;
this->peaks = spa_streq(str, "true") || atoi(str) == 1;
if ((str = spa_dict_lookup(info, "factory.mode")) != NULL) {
if (strcmp(str, "split") == 0)
if (spa_streq(str, "split"))
this->mode = MODE_SPLIT;
else if (strcmp(str, "merge") == 0)
else if (spa_streq(str, "merge"))
this->mode = MODE_MERGE;
else
this->mode = MODE_CONVERT;

View file

@ -32,6 +32,7 @@
#include <spa/support/log.h>
#include <spa/utils/list.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
@ -1017,7 +1018,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -30,6 +30,7 @@
#include <time.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/support/plugin.h>
#include <spa/param/param.h>
#include <spa/param/audio/format.h>
@ -56,7 +57,7 @@ static const struct spa_handle_factory *find_factory(const char *name)
const struct spa_handle_factory *factory;
while (spa_handle_factory_enum(&factory, &index) == 1) {
if (strcmp(factory->name, name) == 0)
if (spa_streq(factory->name, name))
return factory;
}
return NULL;

View file

@ -30,6 +30,7 @@
#include <time.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/support/plugin.h>
#include <spa/param/param.h>
#include <spa/param/audio/format.h>
@ -59,7 +60,7 @@ static const struct spa_handle_factory *find_factory(const char *name)
const struct spa_handle_factory *factory;
while (spa_handle_factory_enum(&factory, &index) == 1) {
if (strcmp(factory->name, name) == 0)
if (spa_streq(factory->name, name))
return factory;
}
return NULL;

View file

@ -31,6 +31,7 @@
#include <spa/support/cpu.h>
#include <spa/utils/list.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/node/io.h>
#include <spa/node/utils.h>
@ -799,7 +800,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -31,6 +31,7 @@
#include <spa/support/cpu.h>
#include <spa/utils/list.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
@ -835,7 +836,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -31,6 +31,7 @@
#include <spa/support/cpu.h>
#include <spa/utils/list.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
@ -770,7 +771,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -34,6 +34,7 @@
#include <spa/support/loop.h>
#include <spa/utils/list.h>
#include <spa/utils/keys.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
@ -973,7 +974,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -28,6 +28,7 @@
#include <arpa/inet.h>
#include <spa/param/audio/format.h>
#include <spa/utils/string.h>
#include <sbc/sbc.h>
@ -164,7 +165,7 @@ static int codec_select_config(const struct a2dp_codec *codec, uint32_t flags,
if (caps_size < sizeof(conf))
return -EINVAL;
xq = (strcmp(codec->name, "sbc_xq") == 0);
xq = (spa_streq(codec->name, "sbc_xq"));
memcpy(&conf, caps, sizeof(conf));
@ -235,7 +236,7 @@ static int codec_caps_preference_cmp(const struct a2dp_codec *codec, const void
a2dp_sbc_t *conf;
int res1, res2;
int a, b;
bool xq = (strcmp(codec->name, "sbc_xq") == 0);
bool xq = (spa_streq(codec->name, "sbc_xq"));
/* Order selected configurations by preference */
res1 = codec->select_config(codec, 0, caps1, caps1_size, info, NULL, (uint8_t *)&conf1);

View file

@ -36,6 +36,7 @@
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/result.h>
#include <spa/utils/string.h>
#include <spa/monitor/device.h>
#include <spa/node/node.h>
@ -1324,7 +1325,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -39,6 +39,7 @@
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/result.h>
#include <spa/utils/string.h>
#include <spa/monitor/device.h>
#include <spa/node/node.h>
@ -1236,7 +1237,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;
@ -1341,7 +1342,7 @@ impl_init(const struct spa_handle_factory *factory,
if ((str = spa_dict_lookup(info, SPA_KEY_API_BLUEZ5_TRANSPORT)) != NULL)
sscanf(str, "pointer:%p", &this->transport);
if ((str = spa_dict_lookup(info, "bluez5.a2dp-source-role")) != NULL)
this->is_input = strcmp(str, "input") == 0;
this->is_input = spa_streq(str, "input");
}
if (this->transport == NULL) {

View file

@ -33,6 +33,7 @@
#include <spa/support/loop.h>
#include <spa/support/dbus.h>
#include <spa/support/plugin.h>
#include <spa/utils/string.h>
#include <spa/utils/type.h>
#include <spa/param/audio/raw.h>
@ -175,7 +176,7 @@ static struct hsphfpd_endpoint *endpoint_find(struct impl *backend, const char *
{
struct hsphfpd_endpoint *d;
spa_list_for_each(d, &backend->endpoint_list, link)
if (strcmp(d->path, path) == 0)
if (spa_streq(d->path, path))
return d;
return NULL;
}
@ -193,7 +194,7 @@ static void endpoint_free(struct hsphfpd_endpoint *endpoint)
static bool hsphfpd_cmp_transport_path(struct spa_bt_transport *t, const void *data)
{
struct hsphfpd_transport_data *td = t->user_data;
if (strcmp(td->transport_path, data) == 0)
if (spa_streq(td->transport_path, data))
return true;
return false;
@ -201,7 +202,7 @@ static bool hsphfpd_cmp_transport_path(struct spa_bt_transport *t, const void *d
static inline bool check_signature(DBusMessage *m, const char sig[])
{
return strcmp(dbus_message_get_signature(m), sig) == 0;
return spa_streq(dbus_message_get_signature(m), sig);
}
static int set_dbus_property(struct impl *backend,
@ -316,41 +317,41 @@ static void parse_transport_properties_values(struct impl *backend,
switch (dbus_message_iter_get_arg_type(&variant_i)) {
case DBUS_TYPE_STRING:
if (strcmp(key, "RxVolumeControl") == 0 || strcmp(key, "TxVolumeControl") == 0) {
if (spa_streq(key, "RxVolumeControl") || spa_streq(key, "TxVolumeControl")) {
const char *value;
enum hsphfpd_volume_control volume_control;
dbus_message_iter_get_basic(&variant_i, &value);
if (strcmp(value, "none") == 0)
if (spa_streq(value, "none"))
volume_control = HSPHFPD_VOLUME_CONTROL_NONE;
else if (strcmp(value, "local") == 0)
else if (spa_streq(value, "local"))
volume_control = HSPHFPD_VOLUME_CONTROL_LOCAL;
else if (strcmp(value, "remote") == 0)
else if (spa_streq(value, "remote"))
volume_control = HSPHFPD_VOLUME_CONTROL_REMOTE;
else
volume_control = 0;
if (!volume_control)
spa_log_warn(backend->log, NAME": Transport %s received invalid '%s' property value '%s', ignoring", transport_path, key, value);
else if (strcmp(key, "RxVolumeControl") == 0)
else if (spa_streq(key, "RxVolumeControl"))
*rx_volume_control = volume_control;
else if (strcmp(key, "TxVolumeControl") == 0)
else if (spa_streq(key, "TxVolumeControl"))
*tx_volume_control = volume_control;
} else if (strcmp(key, "AirCodec") == 0)
} else if (spa_streq(key, "AirCodec"))
dbus_message_iter_get_basic(&variant_i, air_codec);
break;
case DBUS_TYPE_UINT16:
if (strcmp(key, "MTU") == 0)
if (spa_streq(key, "MTU"))
dbus_message_iter_get_basic(&variant_i, mtu);
else if (strcmp(key, "RxVolumeGain") == 0)
else if (spa_streq(key, "RxVolumeGain"))
dbus_message_iter_get_basic(&variant_i, rx_volume_gain);
else if (strcmp(key, "TxVolumeGain") == 0)
else if (spa_streq(key, "TxVolumeGain"))
dbus_message_iter_get_basic(&variant_i, tx_volume_gain);
break;
case DBUS_TYPE_OBJECT_PATH:
if (strcmp(key, "Endpoint") == 0)
if (spa_streq(key, "Endpoint"))
dbus_message_iter_get_basic(&variant_i, endpoint_path);
break;
}
@ -484,9 +485,9 @@ static DBusHandlerResult audio_agent_get_property(DBusConnection *conn, DBusMess
goto fail;
}
if (strcmp(path, HSPHFP_AUDIO_CLIENT_PCM_S16LE_8KHZ) == 0)
if (spa_streq(path, HSPHFP_AUDIO_CLIENT_PCM_S16LE_8KHZ))
agent_codec = HSPHFP_AGENT_CODEC_PCM;
else if (strcmp(path, HSPHFP_AUDIO_CLIENT_MSBC) == 0)
else if (spa_streq(path, HSPHFP_AUDIO_CLIENT_MSBC))
agent_codec = HSPHFP_AGENT_CODEC_MSBC;
else {
r = dbus_message_new_error(m, DBUS_ERROR_INVALID_ARGS, "Invalid path in method call");
@ -526,9 +527,9 @@ static DBusHandlerResult audio_agent_getall_properties(DBusConnection *conn, DBu
goto fail;
}
if (strcmp(path, HSPHFP_AUDIO_CLIENT_PCM_S16LE_8KHZ) == 0)
if (spa_streq(path, HSPHFP_AUDIO_CLIENT_PCM_S16LE_8KHZ))
agent_codec = HSPHFP_AGENT_CODEC_PCM;
else if (strcmp(path, HSPHFP_AUDIO_CLIENT_MSBC) == 0)
else if (spa_streq(path, HSPHFP_AUDIO_CLIENT_MSBC))
agent_codec = HSPHFP_AGENT_CODEC_MSBC;
else {
r = dbus_message_new_error(m, DBUS_ERROR_INVALID_ARGS, "Invalid path in method call");
@ -599,9 +600,9 @@ static DBusHandlerResult hsphfpd_new_audio_connection(DBusConnection *conn, DBus
goto fail;
}
if (strcmp(path, HSPHFP_AUDIO_CLIENT_PCM_S16LE_8KHZ) == 0)
if (spa_streq(path, HSPHFP_AUDIO_CLIENT_PCM_S16LE_8KHZ))
codec = HFP_AUDIO_CODEC_CVSD;
else if (strcmp(path, HSPHFP_AUDIO_CLIENT_MSBC) == 0)
else if (spa_streq(path, HSPHFP_AUDIO_CLIENT_MSBC))
codec = HFP_AUDIO_CODEC_MSBC;
else {
r = dbus_message_new_error(m, HSPHFPD_ERROR_REJECTED, "Invalid path");
@ -1013,25 +1014,25 @@ static DBusHandlerResult hsphfpd_parse_endpoint_properties(struct impl *backend,
{
const char *value;
dbus_message_iter_get_basic(&value_i, &value);
if (strcmp(key, "RemoteAddress") == 0)
if (spa_streq(key, "RemoteAddress"))
endpoint->remote_address = strdup(value);
else if (strcmp(key, "LocalAddress") == 0)
else if (spa_streq(key, "LocalAddress"))
endpoint->local_address = strdup(value);
else if (strcmp(key, "Profile") == 0) {
else if (spa_streq(key, "Profile")) {
if (endpoint->profile)
spa_log_warn(backend->log, NAME": Endpoint %s received a duplicate '%s' property, ignoring", endpoint->path, key);
else if (strcmp(value, "headset") == 0)
else if (spa_streq(value, "headset"))
endpoint->profile = HSPHFPD_PROFILE_HEADSET;
else if (strcmp(value, "handsfree") == 0)
else if (spa_streq(value, "handsfree"))
endpoint->profile = HSPHFPD_PROFILE_HANDSFREE;
else
spa_log_warn(backend->log, NAME": Endpoint %s received invalid '%s' property value '%s', ignoring", endpoint->path, key, value);
} else if (strcmp(key, "Role") == 0) {
} else if (spa_streq(key, "Role")) {
if (endpoint->role)
spa_log_warn(backend->log, NAME": Endpoint %s received a duplicate '%s' property, ignoring", endpoint->path, key);
else if (strcmp(value, "client") == 0)
else if (spa_streq(value, "client"))
endpoint->role = HSPHFPD_ROLE_CLIENT;
else if (strcmp(value, "gateway") == 0)
else if (spa_streq(value, "gateway"))
endpoint->role = HSPHFPD_ROLE_GATEWAY;
else
spa_log_warn(backend->log, NAME": Endpoint %s received invalid '%s' property value '%s', ignoring", endpoint->path, key, value);
@ -1044,7 +1045,7 @@ static DBusHandlerResult hsphfpd_parse_endpoint_properties(struct impl *backend,
{
bool value;
dbus_message_iter_get_basic(&value_i, &value);
if (strcmp(key, "Connected") == 0)
if (spa_streq(key, "Connected"))
endpoint->connected = value;
spa_log_trace(backend->log, NAME": %s: %d", key, value);
}
@ -1052,7 +1053,7 @@ static DBusHandlerResult hsphfpd_parse_endpoint_properties(struct impl *backend,
case DBUS_TYPE_ARRAY:
{
if (strcmp(key, "AudioCodecs") == 0) {
if (spa_streq(key, "AudioCodecs")) {
DBusMessageIter array_i;
const char *value;
@ -1060,9 +1061,9 @@ static DBusHandlerResult hsphfpd_parse_endpoint_properties(struct impl *backend,
dbus_message_iter_recurse(&value_i, &array_i);
while (dbus_message_iter_get_arg_type(&array_i) != DBUS_TYPE_INVALID) {
dbus_message_iter_get_basic(&array_i, &value);
if (strcmp(value, HSPHFP_AIR_CODEC_CVSD) == 0)
if (spa_streq(value, HSPHFP_AIR_CODEC_CVSD))
endpoint->air_codecs |= HFP_AUDIO_CODEC_CVSD;
if (strcmp(value, HSPHFP_AIR_CODEC_MSBC) == 0)
if (spa_streq(value, HSPHFP_AIR_CODEC_MSBC))
endpoint->air_codecs |= HFP_AUDIO_CODEC_MSBC;
dbus_message_iter_next(&array_i);
}
@ -1163,7 +1164,7 @@ static DBusHandlerResult hsphfpd_parse_interfaces(struct impl *backend, DBusMess
dbus_message_iter_get_basic(&iface_i, &interface);
dbus_message_iter_next(&iface_i);
if (strcmp(interface, HSPHFPD_ENDPOINT_INTERFACE) == 0) {
if (spa_streq(interface, HSPHFPD_ENDPOINT_INTERFACE)) {
struct hsphfpd_endpoint *endpoint;
endpoint = endpoint_find(backend, path);
@ -1315,7 +1316,7 @@ static DBusHandlerResult hsphfpd_filter_cb(DBusConnection *bus, DBusMessage *m,
sender = dbus_message_get_sender(m);
if (backend->hsphfpd_service_id && strcmp(sender, backend->hsphfpd_service_id) == 0) {
if (backend->hsphfpd_service_id && spa_streq(sender, backend->hsphfpd_service_id)) {
if (dbus_message_is_signal(m, DBUS_INTERFACE_OBJECTMANAGER, "InterfacesAdded")) {
DBusMessageIter arg_i;
@ -1351,7 +1352,7 @@ static DBusHandlerResult hsphfpd_filter_cb(DBusConnection *bus, DBusMessage *m,
dbus_message_iter_get_basic(&element_i, &iface);
if (strcmp(iface, HSPHFPD_ENDPOINT_INTERFACE) == 0) {
if (spa_streq(iface, HSPHFPD_ENDPOINT_INTERFACE)) {
struct hsphfpd_endpoint *endpoint;
struct spa_bt_transport *transport = spa_bt_transport_find(backend->monitor, path);
@ -1384,7 +1385,7 @@ static DBusHandlerResult hsphfpd_filter_cb(DBusConnection *bus, DBusMessage *m,
path = dbus_message_get_path(m);
if (strcmp(iface, HSPHFPD_ENDPOINT_INTERFACE) == 0) {
if (spa_streq(iface, HSPHFPD_ENDPOINT_INTERFACE)) {
struct hsphfpd_endpoint *endpoint = endpoint_find(backend, path);
if (!endpoint) {
spa_log_warn(backend->log, NAME": Properties changed on unknown endpoint %s", path);
@ -1392,7 +1393,7 @@ static DBusHandlerResult hsphfpd_filter_cb(DBusConnection *bus, DBusMessage *m,
}
spa_log_debug(backend->log, NAME": Properties changed on endpoint %s", path);
hsphfpd_parse_endpoint_properties(backend, endpoint, &arg_i);
} else if (strcmp(iface, HSPHFPD_AUDIO_TRANSPORT_INTERFACE) == 0) {
} else if (spa_streq(iface, HSPHFPD_AUDIO_TRANSPORT_INTERFACE)) {
struct spa_bt_transport *transport = spa_bt_transport_find_full(backend->monitor,
hsphfpd_cmp_transport_path,
(const void *)path);
@ -1507,7 +1508,7 @@ struct spa_bt_backend *backend_hsphfpd_new(struct spa_bt_monitor *monitor,
backend->main_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Loop);
backend->conn = dbus_connection;
if (info && (str = spa_dict_lookup(info, "bluez5.msbc-support")))
backend->msbc_supported = strcmp(str, "true") == 0 || atoi(str) == 1;
backend->msbc_supported = spa_streq(str, "true") || atoi(str) == 1;
else
backend->msbc_supported = false;

View file

@ -37,6 +37,7 @@
#include <spa/support/loop.h>
#include <spa/support/dbus.h>
#include <spa/support/plugin.h>
#include <spa/utils/string.h>
#include <spa/utils/type.h>
#include <spa/utils/json.h>
#include <spa/param/audio/raw.h>
@ -1056,8 +1057,8 @@ static void sco_listen_event(struct spa_source *source)
/* Find transport for local and remote address */
spa_list_for_each_safe(rfcomm, rfcomm_tmp, &backend->rfcomm_list, link) {
if (rfcomm->transport && strcmp(rfcomm->transport->device->address, remote_address) == 0 &&
strcmp(rfcomm->transport->device->adapter->address, local_address) == 0) {
if (rfcomm->transport && spa_streq(rfcomm->transport->device->address, remote_address) &&
spa_streq(rfcomm->transport->device->adapter->address, local_address)) {
t = rfcomm->transport;
break;
}
@ -1421,15 +1422,15 @@ static DBusHandlerResult profile_new_connection(DBusConnection *conn, DBusMessag
handler = dbus_message_get_path(m);
#ifdef HAVE_BLUEZ_5_BACKEND_HSP_NATIVE
if (strcmp(handler, PROFILE_HSP_AG) == 0)
if (spa_streq(handler, PROFILE_HSP_AG))
profile = SPA_BT_PROFILE_HSP_HS;
else if (strcmp(handler, PROFILE_HSP_HS) == 0)
else if (spa_streq(handler, PROFILE_HSP_HS))
profile = SPA_BT_PROFILE_HSP_AG;
#endif
#ifdef HAVE_BLUEZ_5_BACKEND_HFP_NATIVE
if (strcmp(handler, PROFILE_HFP_AG) == 0)
if (spa_streq(handler, PROFILE_HFP_AG))
profile = SPA_BT_PROFILE_HFP_HF;
else if (strcmp(handler, PROFILE_HFP_HF) == 0)
else if (spa_streq(handler, PROFILE_HFP_HF))
profile = SPA_BT_PROFILE_HFP_AG;
#endif
@ -1477,7 +1478,7 @@ static DBusHandlerResult profile_new_connection(DBusConnection *conn, DBusMessag
spa_list_append(&backend->rfcomm_list, &rfcomm->link);
if (d->settings && (str = spa_dict_lookup(d->settings, "bluez5.msbc-support")))
rfcomm->msbc_support_enabled_in_config = strcmp(str, "true") == 0 || atoi(str) == 1;
rfcomm->msbc_support_enabled_in_config = spa_streq(str, "true") || atoi(str) == 1;
else
rfcomm->msbc_support_enabled_in_config = false;
@ -1560,15 +1561,15 @@ static DBusHandlerResult profile_request_disconnection(DBusConnection *conn, DBu
handler = dbus_message_get_path(m);
#ifdef HAVE_BLUEZ_5_BACKEND_HSP_NATIVE
if (strcmp(handler, PROFILE_HSP_AG) == 0)
if (spa_streq(handler, PROFILE_HSP_AG))
profile = SPA_BT_PROFILE_HSP_HS;
else if (strcmp(handler, PROFILE_HSP_HS) == 0)
else if (spa_streq(handler, PROFILE_HSP_HS))
profile = SPA_BT_PROFILE_HSP_AG;
#endif
#ifdef HAVE_BLUEZ_5_BACKEND_HFP_NATIVE
if (strcmp(handler, PROFILE_HFP_AG) == 0)
if (spa_streq(handler, PROFILE_HFP_AG))
profile = SPA_BT_PROFILE_HFP_HF;
else if (strcmp(handler, PROFILE_HFP_HF) == 0)
else if (spa_streq(handler, PROFILE_HFP_HF))
profile = SPA_BT_PROFILE_HFP_AG;
#endif
@ -1692,8 +1693,8 @@ static int register_profile(struct impl *backend, const char *profile, const cha
dbus_message_iter_append_basic(&it[0], DBUS_TYPE_STRING, &uuid);
dbus_message_iter_open_container(&it[0], DBUS_TYPE_ARRAY, "{sv}", &it[1]);
if (strcmp(uuid, SPA_BT_UUID_HSP_HS) == 0 ||
strcmp(uuid, SPA_BT_UUID_HSP_HS_ALT) == 0) {
if (spa_streq(uuid, SPA_BT_UUID_HSP_HS) ||
spa_streq(uuid, SPA_BT_UUID_HSP_HS_ALT)) {
/* In the headset role, the connection will only be initiated from the remote side */
str = "AutoConnect";
@ -1723,7 +1724,7 @@ static int register_profile(struct impl *backend, const char *profile, const cha
dbus_message_iter_append_basic(&it[3], DBUS_TYPE_UINT16, &version);
dbus_message_iter_close_container(&it[2], &it[3]);
dbus_message_iter_close_container(&it[1], &it[2]);
} else if (strcmp(uuid, SPA_BT_UUID_HFP_AG) == 0) {
} else if (spa_streq(uuid, SPA_BT_UUID_HFP_AG)) {
str = "Features";
/* We announce wideband speech support anyway */
@ -1744,7 +1745,7 @@ static int register_profile(struct impl *backend, const char *profile, const cha
dbus_message_iter_append_basic(&it[3], DBUS_TYPE_UINT16, &version);
dbus_message_iter_close_container(&it[2], &it[3]);
dbus_message_iter_close_container(&it[1], &it[2]);
} else if (strcmp(uuid, SPA_BT_UUID_HFP_HF) == 0) {
} else if (spa_streq(uuid, SPA_BT_UUID_HFP_HF)) {
str = "Features";
/* We announce wideband speech support anyway */

View file

@ -36,6 +36,7 @@
#include <spa/support/loop.h>
#include <spa/support/dbus.h>
#include <spa/support/plugin.h>
#include <spa/utils/string.h>
#include <spa/utils/type.h>
#include <spa/param/audio/raw.h>
@ -321,12 +322,12 @@ static DBusHandlerResult ofono_audio_card_found(struct impl *backend, char *path
dbus_message_iter_get_basic(&value_i, &value);
if (strcmp(key, "RemoteAddress") == 0) {
if (spa_streq(key, "RemoteAddress")) {
remote_address = value;
} else if (strcmp(key, "LocalAddress") == 0) {
} else if (spa_streq(key, "LocalAddress")) {
local_address = value;
} else if (strcmp(key, "Type") == 0) {
if (strcmp(value, "gateway") == 0)
} else if (spa_streq(key, "Type")) {
if (spa_streq(value, "gateway"))
profile = SPA_BT_PROFILE_HFP_HF;
}
@ -788,7 +789,7 @@ struct spa_bt_backend *backend_ofono_new(struct spa_bt_monitor *monitor,
backend->main_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Loop);
backend->conn = dbus_connection;
if (info && (str = spa_dict_lookup(info, "bluez5.msbc-support")))
backend->msbc_supported = strcmp(str, "true") == 0 || atoi(str) == 1;
backend->msbc_supported = spa_streq(str, "true") || atoi(str) == 1;
else
backend->msbc_supported = false;

View file

@ -46,6 +46,7 @@
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/result.h>
#include <spa/utils/string.h>
#include <spa/utils/json.h>
#include "a2dp-codecs.h"
@ -413,7 +414,7 @@ static const struct a2dp_codec *a2dp_endpoint_to_codec(const char *endpoint)
for (i = 0; a2dp_codecs[i]; i++) {
const struct a2dp_codec *codec = a2dp_codecs[i];
if (strcmp(codec->name, codec_name) == 0)
if (spa_streq(codec->name, codec_name))
return codec;
}
return NULL;
@ -433,7 +434,7 @@ static int a2dp_endpoint_to_profile(const char *endpoint)
static bool is_a2dp_codec_enabled(struct spa_bt_monitor *monitor, const struct a2dp_codec *codec)
{
if (!monitor->enable_sbc_xq && codec->feature_flag != NULL &&
strcmp(codec->feature_flag, "sbc-xq") == 0)
spa_streq(codec->feature_flag, "sbc-xq"))
return false;
return spa_dict_lookup(&monitor->enabled_codecs, codec->name) != NULL;
@ -505,7 +506,7 @@ static struct spa_bt_adapter *adapter_find(struct spa_bt_monitor *monitor, const
{
struct spa_bt_adapter *d;
spa_list_for_each(d, &monitor->adapter_list, link)
if (strcmp(d->path, path) == 0)
if (spa_streq(d->path, path))
return d;
return NULL;
}
@ -545,15 +546,15 @@ static int adapter_update_props(struct spa_bt_adapter *adapter,
spa_log_debug(monitor->log, "adapter %p: %s=%s", adapter, key, value);
if (strcmp(key, "Alias") == 0) {
if (spa_streq(key, "Alias")) {
free(adapter->alias);
adapter->alias = strdup(value);
}
else if (strcmp(key, "Name") == 0) {
else if (spa_streq(key, "Name")) {
free(adapter->name);
adapter->name = strdup(value);
}
else if (strcmp(key, "Address") == 0) {
else if (spa_streq(key, "Address")) {
free(adapter->address);
adapter->address = strdup(value);
}
@ -565,7 +566,7 @@ static int adapter_update_props(struct spa_bt_adapter *adapter,
spa_log_debug(monitor->log, "adapter %p: %s=%d", adapter, key, value);
if (strcmp(key, "Class") == 0)
if (spa_streq(key, "Class"))
adapter->bluetooth_class = value;
}
@ -576,11 +577,11 @@ static int adapter_update_props(struct spa_bt_adapter *adapter,
spa_log_debug(monitor->log, "adapter %p: %s=%d", adapter, key, value);
if (strcmp(key, "Powered") == 0) {
if (spa_streq(key, "Powered")) {
adapter->powered = value;
}
}
else if (strcmp(key, "UUIDs") == 0) {
else if (spa_streq(key, "UUIDs")) {
DBusMessageIter iter;
if (!check_iter_signature(&it[1], "as"))
@ -645,7 +646,7 @@ struct spa_bt_device *spa_bt_device_find(struct spa_bt_monitor *monitor, const c
{
struct spa_bt_device *d;
spa_list_for_each(d, &monitor->device_list, link)
if (strcmp(d->path, path) == 0)
if (spa_streq(d->path, path))
return d;
return NULL;
}
@ -654,7 +655,7 @@ struct spa_bt_device *spa_bt_device_find_by_address(struct spa_bt_monitor *monit
{
struct spa_bt_device *d;
spa_list_for_each(d, &monitor->device_list, link)
if (strcmp(d->address, remote_address) == 0 && strcmp(d->adapter->address, local_address) == 0)
if (spa_streq(d->address, remote_address) && spa_streq(d->adapter->address, local_address))
return d;
return NULL;
}
@ -1107,19 +1108,19 @@ static int device_update_props(struct spa_bt_device *device,
spa_log_debug(monitor->log, "device %p: %s=%s", device, key, value);
if (strcmp(key, "Alias") == 0) {
if (spa_streq(key, "Alias")) {
free(device->alias);
device->alias = strdup(value);
}
else if (strcmp(key, "Name") == 0) {
else if (spa_streq(key, "Name")) {
free(device->name);
device->name = strdup(value);
}
else if (strcmp(key, "Address") == 0) {
else if (spa_streq(key, "Address")) {
free(device->address);
device->address = strdup(value);
}
else if (strcmp(key, "Adapter") == 0) {
else if (spa_streq(key, "Adapter")) {
free(device->adapter_path);
device->adapter_path = strdup(value);
@ -1128,7 +1129,7 @@ static int device_update_props(struct spa_bt_device *device,
spa_log_warn(monitor->log, "unknown adapter %s", value);
}
}
else if (strcmp(key, "Icon") == 0) {
else if (spa_streq(key, "Icon")) {
free(device->icon);
device->icon = strdup(value);
}
@ -1140,7 +1141,7 @@ static int device_update_props(struct spa_bt_device *device,
spa_log_debug(monitor->log, "device %p: %s=%08x", device, key, value);
if (strcmp(key, "Class") == 0)
if (spa_streq(key, "Class"))
device->bluetooth_class = value;
}
else if (type == DBUS_TYPE_UINT16) {
@ -1150,7 +1151,7 @@ static int device_update_props(struct spa_bt_device *device,
spa_log_debug(monitor->log, "device %p: %s=%d", device, key, value);
if (strcmp(key, "Appearance") == 0)
if (spa_streq(key, "Appearance"))
device->appearance = value;
}
else if (type == DBUS_TYPE_INT16) {
@ -1160,7 +1161,7 @@ static int device_update_props(struct spa_bt_device *device,
spa_log_debug(monitor->log, "device %p: %s=%d", device, key, value);
if (strcmp(key, "RSSI") == 0)
if (spa_streq(key, "RSSI"))
device->RSSI = value;
}
else if (type == DBUS_TYPE_BOOLEAN) {
@ -1170,24 +1171,24 @@ static int device_update_props(struct spa_bt_device *device,
spa_log_debug(monitor->log, "device %p: %s=%d", device, key, value);
if (strcmp(key, "Paired") == 0) {
if (spa_streq(key, "Paired")) {
device->paired = value;
}
else if (strcmp(key, "Trusted") == 0) {
else if (spa_streq(key, "Trusted")) {
device->trusted = value;
}
else if (strcmp(key, "Connected") == 0) {
else if (spa_streq(key, "Connected")) {
device_set_connected(device, value);
}
else if (strcmp(key, "Blocked") == 0) {
else if (spa_streq(key, "Blocked")) {
device->blocked = value;
}
else if (strcmp(key, "ServicesResolved") == 0) {
else if (spa_streq(key, "ServicesResolved")) {
if (value)
spa_bt_device_check_profiles(device, false);
}
}
else if (strcmp(key, "UUIDs") == 0) {
else if (spa_streq(key, "UUIDs")) {
DBusMessageIter iter;
uint32_t prev_profiles = device->profiles;
@ -1232,7 +1233,7 @@ bool spa_bt_device_supports_a2dp_codec(struct spa_bt_device *device, const struc
if (!device->adapter->application_registered) {
/* Codec switching not supported: only plain SBC allowed */
return (codec->codec_id == A2DP_CODEC_SBC && strcmp(codec->name, "sbc") == 0);
return (codec->codec_id == A2DP_CODEC_SBC && spa_streq(codec->name, "sbc"));
}
spa_list_for_each(ep, &device->remote_endpoint_list, device_link) {
@ -1285,7 +1286,7 @@ static struct spa_bt_remote_endpoint *device_remote_endpoint_find(struct spa_bt_
{
struct spa_bt_remote_endpoint *ep;
spa_list_for_each(ep, &device->remote_endpoint_list, device_link)
if (strcmp(ep->path, path) == 0)
if (spa_streq(ep->path, path))
return ep;
return NULL;
}
@ -1294,7 +1295,7 @@ static struct spa_bt_remote_endpoint *remote_endpoint_find(struct spa_bt_monitor
{
struct spa_bt_remote_endpoint *ep;
spa_list_for_each(ep, &monitor->remote_endpoint_list, link)
if (strcmp(ep->path, path) == 0)
if (spa_streq(ep->path, path))
return ep;
return NULL;
}
@ -1324,11 +1325,11 @@ static int remote_endpoint_update_props(struct spa_bt_remote_endpoint *remote_en
spa_log_debug(monitor->log, "remote_endpoint %p: %s=%s", remote_endpoint, key, value);
if (strcmp(key, "UUID") == 0) {
if (spa_streq(key, "UUID")) {
free(remote_endpoint->uuid);
remote_endpoint->uuid = strdup(value);
}
else if (strcmp(key, "Device") == 0) {
else if (spa_streq(key, "Device")) {
struct spa_bt_device *device;
device = spa_bt_device_find(monitor, value);
if (device == NULL)
@ -1351,7 +1352,7 @@ static int remote_endpoint_update_props(struct spa_bt_remote_endpoint *remote_en
spa_log_debug(monitor->log, "remote_endpoint %p: %s=%d", remote_endpoint, key, value);
if (strcmp(key, "DelayReporting") == 0) {
if (spa_streq(key, "DelayReporting")) {
remote_endpoint->delay_reporting = value;
}
}
@ -1362,11 +1363,11 @@ static int remote_endpoint_update_props(struct spa_bt_remote_endpoint *remote_en
spa_log_debug(monitor->log, "remote_endpoint %p: %s=%02x", remote_endpoint, key, value);
if (strcmp(key, "Codec") == 0) {
if (spa_streq(key, "Codec")) {
remote_endpoint->codec = value;
}
}
else if (strcmp(key, "Capabilities") == 0) {
else if (spa_streq(key, "Capabilities")) {
DBusMessageIter iter;
uint8_t *value;
int i, len;
@ -1436,7 +1437,7 @@ struct spa_bt_transport *spa_bt_transport_find(struct spa_bt_monitor *monitor, c
{
struct spa_bt_transport *t;
spa_list_for_each(t, &monitor->transport_list, link)
if (strcmp(t->path, path) == 0)
if (spa_streq(t->path, path))
return t;
return NULL;
}
@ -1816,7 +1817,7 @@ static int transport_update_props(struct spa_bt_transport *transport,
spa_log_debug(monitor->log, "transport %p: %s=%s", transport, key, value);
if (strcmp(key, "UUID") == 0) {
if (spa_streq(key, "UUID")) {
switch (spa_bt_profile_from_uuid(value)) {
case SPA_BT_PROFILE_A2DP_SOURCE:
transport->profile = SPA_BT_PROFILE_A2DP_SINK;
@ -1829,16 +1830,16 @@ static int transport_update_props(struct spa_bt_transport *transport,
break;
}
}
else if (strcmp(key, "State") == 0) {
else if (spa_streq(key, "State")) {
spa_bt_transport_set_state(transport, spa_bt_transport_state_from_string(value));
}
else if (strcmp(key, "Device") == 0) {
else if (spa_streq(key, "Device")) {
transport->device = spa_bt_device_find(monitor, value);
if (transport->device == NULL)
spa_log_warn(monitor->log, "could not find device %s", value);
}
}
else if (strcmp(key, "Codec") == 0) {
else if (spa_streq(key, "Codec")) {
uint8_t value;
if (type != DBUS_TYPE_BYTE)
@ -1849,7 +1850,7 @@ static int transport_update_props(struct spa_bt_transport *transport,
transport->codec = value;
}
else if (strcmp(key, "Configuration") == 0) {
else if (spa_streq(key, "Configuration")) {
DBusMessageIter iter;
uint8_t *value;
int i, len;
@ -1873,7 +1874,7 @@ static int transport_update_props(struct spa_bt_transport *transport,
transport->configuration_len = len;
}
}
else if (strcmp(key, "Volume") == 0) {
else if (spa_streq(key, "Volume")) {
uint16_t value;
struct spa_bt_transport_volume * t_volume;
@ -1898,7 +1899,7 @@ static int transport_update_props(struct spa_bt_transport *transport,
else
spa_bt_transport_volume_changed(transport);
}
else if (strcmp(key, "Delay") == 0) {
else if (spa_streq(key, "Delay")) {
uint16_t value;
if (type != DBUS_TYPE_UINT16)
@ -2011,7 +2012,7 @@ static int transport_acquire(void *data, bool optional)
m = NULL;
if (r == NULL) {
if (optional && strcmp(err.name, "org.bluez.Error.NotAvailable") == 0) {
if (optional && spa_streq(err.name, "org.bluez.Error.NotAvailable")) {
spa_log_info(monitor->log, "Failed optional acquire of unavailable transport %s",
transport->path);
}
@ -2851,7 +2852,7 @@ static int adapter_register_endpoints(struct spa_bt_adapter *a)
if (!is_a2dp_codec_enabled(monitor, codec))
continue;
if (!(codec->codec_id == A2DP_CODEC_SBC && strcmp(codec->name, "sbc") == 0))
if (!(codec->codec_id == A2DP_CODEC_SBC && spa_streq(codec->name, "sbc")))
continue;
if ((err = bluez_register_endpoint(monitor, a->path,
@ -3125,7 +3126,7 @@ static void interface_added(struct spa_bt_monitor *monitor,
{
spa_log_debug(monitor->log, "Found object %s, interface %s", object_path, interface_name);
if (strcmp(interface_name, BLUEZ_ADAPTER_INTERFACE) == 0) {
if (spa_streq(interface_name, BLUEZ_ADAPTER_INTERFACE)) {
struct spa_bt_adapter *a;
a = adapter_find(monitor, object_path);
@ -3139,13 +3140,13 @@ static void interface_added(struct spa_bt_monitor *monitor,
adapter_update_props(a, props_iter, NULL);
adapter_register_application(a);
}
else if (strcmp(interface_name, BLUEZ_PROFILE_MANAGER_INTERFACE) == 0) {
else if (spa_streq(interface_name, BLUEZ_PROFILE_MANAGER_INTERFACE)) {
if (!monitor->backend_ofono_registered && !monitor->backend_hsphfpd_registered) {
spa_bt_backend_register_profiles(monitor->backend_native);
monitor->backend_native_registered = true;
}
}
else if (strcmp(interface_name, BLUEZ_DEVICE_INTERFACE) == 0) {
else if (spa_streq(interface_name, BLUEZ_DEVICE_INTERFACE)) {
struct spa_bt_device *d;
d = spa_bt_device_find(monitor, object_path);
@ -3171,7 +3172,7 @@ static void interface_added(struct spa_bt_monitor *monitor,
d->reconnect_state = BT_DEVICE_RECONNECT_INIT;
device_start_timer(d);
}
else if (strcmp(interface_name, BLUEZ_MEDIA_ENDPOINT_INTERFACE) == 0) {
else if (spa_streq(interface_name, BLUEZ_MEDIA_ENDPOINT_INTERFACE)) {
struct spa_bt_remote_endpoint *ep;
struct spa_bt_device *d;
@ -3233,17 +3234,17 @@ static void interfaces_removed(struct spa_bt_monitor *monitor, DBusMessageIter *
spa_log_debug(monitor->log, "Found object %s, interface %s", object_path, interface_name);
if (strcmp(interface_name, BLUEZ_DEVICE_INTERFACE) == 0) {
if (spa_streq(interface_name, BLUEZ_DEVICE_INTERFACE)) {
struct spa_bt_device *d;
d = spa_bt_device_find(monitor, object_path);
if (d != NULL)
device_free(d);
} else if (strcmp(interface_name, BLUEZ_ADAPTER_INTERFACE) == 0) {
} else if (spa_streq(interface_name, BLUEZ_ADAPTER_INTERFACE)) {
struct spa_bt_adapter *a;
a = adapter_find(monitor, object_path);
if (a != NULL)
adapter_free(a);
} else if (strcmp(interface_name, BLUEZ_MEDIA_ENDPOINT_INTERFACE) == 0) {
} else if (spa_streq(interface_name, BLUEZ_MEDIA_ENDPOINT_INTERFACE)) {
struct spa_bt_remote_endpoint *ep;
ep = remote_endpoint_find(monitor, object_path);
if (ep != NULL) {
@ -3339,7 +3340,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
goto fail;
}
if (strcmp(name, BLUEZ_SERVICE) == 0) {
if (spa_streq(name, BLUEZ_SERVICE)) {
bool has_old_owner = old_owner && *old_owner;
bool has_new_owner = new_owner && *new_owner;
@ -3374,7 +3375,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
spa_log_debug(monitor->log, "Bluetooth daemon appeared");
get_managed_objects(monitor);
}
} else if (strcmp(name, OFONO_SERVICE) == 0 && monitor->backend_ofono) {
} else if (spa_streq(name, OFONO_SERVICE) && monitor->backend_ofono) {
if (old_owner && *old_owner) {
spa_log_debug(monitor->log, "oFono daemon disappeared");
monitor->backend_ofono_registered = false;
@ -3395,7 +3396,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
monitor->backend_native_registered = true;
}
}
} else if (strcmp(name, HSPHFPD_SERVICE) == 0 && monitor->backend_hsphfpd) {
} else if (spa_streq(name, HSPHFPD_SERVICE) && monitor->backend_hsphfpd) {
if (old_owner && *old_owner) {
spa_log_debug(monitor->log, "hsphfpd daemon disappeared");
spa_bt_backend_unregistered(monitor->backend_hsphfpd);
@ -3464,7 +3465,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
dbus_message_iter_next(&it[0]);
dbus_message_iter_recurse(&it[0], &it[1]);
if (strcmp(iface, BLUEZ_ADAPTER_INTERFACE) == 0) {
if (spa_streq(iface, BLUEZ_ADAPTER_INTERFACE)) {
struct spa_bt_adapter *a;
a = adapter_find(monitor, path);
@ -3477,7 +3478,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
adapter_update_props(a, &it[1], NULL);
}
else if (strcmp(iface, BLUEZ_DEVICE_INTERFACE) == 0) {
else if (spa_streq(iface, BLUEZ_DEVICE_INTERFACE)) {
struct spa_bt_device *d;
d = spa_bt_device_find(monitor, path);
@ -3490,7 +3491,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
device_update_props(d, &it[1], NULL);
}
else if (strcmp(iface, BLUEZ_MEDIA_ENDPOINT_INTERFACE) == 0) {
else if (spa_streq(iface, BLUEZ_MEDIA_ENDPOINT_INTERFACE)) {
struct spa_bt_remote_endpoint *ep;
struct spa_bt_device *d;
@ -3508,7 +3509,7 @@ static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *m, void *us
if (d)
spa_bt_device_emit_profiles_changed(d, d->profiles, d->connected_profiles);
}
else if (strcmp(iface, BLUEZ_MEDIA_TRANSPORT_INTERFACE) == 0) {
else if (spa_streq(iface, BLUEZ_MEDIA_TRANSPORT_INTERFACE)) {
struct spa_bt_transport *transport;
transport = spa_bt_transport_find(monitor, path);
@ -3631,7 +3632,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct spa_bt_monitor *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Device))
*interface = &this->device;
else
return -ENOENT;
@ -3723,17 +3724,17 @@ int spa_bt_profiles_from_json_array(const char *str)
return -EINVAL;
while (spa_json_get_string(&it_array, role_name, sizeof(role_name)) > 0) {
if (strcmp(role_name, "hsp_hs") == 0) {
if (spa_streq(role_name, "hsp_hs")) {
profiles |= SPA_BT_PROFILE_HSP_HS;
} else if (strcmp(role_name, "hsp_ag") == 0) {
} else if (spa_streq(role_name, "hsp_ag")) {
profiles |= SPA_BT_PROFILE_HSP_AG;
} else if (strcmp(role_name, "hfp_hf") == 0) {
} else if (spa_streq(role_name, "hfp_hf")) {
profiles |= SPA_BT_PROFILE_HFP_HF;
} else if (strcmp(role_name, "hfp_ag") == 0) {
} else if (spa_streq(role_name, "hfp_ag")) {
profiles |= SPA_BT_PROFILE_HFP_AG;
} else if (strcmp(role_name, "a2dp_sink") == 0) {
} else if (spa_streq(role_name, "a2dp_sink")) {
profiles |= SPA_BT_PROFILE_A2DP_SINK;
} else if (strcmp(role_name, "a2dp_source") == 0) {
} else if (spa_streq(role_name, "a2dp_source")) {
profiles |= SPA_BT_PROFILE_A2DP_SOURCE;
}
}
@ -3875,7 +3876,7 @@ impl_init(const struct spa_handle_factory *factory,
uint32_t tmp;
if ((str = spa_dict_lookup(info, "api.bluez5.connection-info")) != NULL &&
(strcmp(str, "true") == 0 || atoi(str)))
(spa_streq(str, "true") || atoi(str)))
this->connection_info_supported = true;
if ((str = spa_dict_lookup(info, "bluez5.default.rate")) != NULL &&
@ -3887,7 +3888,7 @@ impl_init(const struct spa_handle_factory *factory,
this->default_audio_info.channels = tmp;
if ((str = spa_dict_lookup(info, "bluez5.sbc-xq-support")) != NULL &&
(strcmp(str, "true") == 0 || atoi(str)))
(spa_streq(str, "true") || atoi(str)))
this->enable_sbc_xq = true;
}

View file

@ -34,6 +34,7 @@
#include <spa/utils/type.h>
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/support/loop.h>
#include <spa/support/plugin.h>
@ -980,7 +981,7 @@ static void set_initial_profile(struct impl *this)
const char *str;
if (this->bt_dev->settings != NULL) {
str = spa_dict_lookup(this->bt_dev->settings, "device.profile");
if (str != NULL && strcmp(str, "headset-head-unit") == 0 && find_hsp_hfp_profile(this))
if (str != NULL && spa_streq(str, "headset-head-unit") && find_hsp_hfp_profile(this))
return;
}
@ -1806,7 +1807,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Device))
*interface = &this->device;
else
return -ENOENT;

View file

@ -35,6 +35,7 @@
#include <spa/utils/list.h>
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/monitor/device.h>
#include <spa/node/node.h>
@ -1139,7 +1140,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -37,6 +37,7 @@
#include <spa/utils/list.h>
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/monitor/device.h>
#include <spa/node/node.h>
@ -1198,7 +1199,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -31,6 +31,7 @@
#include <spa/support/cpu.h>
#include <spa/utils/list.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
@ -707,7 +708,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -28,6 +28,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <spa/utils/string.h>
#include <spa/support/plugin.h>
#include <spa/support/log.h>
#include <spa/node/node.h>
@ -445,7 +446,7 @@ impl_get_interface(struct spa_handle *handle, const char *type, void **interface
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -28,6 +28,7 @@
#include <sys/stat.h>
#include <fcntl.h>
#include <spa/utils/string.h>
#include <spa/support/plugin.h>
#include <spa/support/log.h>
#include <spa/node/node.h>
@ -424,7 +425,7 @@ impl_get_interface(struct spa_handle *handle, const char *type, void **interface
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -34,6 +34,7 @@
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/result.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/support/loop.h>
#include <spa/support/plugin.h>
@ -168,7 +169,7 @@ static int emit_info(struct impl *this, bool full)
dinfo.change_mask = SPA_DEVICE_CHANGE_MASK_PROPS;
items[0] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_API, "jack");
items[1] = SPA_DICT_ITEM_INIT(SPA_KEY_DEVICE_NICK, "jack");
if (strcmp(this->props.server, "default") == 0)
if (spa_streq(this->props.server, "default"))
snprintf(name, sizeof(name), "JACK Client");
else
snprintf(name, sizeof(name), "JACK Client (%s)", this->props.server);
@ -365,7 +366,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Device))
*interface = &this->device;
else
return -ENOENT;

View file

@ -36,6 +36,7 @@
#include <spa/utils/list.h>
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
@ -804,7 +805,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -36,6 +36,7 @@
#include <spa/utils/list.h>
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
@ -826,7 +827,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -38,6 +38,7 @@
#include <spa/utils/type.h>
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/monitor/device.h>
#include <spa/monitor/utils.h>
@ -146,7 +147,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Device))
*interface = &this->device;
else
return -ENOENT;

View file

@ -37,6 +37,7 @@
#include <spa/support/loop.h>
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/pod/builder.h>
#include <spa/monitor/device.h>
@ -203,7 +204,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Device))
*interface = &this->device;
else
return -ENOENT;

View file

@ -36,6 +36,7 @@
#include <spa/utils/list.h>
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/monitor/device.h>
#include <spa/node/node.h>
#include <spa/node/io.h>
@ -882,7 +883,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -40,6 +40,7 @@
#include <spa/utils/type.h>
#include <spa/utils/hook.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#define NAME "cpu"
@ -205,7 +206,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_CPU) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_CPU))
*interface = &this->cpu;
else
return -ENOENT;

View file

@ -35,6 +35,7 @@
#include <spa/utils/result.h>
#include <spa/utils/type.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/support/log.h>
#include <spa/support/plugin.h>
#include <spa/support/dbus.h>
@ -437,7 +438,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_DBus) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_DBus))
*interface = &this->dbus;
else
return -ENOENT;

View file

@ -40,6 +40,7 @@
#include <spa/support/plugin.h>
#include <spa/utils/type.h>
#include <spa/utils/result.h>
#include <spa/utils/string.h>
#define NAME "evl-system"
@ -372,7 +373,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
impl = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_System) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_System))
*interface = &impl->system;
else
return -ENOENT;

View file

@ -35,6 +35,7 @@
#include <spa/support/plugin.h>
#include <spa/utils/type.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <systemd/sd-journal.h>
@ -135,7 +136,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Log) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Log))
*interface = &this->log;
else
return -ENOENT;

View file

@ -36,6 +36,7 @@
#include <spa/utils/ringbuffer.h>
#include <spa/utils/type.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#ifdef __FreeBSD__
#define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC
@ -190,7 +191,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Log) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Log))
*interface = &this->log;
else
return -ENOENT;
@ -265,11 +266,11 @@ impl_init(const struct spa_handle_factory *factory,
}
if (info) {
if ((str = spa_dict_lookup(info, SPA_KEY_LOG_TIMESTAMP)) != NULL)
this->timestamp = (strcmp(str, "true") == 0 || atoi(str) == 1);
this->timestamp = (spa_streq(str, "true") || atoi(str) == 1);
if ((str = spa_dict_lookup(info, SPA_KEY_LOG_LINE)) != NULL)
this->line = (strcmp(str, "true") == 0 || atoi(str) == 1);
this->line = (spa_streq(str, "true") || atoi(str) == 1);
if ((str = spa_dict_lookup(info, SPA_KEY_LOG_COLORS)) != NULL)
this->colors = (strcmp(str, "true") == 0 || atoi(str) == 1);
this->colors = (spa_streq(str, "true") || atoi(str) == 1);
if ((str = spa_dict_lookup(info, SPA_KEY_LOG_LEVEL)) != NULL)
this->log.level = atoi(str);
if ((str = spa_dict_lookup(info, SPA_KEY_LOG_FILE)) != NULL) {

View file

@ -39,6 +39,7 @@
#include <spa/utils/result.h>
#include <spa/utils/type.h>
#include <spa/utils/ringbuffer.h>
#include <spa/utils/string.h>
#define NAME "loop"
@ -706,11 +707,11 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
impl = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Loop) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Loop))
*interface = &impl->loop;
else if (strcmp(type, SPA_TYPE_INTERFACE_LoopControl) == 0)
else if (spa_streq(type, SPA_TYPE_INTERFACE_LoopControl))
*interface = &impl->control;
else if (strcmp(type, SPA_TYPE_INTERFACE_LoopUtils) == 0)
else if (spa_streq(type, SPA_TYPE_INTERFACE_LoopUtils))
*interface = &impl->utils;
else
return -ENOENT;

View file

@ -32,6 +32,7 @@
#include <spa/support/log.h>
#include <spa/support/loop.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/node/keys.h>
#include <spa/node/io.h>
@ -267,7 +268,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;
@ -359,7 +360,7 @@ impl_init(const struct spa_handle_factory *factory,
if (info) {
if ((str = spa_dict_lookup(info, "node.freewheel")) != NULL)
this->props.freewheel = (strcmp(str, "true") == 0 || atoi(str) == 1);
this->props.freewheel = (spa_streq(str, "true") || atoi(str) == 1);
}
spa_loop_add_source(this->data_loop, &this->timer_source);

View file

@ -35,6 +35,7 @@
#include <spa/utils/list.h>
#include <spa/utils/keys.h>
#include <spa/utils/json.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
@ -695,7 +696,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;
@ -728,7 +729,7 @@ static uint32_t channel_from_name(const char *name)
{
int i;
for (i = 0; spa_type_audio_channel[i].name; i++) {
if (strcmp(name, spa_debug_type_short_name(spa_type_audio_channel[i].name)) == 0)
if (spa_streq(name, spa_debug_type_short_name(spa_type_audio_channel[i].name)))
return spa_type_audio_channel[i].type;
}
return SPA_AUDIO_CHANNEL_UNKNOWN;

View file

@ -39,6 +39,7 @@
#include <spa/support/plugin.h>
#include <spa/utils/type.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#define NAME "system"
@ -301,7 +302,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
impl = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_System) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_System))
*interface = &impl->system;
else
return -ENOENT;

View file

@ -32,6 +32,7 @@
#include <spa/support/log.h>
#include <spa/support/loop.h>
#include <spa/utils/list.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
@ -688,7 +689,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -32,6 +32,7 @@
#include <spa/support/log.h>
#include <spa/support/loop.h>
#include <spa/utils/list.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
@ -721,7 +722,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -34,6 +34,7 @@
#include <spa/support/loop.h>
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/pod/builder.h>
#include <spa/monitor/device.h>
@ -196,7 +197,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Device))
*interface = &this->device;
else
return -ENOENT;

View file

@ -35,6 +35,7 @@
#include <spa/utils/list.h>
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/monitor/device.h>
#include <spa/node/node.h>
#include <spa/node/io.h>
@ -883,7 +884,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -500,10 +500,10 @@ static void impl_on_fd_events(struct spa_source *source)
start_inotify(this);
if (strcmp(action, "add") == 0 ||
strcmp(action, "change") == 0) {
if (spa_streq(action, "add") ||
spa_streq(action, "change")) {
process_device(this, ACTION_ADD, dev);
} else if (strcmp(action, "remove") == 0) {
} else if (spa_streq(action, "remove")) {
process_device(this, ACTION_REMOVE, dev);
}
udev_device_unref(dev);
@ -653,7 +653,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Device) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Device))
*interface = &this->device;
else
return -ENOENT;

View file

@ -31,6 +31,7 @@
#include <spa/node/keys.h>
#include <spa/utils/result.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/buffer/alloc.h>
#include <spa/pod/parser.h>
#include <spa/pod/filter.h>
@ -336,7 +337,7 @@ static void follower_info(void *data, const struct spa_node_info *info)
if (info->props) {
if ((str = spa_dict_lookup(info->props, SPA_KEY_NODE_DRIVER)) != NULL)
this->driver = strcmp(str, "true") == 0 || atoi(str) == 1;
this->driver = spa_streq(str, "true") || atoi(str) == 1;
}
}
@ -810,7 +811,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -33,6 +33,7 @@
#include <spa/support/loop.h>
#include <spa/utils/list.h>
#include <spa/utils/keys.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
@ -828,7 +829,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -29,6 +29,7 @@
#include <spa/support/plugin.h>
#include <spa/support/log.h>
#include <spa/utils/list.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
@ -746,7 +747,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;

View file

@ -34,6 +34,7 @@
#include <spa/utils/list.h>
#include <spa/utils/keys.h>
#include <spa/utils/names.h>
#include <spa/utils/string.h>
#include <spa/node/node.h>
#include <spa/node/utils.h>
#include <spa/node/io.h>
@ -844,7 +845,7 @@ static int impl_get_interface(struct spa_handle *handle, const char *type, void
this = (struct impl *) handle;
if (strcmp(type, SPA_TYPE_INTERFACE_Node) == 0)
if (spa_streq(type, SPA_TYPE_INTERFACE_Node))
*interface = &this->node;
else
return -ENOENT;