treewide: replace !strcmp() 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:40:50 +10:00
parent 7697ed0757
commit 95a84e797a
28 changed files with 239 additions and 221 deletions

View file

@ -167,17 +167,17 @@ sf_str_to_fmt(const char *str)
if (!str)
return -1;
if (!strcmp(str, "s8"))
if (spa_streq(str, "s8"))
return SF_FORMAT_PCM_S8;
if (!strcmp(str, "s16"))
if (spa_streq(str, "s16"))
return SF_FORMAT_PCM_16;
if (!strcmp(str, "s24"))
if (spa_streq(str, "s24"))
return SF_FORMAT_PCM_24;
if (!strcmp(str, "s32"))
if (spa_streq(str, "s32"))
return SF_FORMAT_PCM_32;
if (!strcmp(str, "f32"))
if (spa_streq(str, "f32"))
return SF_FORMAT_FLOAT;
if (!strcmp(str, "f64"))
if (spa_streq(str, "f64"))
return SF_FORMAT_DOUBLE;
return -1;
@ -742,9 +742,9 @@ static void registry_event_global(void *userdata, uint32_t id,
/* get allowed mode from the media class */
/* TODO extend to something else besides Audio/Source|Sink */
if (!strcmp(media_class, "Audio/Source"))
if (spa_streq(media_class, "Audio/Source"))
mode = mode_record;
else if (!strcmp(media_class, "Audio/Sink"))
else if (spa_streq(media_class, "Audio/Sink"))
mode = mode_playback;
/* modes must match */
@ -1029,7 +1029,7 @@ static void show_usage(const char *name, bool is_error)
DEFAULT_VOLUME,
DEFAULT_QUALITY);
if (!strcmp(name, "pw-cat")) {
if (spa_streq(name, "pw-cat")) {
fputs(
_(" -p, --playback Playback mode\n"
" -r, --record Recording mode\n"
@ -1292,15 +1292,15 @@ static int setup_sndfile(struct data *data)
s++;
if (!*s)
data->latency_unit = unit_samples;
else if (!strcmp(s, "none"))
else if (spa_streq(s, "none"))
data->latency_unit = unit_none;
else if (!strcmp(s, "s") || !strcmp(s, "sec") || !strcmp(s, "secs"))
else if (spa_streq(s, "s") || spa_streq(s, "sec") || spa_streq(s, "secs"))
data->latency_unit = unit_sec;
else if (!strcmp(s, "ms") || !strcmp(s, "msec") || !strcmp(s, "msecs"))
else if (spa_streq(s, "ms") || spa_streq(s, "msec") || spa_streq(s, "msecs"))
data->latency_unit = unit_msec;
else if (!strcmp(s, "us") || !strcmp(s, "usec") || !strcmp(s, "usecs"))
else if (spa_streq(s, "us") || spa_streq(s, "usec") || spa_streq(s, "usecs"))
data->latency_unit = unit_usec;
else if (!strcmp(s, "ns") || !strcmp(s, "nsec") || !strcmp(s, "nsecs"))
else if (spa_streq(s, "ns") || spa_streq(s, "nsec") || spa_streq(s, "nsecs"))
data->latency_unit = unit_nsec;
else {
fprintf(stderr, "error: bad latency value %s (bad unit)\n", data->latency);
@ -1370,14 +1370,14 @@ int main(int argc, char *argv[])
prog = argv[0];
/* prime the mode from the program name */
if (!strcmp(prog, "pw-play"))
if (spa_streq(prog, "pw-play"))
data.mode = mode_playback;
else if (!strcmp(prog, "pw-record"))
else if (spa_streq(prog, "pw-record"))
data.mode = mode_record;
else if (!strcmp(prog, "pw-midiplay")) {
else if (spa_streq(prog, "pw-midiplay")) {
data.mode = mode_playback;
data.is_midi = true;
} else if (!strcmp(prog, "pw-midirecord")) {
} else if (spa_streq(prog, "pw-midirecord")) {
data.mode = mode_record;
data.is_midi = true;
} else
@ -1445,7 +1445,7 @@ int main(int argc, char *argv[])
case OPT_TARGET:
data.target = optarg;
if (!strcmp(optarg, "auto")) {
if (spa_streq(optarg, "auto")) {
data.target_id = PW_ID_ANY;
break;
}