mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
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:
parent
d8a9534a9a
commit
7697ed0757
130 changed files with 817 additions and 675 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue