mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05: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
|
|
@ -22,6 +22,8 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <spa/utils/string.h>
|
||||
|
||||
struct selector {
|
||||
bool (*type) (struct pw_manager_object *o);
|
||||
uint32_t id;
|
||||
|
|
@ -64,7 +66,7 @@ static struct pw_manager_object *select_object(struct pw_manager *m,
|
|||
s->accumulate(s, o);
|
||||
if (o->props && s->key != NULL && s->value != NULL &&
|
||||
(str = pw_properties_get(o->props, s->key)) != NULL &&
|
||||
strcmp(str, s->value) == 0)
|
||||
spa_streq(str, s->value))
|
||||
return o;
|
||||
if (s->value != NULL && (uint32_t)atoi(s->value) == o->id)
|
||||
return o;
|
||||
|
|
@ -192,9 +194,9 @@ static uint32_t collect_profile_info(struct pw_manager_object *card, struct card
|
|||
SPA_POD_Int(&count)) < 0)
|
||||
continue;
|
||||
|
||||
if (strcmp(class, "Audio/Sink") == 0)
|
||||
if (spa_streq(class, "Audio/Sink"))
|
||||
pi->n_sinks += count;
|
||||
else if (strcmp(class, "Audio/Source") == 0)
|
||||
else if (spa_streq(class, "Audio/Source"))
|
||||
pi->n_sources += count;
|
||||
}
|
||||
}
|
||||
|
|
@ -223,7 +225,7 @@ static uint32_t find_profile_id(struct pw_manager_object *card, const char *name
|
|||
SPA_PARAM_PROFILE_name, SPA_POD_String(&test_name)) < 0)
|
||||
continue;
|
||||
|
||||
if (strcmp(test_name, name) == 0)
|
||||
if (spa_streq(test_name, name))
|
||||
return id;
|
||||
|
||||
}
|
||||
|
|
@ -409,9 +411,9 @@ static uint32_t collect_port_info(struct pw_manager_object *card, struct card_in
|
|||
SPA_POD_String(&value),
|
||||
NULL) < 0)
|
||||
break;
|
||||
if (strcmp(key, "port.availability-group") == 0)
|
||||
if (spa_streq(key, "port.availability-group"))
|
||||
pi->availability_group = value;
|
||||
else if (strcmp(key, "port.type") == 0)
|
||||
else if (spa_streq(key, "port.type"))
|
||||
pi->type = port_type_value(value);
|
||||
}
|
||||
spa_pod_parser_pop(&prs, &f[0]);
|
||||
|
|
@ -443,7 +445,7 @@ static uint32_t find_port_id(struct pw_manager_object *card, uint32_t direction,
|
|||
continue;
|
||||
if (dir != direction)
|
||||
continue;
|
||||
if (strcmp(name, port_name) == 0)
|
||||
if (spa_streq(name, port_name))
|
||||
return id;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
#define EXT_STREAM_RESTORE_VERSION 1
|
||||
|
||||
#include <spa/utils/string.h>
|
||||
|
||||
static const struct extension_sub ext_stream_restore[];
|
||||
|
||||
static int do_extension_stream_restore_test(struct client *client, uint32_t command, uint32_t tag, struct message *m)
|
||||
|
|
@ -139,15 +141,15 @@ static int do_extension_stream_restore_read(struct client *client, uint32_t comm
|
|||
continue;
|
||||
|
||||
while (spa_json_get_string(&it[1], key, sizeof(key)-1) > 0) {
|
||||
if (strcmp(key, "volume") == 0) {
|
||||
if (spa_streq(key, "volume")) {
|
||||
if (spa_json_get_float(&it[1], &volume) <= 0)
|
||||
continue;
|
||||
}
|
||||
else if (strcmp(key, "mute") == 0) {
|
||||
else if (spa_streq(key, "mute")) {
|
||||
if (spa_json_get_bool(&it[1], &mute) <= 0)
|
||||
continue;
|
||||
}
|
||||
else if (strcmp(key, "volumes") == 0) {
|
||||
else if (spa_streq(key, "volumes")) {
|
||||
vol = VOLUME_INIT;
|
||||
if (spa_json_enter_array(&it[1], &it[2]) <= 0)
|
||||
continue;
|
||||
|
|
@ -157,7 +159,7 @@ static int do_extension_stream_restore_read(struct client *client, uint32_t comm
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if (strcmp(key, "channels") == 0) {
|
||||
else if (spa_streq(key, "channels")) {
|
||||
if (spa_json_enter_array(&it[1], &it[2]) <= 0)
|
||||
continue;
|
||||
|
||||
|
|
@ -168,7 +170,7 @@ static int do_extension_stream_restore_read(struct client *client, uint32_t comm
|
|||
map.map[map.channels] = channel_name2id(chname);
|
||||
}
|
||||
}
|
||||
else if (strcmp(key, "target-node") == 0) {
|
||||
else if (spa_streq(key, "target-node")) {
|
||||
if (spa_json_get_string(&it[1], device_name, sizeof(device_name)) <= 0)
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <spa/utils/string.h>
|
||||
|
||||
struct extension_sub {
|
||||
const char *name;
|
||||
uint32_t command;
|
||||
|
|
@ -57,7 +59,7 @@ static struct extension *find_extension(uint32_t idx, const char *name)
|
|||
uint32_t i;
|
||||
for (i = 0; i < SPA_N_ELEMENTS(extensions); i++) {
|
||||
if (idx == extensions[i].idx ||
|
||||
(name && strcmp(name, extensions[i].name) == 0))
|
||||
(name && spa_streq(name, extensions[i].name)))
|
||||
return &extensions[i];
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
#include "format.h"
|
||||
|
||||
#include <spa/utils/string.h>
|
||||
|
||||
static const struct format audio_formats[] = {
|
||||
[SAMPLE_U8] = { SAMPLE_U8, SPA_AUDIO_FORMAT_U8, "u8", 1 },
|
||||
[SAMPLE_ALAW] = { SAMPLE_ALAW, SPA_AUDIO_FORMAT_UNKNOWN, "aLaw", 1 },
|
||||
|
|
@ -81,7 +83,7 @@ uint32_t format_name2id(const char *name)
|
|||
{
|
||||
int i;
|
||||
for (i = 0; spa_type_audio_format[i].name; i++) {
|
||||
if (strcmp(name, spa_debug_type_short_name(spa_type_audio_format[i].name)) == 0)
|
||||
if (spa_streq(name, spa_debug_type_short_name(spa_type_audio_format[i].name)))
|
||||
return spa_type_audio_format[i].type;
|
||||
}
|
||||
return SPA_AUDIO_CHANNEL_UNKNOWN;
|
||||
|
|
@ -287,20 +289,20 @@ void channel_map_parse(const char *str, struct channel_map *map)
|
|||
const char *p = str;
|
||||
size_t len;
|
||||
|
||||
if (strcmp(p, "stereo") == 0) {
|
||||
if (spa_streq(p, "stereo")) {
|
||||
*map = (struct channel_map) {
|
||||
.channels = 2,
|
||||
.map[0] = SPA_AUDIO_CHANNEL_FL,
|
||||
.map[1] = SPA_AUDIO_CHANNEL_FR,
|
||||
};
|
||||
} else if (strcmp(p, "surround-21") == 0) {
|
||||
} else if (spa_streq(p, "surround-21")) {
|
||||
*map = (struct channel_map) {
|
||||
.channels = 3,
|
||||
.map[0] = SPA_AUDIO_CHANNEL_FL,
|
||||
.map[1] = SPA_AUDIO_CHANNEL_FR,
|
||||
.map[2] = SPA_AUDIO_CHANNEL_LFE,
|
||||
};
|
||||
} else if (strcmp(p, "surround-40") == 0) {
|
||||
} else if (spa_streq(p, "surround-40")) {
|
||||
*map = (struct channel_map) {
|
||||
.channels = 4,
|
||||
.map[0] = SPA_AUDIO_CHANNEL_FL,
|
||||
|
|
@ -308,7 +310,7 @@ void channel_map_parse(const char *str, struct channel_map *map)
|
|||
.map[2] = SPA_AUDIO_CHANNEL_RL,
|
||||
.map[3] = SPA_AUDIO_CHANNEL_RR,
|
||||
};
|
||||
} else if (strcmp(p, "surround-41") == 0) {
|
||||
} else if (spa_streq(p, "surround-41")) {
|
||||
*map = (struct channel_map) {
|
||||
.channels = 5,
|
||||
.map[0] = SPA_AUDIO_CHANNEL_FL,
|
||||
|
|
@ -317,7 +319,7 @@ void channel_map_parse(const char *str, struct channel_map *map)
|
|||
.map[3] = SPA_AUDIO_CHANNEL_RR,
|
||||
.map[4] = SPA_AUDIO_CHANNEL_LFE,
|
||||
};
|
||||
} else if (strcmp(p, "surround-50") == 0) {
|
||||
} else if (spa_streq(p, "surround-50")) {
|
||||
*map = (struct channel_map) {
|
||||
.channels = 5,
|
||||
.map[0] = SPA_AUDIO_CHANNEL_FL,
|
||||
|
|
@ -326,7 +328,7 @@ void channel_map_parse(const char *str, struct channel_map *map)
|
|||
.map[3] = SPA_AUDIO_CHANNEL_RR,
|
||||
.map[4] = SPA_AUDIO_CHANNEL_FC,
|
||||
};
|
||||
} else if (strcmp(p, "surround-51") == 0) {
|
||||
} else if (spa_streq(p, "surround-51")) {
|
||||
*map = (struct channel_map) {
|
||||
.channels = 6,
|
||||
.map[0] = SPA_AUDIO_CHANNEL_FL,
|
||||
|
|
@ -336,7 +338,7 @@ void channel_map_parse(const char *str, struct channel_map *map)
|
|||
.map[4] = SPA_AUDIO_CHANNEL_FC,
|
||||
.map[5] = SPA_AUDIO_CHANNEL_LFE,
|
||||
};
|
||||
} else if (strcmp(p, "surround-71") == 0) {
|
||||
} else if (spa_streq(p, "surround-71")) {
|
||||
*map = (struct channel_map) {
|
||||
.channels = 8,
|
||||
.map[0] = SPA_AUDIO_CHANNEL_FL,
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include <spa/pod/iter.h>
|
||||
#include <spa/pod/parser.h>
|
||||
#include <spa/utils/result.h>
|
||||
#include <spa/utils/string.h>
|
||||
#include <extensions/metadata.h>
|
||||
|
||||
#define MAX_PARAMS 32
|
||||
|
|
@ -540,7 +541,7 @@ static const struct object_info *find_info(const char *type, uint32_t version)
|
|||
{
|
||||
size_t i;
|
||||
for (i = 0; i < SPA_N_ELEMENTS(objects); i++) {
|
||||
if (strcmp(objects[i]->type, type) == 0 &&
|
||||
if (spa_streq(objects[i]->type, type) &&
|
||||
objects[i]->version <= version)
|
||||
return objects[i];
|
||||
}
|
||||
|
|
@ -810,7 +811,7 @@ static struct object_data *object_find_data(struct object *o, const char *id)
|
|||
{
|
||||
struct object_data *d;
|
||||
spa_list_for_each(d, &o->data_list, link) {
|
||||
if (strcmp(d->id, id) == 0)
|
||||
if (spa_streq(d->id, id))
|
||||
return d;
|
||||
}
|
||||
return NULL;
|
||||
|
|
@ -847,57 +848,57 @@ int pw_manager_sync(struct pw_manager *manager)
|
|||
|
||||
bool pw_manager_object_is_client(struct pw_manager_object *o)
|
||||
{
|
||||
return strcmp(o->type, PW_TYPE_INTERFACE_Client) == 0;
|
||||
return spa_streq(o->type, PW_TYPE_INTERFACE_Client);
|
||||
}
|
||||
|
||||
bool pw_manager_object_is_module(struct pw_manager_object *o)
|
||||
{
|
||||
return strcmp(o->type, PW_TYPE_INTERFACE_Module) == 0;
|
||||
return spa_streq(o->type, PW_TYPE_INTERFACE_Module);
|
||||
}
|
||||
|
||||
bool pw_manager_object_is_card(struct pw_manager_object *o)
|
||||
{
|
||||
const char *str;
|
||||
return strcmp(o->type, PW_TYPE_INTERFACE_Device) == 0 &&
|
||||
return spa_streq(o->type, PW_TYPE_INTERFACE_Device) &&
|
||||
o->props != NULL &&
|
||||
(str = pw_properties_get(o->props, PW_KEY_MEDIA_CLASS)) != NULL &&
|
||||
strcmp(str, "Audio/Device") == 0;
|
||||
spa_streq(str, "Audio/Device");
|
||||
}
|
||||
|
||||
bool pw_manager_object_is_sink(struct pw_manager_object *o)
|
||||
{
|
||||
const char *str;
|
||||
return strcmp(o->type, PW_TYPE_INTERFACE_Node) == 0 &&
|
||||
return spa_streq(o->type, PW_TYPE_INTERFACE_Node) &&
|
||||
o->props != NULL &&
|
||||
(str = pw_properties_get(o->props, PW_KEY_MEDIA_CLASS)) != NULL &&
|
||||
(strcmp(str, "Audio/Sink") == 0 || strcmp(str, "Audio/Duplex") == 0);
|
||||
(spa_streq(str, "Audio/Sink") || spa_streq(str, "Audio/Duplex"));
|
||||
}
|
||||
|
||||
bool pw_manager_object_is_source(struct pw_manager_object *o)
|
||||
{
|
||||
const char *str;
|
||||
return strcmp(o->type, PW_TYPE_INTERFACE_Node) == 0 &&
|
||||
return spa_streq(o->type, PW_TYPE_INTERFACE_Node) &&
|
||||
o->props != NULL &&
|
||||
(str = pw_properties_get(o->props, PW_KEY_MEDIA_CLASS)) != NULL &&
|
||||
(strcmp(str, "Audio/Source") == 0 ||
|
||||
strcmp(str, "Audio/Duplex") == 0 ||
|
||||
strcmp(str, "Audio/Source/Virtual") == 0);
|
||||
(spa_streq(str, "Audio/Source") ||
|
||||
spa_streq(str, "Audio/Duplex") ||
|
||||
spa_streq(str, "Audio/Source/Virtual"));
|
||||
}
|
||||
|
||||
bool pw_manager_object_is_monitor(struct pw_manager_object *o)
|
||||
{
|
||||
const char *str;
|
||||
return strcmp(o->type, PW_TYPE_INTERFACE_Node) == 0 &&
|
||||
return spa_streq(o->type, PW_TYPE_INTERFACE_Node) &&
|
||||
o->props != NULL &&
|
||||
(str = pw_properties_get(o->props, PW_KEY_MEDIA_CLASS)) != NULL &&
|
||||
(strcmp(str, "Audio/Sink") == 0);
|
||||
(spa_streq(str, "Audio/Sink"));
|
||||
}
|
||||
|
||||
bool pw_manager_object_is_virtual(struct pw_manager_object *o)
|
||||
{
|
||||
const char *str;
|
||||
struct pw_node_info *info;
|
||||
return strcmp(o->type, PW_TYPE_INTERFACE_Node) == 0 &&
|
||||
return spa_streq(o->type, PW_TYPE_INTERFACE_Node) &&
|
||||
(info = o->info) != NULL && info->props != NULL &&
|
||||
(str = spa_dict_lookup(info->props, PW_KEY_NODE_VIRTUAL)) != NULL &&
|
||||
pw_properties_parse_bool(str);
|
||||
|
|
@ -911,19 +912,19 @@ bool pw_manager_object_is_source_or_monitor(struct pw_manager_object *o)
|
|||
bool pw_manager_object_is_sink_input(struct pw_manager_object *o)
|
||||
{
|
||||
const char *str;
|
||||
return strcmp(o->type, PW_TYPE_INTERFACE_Node) == 0 &&
|
||||
return spa_streq(o->type, PW_TYPE_INTERFACE_Node) &&
|
||||
o->props != NULL &&
|
||||
(str = pw_properties_get(o->props, PW_KEY_MEDIA_CLASS)) != NULL &&
|
||||
strcmp(str, "Stream/Output/Audio") == 0;
|
||||
spa_streq(str, "Stream/Output/Audio");
|
||||
}
|
||||
|
||||
bool pw_manager_object_is_source_output(struct pw_manager_object *o)
|
||||
{
|
||||
const char *str;
|
||||
return strcmp(o->type, PW_TYPE_INTERFACE_Node) == 0 &&
|
||||
return spa_streq(o->type, PW_TYPE_INTERFACE_Node) &&
|
||||
o->props != NULL &&
|
||||
(str = pw_properties_get(o->props, PW_KEY_MEDIA_CLASS)) != NULL &&
|
||||
strcmp(str, "Stream/Input/Audio") == 0;
|
||||
spa_streq(str, "Stream/Input/Audio");
|
||||
}
|
||||
|
||||
bool pw_manager_object_is_recordable(struct pw_manager_object *o)
|
||||
|
|
@ -933,5 +934,5 @@ bool pw_manager_object_is_recordable(struct pw_manager_object *o)
|
|||
|
||||
bool pw_manager_object_is_link(struct pw_manager_object *o)
|
||||
{
|
||||
return strcmp(o->type, PW_TYPE_INTERFACE_Link) == 0;
|
||||
return spa_streq(o->type, PW_TYPE_INTERFACE_Link);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#include <spa/utils/string.h>
|
||||
|
||||
static int bluez_card_object_message_handler(struct pw_manager *m, struct pw_manager_object *o, const char *message, const char *params, char **response)
|
||||
{
|
||||
struct transport_codec_info codecs[64];
|
||||
|
|
@ -10,7 +12,7 @@ static int bluez_card_object_message_handler(struct pw_manager *m, struct pw_man
|
|||
if (n_codecs == 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (strcmp(message, "switch-codec") == 0) {
|
||||
if (spa_streq(message, "switch-codec")) {
|
||||
regex_t re;
|
||||
regmatch_t matches[2];
|
||||
char *codec;
|
||||
|
|
@ -47,7 +49,7 @@ static int bluez_card_object_message_handler(struct pw_manager *m, struct pw_man
|
|||
pw_device_set_param((struct pw_device *)o->proxy,
|
||||
SPA_PARAM_Props, 0, param);
|
||||
return 0;
|
||||
} else if (strcmp(message, "list-codecs") == 0) {
|
||||
} else if (spa_streq(message, "list-codecs")) {
|
||||
uint32_t i;
|
||||
FILE *r;
|
||||
size_t size;
|
||||
|
|
@ -64,7 +66,7 @@ static int bluez_card_object_message_handler(struct pw_manager *m, struct pw_man
|
|||
fputc('}', r);
|
||||
|
||||
return fclose(r) ? -errno : 0;
|
||||
} else if (strcmp(message, "get-codec") == 0) {
|
||||
} else if (spa_streq(message, "get-codec")) {
|
||||
if (active == SPA_ID_INVALID)
|
||||
*response = strdup("{none}");
|
||||
else
|
||||
|
|
@ -79,7 +81,7 @@ static int core_object_message_handler(struct pw_manager *m, struct pw_manager_o
|
|||
{
|
||||
pw_log_debug(NAME "core %p object message:'%s' params:'%s'", o, message, params);
|
||||
|
||||
if (strcmp(message, "list-handlers") == 0) {
|
||||
if (spa_streq(message, "list-handlers")) {
|
||||
FILE *r;
|
||||
size_t size;
|
||||
|
||||
|
|
@ -112,7 +114,7 @@ static void register_object_message_handlers(struct pw_manager_object *o)
|
|||
|
||||
if (pw_manager_object_is_card(o) && o->props != NULL &&
|
||||
(str = pw_properties_get(o->props, PW_KEY_DEVICE_API)) != NULL &&
|
||||
strcmp(str, "bluez5") == 0) {
|
||||
spa_streq(str, "bluez5")) {
|
||||
str = pw_properties_get(o->props, PW_KEY_DEVICE_NAME);
|
||||
if (str) {
|
||||
free(o->message_object_path);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@
|
|||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <spa/utils/string.h>
|
||||
|
||||
#define VOLUME_MUTED ((uint32_t) 0U)
|
||||
#define VOLUME_NORM ((uint32_t) 0x10000U)
|
||||
#define VOLUME_MAX ((uint32_t) UINT32_MAX/2)
|
||||
|
|
@ -82,8 +84,8 @@ static inline const struct str_map *str_map_find(const struct str_map *map, cons
|
|||
{
|
||||
uint32_t i;
|
||||
for (i = 0; map[i].pw_str; i++)
|
||||
if ((pw && strcmp(map[i].pw_str, pw) == 0) ||
|
||||
(pa && strcmp(map[i].pa_str, pa) == 0))
|
||||
if ((pw && spa_streq(map[i].pw_str, pw)) ||
|
||||
(pa && spa_streq(map[i].pa_str, pa)))
|
||||
return &map[i];
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -569,9 +571,9 @@ static void add_stream_group(struct message *m, struct spa_dict *dict, const cha
|
|||
|
||||
if (media_class == NULL)
|
||||
return;
|
||||
if (strcmp(media_class, "Stream/Output/Audio") == 0)
|
||||
if (spa_streq(media_class, "Stream/Output/Audio"))
|
||||
prefix = "sink-input";
|
||||
else if (strcmp(media_class, "Stream/Input/Audio") == 0)
|
||||
else if (spa_streq(media_class, "Stream/Input/Audio"))
|
||||
prefix = "source-output";
|
||||
else
|
||||
return;
|
||||
|
|
@ -614,9 +616,9 @@ static void write_dict(struct message *m, struct spa_dict *dict, bool remap)
|
|||
(map = str_map_find(map->child, val, NULL)) != NULL)
|
||||
val = map->pa_str;
|
||||
}
|
||||
if (strcmp(key, "media.class") == 0)
|
||||
if (spa_streq(key, "media.class"))
|
||||
media_class = val;
|
||||
if (strcmp(key, "media.role") == 0)
|
||||
if (spa_streq(key, "media.role"))
|
||||
media_role = val;
|
||||
|
||||
write_string(m, key);
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@
|
|||
|
||||
#include "module.h"
|
||||
|
||||
#include <spa/utils/string.h>
|
||||
|
||||
static int module_unload(struct client *client, struct module *module);
|
||||
|
||||
static void on_module_unload(void *obj, void *data, int res, uint32_t id)
|
||||
|
|
@ -231,7 +233,7 @@ static const struct module_info *find_module_info(const char *name)
|
|||
{
|
||||
int i;
|
||||
for (i = 0; module_list[i].name != NULL; i++) {
|
||||
if (strcmp(module_list[i].name, name) == 0)
|
||||
if (spa_streq(module_list[i].name, name))
|
||||
return &module_list[i];
|
||||
}
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -62,6 +62,7 @@
|
|||
|
||||
#include <spa/support/cpu.h>
|
||||
#include <spa/utils/result.h>
|
||||
#include <spa/utils/string.h>
|
||||
#include <spa/debug/dict.h>
|
||||
#include <spa/debug/mem.h>
|
||||
#include <spa/debug/types.h>
|
||||
|
|
@ -147,7 +148,7 @@ static struct sample *find_sample(struct impl *impl, uint32_t idx, const char *n
|
|||
pw_array_for_each(item, &impl->samples.items) {
|
||||
struct sample *s = item->data;
|
||||
if (!pw_map_item_is_free(item) &&
|
||||
strcmp(s->name, name) == 0)
|
||||
spa_streq(s->name, name))
|
||||
return s;
|
||||
}
|
||||
return NULL;
|
||||
|
|
@ -726,11 +727,11 @@ static void send_default_change_subscribe_event(struct client *client, bool sink
|
|||
static void handle_metadata(struct client *client, struct pw_manager_object *old,
|
||||
struct pw_manager_object *new, const char *name)
|
||||
{
|
||||
if (strcmp(name, "default") == 0) {
|
||||
if (spa_streq(name, "default")) {
|
||||
if (client->metadata_default == old)
|
||||
client->metadata_default = new;
|
||||
}
|
||||
else if (strcmp(name, "route-settings") == 0) {
|
||||
else if (spa_streq(name, "route-settings")) {
|
||||
if (client->metadata_routes == old)
|
||||
client->metadata_routes = new;
|
||||
}
|
||||
|
|
@ -743,7 +744,7 @@ static void manager_added(void *data, struct pw_manager_object *o)
|
|||
|
||||
register_object_message_handlers(o);
|
||||
|
||||
if (strcmp(o->type, PW_TYPE_INTERFACE_Metadata) == 0) {
|
||||
if (spa_streq(o->type, PW_TYPE_INTERFACE_Metadata)) {
|
||||
if (o->props != NULL &&
|
||||
(str = pw_properties_get(o->props, PW_KEY_METADATA_NAME)) != NULL)
|
||||
handle_metadata(client, NULL, o, str);
|
||||
|
|
@ -774,7 +775,7 @@ static void manager_removed(void *data, struct pw_manager_object *o)
|
|||
|
||||
send_default_change_subscribe_event(client, pw_manager_object_is_sink(o), pw_manager_object_is_source_or_monitor(o));
|
||||
|
||||
if (strcmp(o->type, PW_TYPE_INTERFACE_Metadata) == 0) {
|
||||
if (spa_streq(o->type, PW_TYPE_INTERFACE_Metadata)) {
|
||||
if (o->props != NULL &&
|
||||
(str = pw_properties_get(o->props, PW_KEY_METADATA_NAME)) != NULL)
|
||||
handle_metadata(client, o, NULL, str);
|
||||
|
|
@ -792,7 +793,7 @@ static int json_object_find(const char *obj, const char *key, char *value, size_
|
|||
return -EINVAL;
|
||||
|
||||
while (spa_json_get_string(&it[1], k, sizeof(k)-1) > 0) {
|
||||
if (strcmp(k, key) == 0) {
|
||||
if (spa_streq(k, key)) {
|
||||
if (spa_json_get_string(&it[1], value, len) <= 0)
|
||||
continue;
|
||||
return 0;
|
||||
|
|
@ -825,7 +826,7 @@ static void manager_metadata(void *data, struct pw_manager_object *o,
|
|||
if (subject == PW_ID_CORE && o == client->metadata_default) {
|
||||
char name[1024];
|
||||
|
||||
if (key == NULL || strcmp(key, "default.audio.sink") == 0) {
|
||||
if (key == NULL || spa_streq(key, "default.audio.sink")) {
|
||||
if (value != NULL) {
|
||||
if (json_object_find(value,
|
||||
"name", name, sizeof(name)) < 0)
|
||||
|
|
@ -838,7 +839,7 @@ static void manager_metadata(void *data, struct pw_manager_object *o,
|
|||
client->default_sink = value ? strdup(value) : NULL;
|
||||
}
|
||||
}
|
||||
if (key == NULL || strcmp(key, "default.audio.source") == 0) {
|
||||
if (key == NULL || spa_streq(key, "default.audio.source")) {
|
||||
if (value != NULL) {
|
||||
if (json_object_find(value,
|
||||
"name", name, sizeof(name)) < 0)
|
||||
|
|
@ -2597,7 +2598,7 @@ static struct pw_manager_object *find_device(struct client *client,
|
|||
if (pw_endswith(name, ".monitor")) {
|
||||
name = strndupa(name, strlen(name)-8);
|
||||
monitor = true;
|
||||
} else if (strcmp(name, DEFAULT_MONITOR) == 0) {
|
||||
} else if (spa_streq(name, DEFAULT_MONITOR)) {
|
||||
name = NULL;
|
||||
monitor = true;
|
||||
}
|
||||
|
|
@ -2626,8 +2627,8 @@ static struct pw_manager_object *find_device(struct client *client,
|
|||
def = DEFAULT_SOURCE;
|
||||
}
|
||||
if (id == SPA_ID_INVALID &&
|
||||
(sel.value == NULL || strcmp(sel.value, def) == 0 ||
|
||||
strcmp(sel.value, "0") == 0))
|
||||
(sel.value == NULL || spa_streq(sel.value, def) ||
|
||||
spa_streq(sel.value, "0")))
|
||||
sel.value = get_default(client, sink);
|
||||
|
||||
return select_object(client->manager, &sel);
|
||||
|
|
@ -4412,7 +4413,7 @@ static int do_get_info(struct client *client, uint32_t command, uint32_t tag, st
|
|||
|
||||
if (command == COMMAND_GET_SINK_INFO || command == COMMAND_GET_SOURCE_INFO) {
|
||||
if ((sel.value == NULL && (sel.id == SPA_ID_INVALID || sel.id == 0)) ||
|
||||
(sel.value != NULL && (strcmp(sel.value, def) == 0 || strcmp(sel.value, "0") == 0)))
|
||||
(sel.value != NULL && (spa_streq(sel.value, def) || spa_streq(sel.value, "0"))))
|
||||
sel.value = get_default(client, command == COMMAND_GET_SINK_INFO);
|
||||
} else {
|
||||
if (sel.value == NULL && sel.id == SPA_ID_INVALID)
|
||||
|
|
@ -5144,7 +5145,7 @@ static int do_send_object_message(struct client *client, uint32_t command, uint3
|
|||
res = -ENOENT;
|
||||
|
||||
spa_list_for_each(o, &manager->object_list, link) {
|
||||
if (o->message_object_path && strcmp(o->message_object_path, path) == 0) {
|
||||
if (o->message_object_path && spa_streq(o->message_object_path, path)) {
|
||||
if (o->message_handler)
|
||||
res = o->message_handler(manager, o, message, params, &response);
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue