diff options
author | poljar (Damir Jelić) <poljarinho@gmail.com> | 2013-06-27 19:28:09 +0200 |
---|---|---|
committer | Tanu Kaskinen <tanu.kaskinen@linux.intel.com> | 2013-07-04 12:25:30 +0300 |
commit | d806b197144733607b0ecb8678c6ee5d99ccc9ea (patch) | |
tree | 67b37aaa47303713295c43e535892822a9e11322 | |
parent | e9822bfcb071a1b0e8f4eb67c6d471c466aeaf98 (diff) | |
download | pulseaudio-d806b197144733607b0ecb8678c6ee5d99ccc9ea.tar.gz |
Remove pa_bool_t and replace it with bool.
commands used for this (executed from the pulseaudio/src directory):
find . -regex '\(.*\.[hc]\|.*\.cc\|.*\.m4\)' -not -name 'macro.h' \
-a -not -name 'reserve.[ch]' -a -not -name 'reserve-monitor.[ch]' \
-a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
-a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
-a -not -name 'poll-win32.c' -a -not -name 'thread-win32.c' \
-a -not -name 'dllmain.c' -a -not -name 'gconf-helper.c' \
-exec sed -i -e 's/\bpa_bool_t\b/bool/g' \
-e 's/\bTRUE\b/true/g' -e 's/\bFALSE\b/false/g' {} \;
and:
sed -i -e '181,194!s/\bpa_bool_t\b/bool/' \
-e '181,194!s/\bTRUE\b/true/' -e \
'181,194!s/\bFALSE\b/false/' pulsecore/macro.h
288 files changed, 3360 insertions, 3360 deletions
diff --git a/src/daemon/cmdline.c b/src/daemon/cmdline.c index a6ceb8b80..6361a3df5 100644 --- a/src/daemon/cmdline.c +++ b/src/daemon/cmdline.c @@ -215,7 +215,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d case ARG_START: conf->cmd = PA_CMD_START; - conf->daemonize = TRUE; + conf->daemonize = true; break; case ARG_CHECK: @@ -318,7 +318,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d break; case 'n': - conf->load_default_script_file = FALSE; + conf->load_default_script_file = false; break; case ARG_LOG_TARGET: diff --git a/src/daemon/cpulimit.c b/src/daemon/cpulimit.c index 0abbac023..7c753978d 100644 --- a/src/daemon/cpulimit.c +++ b/src/daemon/cpulimit.c @@ -80,7 +80,7 @@ static pa_io_event *io_event = NULL; static struct sigaction sigaction_prev; /* Nonzero after pa_cpu_limit_init() */ -static pa_bool_t installed = FALSE; +static bool installed = false; /* The current state of operation */ static enum { @@ -209,7 +209,7 @@ int pa_cpu_limit_init(pa_mainloop_api *m) { return -1; } - installed = TRUE; + installed = true; reset_cpu_time(CPUTIME_INTERVAL_SOFT); @@ -230,7 +230,7 @@ void pa_cpu_limit_done(void) { if (installed) { pa_assert_se(sigaction(SIGXCPU, &sigaction_prev, NULL) >= 0); - installed = FALSE; + installed = false; } } diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c index 4cc348571..5a480cc00 100644 --- a/src/daemon/daemon-conf.c +++ b/src/daemon/daemon-conf.c @@ -62,39 +62,39 @@ static const pa_daemon_conf default_conf = { .cmd = PA_CMD_DAEMON, - .daemonize = FALSE, - .fail = TRUE, - .high_priority = TRUE, + .daemonize = false, + .fail = true, + .high_priority = true, .nice_level = -11, - .realtime_scheduling = TRUE, + .realtime_scheduling = true, .realtime_priority = 5, /* Half of JACK's default rtprio */ - .disallow_module_loading = FALSE, - .disallow_exit = FALSE, - .flat_volumes = TRUE, + .disallow_module_loading = false, + .disallow_exit = false, + .flat_volumes = true, .exit_idle_time = 20, .scache_idle_time = 20, .script_commands = NULL, .dl_search_path = NULL, - .load_default_script_file = TRUE, + .load_default_script_file = true, .default_script_file = NULL, .log_target = NULL, .log_level = PA_LOG_NOTICE, .log_backtrace = 0, - .log_meta = FALSE, - .log_time = FALSE, + .log_meta = false, + .log_time = false, .resample_method = PA_RESAMPLER_AUTO, - .disable_remixing = FALSE, - .disable_lfe_remixing = TRUE, + .disable_remixing = false, + .disable_lfe_remixing = true, .config_file = NULL, - .use_pid_file = TRUE, - .system_instance = FALSE, + .use_pid_file = true, + .system_instance = false, #ifdef HAVE_DBUS .local_server_type = PA_SERVER_TYPE_UNSET, /* The actual default is _USER, but we have to detect when the user doesn't specify this option. */ #endif - .no_cpu_limit = TRUE, - .disable_shm = FALSE, - .lock_memory = FALSE, - .deferred_volume = TRUE, + .no_cpu_limit = true, + .disable_shm = false, + .lock_memory = false, + .deferred_volume = true, .default_n_fragments = 4, .default_fragment_size_msec = 25, .deferred_volume_safety_margin_usec = 8000, @@ -104,42 +104,42 @@ static const pa_daemon_conf default_conf = { .default_channel_map = { .channels = 2, .map = { PA_CHANNEL_POSITION_LEFT, PA_CHANNEL_POSITION_RIGHT } }, .shm_size = 0 #ifdef HAVE_SYS_RESOURCE_H - ,.rlimit_fsize = { .value = 0, .is_set = FALSE }, - .rlimit_data = { .value = 0, .is_set = FALSE }, - .rlimit_stack = { .value = 0, .is_set = FALSE }, - .rlimit_core = { .value = 0, .is_set = FALSE } + ,.rlimit_fsize = { .value = 0, .is_set = false }, + .rlimit_data = { .value = 0, .is_set = false }, + .rlimit_stack = { .value = 0, .is_set = false }, + .rlimit_core = { .value = 0, .is_set = false } #ifdef RLIMIT_RSS - ,.rlimit_rss = { .value = 0, .is_set = FALSE } + ,.rlimit_rss = { .value = 0, .is_set = false } #endif #ifdef RLIMIT_NPROC - ,.rlimit_nproc = { .value = 0, .is_set = FALSE } + ,.rlimit_nproc = { .value = 0, .is_set = false } #endif #ifdef RLIMIT_NOFILE - ,.rlimit_nofile = { .value = 256, .is_set = TRUE } + ,.rlimit_nofile = { .value = 256, .is_set = true } #endif #ifdef RLIMIT_MEMLOCK - ,.rlimit_memlock = { .value = 0, .is_set = FALSE } + ,.rlimit_memlock = { .value = 0, .is_set = false } #endif #ifdef RLIMIT_AS - ,.rlimit_as = { .value = 0, .is_set = FALSE } + ,.rlimit_as = { .value = 0, .is_set = false } #endif #ifdef RLIMIT_LOCKS - ,.rlimit_locks = { .value = 0, .is_set = FALSE } + ,.rlimit_locks = { .value = 0, .is_set = false } #endif #ifdef RLIMIT_SIGPENDING - ,.rlimit_sigpending = { .value = 0, .is_set = FALSE } + ,.rlimit_sigpending = { .value = 0, .is_set = false } #endif #ifdef RLIMIT_MSGQUEUE - ,.rlimit_msgqueue = { .value = 0, .is_set = FALSE } + ,.rlimit_msgqueue = { .value = 0, .is_set = false } #endif #ifdef RLIMIT_NICE - ,.rlimit_nice = { .value = 31, .is_set = TRUE } /* nice level of -11 */ + ,.rlimit_nice = { .value = 31, .is_set = true } /* nice level of -11 */ #endif #ifdef RLIMIT_RTPRIO - ,.rlimit_rtprio = { .value = 9, .is_set = TRUE } /* One below JACK's default for the server */ + ,.rlimit_rtprio = { .value = 9, .is_set = true } /* One below JACK's default for the server */ #endif #ifdef RLIMIT_RTTIME - ,.rlimit_rttime = { .value = PA_USEC_PER_SEC, .is_set = TRUE } + ,.rlimit_rttime = { .value = PA_USEC_PER_SEC, .is_set = true } #endif #endif }; @@ -375,8 +375,8 @@ static int parse_alternate_sample_rate(pa_config_parser_state *state) { struct channel_conf_info { pa_daemon_conf *conf; - pa_bool_t default_sample_spec_set; - pa_bool_t default_channel_map_set; + bool default_sample_spec_set; + bool default_channel_map_set; }; static int parse_sample_channels(pa_config_parser_state *state) { @@ -393,7 +393,7 @@ static int parse_sample_channels(pa_config_parser_state *state) { } i->conf->default_sample_spec.channels = (uint8_t) n; - i->default_sample_spec_set = TRUE; + i->default_sample_spec_set = true; return 0; } @@ -409,7 +409,7 @@ static int parse_channel_map(pa_config_parser_state *state) { return -1; } - i->default_channel_map_set = TRUE; + i->default_channel_map_set = true; return 0; } @@ -616,7 +616,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) { goto finish; } - ci.default_channel_map_set = ci.default_sample_spec_set = FALSE; + ci.default_channel_map_set = ci.default_sample_spec_set = false; ci.conf = c; r = f ? pa_config_parse(c->config_file, f, table, NULL, NULL) : 0; diff --git a/src/daemon/daemon-conf.h b/src/daemon/daemon-conf.h index 067ff21b5..20225c053 100644 --- a/src/daemon/daemon-conf.h +++ b/src/daemon/daemon-conf.h @@ -52,14 +52,14 @@ typedef enum pa_daemon_conf_cmd { #ifdef HAVE_SYS_RESOURCE_H typedef struct pa_rlimit { rlim_t value; - pa_bool_t is_set; + bool is_set; } pa_rlimit; #endif /* A structure containing configuration data for the PulseAudio server . */ typedef struct pa_daemon_conf { pa_daemon_conf_cmd_t cmd; - pa_bool_t daemonize, + bool daemonize, fail, high_priority, realtime_scheduling, diff --git a/src/daemon/main.c b/src/daemon/main.c index 9bb852cbd..5b4e0053b 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -202,12 +202,12 @@ static int change_user(void) { if (!pa_streq(pw->pw_dir, PA_SYSTEM_RUNTIME_PATH)) pa_log_warn(_("Home directory of user '%s' is not '%s', ignoring."), PA_SYSTEM_USER, PA_SYSTEM_RUNTIME_PATH); - if (pa_make_secure_dir(PA_SYSTEM_RUNTIME_PATH, 0755, pw->pw_uid, gr->gr_gid, TRUE) < 0) { + if (pa_make_secure_dir(PA_SYSTEM_RUNTIME_PATH, 0755, pw->pw_uid, gr->gr_gid, true) < 0) { pa_log(_("Failed to create '%s': %s"), PA_SYSTEM_RUNTIME_PATH, pa_cstrerror(errno)); return -1; } - if (pa_make_secure_dir(PA_SYSTEM_STATE_PATH, 0700, pw->pw_uid, gr->gr_gid, TRUE) < 0) { + if (pa_make_secure_dir(PA_SYSTEM_STATE_PATH, 0700, pw->pw_uid, gr->gr_gid, true) < 0) { pa_log(_("Failed to create '%s': %s"), PA_SYSTEM_STATE_PATH, pa_cstrerror(errno)); return -1; } @@ -402,8 +402,8 @@ int main(int argc, char *argv[]) { char *s; char *configured_address; int r = 0, retval = 1, d = 0; - pa_bool_t valid_pid_file = FALSE; - pa_bool_t ltdl_init = FALSE; + bool valid_pid_file = false; + bool ltdl_init = false; int passed_fd = -1; const char *e; #ifdef HAVE_FORK @@ -415,12 +415,12 @@ int main(int argc, char *argv[]) { struct timeval win32_tv; #endif int autospawn_fd = -1; - pa_bool_t autospawn_locked = FALSE; + bool autospawn_locked = false; #ifdef HAVE_DBUS pa_dbusobj_server_lookup *server_lookup = NULL; /* /org/pulseaudio/server_lookup */ pa_dbus_connection *lookup_service_bus = NULL; /* Always the user bus. */ pa_dbus_connection *server_bus = NULL; /* The bus where we reserve org.pulseaudio.Server, either the user or the system bus. */ - pa_bool_t start_server; + bool start_server; #endif pa_log_set_ident("pulseaudio"); @@ -522,10 +522,10 @@ int main(int argc, char *argv[]) { break; case PA_SERVER_TYPE_USER: case PA_SERVER_TYPE_NONE: - conf->system_instance = FALSE; + conf->system_instance = false; break; case PA_SERVER_TYPE_SYSTEM: - conf->system_instance = TRUE; + conf->system_instance = true; break; default: pa_assert_not_reached(); @@ -535,13 +535,13 @@ int main(int argc, char *argv[]) { if (!start_server && conf->local_server_type == PA_SERVER_TYPE_SYSTEM) { pa_log_notice(_("System mode refused for non-root user. Only starting the D-Bus server lookup service.")); - conf->system_instance = FALSE; + conf->system_instance = false; } #endif LTDL_SET_PRELOADED_SYMBOLS(); pa_ltdl_init(); - ltdl_init = TRUE; + ltdl_init = true; if (conf->dl_search_path) lt_dlsetsearchpath(conf->dl_search_path); @@ -685,7 +685,7 @@ int main(int argc, char *argv[]) { * recover (i.e. autospawn) from a crash. */ char *ufn; - pa_bool_t start_anyway = FALSE; + bool start_anyway = false; if ((ufn = pa_runtime_path(PA_NATIVE_DEFAULT_UNIX_SOCKET))) { char *id; @@ -730,7 +730,7 @@ int main(int argc, char *argv[]) { if (conf->system_instance && !conf->disable_shm) { pa_log_notice(_("Running in system mode, forcibly disabling SHM mode!")); - conf->disable_shm = TRUE; + conf->disable_shm = true; } if (conf->system_instance && conf->exit_idle_time >= 0) { @@ -748,12 +748,12 @@ int main(int argc, char *argv[]) { goto finish; } - if ((pa_autospawn_lock_acquire(TRUE) < 0)) { + if ((pa_autospawn_lock_acquire(true) < 0)) { pa_log("Failed to acquire autospawn lock"); goto finish; } - autospawn_locked = TRUE; + autospawn_locked = true; } if (conf->daemonize) { @@ -806,9 +806,9 @@ int main(int argc, char *argv[]) { * to close it in the child */ pa_autospawn_lock_release(); - pa_autospawn_lock_done(TRUE); + pa_autospawn_lock_done(true); - autospawn_locked = FALSE; + autospawn_locked = false; autospawn_fd = -1; } @@ -992,7 +992,7 @@ int main(int argc, char *argv[]) { goto finish; } - valid_pid_file = TRUE; + valid_pid_file = true; } pa_disable_sigpipe(); @@ -1110,7 +1110,7 @@ int main(int argc, char *argv[]) { * any modules to be loaded. We haven't loaded any so far, so one might * think there's no way to contact the server, but receiving certain * signals could still cause modules to load. */ - conf->disallow_module_loading = TRUE; + conf->disallow_module_loading = true; } #endif @@ -1161,7 +1161,7 @@ finish: if (autospawn_locked) pa_autospawn_lock_release(); - pa_autospawn_lock_done(FALSE); + pa_autospawn_lock_done(false); } #ifdef OS_IS_WIN32 diff --git a/src/daemon/server-lookup.c b/src/daemon/server-lookup.c index 9bdc69919..82c88510a 100644 --- a/src/daemon/server-lookup.c +++ b/src/daemon/server-lookup.c @@ -42,7 +42,7 @@ struct pa_dbusobj_server_lookup { pa_core *core; pa_dbus_connection *conn; - pa_bool_t path_registered; + bool path_registered; }; static const char introspection[] = @@ -82,7 +82,7 @@ static void unregister_cb(DBusConnection *conn, void *user_data) { pa_assert(sl); pa_assert(sl->path_registered); - sl->path_registered = FALSE; + sl->path_registered = false; } static DBusHandlerResult handle_introspect(DBusConnection *conn, DBusMessage *msg, pa_dbusobj_server_lookup *sl) { @@ -482,7 +482,7 @@ pa_dbusobj_server_lookup *pa_dbusobj_server_lookup_new(pa_core *c) { sl = pa_xnew(pa_dbusobj_server_lookup, 1); sl->core = c; - sl->path_registered = FALSE; + sl->path_registered = false; if (!(sl->conn = pa_dbus_bus_get(c, DBUS_BUS_SESSION, &error)) || dbus_error_is_set(&error)) { pa_log_warn("Unable to contact D-Bus: %s: %s", error.name, error.message); @@ -494,7 +494,7 @@ pa_dbusobj_server_lookup *pa_dbusobj_server_lookup_new(pa_core *c) { goto fail; } - sl->path_registered = TRUE; + sl->path_registered = true; return sl; diff --git a/src/modules/alsa/alsa-mixer.c b/src/modules/alsa/alsa-mixer.c index f4410d74c..545ae9f9d 100644 --- a/src/modules/alsa/alsa-mixer.c +++ b/src/modules/alsa/alsa-mixer.c @@ -83,7 +83,7 @@ struct pa_alsa_fdlist { pa_defer_event *defer; pa_io_event **ios; - pa_bool_t polled; + bool polled; void (*cb)(void *userdata); void *userdata; @@ -105,7 +105,7 @@ static void io_cb(pa_mainloop_api *a, pa_io_event *e, int fd, pa_io_event_flags_ if (fdl->polled) return; - fdl->polled = TRUE; + fdl->polled = true; memcpy(fdl->work_fds, fdl->fds, sizeof(struct pollfd) * fdl->num_fds); @@ -189,7 +189,7 @@ static void defer_cb(pa_mainloop_api *a, pa_defer_event *e, void *userdata) { return; } - fdl->polled = FALSE; + fdl->polled = false; if (memcmp(fdl->fds, fdl->work_fds, sizeof(struct pollfd) * num_fds) == 0) return; @@ -559,7 +559,7 @@ static pa_volume_t from_alsa_volume(long v, long min, long max) { snd_mixer_selem_id_alloca(&(sid)); \ snd_mixer_selem_id_set_name((sid), (name)); \ snd_mixer_selem_id_set_index((sid), 0); \ - } while(FALSE) + } while(false) static int element_get_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v) { snd_mixer_selem_id_t *sid; @@ -729,7 +729,7 @@ int pa_alsa_path_get_volume(pa_alsa_path *p, snd_mixer_t *m, const pa_channel_ma return 0; } -static int element_get_switch(pa_alsa_element *e, snd_mixer_t *m, pa_bool_t *b) { +static int element_get_switch(pa_alsa_element *e, snd_mixer_t *m, bool *b) { snd_mixer_selem_id_t *sid; snd_mixer_elem_t *me; snd_mixer_selem_channel_id_t c; @@ -766,16 +766,16 @@ static int element_get_switch(pa_alsa_element *e, snd_mixer_t *m, pa_bool_t *b) continue; if (!value) { - *b = FALSE; + *b = false; return 0; } } - *b = TRUE; + *b = true; return 0; } -int pa_alsa_path_get_mute(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t *muted) { +int pa_alsa_path_get_mute(pa_alsa_path *p, snd_mixer_t *m, bool *muted) { pa_alsa_element *e; pa_assert(m); @@ -786,7 +786,7 @@ int pa_alsa_path_get_mute(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t *muted) { return -1; PA_LLIST_FOREACH(e, p->elements) { - pa_bool_t b; + bool b; if (e->switch_use != PA_ALSA_SWITCH_MUTE) continue; @@ -795,12 +795,12 @@ int pa_alsa_path_get_mute(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t *muted) { return -1; if (!b) { - *muted = TRUE; + *muted = true; return 0; } } - *muted = FALSE; + *muted = false; return 0; } @@ -887,7 +887,7 @@ static int element_get_nearest_alsa_dB(snd_mixer_elem_t *me, snd_mixer_selem_cha return r; } -static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, pa_bool_t deferred_volume, pa_bool_t write_to_hw) { +static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, bool deferred_volume, bool write_to_hw) { snd_mixer_selem_id_t *sid; pa_cvolume rv; @@ -913,11 +913,11 @@ static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_chann for (c = 0; c <= SND_MIXER_SCHN_LAST; c++) { int r; pa_volume_t f = PA_VOLUME_MUTED; - pa_bool_t found = FALSE; + bool found = false; for (k = 0; k < cm->channels; k++) if (e->masks[c][e->n_channels-1] & PA_CHANNEL_POSITION_MASK(cm->map[k])) { - found = TRUE; + found = true; if (v->values[k] > f) f = v->values[k]; } @@ -1047,7 +1047,7 @@ static int element_set_volume(pa_alsa_element *e, snd_mixer_t *m, const pa_chann return 0; } -int pa_alsa_path_set_volume(pa_alsa_path *p, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, pa_bool_t deferred_volume, pa_bool_t write_to_hw) { +int pa_alsa_path_set_volume(pa_alsa_path *p, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, bool deferred_volume, bool write_to_hw) { pa_alsa_element *e; pa_cvolume rv; @@ -1088,7 +1088,7 @@ int pa_alsa_path_set_volume(pa_alsa_path *p, snd_mixer_t *m, const pa_channel_ma return 0; } -static int element_set_switch(pa_alsa_element *e, snd_mixer_t *m, pa_bool_t b) { +static int element_set_switch(pa_alsa_element *e, snd_mixer_t *m, bool b) { snd_mixer_elem_t *me; snd_mixer_selem_id_t *sid; int r; @@ -1113,7 +1113,7 @@ static int element_set_switch(pa_alsa_element *e, snd_mixer_t *m, pa_bool_t b) { return r; } -int pa_alsa_path_set_mute(pa_alsa_path *p, snd_mixer_t *m, pa_bool_t muted) { +int pa_alsa_path_set_mute(pa_alsa_path *p, snd_mixer_t *m, bool muted) { pa_alsa_element *e; pa_assert(m); @@ -1142,7 +1142,7 @@ static int element_set_constant_volume(pa_alsa_element *e, snd_mixer_t *m) { snd_mixer_selem_id_t *sid = NULL; int r = 0; long volume = -1; - pa_bool_t volume_set = FALSE; + bool volume_set = false; pa_assert(m); pa_assert(e); @@ -1156,7 +1156,7 @@ static int element_set_constant_volume(pa_alsa_element *e, snd_mixer_t *m) { switch (e->volume_use) { case PA_ALSA_VOLUME_OFF: volume = e->min_volume; - volume_set = TRUE; + volume_set = true; break; case PA_ALSA_VOLUME_ZERO: @@ -1164,13 +1164,13 @@ static int element_set_constant_volume(pa_alsa_element *e, snd_mixer_t *m) { long dB = 0; volume = decibel_fix_get_step(e->db_fix, &dB, (e->direction == PA_ALSA_DIRECTION_OUTPUT ? +1 : -1)); - volume_set = TRUE; + volume_set = true; } break; case PA_ALSA_VOLUME_CONSTANT: volume = e->constant_volume; - volume_set = TRUE; + volume_set = true; break; default: @@ -1217,7 +1217,7 @@ int pa_alsa_path_select(pa_alsa_path *p, pa_alsa_setting *s, snd_mixer_t *m, boo * selecting a path, so we ignore the return value. * element_set_switch() will print a warning anyway, so this * won't be a silent failure either. */ - (void) element_set_switch(e, m, FALSE); + (void) element_set_switch(e, m, false); } } @@ -1225,11 +1225,11 @@ int pa_alsa_path_select(pa_alsa_path *p, pa_alsa_setting *s, snd_mixer_t *m, boo switch (e->switch_use) { case PA_ALSA_SWITCH_OFF: - r = element_set_switch(e, m, FALSE); + r = element_set_switch(e, m, false); break; case PA_ALSA_SWITCH_ON: - r = element_set_switch(e, m, TRUE); + r = element_set_switch(e, m, true); break; case PA_ALSA_SWITCH_MUTE: @@ -1276,9 +1276,9 @@ int pa_alsa_path_select(pa_alsa_path *p, pa_alsa_setting *s, snd_mixer_t *m, boo } static int check_required(pa_alsa_element *e, snd_mixer_elem_t *me) { - pa_bool_t has_switch; - pa_bool_t has_enumeration; - pa_bool_t has_volume; + bool has_switch; + bool has_enumeration; + bool has_volume; pa_assert(e); pa_assert(me); @@ -1401,7 +1401,7 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) { } if (e->switch_use != PA_ALSA_SWITCH_IGNORE) - e->direction_try_other = FALSE; + e->direction_try_other = false; } if (e->volume_use != PA_ALSA_VOLUME_IGNORE) { @@ -1429,7 +1429,7 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) { long min_dB = 0, max_dB = 0; int r; - e->direction_try_other = FALSE; + e->direction_try_other = false; if (e->direction == PA_ALSA_DIRECTION_OUTPUT) r = snd_mixer_selem_get_playback_volume_range(me, &e->min_volume, &e->max_volume); @@ -1452,7 +1452,7 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) { e->volume_use = PA_ALSA_VOLUME_IGNORE; } else { - pa_bool_t is_mono; + bool is_mono; pa_channel_position_t p; if (e->db_fix && @@ -1468,7 +1468,7 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) { } if (e->db_fix) { - e->has_dB = TRUE; + e->has_dB = true; e->min_volume = e->db_fix->min_step; e->max_volume = e->db_fix->max_step; min_dB = e->db_fix->db_values[0]; @@ -1527,7 +1527,7 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) { if (min_dB >= max_dB) { pa_assert(!e->db_fix); pa_log_warn("Your kernel driver is broken: it reports a volume range from %0.2f dB to %0.2f dB which makes no sense.", e->min_dB, e->max_dB); - e->has_dB = FALSE; + e->has_dB = false; } } @@ -1553,7 +1553,7 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) { if (r < 0) { pa_log_warn("Failed to get dB value of %s: %s", e->alsa_name, pa_alsa_strerror(r)); - e->has_dB = FALSE; + e->has_dB = false; } else e->max_dB = ((double) max_dB) / 100.0; } @@ -1617,7 +1617,7 @@ static int element_probe(pa_alsa_element *e, snd_mixer_t *m) { if (!e->override_map) { for (p = PA_CHANNEL_POSITION_FRONT_LEFT; p < PA_CHANNEL_POSITION_MAX; p++) { - pa_bool_t has_channel; + bool has_channel; if (alsa_channel_ids[p] == SND_MIXER_SCHN_UNKNOWN) continue; @@ -1692,7 +1692,7 @@ static int jack_probe(pa_alsa_jack *j, snd_hctl_t *h) { if (j->required_absent != PA_ALSA_REQUIRED_IGNORE) return -1; if (j->required_any != PA_ALSA_REQUIRED_IGNORE) - j->path->req_any_present = TRUE; + j->path->req_any_present = true; } else { if (j->required != PA_ALSA_REQUIRED_IGNORE) return -1; @@ -1701,7 +1701,7 @@ static int jack_probe(pa_alsa_jack *j, snd_hctl_t *h) { return 0; } -static pa_alsa_element* element_get(pa_alsa_path *p, const char *section, pa_bool_t prefixed) { +static pa_alsa_element* element_get(pa_alsa_path *p, const char *section, bool prefixed) { pa_alsa_element *e; pa_assert(p); @@ -1790,7 +1790,7 @@ static pa_alsa_option* option_get(pa_alsa_path *p, const char *section) { return p->last_option; } - pa_assert_se(e = element_get(p, en, FALSE)); + pa_assert_se(e = element_get(p, en, false)); pa_xfree(en); PA_LLIST_FOREACH(o, e->options) @@ -1820,7 +1820,7 @@ static int element_parse_switch(pa_config_parser_state *state) { p = state->userdata; - if (!(e = element_get(p, state->section, TRUE))) { + if (!(e = element_get(p, state->section, true))) { pa_log("[%s:%u] Switch makes no sense in '%s'", state->filename, state->lineno, state->section); return -1; } @@ -1851,7 +1851,7 @@ static int element_parse_volume(pa_config_parser_state *state) { p = state->userdata; - if (!(e = element_get(p, state->section, TRUE))) { + if (!(e = element_get(p, state->section, true))) { pa_log("[%s:%u] Volume makes no sense in '%s'", state->filename, state->lineno, state->section); return -1; } @@ -1887,7 +1887,7 @@ static int element_parse_enumeration(pa_config_parser_state *state) { p = state->userdata; - if (!(e = element_get(p, state->section, TRUE))) { + if (!(e = element_get(p, state->section, true))) { pa_log("[%s:%u] Enumeration makes no sense in '%s'", state->filename, state->lineno, state->section); return -1; } @@ -1957,7 +1957,7 @@ static int element_parse_required(pa_config_parser_state *state) { p = state->userdata; - e = element_get(p, state->section, TRUE); + e = element_get(p, state->section, true); o = option_get(p, state->section); j = jack_get(p, state->section); if (!e && !o && !j) { @@ -2023,7 +2023,7 @@ static int element_parse_direction(pa_config_parser_state *state) { p = state->userdata; - if (!(e = element_get(p, state->section, TRUE))) { + if (!(e = element_get(p, state->section, true))) { pa_log("[%s:%u] Direction makes no sense in '%s'", state->filename, state->lineno, state->section); return -1; } @@ -2049,7 +2049,7 @@ static int element_parse_direction_try_other(pa_config_parser_state *state) { p = state->userdata; - if (!(e = element_get(p, state->section, TRUE))) { + if (!(e = element_get(p, state->section, true))) { pa_log("[%s:%u] Direction makes no sense in '%s'", state->filename, state->lineno, state->section); return -1; } @@ -2072,7 +2072,7 @@ static int element_parse_volume_limit(pa_config_parser_state *state) { p = state->userdata; - if (!(e = element_get(p, state->section, TRUE))) { + if (!(e = element_get(p, state->section, true))) { pa_log("[%s:%u] volume-limit makes no sense in '%s'", state->filename, state->lineno, state->section); return -1; } @@ -2130,7 +2130,7 @@ static int element_parse_override_map(pa_config_parser_state *state) { p = state->userdata; - if (!(e = element_get(p, state->section, TRUE))) { + if (!(e = element_get(p, state->section, true))) { pa_log("[%s:%u] Override map makes no sense in '%s'", state->filename, state->lineno, state->section); return -1; } @@ -2158,7 +2158,7 @@ static int element_parse_override_map(pa_config_parser_state *state) { pa_xfree(n); } - e->override_map = TRUE; + e->override_map = true; return 0; } @@ -2482,7 +2482,7 @@ pa_alsa_path *pa_alsa_path_synthesize(const char *element, pa_alsa_direction_t d return p; } -static pa_bool_t element_drop_unsupported(pa_alsa_element *e) { +static bool element_drop_unsupported(pa_alsa_element *e) { pa_alsa_option *o, *n; pa_assert(e); @@ -2558,7 +2558,7 @@ static void path_make_options_unique(pa_alsa_path *p) { } } -static pa_bool_t element_create_settings(pa_alsa_element *e, pa_alsa_setting *template) { +static bool element_create_settings(pa_alsa_element *e, pa_alsa_setting *template) { pa_alsa_option *o; for (; e; e = e->next) @@ -2567,7 +2567,7 @@ static pa_bool_t element_create_settings(pa_alsa_element *e, pa_alsa_setting *te break; if (!e) - return FALSE; + return false; for (o = e->options; o; o = o->next) { pa_alsa_setting *s; @@ -2605,7 +2605,7 @@ static pa_bool_t element_create_settings(pa_alsa_element *e, pa_alsa_setting *te } } - return TRUE; + return true; } static void path_create_settings(pa_alsa_path *p) { @@ -2614,7 +2614,7 @@ static void path_create_settings(pa_alsa_path *p) { element_create_settings(p->elements, NULL); } -int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, pa_bool_t ignore_dB) { +int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, bool ignore_dB) { pa_alsa_element *e; pa_alsa_jack *j; double min_dB[PA_CHANNEL_POSITION_MAX], max_dB[PA_CHANNEL_POSITION_MAX]; @@ -2626,7 +2626,7 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, pa_boo if (p->probed) return p->supported ? 0 : -1; - p->probed = TRUE; + p->probed = true; pa_zero(min_dB); pa_zero(max_dB); @@ -2635,7 +2635,7 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, pa_boo PA_LLIST_FOREACH(j, p->jacks) { if (jack_probe(j, hctl) < 0) { - p->supported = FALSE; + p->supported = false; pa_log_debug("Probe of jack '%s' failed.", j->alsa_name); return -1; } @@ -2644,14 +2644,14 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, pa_boo PA_LLIST_FOREACH(e, p->elements) { if (element_probe(e, m) < 0) { - p->supported = FALSE; + p->supported = false; pa_log_debug("Probe of element '%s' failed.", e->alsa_name); return -1; } pa_log_debug("Probe of element '%s' succeeded (volume=%d, switch=%d, enumeration=%d).", e->alsa_name, e->volume_use, e->switch_use, e->enumeration_use); if (ignore_dB) - e->has_dB = FALSE; + e->has_dB = false; if (e->volume_use == PA_ALSA_VOLUME_MERGE) { @@ -2669,7 +2669,7 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, pa_boo path_volume_channels |= PA_CHANNEL_POSITION_MASK(t); } - p->has_dB = TRUE; + p->has_dB = true; } else { if (p->has_dB) { @@ -2692,15 +2692,15 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, pa_boo e->volume_use = PA_ALSA_VOLUME_IGNORE; pa_log_info("Ignoring volume of '%s' on path '%s' (missing dB info)", e->alsa_name, p->name); } - p->has_volume = TRUE; + p->has_volume = true; } if (e->switch_use == PA_ALSA_SWITCH_MUTE) - p->has_mute = TRUE; + p->has_mute = true; } if (p->has_req_any && !p->req_any_present) { - p->supported = FALSE; + p->supported = false; pa_log_debug("Skipping path '%s', none of required-any elements preset.", p->name); return -1; } @@ -2709,7 +2709,7 @@ int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, pa_boo path_make_options_unique(p); path_create_settings(p); - p->supported = TRUE; + p->supported = true; p->min_dB = INFINITY; p->max_dB = -INFINITY; @@ -2904,12 +2904,12 @@ pa_alsa_path_set *pa_alsa_path_set_new(pa_alsa_mapping *m, pa_alsa_direction_t d for (in = pn; *in; in++) { pa_alsa_path *p = NULL; - pa_bool_t duplicate = FALSE; + bool duplicate = false; char **kn; for (kn = pn; kn < in; kn++) if (pa_streq(*kn, *in)) { - duplicate = TRUE; + duplicate = true; break; } @@ -3018,7 +3018,7 @@ void pa_alsa_path_set_dump(pa_alsa_path_set *ps) { pa_alsa_path_dump(p); } -static pa_bool_t options_have_option(pa_alsa_option *options, const char *alsa_name) { +static bool options_have_option(pa_alsa_option *options, const char *alsa_name) { pa_alsa_option *o; pa_assert(options); @@ -3026,36 +3026,36 @@ static pa_bool_t options_have_option(pa_alsa_option *options, const char *alsa_n PA_LLIST_FOREACH(o, options) { if (pa_streq(o->alsa_name, alsa_name)) - return TRUE; + return true; } - return FALSE; + return false; } -static pa_bool_t enumeration_is_subset(pa_alsa_option *a_options, pa_alsa_option *b_options) { +static bool enumeration_is_subset(pa_alsa_option *a_options, pa_alsa_option *b_options) { pa_alsa_option *oa, *ob; - if (!a_options) return TRUE; - if (!b_options) return FALSE; + if (!a_options) return true; + if (!b_options) return false; /* If there is an option A offers that B does not, then A is not a subset of B. */ PA_LLIST_FOREACH(oa, a_options) { - pa_bool_t found = FALSE; + bool found = false; PA_LLIST_FOREACH(ob, b_options) { if (pa_streq(oa->alsa_name, ob->alsa_name)) { - found = TRUE; + found = true; break; } } if (!found) - return FALSE; + return false; } - return TRUE; + return true; } /** * Compares two elements to see if a is a subset of b */ -static pa_bool_t element_is_subset(pa_alsa_element *a, pa_alsa_element *b, snd_mixer_t *m) { +static bool element_is_subset(pa_alsa_element *a, pa_alsa_element *b, snd_mixer_t *m) { pa_assert(a); pa_assert(b); pa_assert(m); @@ -3069,11 +3069,11 @@ static pa_bool_t element_is_subset(pa_alsa_element *a, pa_alsa_element *b, snd_m /* "Constant" is subset of "Constant" only when their constant values are equal */ if (a->volume_use == PA_ALSA_VOLUME_CONSTANT && b->volume_use == PA_ALSA_VOLUME_CONSTANT && a->constant_volume != b->constant_volume) - return FALSE; + return false; /* Different volume uses when b is not "Merge" means we are definitely not a subset */ if (a->volume_use != b->volume_use && b->volume_use != PA_ALSA_VOLUME_MERGE) - return FALSE; + return false; /* "Constant" is a subset of "Merge", if there is not a "volume-limit" in "Merge" below the actual constant. * "Zero" and "Off" are just special cases of "Constant" when comparing to "Merge" @@ -3096,15 +3096,15 @@ static pa_bool_t element_is_subset(pa_alsa_element *a, pa_alsa_element *b, snd_m SELEM_INIT(sid, a->alsa_name); if (!(me = snd_mixer_find_selem(m, sid))) { pa_log_warn("Element %s seems to have disappeared.", a->alsa_name); - return FALSE; + return false; } if (a->direction == PA_ALSA_DIRECTION_OUTPUT) { if (snd_mixer_selem_ask_playback_dB_vol(me, dB, +1, &a_limit) < 0) - return FALSE; + return false; } else { if (snd_mixer_selem_ask_capture_dB_vol(me, dB, -1, &a_limit) < 0) - return FALSE; + return false; } } } else if (a->volume_use == PA_ALSA_VOLUME_OFF) @@ -3113,22 +3113,22 @@ static pa_bool_t element_is_subset(pa_alsa_element *a, pa_alsa_element *b, snd_m a_limit = a->volume_limit; else /* This should never be reached */ - pa_assert(FALSE); + pa_assert(false); if (a_limit > b->volume_limit) - return FALSE; + return false; } if (a->volume_use == PA_ALSA_VOLUME_MERGE) { int s; /* If override-maps are different, they're not subsets */ if (a->n_channels != b->n_channels) - return FALSE; + return false; for (s = 0; s <= SND_MIXER_SCHN_LAST; s++) if (a->masks[s][a->n_channels-1] != b->masks[s][b->n_channels-1]) { pa_log_debug("Element %s is not a subset - mask a: 0x%" PRIx64 ", mask b: 0x%" PRIx64 ", at channel %d", a->alsa_name, a->masks[s][a->n_channels-1], b->masks[s][b->n_channels-1], s); - return FALSE; + return false; } } } @@ -3144,31 +3144,31 @@ static pa_bool_t element_is_subset(pa_alsa_element *a, pa_alsa_element *b, snd_m if (a->switch_use == PA_ALSA_SWITCH_SELECT || a->switch_use == PA_ALSA_SWITCH_MUTE || b->switch_use == PA_ALSA_SWITCH_OFF || b->switch_use == PA_ALSA_SWITCH_ON) - return FALSE; + return false; if (b->switch_use == PA_ALSA_SWITCH_SELECT) { if (a->switch_use == PA_ALSA_SWITCH_ON) { if (!options_have_option(b->options, "on")) - return FALSE; + return false; } else if (a->switch_use == PA_ALSA_SWITCH_OFF) { if (!options_have_option(b->options, "off")) - return FALSE; + return false; } } } else if (a->switch_use == PA_ALSA_SWITCH_SELECT) { if (!enumeration_is_subset(a->options, b->options)) - return FALSE; + return false; } } if (a->enumeration_use != PA_ALSA_ENUMERATION_IGNORE) { if (b->enumeration_use == PA_ALSA_ENUMERATION_IGNORE) - return FALSE; + return false; if (!enumeration_is_subset(a->options, b->options)) - return FALSE; + return false; } - return TRUE; + return true; } static void path_set_condense(pa_alsa_path_set *ps, snd_mixer_t *m) { @@ -3966,11 +3966,11 @@ static int profile_verify(pa_alsa_profile *p) { for (name = p->output_mapping_names; *name; name++) { pa_alsa_mapping *m; char **in; - pa_bool_t duplicate = FALSE; + bool duplicate = false; for (in = name + 1; *in; in++) if (pa_streq(*name, *in)) { - duplicate = TRUE; + duplicate = true; break; } @@ -4002,11 +4002,11 @@ static int profile_verify(pa_alsa_profile *p) { for (name = p->input_mapping_names; *name; name++) { pa_alsa_mapping *m; char **in; - pa_bool_t duplicate = FALSE; + bool duplicate = false; for (in = name + 1; *in; in++) if (pa_streq(*name, *in)) { - duplicate = TRUE; + duplicate = true; break; } @@ -4277,7 +4277,7 @@ static snd_pcm_t* mapping_open_pcm(pa_alsa_mapping *m, return pa_alsa_open_by_template( m->device_strings, dev_id, NULL, &try_ss, &try_map, mode, &try_period_size, - &try_buffer_size, 0, NULL, NULL, TRUE); + &try_buffer_size, 0, NULL, NULL, true); } static void paths_drop_unsupported(pa_hashmap* h) { @@ -4326,13 +4326,13 @@ void pa_alsa_profile_set_probe( if (!p->supported) { profile_finalize_probing(last, p); - p->supported = TRUE; + p->supported = true; if (p->output_mappings) { PA_IDXSET_FOREACH(m, p->output_mappings, idx) { if (pa_hashmap_get(broken_outputs, m) == m) { pa_log_debug("Skipping profile %s - will not be able to open output:%s", p->name, m->name); - p->supported = FALSE; + p->supported = false; break; } } @@ -4342,7 +4342,7 @@ void pa_alsa_profile_set_probe( PA_IDXSET_FOREACH(m, p->input_mappings, idx) { if (pa_hashmap_get(broken_inputs, m) == m) { pa_log_debug("Skipping profile %s - will not be able to open input:%s", p->name, m->name); - p->supported = FALSE; + p->supported = false; break; } } @@ -4363,7 +4363,7 @@ void pa_alsa_profile_set_probe( SND_PCM_STREAM_PLAYBACK, default_n_fragments, default_fragment_size_msec))) { - p->supported = FALSE; + p->supported = false; if (pa_idxset_size(p->output_mappings) == 1 && ((!p->input_mappings) || pa_idxset_size(p->input_mappings) == 0)) { pa_log_debug("Caching failure to open output:%s", m->name); @@ -4384,7 +4384,7 @@ void pa_alsa_profile_set_probe( SND_PCM_STREAM_CAPTURE, default_n_fragments, default_fragment_size_msec))) { - p->supported = FALSE; + p->supported = false; if (pa_idxset_size(p->input_mappings) == 1 && ((!p->output_mappings) || pa_idxset_size(p->output_mappings) == 0)) { pa_log_debug("Caching failure to open input:%s", m->name); @@ -4423,7 +4423,7 @@ void pa_alsa_profile_set_probe( pa_hashmap_free(broken_inputs, NULL); pa_hashmap_free(broken_outputs, NULL); - ps->probed = TRUE; + ps->probed = true; } void pa_alsa_profile_set_dump(pa_alsa_profile_set *ps) { diff --git a/src/modules/alsa/alsa-mixer.h b/src/modules/alsa/alsa-mixer.h index 3d50ebb61..432e4de78 100644 --- a/src/modules/alsa/alsa-mixer.h +++ b/src/modules/alsa/alsa-mixer.h @@ -138,10 +138,10 @@ struct pa_alsa_element { long constant_volume; - pa_bool_t override_map:1; - pa_bool_t direction_try_other:1; + bool override_map:1; + bool direction_try_other:1; - pa_bool_t has_dB:1; + bool has_dB:1; long min_volume, max_volume; long volume_limit; /* -1 for no configured limit */ double min_dB, max_dB; @@ -162,8 +162,8 @@ struct pa_alsa_jack { char *name; /* E g "Headphone" */ char *alsa_name; /* E g "Headphone Jack" */ - pa_bool_t has_control; /* is the jack itself present? */ - pa_bool_t plugged_in; /* is this jack currently plugged in? */ + bool has_control; /* is the jack itself present? */ + bool plugged_in; /* is this jack currently plugged in? */ snd_hctl_elem_t *hctl_elem; /* Jack detection handle */ pa_available_t state_unplugged, state_plugged; @@ -186,15 +186,15 @@ struct pa_alsa_path { int eld_device; pa_proplist *proplist; - pa_bool_t probed:1; - pa_bool_t supported:1; - pa_bool_t has_mute:1; - pa_bool_t has_volume:1; - pa_bool_t has_dB:1; + bool probed:1; + bool supported:1; + bool has_mute:1; + bool has_volume:1; + bool has_dB:1; bool mute_during_activation:1; /* These two are used during probing only */ - pa_bool_t has_req_any:1; - pa_bool_t req_any_present:1; + bool has_req_any:1; + bool req_any_present:1; long min_volume, max_volume; double min_dB, max_dB; @@ -226,12 +226,12 @@ void pa_alsa_element_dump(pa_alsa_element *e); pa_alsa_path *pa_alsa_path_new(const char *paths_dir, const char *fname, pa_alsa_direction_t direction); pa_alsa_path *pa_alsa_path_synthesize(const char *element, pa_alsa_direction_t direction); -int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, pa_bool_t ignore_dB); +int pa_alsa_path_probe(pa_alsa_path *p, snd_mixer_t *m, snd_hctl_t *hctl, bool ignore_dB); void pa_alsa_path_dump(pa_alsa_path *p); int pa_alsa_path_get_volume(pa_alsa_path *p, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v); -int pa_alsa_path_get_mute(pa_alsa_path *path, snd_mixer_t *m, pa_bool_t *muted); -int pa_alsa_path_set_volume(pa_alsa_path *path, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, pa_bool_t deferred_volume, pa_bool_t write_to_hw); -int pa_alsa_path_set_mute(pa_alsa_path *path, snd_mixer_t *m, pa_bool_t muted); +int pa_alsa_path_get_mute(pa_alsa_path *path, snd_mixer_t *m, bool *muted); +int pa_alsa_path_set_volume(pa_alsa_path *path, snd_mixer_t *m, const pa_channel_map *cm, pa_cvolume *v, bool deferred_volume, bool write_to_hw); +int pa_alsa_path_set_mute(pa_alsa_path *path, snd_mixer_t *m, bool muted); int pa_alsa_path_select(pa_alsa_path *p, pa_alsa_setting *s, snd_mixer_t *m, bool device_is_muted); void pa_alsa_path_set_callback(pa_alsa_path *p, snd_mixer_t *m, snd_mixer_elem_callback_t cb, void *userdata); void pa_alsa_path_free(pa_alsa_path *p); @@ -282,7 +282,7 @@ struct pa_alsa_profile { char *description; unsigned priority; - pa_bool_t supported:1; + bool supported:1; char **input_mapping_names; char **output_mapping_names; @@ -314,9 +314,9 @@ struct pa_alsa_profile_set { pa_hashmap *input_paths; pa_hashmap *output_paths; - pa_bool_t auto_profiles; - pa_bool_t ignore_dB:1; - pa_bool_t probed:1; + bool auto_profiles; + bool ignore_dB:1; + bool probed:1; }; void pa_alsa_mapping_dump(pa_alsa_mapping *m); diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index aa6cf74d4..535f7ec59 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -136,9 +136,9 @@ struct userdata { char *device_name; /* name of the PCM device */ char *control_device; /* name of the control device */ - pa_bool_t use_mmap:1, use_tsched:1, deferred_volume:1, fixed_latency_range:1; + bool use_mmap:1, use_tsched:1, deferred_volume:1, fixed_latency_range:1; - pa_bool_t first, after_rewind; + bool first, after_rewind; pa_rtpoll_item *alsa_rtpoll_item; @@ -162,11 +162,11 @@ struct userdata { static void userdata_free(struct userdata *u); /* FIXME: Is there a better way to do this than device names? */ -static pa_bool_t is_iec958(struct userdata *u) { +static bool is_iec958(struct userdata *u) { return (strncmp("iec958", u->device_name, 6) == 0); } -static pa_bool_t is_hdmi(struct userdata *u) { +static bool is_hdmi(struct userdata *u) { return (strncmp("hdmi", u->device_name, 4) == 0); } @@ -176,7 +176,7 @@ static pa_hook_result_t reserve_cb(pa_reserve_wrapper *r, void *forced, struct u pa_log_debug("Suspending sink %s, because another application requested us to release the device.", u->sink->name); - if (pa_sink_suspend(u->sink, TRUE, PA_SUSPEND_APPLICATION) < 0) + if (pa_sink_suspend(u->sink, true, PA_SUSPEND_APPLICATION) < 0) return PA_HOOK_CANCEL; return PA_HOOK_OK; @@ -445,14 +445,14 @@ static int try_recover(struct userdata *u, const char *call, int err) { return -1; } - u->first = TRUE; + u->first = true; u->since_start = 0; return 0; } -static size_t check_left_to_play(struct userdata *u, size_t n_bytes, pa_bool_t on_timeout) { +static size_t check_left_to_play(struct userdata *u, size_t n_bytes, bool on_timeout) { size_t left_to_play; - pa_bool_t underrun = FALSE; + bool underrun = false; /* We use <= instead of < for this check here because an underrun * only happens after the last sample was processed, not already when @@ -465,7 +465,7 @@ static size_t check_left_to_play(struct userdata *u, size_t n_bytes, pa_bool_t o /* We got a dropout. What a mess! */ left_to_play = 0; - underrun = TRUE; + underrun = true; #if 0 PA_DEBUG_TRAP; @@ -484,13 +484,13 @@ static size_t check_left_to_play(struct userdata *u, size_t n_bytes, pa_bool_t o #endif if (u->use_tsched) { - pa_bool_t reset_not_before = TRUE; + bool reset_not_before = true; if (!u->first && !u->after_rewind) { if (underrun || left_to_play < u->watermark_inc_threshold) increase_watermark(u); else if (left_to_play > u->watermark_dec_threshold) { - reset_not_before = FALSE; + reset_not_before = false; /* We decrease the watermark only if have actually * been woken up by a timeout. If something else woke @@ -508,8 +508,8 @@ static size_t check_left_to_play(struct userdata *u, size_t n_bytes, pa_bool_t o return left_to_play; } -static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled, pa_bool_t on_timeout) { - pa_bool_t work_done = FALSE; +static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, bool polled, bool on_timeout) { + bool work_done = false; pa_usec_t max_sleep_usec = 0, process_usec = 0; size_t left_to_play, input_underrun; unsigned j = 0; @@ -524,7 +524,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle snd_pcm_sframes_t n; size_t n_bytes; int r; - pa_bool_t after_avail = TRUE; + bool after_avail = true; /* First we determine how many samples are missing to fill the * buffer up to 100% */ @@ -544,7 +544,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle #endif left_to_play = check_left_to_play(u, n_bytes, on_timeout); - on_timeout = FALSE; + on_timeout = false; if (u->use_tsched) @@ -589,7 +589,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle } n_bytes -= u->hwbuf_unused; - polled = FALSE; + polled = false; #ifdef DEBUG_TIMING pa_log_debug("Filling up"); @@ -626,7 +626,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle break; pa_assert(frames > 0); - after_avail = FALSE; + after_avail = false; /* Check these are multiples of 8 bit */ pa_assert((areas[0].first & 7) == 0); @@ -639,7 +639,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle p = (uint8_t*) areas[0].addr + (offset * u->frame_size); written = frames * u->frame_size; - chunk.memblock = pa_memblock_new_fixed(u->core->mempool, p, written, TRUE); + chunk.memblock = pa_memblock_new_fixed(u->core->mempool, p, written, true); chunk.length = pa_memblock_get_length(chunk.memblock); chunk.index = 0; @@ -657,7 +657,7 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle return r; } - work_done = TRUE; + work_done = true; u->write_count += written; u->since_start += written; @@ -693,8 +693,8 @@ static int mmap_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle return work_done ? 1 : 0; } -static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled, pa_bool_t on_timeout) { - pa_bool_t work_done = FALSE; +static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, bool polled, bool on_timeout) { + bool work_done = false; pa_usec_t max_sleep_usec = 0, process_usec = 0; size_t left_to_play, input_underrun; unsigned j = 0; @@ -709,7 +709,7 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle snd_pcm_sframes_t n; size_t n_bytes; int r; - pa_bool_t after_avail = TRUE; + bool after_avail = true; if (PA_UNLIKELY((n = pa_alsa_safe_avail(u->pcm_handle, u->hwbuf_size, &u->sink->sample_spec)) < 0)) { @@ -726,7 +726,7 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle #endif left_to_play = check_left_to_play(u, n_bytes, on_timeout); - on_timeout = FALSE; + on_timeout = false; if (u->use_tsched) @@ -764,7 +764,7 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle } n_bytes -= u->hwbuf_unused; - polled = FALSE; + polled = false; for (;;) { snd_pcm_sframes_t frames; @@ -802,7 +802,7 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle break; pa_assert(frames > 0); - after_avail = FALSE; + after_avail = false; written = frames * u->frame_size; u->memchunk.index += written; @@ -813,7 +813,7 @@ static int unix_write(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polle pa_memchunk_reset(&u->memchunk); } - work_done = TRUE; + work_done = true; u->write_count += written; u->since_start += written; @@ -862,7 +862,7 @@ static void update_smoother(struct userdata *u) { /* Let's update the time smoother */ - if (PA_UNLIKELY((err = pa_alsa_safe_delay(u->pcm_handle, status, &delay, u->hwbuf_size, &u->sink->sample_spec, FALSE)) < 0)) { + if (PA_UNLIKELY((err = pa_alsa_safe_delay(u->pcm_handle, status, &delay, u->hwbuf_size, &u->sink->sample_spec, false)) < 0)) { pa_log_warn("Failed to query DSP status data: %s", pa_alsa_strerror(err)); return; } @@ -1020,7 +1020,7 @@ static int update_sw_params(struct userdata *u) { /* Called from IO Context on unsuspend or from main thread when creating sink */ static void reset_watermark(struct userdata *u, size_t tsched_watermark, pa_sample_spec *ss, - pa_bool_t in_thread) { + bool in_thread) { u->tsched_watermark = pa_usec_to_bytes_round_up(pa_bytes_to_usec_round_up(tsched_watermark, ss), &u->sink->sample_spec); @@ -1056,7 +1056,7 @@ static void reset_watermark(struct userdata *u, size_t tsched_watermark, pa_samp static int unsuspend(struct userdata *u) { pa_sample_spec ss; int err; - pa_bool_t b, d; + bool b, d; snd_pcm_uframes_t period_size, buffer_size; char *device_name = NULL; @@ -1088,7 +1088,7 @@ static int unsuspend(struct userdata *u) { b = u->use_mmap; d = u->use_tsched; - if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &period_size, &buffer_size, 0, &b, &d, TRUE)) < 0) { + if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &period_size, &buffer_size, 0, &b, &d, true)) < 0) { pa_log("Failed to set hardware parameters: %s", pa_alsa_strerror(err)); goto fail; } @@ -1118,16 +1118,16 @@ static int unsuspend(struct userdata *u) { goto fail; u->write_count = 0; - pa_smoother_reset(u->smoother, pa_rtclock_now(), TRUE); + pa_smoother_reset(u->smoother, pa_rtclock_now(), true); u->smoother_interval = SMOOTHER_MIN_INTERVAL; u->last_smoother_update = 0; - u->first = TRUE; + u->first = true; u->since_start = 0; /* reset the watermark to the value defined when sink was created */ if (u->use_tsched) - reset_watermark(u, u->tsched_watermark_ref, &u->sink->sample_spec, TRUE); + reset_watermark(u, u->tsched_watermark_ref, &u->sink->sample_spec, true); pa_log_info("Resumed successfully..."); @@ -1238,13 +1238,13 @@ static int ctl_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) { return 0; if (u->sink->suspend_cause & PA_SUSPEND_SESSION) { - pa_sink_set_mixer_dirty(u->sink, TRUE); + pa_sink_set_mixer_dirty(u->sink, true); return 0; } if (mask & SND_CTL_EVENT_MASK_VALUE) { - pa_sink_get_volume(u->sink, TRUE); - pa_sink_get_mute(u->sink, TRUE); + pa_sink_get_volume(u->sink, true); + pa_sink_get_mute(u->sink, true); } return 0; @@ -1260,7 +1260,7 @@ static int io_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) { return 0; if (u->sink->suspend_cause & PA_SUSPEND_SESSION) { - pa_sink_set_mixer_dirty(u->sink, TRUE); + pa_sink_set_mixer_dirty(u->sink, true); return 0; } @@ -1307,7 +1307,7 @@ static void sink_set_volume_cb(pa_sink *s) { struct userdata *u = s->userdata; pa_cvolume r; char vol_str_pcnt[PA_CVOLUME_SNPRINT_MAX]; - pa_bool_t deferred_volume = !!(s->flags & PA_SINK_DEFERRED_VOLUME); + bool deferred_volume = !!(s->flags & PA_SINK_DEFERRED_VOLUME); pa_assert(u); pa_assert(u->mixer_path); @@ -1326,7 +1326,7 @@ static void sink_set_volume_cb(pa_sink *s) { if (u->mixer_path->has_dB) { pa_cvolume new_soft_volume; - pa_bool_t accurate_enough; + bool accurate_enough; char vol_str_db[PA_SW_CVOLUME_SNPRINT_DB_MAX]; /* Match exactly what the user requested by software */ @@ -1373,11 +1373,11 @@ static void sink_write_volume_cb(pa_sink *s) { /* Shift up by the base volume */ pa_sw_cvolume_divide_scalar(&hw_vol, &hw_vol, s->base_volume); - if (pa_alsa_path_set_volume(u->mixer_path, u->mixer_handle, &s->channel_map, &hw_vol, TRUE, TRUE) < 0) + if (pa_alsa_path_set_volume(u->mixer_path, u->mixer_handle, &s->channel_map, &hw_vol, true, true) < 0) pa_log_error("Writing HW volume failed"); else { pa_cvolume tmp_vol; - pa_bool_t accurate_enough; + bool accurate_enough; /* Shift down by the base volume, so that 0dB becomes maximum volume */ pa_sw_cvolume_multiply_scalar(&hw_vol, &hw_vol, s->base_volume); @@ -1405,7 +1405,7 @@ static void sink_write_volume_cb(pa_sink *s) { static void sink_get_mute_cb(pa_sink *s) { struct userdata *u = s->userdata; - pa_bool_t b; + bool b; pa_assert(u); pa_assert(u->mixer_path); @@ -1447,7 +1447,7 @@ static void mixer_volume_init(struct userdata *u) { pa_sink_set_write_volume_callback(u->sink, NULL); if (u->mixer_path->has_dB) { - pa_sink_enable_decibel_volume(u->sink, TRUE); + pa_sink_enable_decibel_volume(u->sink, true); pa_log_info("Hardware volume ranges from %0.2f dB to %0.2f dB.", u->mixer_path->min_dB, u->mixer_path->max_dB); u->sink->base_volume = pa_sw_volume_from_dB(-u->mixer_path->max_dB); @@ -1455,7 +1455,7 @@ static void mixer_volume_init(struct userdata *u) { pa_log_info("Fixing base volume to %0.2f dB", pa_sw_volume_to_dB(u->sink->base_volume)); } else { - pa_sink_enable_decibel_volume(u->sink, FALSE); + pa_sink_enable_decibel_volume(u->sink, false); pa_log_info("Hardware volume ranges from %li to %li.", u->mixer_path->min_volume, u->mixer_path->max_volume); u->sink->base_volume = PA_VOLUME_NORM; @@ -1483,7 +1483,7 @@ static int sink_set_port_ucm_cb(pa_sink *s, pa_device_port *p) { pa_assert(p); pa_assert(u->ucm_context); - return pa_alsa_ucm_set_port(u->ucm_context, p, TRUE); + return pa_alsa_ucm_set_port(u->ucm_context, p, true); } static int sink_set_port_cb(pa_sink *s, pa_device_port *p) { @@ -1555,7 +1555,7 @@ static pa_idxset* sink_get_formats(pa_sink *s) { return ret; } -static pa_bool_t sink_set_formats(pa_sink *s, pa_idxset *formats) { +static bool sink_set_formats(pa_sink *s, pa_idxset *formats) { struct userdata *u = s->userdata; pa_format_info *f, *g; uint32_t idx, n; @@ -1566,7 +1566,7 @@ static pa_bool_t sink_set_formats(pa_sink *s, pa_idxset *formats) { PA_IDXSET_FOREACH(f, formats, idx) { if (is_iec958(u) && f->encoding == PA_ENCODING_EAC3_IEC61937) /* EAC3 cannot be sent over over S/PDIF */ - return FALSE; + return false; } pa_idxset_free(u->formats, (pa_free_cb_t) pa_format_info_free); @@ -1598,35 +1598,35 @@ static pa_bool_t sink_set_formats(pa_sink *s, pa_idxset *formats) { } } - return TRUE; + return true; } -static pa_bool_t sink_update_rate_cb(pa_sink *s, uint32_t rate) { +static bool sink_update_rate_cb(pa_sink *s, uint32_t rate) { struct userdata *u = s->userdata; int i; - pa_bool_t supported = FALSE; + bool supported = false; pa_assert(u); for (i = 0; u->rates[i]; i++) { if (u->rates[i] == rate) { - supported = TRUE; + supported = true; break; } } if (!supported) { pa_log_info("Sink does not support sample rate of %d Hz", rate); - return FALSE; + return false; } if (!PA_SINK_IS_OPENED(s->state)) { pa_log_info("Updating rate for device %s, new rate is %d",u->device_name, rate); u->sink->sample_spec.rate = rate; - return TRUE; + return true; } - return FALSE; + return false; } static int process_rewind(struct userdata *u) { @@ -1687,7 +1687,7 @@ static int process_rewind(struct userdata *u) { pa_log_debug("Rewound %lu bytes.", (unsigned long) rewind_nbytes); pa_sink_process_rewind(u->sink, rewind_nbytes); - u->after_rewind = TRUE; + u->after_rewind = true; return 0; } } else @@ -1727,7 +1727,7 @@ static void thread_func(void *userdata) { if (PA_SINK_IS_OPENED(u->sink->thread_info.state)) { int work_done; pa_usec_t sleep_usec = 0; - pa_bool_t on_timeout = pa_rtpoll_timer_elapsed(u->rtpoll); + bool on_timeout = pa_rtpoll_timer_elapsed(u->rtpoll); if (u->use_mmap) work_done = mmap_write(u, &sleep_usec, revents & POLLOUT, on_timeout); @@ -1745,9 +1745,9 @@ static void thread_func(void *userdata) { pa_log_info("Starting playback."); snd_pcm_start(u->pcm_handle); - pa_smoother_resume(u->smoother, pa_rtclock_now(), TRUE); + pa_smoother_resume(u->smoother, pa_rtclock_now(), true); - u->first = FALSE; + u->first = false; } update_smoother(u); @@ -1789,7 +1789,7 @@ static void thread_func(void *userdata) { rtpoll_sleep = PA_MIN(sleep_usec, cusec); } - u->after_rewind = FALSE; + u->after_rewind = false; } @@ -1812,7 +1812,7 @@ static void thread_func(void *userdata) { pa_rtpoll_set_timer_disabled(u->rtpoll); /* Hmm, nothing to do. Let's sleep */ - if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) + if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) goto fail; if (rtpoll_sleep > 0) { @@ -1851,7 +1851,7 @@ static void thread_func(void *userdata) { if (pa_alsa_recover_from_poll(u->pcm_handle, revents) < 0) goto fail; - u->first = TRUE; + u->first = true; u->since_start = 0; revents = 0; } else if (revents && u->use_tsched && pa_log_ratelimit(PA_LOG_DEBUG)) @@ -1881,15 +1881,15 @@ static void set_sink_name(pa_sink_new_data *data, pa_modargs *ma, const char *de if ((n = pa_modargs_get_value(ma, "sink_name", NULL))) { pa_sink_new_data_set_name(data, n); - data->namereg_fail = TRUE; + data->namereg_fail = true; return; } if ((n = pa_modargs_get_value(ma, "name", NULL))) - data->namereg_fail = TRUE; + data->namereg_fail = true; else { n = device_id ? device_id : device_name; - data->namereg_fail = FALSE; + data->namereg_fail = false; } if (mapping) @@ -1901,7 +1901,7 @@ static void set_sink_name(pa_sink_new_data *data, pa_modargs *ma, const char *de pa_xfree(t); } -static void find_mixer(struct userdata *u, pa_alsa_mapping *mapping, const char *element, pa_bool_t ignore_dB) { +static void find_mixer(struct userdata *u, pa_alsa_mapping *mapping, const char *element, bool ignore_dB) { snd_hctl_t *hctl; if (!mapping && !element) @@ -1940,8 +1940,8 @@ fail: } } -static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) { - pa_bool_t need_mixer_callback = FALSE; +static int setup_mixer(struct userdata *u, bool ignore_dB) { + bool need_mixer_callback = false; pa_assert(u); @@ -1982,7 +1982,7 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) { PA_HASHMAP_FOREACH(p, u->mixer_path_set->paths, state) { if (p->has_volume || p->has_mute) - need_mixer_callback = TRUE; + need_mixer_callback = true; } } else if (u->mixer_path) @@ -2028,7 +2028,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca uint32_t nfrags, frag_size, buffer_size, tsched_size, tsched_watermark, rewind_safeguard; snd_pcm_uframes_t period_frames, buffer_frames, tsched_frames; size_t frame_size; - pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE, namereg_fail = FALSE, deferred_volume = FALSE, set_formats = FALSE, fixed_latency_range = FALSE; + bool use_mmap = true, b, use_tsched = true, d, ignore_dB = false, namereg_fail = false, deferred_volume = false, set_formats = false, fixed_latency_range = false; pa_sink_new_data data; pa_alsa_profile_set *profile_set = NULL; void *state = NULL; @@ -2113,7 +2113,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca u->use_tsched = use_tsched; u->deferred_volume = deferred_volume; u->fixed_latency_range = fixed_latency_range; - u->first = TRUE; + u->first = true; u->rewind_safeguard = rewind_safeguard; u->rtpoll = pa_rtpoll_new(); pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll); @@ -2121,11 +2121,11 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca u->smoother = pa_smoother_new( SMOOTHER_ADJUST_USEC, SMOOTHER_WINDOW_USEC, - TRUE, - TRUE, + true, + true, 5, pa_rtclock_now(), - TRUE); + true); u->smoother_interval = SMOOTHER_MIN_INTERVAL; /* use ucm */ @@ -2192,7 +2192,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca &ss, &map, SND_PCM_STREAM_PLAYBACK, &period_frames, &buffer_frames, tsched_frames, - &b, &d, FALSE))) + &b, &d, false))) goto fail; } @@ -2209,12 +2209,12 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca if (use_mmap && !b) { pa_log_info("Device doesn't support mmap(), falling back to UNIX read/write mode."); - u->use_mmap = use_mmap = FALSE; + u->use_mmap = use_mmap = false; } if (use_tsched && (!b || !d)) { pa_log_info("Cannot enable timer-based scheduling, falling back to sound IRQ scheduling."); - u->use_tsched = use_tsched = FALSE; + u->use_tsched = use_tsched = false; } if (u->use_mmap) @@ -2228,7 +2228,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca } if (is_iec958(u) || is_hdmi(u)) - set_formats = TRUE; + set_formats = true; u->rates = pa_alsa_get_supported_rates(u->pcm_handle, ss.rate); if (!u->rates) { @@ -2290,7 +2290,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca } if (u->ucm_context) - pa_alsa_ucm_add_ports(&data.ports, data.proplist, u->ucm_context, TRUE, card); + pa_alsa_ucm_add_ports(&data.ports, data.proplist, u->ucm_context, true, card); else if (u->mixer_path_set) pa_alsa_add_ports(&data, u->mixer_path_set, card); @@ -2352,7 +2352,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca if (u->use_tsched) { u->tsched_watermark_ref = tsched_watermark; - reset_watermark(u, u->tsched_watermark_ref, &ss, FALSE); + reset_watermark(u, u->tsched_watermark_ref, &ss, false); } else pa_sink_set_fixed_latency(u->sink, pa_bytes_to_usec(u->hwbuf_size, &ss)); @@ -2362,7 +2362,7 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca goto fail; if (u->ucm_context) { - if (u->sink->active_port && pa_alsa_ucm_set_port(u->ucm_context, u->sink->active_port, TRUE) < 0) + if (u->sink->active_port && pa_alsa_ucm_set_port(u->ucm_context, u->sink->active_port, true) < 0) goto fail; } else if (setup_mixer(u, ignore_dB) < 0) goto fail; diff --git a/src/modules/alsa/alsa-source.c b/src/modules/alsa/alsa-source.c index 6a53c4b53..3d5601374 100644 --- a/src/modules/alsa/alsa-source.c +++ b/src/modules/alsa/alsa-source.c @@ -123,9 +123,9 @@ struct userdata { char *device_name; /* name of the PCM device */ char *control_device; /* name of the control device */ - pa_bool_t use_mmap:1, use_tsched:1, deferred_volume:1, fixed_latency_range:1; + bool use_mmap:1, use_tsched:1, deferred_volume:1, fixed_latency_range:1; - pa_bool_t first; + bool first; pa_rtpoll_item *alsa_rtpoll_item; @@ -151,7 +151,7 @@ static pa_hook_result_t reserve_cb(pa_reserve_wrapper *r, void *forced, struct u pa_log_debug("Suspending source %s, because another application requested us to release the device.", u->source->name); - if (pa_source_suspend(u->source, TRUE, PA_SUSPEND_APPLICATION) < 0) + if (pa_source_suspend(u->source, true, PA_SUSPEND_APPLICATION) < 0) return PA_HOOK_CANCEL; return PA_HOOK_OK; @@ -420,14 +420,14 @@ static int try_recover(struct userdata *u, const char *call, int err) { return -1; } - u->first = TRUE; + u->first = true; return 0; } -static size_t check_left_to_record(struct userdata *u, size_t n_bytes, pa_bool_t on_timeout) { +static size_t check_left_to_record(struct userdata *u, size_t n_bytes, bool on_timeout) { size_t left_to_record; size_t rec_space = u->hwbuf_size - u->hwbuf_unused; - pa_bool_t overrun = FALSE; + bool overrun = false; /* We use <= instead of < for this check here because an overrun * only happens after the last sample was processed, not already when @@ -440,7 +440,7 @@ static size_t check_left_to_record(struct userdata *u, size_t n_bytes, pa_bool_t /* We got a dropout. What a mess! */ left_to_record = 0; - overrun = TRUE; + overrun = true; #ifdef DEBUG_TIMING PA_DEBUG_TRAP; @@ -455,12 +455,12 @@ static size_t check_left_to_record(struct userdata *u, size_t n_bytes, pa_bool_t #endif if (u->use_tsched) { - pa_bool_t reset_not_before = TRUE; + bool reset_not_before = true; if (overrun || left_to_record < u->watermark_inc_threshold) increase_watermark(u); else if (left_to_record > u->watermark_dec_threshold) { - reset_not_before = FALSE; + reset_not_before = false; /* We decrease the watermark only if have actually * been woken up by a timeout. If something else woke @@ -477,8 +477,8 @@ static size_t check_left_to_record(struct userdata *u, size_t n_bytes, pa_bool_t return left_to_record; } -static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled, pa_bool_t on_timeout) { - pa_bool_t work_done = FALSE; +static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, bool polled, bool on_timeout) { + bool work_done = false; pa_usec_t max_sleep_usec = 0, process_usec = 0; size_t left_to_record; unsigned j = 0; @@ -493,7 +493,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled snd_pcm_sframes_t n; size_t n_bytes; int r; - pa_bool_t after_avail = TRUE; + bool after_avail = true; if (PA_UNLIKELY((n = pa_alsa_safe_avail(u->pcm_handle, u->hwbuf_size, &u->source->sample_spec)) < 0)) { @@ -510,7 +510,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled #endif left_to_record = check_left_to_record(u, n_bytes, on_timeout); - on_timeout = FALSE; + on_timeout = false; if (u->use_tsched) if (!polled && @@ -547,7 +547,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled break; } - polled = FALSE; + polled = false; #ifdef DEBUG_TIMING pa_log_debug("Reading"); @@ -583,7 +583,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled break; pa_assert(frames > 0); - after_avail = FALSE; + after_avail = false; /* Check these are multiples of 8 bit */ pa_assert((areas[0].first & 7) == 0); @@ -595,7 +595,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled p = (uint8_t*) areas[0].addr + (offset * u->frame_size); - chunk.memblock = pa_memblock_new_fixed(u->core->mempool, p, frames * u->frame_size, TRUE); + chunk.memblock = pa_memblock_new_fixed(u->core->mempool, p, frames * u->frame_size, true); chunk.length = pa_memblock_get_length(chunk.memblock); chunk.index = 0; @@ -610,7 +610,7 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled return r; } - work_done = TRUE; + work_done = true; u->read_count += frames * u->frame_size; @@ -638,8 +638,8 @@ static int mmap_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled return work_done ? 1 : 0; } -static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled, pa_bool_t on_timeout) { - int work_done = FALSE; +static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, bool polled, bool on_timeout) { + int work_done = false; pa_usec_t max_sleep_usec = 0, process_usec = 0; size_t left_to_record; unsigned j = 0; @@ -654,7 +654,7 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled snd_pcm_sframes_t n; size_t n_bytes; int r; - pa_bool_t after_avail = TRUE; + bool after_avail = true; if (PA_UNLIKELY((n = pa_alsa_safe_avail(u->pcm_handle, u->hwbuf_size, &u->source->sample_spec)) < 0)) { @@ -666,7 +666,7 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled n_bytes = (size_t) n * u->frame_size; left_to_record = check_left_to_record(u, n_bytes, on_timeout); - on_timeout = FALSE; + on_timeout = false; if (u->use_tsched) if (!polled && @@ -696,7 +696,7 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled break; } - polled = FALSE; + polled = false; for (;;) { void *p; @@ -734,7 +734,7 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled } pa_assert(frames > 0); - after_avail = FALSE; + after_avail = false; chunk.index = 0; chunk.length = (size_t) frames * u->frame_size; @@ -742,7 +742,7 @@ static int unix_read(struct userdata *u, pa_usec_t *sleep_usec, pa_bool_t polled pa_source_post(u->source, &chunk); pa_memblock_unref(chunk.memblock); - work_done = TRUE; + work_done = true; u->read_count += frames * u->frame_size; @@ -783,7 +783,7 @@ static void update_smoother(struct userdata *u) { /* Let's update the time smoother */ - if (PA_UNLIKELY((err = pa_alsa_safe_delay(u->pcm_handle, status, &delay, u->hwbuf_size, &u->source->sample_spec, TRUE)) < 0)) { + if (PA_UNLIKELY((err = pa_alsa_safe_delay(u->pcm_handle, status, &delay, u->hwbuf_size, &u->source->sample_spec, true)) < 0)) { pa_log_warn("Failed to get delay: %s", pa_alsa_strerror(err)); return; } @@ -913,7 +913,7 @@ static int update_sw_params(struct userdata *u) { /* Called from IO Context on unsuspend or from main thread when creating source */ static void reset_watermark(struct userdata *u, size_t tsched_watermark, pa_sample_spec *ss, - pa_bool_t in_thread) { + bool in_thread) { u->tsched_watermark = pa_usec_to_bytes_round_up(pa_bytes_to_usec_round_up(tsched_watermark, ss), &u->source->sample_spec); @@ -949,7 +949,7 @@ static void reset_watermark(struct userdata *u, size_t tsched_watermark, pa_samp static int unsuspend(struct userdata *u) { pa_sample_spec ss; int err; - pa_bool_t b, d; + bool b, d; snd_pcm_uframes_t period_size, buffer_size; pa_assert(u); @@ -972,7 +972,7 @@ static int unsuspend(struct userdata *u) { b = u->use_mmap; d = u->use_tsched; - if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &period_size, &buffer_size, 0, &b, &d, TRUE)) < 0) { + if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &period_size, &buffer_size, 0, &b, &d, true)) < 0) { pa_log("Failed to set hardware parameters: %s", pa_alsa_strerror(err)); goto fail; } @@ -1004,15 +1004,15 @@ static int unsuspend(struct userdata *u) { /* FIXME: We need to reload the volume somehow */ u->read_count = 0; - pa_smoother_reset(u->smoother, pa_rtclock_now(), TRUE); + pa_smoother_reset(u->smoother, pa_rtclock_now(), true); u->smoother_interval = SMOOTHER_MIN_INTERVAL; u->last_smoother_update = 0; - u->first = TRUE; + u->first = true; /* reset the watermark to the value defined when source was created */ if (u->use_tsched) - reset_watermark(u, u->tsched_watermark_ref, &u->source->sample_spec, TRUE); + reset_watermark(u, u->tsched_watermark_ref, &u->source->sample_spec, true); pa_log_info("Resumed successfully..."); @@ -1120,13 +1120,13 @@ static int ctl_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) { return 0; if (u->source->suspend_cause & PA_SUSPEND_SESSION) { - pa_source_set_mixer_dirty(u->source, TRUE); + pa_source_set_mixer_dirty(u->source, true); return 0; } if (mask & SND_CTL_EVENT_MASK_VALUE) { - pa_source_get_volume(u->source, TRUE); - pa_source_get_mute(u->source, TRUE); + pa_source_get_volume(u->source, true); + pa_source_get_mute(u->source, true); } return 0; @@ -1142,7 +1142,7 @@ static int io_mixer_callback(snd_mixer_elem_t *elem, unsigned int mask) { return 0; if (u->source->suspend_cause & PA_SUSPEND_SESSION) { - pa_source_set_mixer_dirty(u->source, TRUE); + pa_source_set_mixer_dirty(u->source, true); return 0; } @@ -1189,7 +1189,7 @@ static void source_set_volume_cb(pa_source *s) { struct userdata *u = s->userdata; pa_cvolume r; char vol_str_pcnt[PA_CVOLUME_SNPRINT_MAX]; - pa_bool_t deferred_volume = !!(s->flags & PA_SOURCE_DEFERRED_VOLUME); + bool deferred_volume = !!(s->flags & PA_SOURCE_DEFERRED_VOLUME); pa_assert(u); pa_assert(u->mixer_path); @@ -1208,7 +1208,7 @@ static void source_set_volume_cb(pa_source *s) { if (u->mixer_path->has_dB) { pa_cvolume new_soft_volume; - pa_bool_t accurate_enough; + bool accurate_enough; char vol_str_db[PA_SW_CVOLUME_SNPRINT_DB_MAX]; /* Match exactly what the user requested by software */ @@ -1255,11 +1255,11 @@ static void source_write_volume_cb(pa_source *s) { /* Shift up by the base volume */ pa_sw_cvolume_divide_scalar(&hw_vol, &hw_vol, s->base_volume); - if (pa_alsa_path_set_volume(u->mixer_path, u->mixer_handle, &s->channel_map, &hw_vol, TRUE, TRUE) < 0) + if (pa_alsa_path_set_volume(u->mixer_path, u->mixer_handle, &s->channel_map, &hw_vol, true, true) < 0) pa_log_error("Writing HW volume failed"); else { pa_cvolume tmp_vol; - pa_bool_t accurate_enough; + bool accurate_enough; /* Shift down by the base volume, so that 0dB becomes maximum volume */ pa_sw_cvolume_multiply_scalar(&hw_vol, &hw_vol, s->base_volume); @@ -1287,7 +1287,7 @@ static void source_write_volume_cb(pa_source *s) { static void source_get_mute_cb(pa_source *s) { struct userdata *u = s->userdata; - pa_bool_t b; + bool b; pa_assert(u); pa_assert(u->mixer_path); @@ -1329,7 +1329,7 @@ static void mixer_volume_init(struct userdata *u) { pa_source_set_write_volume_callback(u->source, NULL); if (u->mixer_path->has_dB) { - pa_source_enable_decibel_volume(u->source, TRUE); + pa_source_enable_decibel_volume(u->source, true); pa_log_info("Hardware volume ranges from %0.2f dB to %0.2f dB.", u->mixer_path->min_dB, u->mixer_path->max_dB); u->source->base_volume = pa_sw_volume_from_dB(-u->mixer_path->max_dB); @@ -1337,7 +1337,7 @@ static void mixer_volume_init(struct userdata *u) { pa_log_info("Fixing base volume to %0.2f dB", pa_sw_volume_to_dB(u->source->base_volume)); } else { - pa_source_enable_decibel_volume(u->source, FALSE); + pa_source_enable_decibel_volume(u->source, false); pa_log_info("Hardware volume ranges from %li to %li.", u->mixer_path->min_volume, u->mixer_path->max_volume); u->source->base_volume = PA_VOLUME_NORM; @@ -1365,7 +1365,7 @@ static int source_set_port_ucm_cb(pa_source *s, pa_device_port *p) { pa_assert(p); pa_assert(u->ucm_context); - return pa_alsa_ucm_set_port(u->ucm_context, p, FALSE); + return pa_alsa_ucm_set_port(u->ucm_context, p, false); } static int source_set_port_cb(pa_source *s, pa_device_port *p) { @@ -1409,32 +1409,32 @@ static void source_update_requested_latency_cb(pa_source *s) { update_sw_params(u); } -static pa_bool_t source_update_rate_cb(pa_source *s, uint32_t rate) { +static bool source_update_rate_cb(pa_source *s, uint32_t rate) { struct userdata *u = s->userdata; int i; - pa_bool_t supported = FALSE; + bool supported = false; pa_assert(u); for (i = 0; u->rates[i]; i++) { if (u->rates[i] == rate) { - supported = TRUE; + supported = true; break; } } if (!supported) { pa_log_info("Source does not support sample rate of %d Hz", rate); - return FALSE; + return false; } if (!PA_SOURCE_IS_OPENED(s->state)) { pa_log_info("Updating rate for device %s, new rate is %d", u->device_name, rate); u->source->sample_spec.rate = rate; - return TRUE; + return true; } - return FALSE; + return false; } static void thread_func(void *userdata) { @@ -1462,15 +1462,15 @@ static void thread_func(void *userdata) { if (PA_SOURCE_IS_OPENED(u->source->thread_info.state)) { int work_done; pa_usec_t sleep_usec = 0; - pa_bool_t on_timeout = pa_rtpoll_timer_elapsed(u->rtpoll); + bool on_timeout = pa_rtpoll_timer_elapsed(u->rtpoll); if (u->first) { pa_log_info("Starting capture."); snd_pcm_start(u->pcm_handle); - pa_smoother_resume(u->smoother, pa_rtclock_now(), TRUE); + pa_smoother_resume(u->smoother, pa_rtclock_now(), true); - u->first = FALSE; + u->first = false; } if (u->use_mmap) @@ -1524,7 +1524,7 @@ static void thread_func(void *userdata) { pa_rtpoll_set_timer_disabled(u->rtpoll); /* Hmm, nothing to do. Let's sleep */ - if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) + if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) goto fail; if (rtpoll_sleep > 0) { @@ -1563,7 +1563,7 @@ static void thread_func(void *userdata) { if (pa_alsa_recover_from_poll(u->pcm_handle, revents) < 0) goto fail; - u->first = TRUE; + u->first = true; revents = 0; } else if (revents && u->use_tsched && pa_log_ratelimit(PA_LOG_DEBUG)) pa_log_debug("Wakeup from ALSA!"); @@ -1592,15 +1592,15 @@ static void set_source_name(pa_source_new_data *data, pa_modargs *ma, const char if ((n = pa_modargs_get_value(ma, "source_name", NULL))) { pa_source_new_data_set_name(data, n); - data->namereg_fail = TRUE; + data->namereg_fail = true; return; } if ((n = pa_modargs_get_value(ma, "name", NULL))) - data->namereg_fail = TRUE; + data->namereg_fail = true; else { n = device_id ? device_id : device_name; - data->namereg_fail = FALSE; + data->namereg_fail = false; } if (mapping) @@ -1612,7 +1612,7 @@ static void set_source_name(pa_source_new_data *data, pa_modargs *ma, const char pa_xfree(t); } -static void find_mixer(struct userdata *u, pa_alsa_mapping *mapping, const char *element, pa_bool_t ignore_dB) { +static void find_mixer(struct userdata *u, pa_alsa_mapping *mapping, const char *element, bool ignore_dB) { snd_hctl_t *hctl; if (!mapping && !element) @@ -1651,8 +1651,8 @@ fail: } } -static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) { - pa_bool_t need_mixer_callback = FALSE; +static int setup_mixer(struct userdata *u, bool ignore_dB) { + bool need_mixer_callback = false; pa_assert(u); @@ -1692,7 +1692,7 @@ static int setup_mixer(struct userdata *u, pa_bool_t ignore_dB) { PA_HASHMAP_FOREACH(p, u->mixer_path_set->paths, state) { if (p->has_volume || p->has_mute) - need_mixer_callback = TRUE; + need_mixer_callback = true; } } else if (u->mixer_path) @@ -1738,7 +1738,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p uint32_t nfrags, frag_size, buffer_size, tsched_size, tsched_watermark; snd_pcm_uframes_t period_frames, buffer_frames, tsched_frames; size_t frame_size; - pa_bool_t use_mmap = TRUE, b, use_tsched = TRUE, d, ignore_dB = FALSE, namereg_fail = FALSE, deferred_volume = FALSE, fixed_latency_range = FALSE; + bool use_mmap = true, b, use_tsched = true, d, ignore_dB = false, namereg_fail = false, deferred_volume = false, fixed_latency_range = false; pa_source_new_data data; pa_alsa_profile_set *profile_set = NULL; void *state = NULL; @@ -1817,18 +1817,18 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p u->use_tsched = use_tsched; u->deferred_volume = deferred_volume; u->fixed_latency_range = fixed_latency_range; - u->first = TRUE; + u->first = true; u->rtpoll = pa_rtpoll_new(); pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll); u->smoother = pa_smoother_new( SMOOTHER_ADJUST_USEC, SMOOTHER_WINDOW_USEC, - TRUE, - TRUE, + true, + true, 5, pa_rtclock_now(), - TRUE); + true); u->smoother_interval = SMOOTHER_MIN_INTERVAL; /* use ucm */ @@ -1895,7 +1895,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p &ss, &map, SND_PCM_STREAM_CAPTURE, &period_frames, &buffer_frames, tsched_frames, - &b, &d, FALSE))) + &b, &d, false))) goto fail; } @@ -1912,12 +1912,12 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p if (use_mmap && !b) { pa_log_info("Device doesn't support mmap(), falling back to UNIX read/write mode."); - u->use_mmap = use_mmap = FALSE; + u->use_mmap = use_mmap = false; } if (use_tsched && (!b || !d)) { pa_log_info("Cannot enable timer-based scheduling, falling back to sound IRQ scheduling."); - u->use_tsched = use_tsched = FALSE; + u->use_tsched = use_tsched = false; } if (u->use_mmap) @@ -1989,7 +1989,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p } if (u->ucm_context) - pa_alsa_ucm_add_ports(&data.ports, data.proplist, u->ucm_context, FALSE, card); + pa_alsa_ucm_add_ports(&data.ports, data.proplist, u->ucm_context, false, card); else if (u->mixer_path_set) pa_alsa_add_ports(&data, u->mixer_path_set, card); @@ -2042,7 +2042,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p if (u->use_tsched) { u->tsched_watermark_ref = tsched_watermark; - reset_watermark(u, u->tsched_watermark_ref, &ss, FALSE); + reset_watermark(u, u->tsched_watermark_ref, &ss, false); } else pa_source_set_fixed_latency(u->source, pa_bytes_to_usec(u->hwbuf_size, &ss)); @@ -2053,7 +2053,7 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p goto fail; if (u->ucm_context) { - if (u->source->active_port && pa_alsa_ucm_set_port(u->ucm_context, u->source->active_port, FALSE) < 0) + if (u->source->active_port && pa_alsa_ucm_set_port(u->ucm_context, u->source->active_port, false) < 0) goto fail; } else if (setup_mixer(u, ignore_dB) < 0) goto fail; diff --git a/src/modules/alsa/alsa-ucm.c b/src/modules/alsa/alsa-ucm.c index bc2ea9b77..677db9947 100644 --- a/src/modules/alsa/alsa-ucm.c +++ b/src/modules/alsa/alsa-ucm.c @@ -451,10 +451,10 @@ static void add_media_role(const char *name, pa_alsa_ucm_device *list, const cha static char *modifier_name_to_role(const char *mod_name, bool *is_sink) { char *sub = NULL, *tmp; - *is_sink = FALSE; + *is_sink = false; if (pa_startswith(mod_name, "Play")) { - *is_sink = TRUE; + *is_sink = true; sub = pa_xstrdup(mod_name + 4); } else if (pa_startswith(mod_name, "Capture")) sub = pa_xstrdup(mod_name + 7); @@ -476,7 +476,7 @@ static char *modifier_name_to_role(const char *mod_name, bool *is_sink) { static void ucm_set_media_roles(pa_alsa_ucm_modifier *modifier, pa_alsa_ucm_device *list, const char *mod_name) { int i; - bool is_sink = FALSE; + bool is_sink = false; char *sub = NULL; const char *role_name; @@ -729,7 +729,7 @@ static int ucm_port_contains(const char *port_name, const char *dev_name, bool i int len; if (!port_name || !dev_name) - return FALSE; + return false; port_name += is_sink ? strlen(PA_UCM_PRE_TAG_OUTPUT) : strlen(PA_UCM_PRE_TAG_INPUT); @@ -1203,9 +1203,9 @@ static int ucm_create_mapping( } if (sink) - ret = ucm_create_mapping_direction(ucm, ps, p, device, verb_name, device_name, sink, TRUE); + ret = ucm_create_mapping_direction(ucm, ps, p, device, verb_name, device_name, sink, true); if (ret == 0 && source) - ret = ucm_create_mapping_direction(ucm, ps, p, device, verb_name, device_name, source, FALSE); + ret = ucm_create_mapping_direction(ucm, ps, p, device, verb_name, device_name, source, false); return ret; } @@ -1260,7 +1260,7 @@ static int ucm_create_profile( p->output_mappings = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); p->input_mappings = pa_idxset_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func); - p->supported = TRUE; + p->supported = true; pa_hashmap_put(ps->profiles, p->name, p); /* TODO: get profile priority from ucm info or policy management */ @@ -1305,9 +1305,9 @@ static int ucm_create_profile( source = pa_proplist_gets(mod->proplist, PA_ALSA_PROP_UCM_SOURCE); if (sink) - ucm_create_mapping_for_modifier(ucm, ps, p, mod, verb_name, name, sink, TRUE); + ucm_create_mapping_for_modifier(ucm, ps, p, mod, verb_name, name, sink, true); else if (source) - ucm_create_mapping_for_modifier(ucm, ps, p, mod, verb_name, name, source, FALSE); + ucm_create_mapping_for_modifier(ucm, ps, p, mod, verb_name, name, source, false); } pa_alsa_profile_dump(p); @@ -1405,7 +1405,7 @@ static void ucm_probe_profile_set(pa_alsa_ucm_config *ucm, pa_alsa_profile_set * if ((snd_use_case_set(ucm->ucm_mgr, "_verb", p->name)) < 0) { pa_log("Failed to set verb %s", p->name); - p->supported = FALSE; + p->supported = false; continue; } @@ -1418,7 +1418,7 @@ static void ucm_probe_profile_set(pa_alsa_ucm_config *ucm, pa_alsa_profile_set * m->output_pcm = mapping_open_pcm(ucm, m, SND_PCM_STREAM_PLAYBACK); if (!m->output_pcm) { - p->supported = FALSE; + p->supported = false; break; } } @@ -1433,7 +1433,7 @@ static void ucm_probe_profile_set(pa_alsa_ucm_config *ucm, pa_alsa_profile_set * m->input_pcm = mapping_open_pcm(ucm, m, SND_PCM_STREAM_CAPTURE); if (!m->input_pcm) { - p->supported = FALSE; + p->supported = false; break; } } @@ -1488,7 +1488,7 @@ pa_alsa_profile_set* pa_alsa_ucm_add_profile_set(pa_alsa_ucm_config *ucm, pa_cha } ucm_probe_profile_set(ucm, ps); - ps->probed = TRUE; + ps->probed = true; return ps; } diff --git a/src/modules/alsa/alsa-util.c b/src/modules/alsa/alsa-util.c index 168a67884..75f58580a 100644 --- a/src/modules/alsa/alsa-util.c +++ b/src/modules/alsa/alsa-util.c @@ -191,17 +191,17 @@ int pa_alsa_set_hw_params( snd_pcm_uframes_t *period_size, snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, - pa_bool_t *use_tsched, - pa_bool_t require_exact_channel_number) { + bool *use_mmap, + bool *use_tsched, + bool require_exact_channel_number) { int ret = -1; snd_pcm_hw_params_t *hwparams, *hwparams_copy; int dir; snd_pcm_uframes_t _period_size = period_size ? *period_size : 0; snd_pcm_uframes_t _buffer_size = buffer_size ? *buffer_size : 0; - pa_bool_t _use_mmap = use_mmap && *use_mmap; - pa_bool_t _use_tsched = use_tsched && *use_tsched; + bool _use_mmap = use_mmap && *use_mmap; + bool _use_tsched = use_tsched && *use_tsched; pa_sample_spec _ss = *ss; pa_assert(pcm_handle); @@ -231,7 +231,7 @@ int pa_alsa_set_hw_params( goto finish; } - _use_mmap = FALSE; + _use_mmap = false; } } else if ((ret = snd_pcm_hw_params_set_access(pcm_handle, hwparams, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0) { @@ -240,10 +240,10 @@ int pa_alsa_set_hw_params( } if (!_use_mmap) - _use_tsched = FALSE; + _use_tsched = false; if (!pa_alsa_pcm_is_hw(pcm_handle)) - _use_tsched = FALSE; + _use_tsched = false; #if (SND_LIB_VERSION >= ((1<<16)|(0<<8)|24)) /* API additions in 1.0.24 */ if (_use_tsched) { @@ -251,7 +251,7 @@ int pa_alsa_set_hw_params( /* try to disable period wakeups if hardware can do so */ if (snd_pcm_hw_params_can_disable_period_wakeup(hwparams)) { - if ((ret = snd_pcm_hw_params_set_period_wakeup(pcm_handle, hwparams, FALSE)) < 0) + if ((ret = snd_pcm_hw_params_set_period_wakeup(pcm_handle, hwparams, false)) < 0) /* don't bail, keep going with default mode with period wakeups */ pa_log_debug("snd_pcm_hw_params_set_period_wakeup() failed: %s", pa_alsa_strerror(ret)); else @@ -426,7 +426,7 @@ finish: return ret; } -int pa_alsa_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min, pa_bool_t period_event) { +int pa_alsa_set_sw_params(snd_pcm_t *pcm, snd_pcm_uframes_t avail_min, bool period_event) { snd_pcm_sw_params_t *swparams; snd_pcm_uframes_t boundary; int err; @@ -487,8 +487,8 @@ snd_pcm_t *pa_alsa_open_by_device_id_auto( snd_pcm_uframes_t *period_size, snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, - pa_bool_t *use_tsched, + bool *use_mmap, + bool *use_tsched, pa_alsa_profile_set *ps, pa_alsa_mapping **mapping) { @@ -578,7 +578,7 @@ snd_pcm_t *pa_alsa_open_by_device_id_auto( tsched_size, use_mmap, use_tsched, - FALSE); + false); pa_xfree(d); if (pcm_handle && mapping) @@ -596,8 +596,8 @@ snd_pcm_t *pa_alsa_open_by_device_id_mapping( snd_pcm_uframes_t *period_size, snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, - pa_bool_t *use_tsched, + bool *use_mmap, + bool *use_tsched, pa_alsa_mapping *m) { snd_pcm_t *pcm_handle; @@ -648,14 +648,14 @@ snd_pcm_t *pa_alsa_open_by_device_string( snd_pcm_uframes_t *period_size, snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, - pa_bool_t *use_tsched, - pa_bool_t require_exact_channel_number) { + bool *use_mmap, + bool *use_tsched, + bool require_exact_channel_number) { int err; char *d; snd_pcm_t *pcm_handle; - pa_bool_t reformat = FALSE; + bool reformat = false; pa_assert(device); pa_assert(ss); @@ -688,7 +688,7 @@ snd_pcm_t *pa_alsa_open_by_device_string( require_exact_channel_number)) < 0) { if (!reformat) { - reformat = TRUE; + reformat = true; snd_pcm_close(pcm_handle); continue; @@ -702,7 +702,7 @@ snd_pcm_t *pa_alsa_open_by_device_string( pa_xfree(d); d = t; - reformat = FALSE; + reformat = false; snd_pcm_close(pcm_handle); continue; @@ -741,9 +741,9 @@ snd_pcm_t *pa_alsa_open_by_template( snd_pcm_uframes_t *period_size, snd_pcm_uframes_t *buffer_size, snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, - pa_bool_t *use_tsched, - pa_bool_t require_exact_channel_number) { + bool *use_mmap, + bool *use_tsched, + bool require_exact_channel_number) { snd_pcm_t *pcm_handle; char **i; @@ -862,18 +862,18 @@ void pa_alsa_refcnt_dec(void) { } } -pa_bool_t pa_alsa_init_description(pa_proplist *p) { +bool pa_alsa_init_description(pa_proplist *p) { const char *d, *k; pa_assert(p); if (pa_device_init_description(p)) - return TRUE; + return true; if (!(d = pa_proplist_gets(p, "alsa.card_name"))) d = pa_proplist_gets(p, "alsa.name"); if (!d) - return FALSE; + return false; k = pa_proplist_gets(p, PA_PROP_DEVICE_PROFILE_DESCRIPTION); @@ -882,7 +882,7 @@ pa_bool_t pa_alsa_init_description(pa_proplist *p) { else if (d) pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, d); - return FALSE; + return false; } void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card) { @@ -1142,7 +1142,7 @@ snd_pcm_sframes_t pa_alsa_safe_avail(snd_pcm_t *pcm, size_t hwbuf_size, const pa } int pa_alsa_safe_delay(snd_pcm_t *pcm, snd_pcm_status_t *status, snd_pcm_sframes_t *delay, size_t hwbuf_size, const pa_sample_spec *ss, - pa_bool_t capture) { + bool capture) { ssize_t k; size_t abs_k; int err; @@ -1333,7 +1333,7 @@ unsigned int *pa_alsa_get_supported_rates(snd_pcm_t *pcm, unsigned int fallback_ 64000, 88200, 96000, 128000, 176400, 192000, 384000 }; - pa_bool_t supported[PA_ELEMENTSOF(all_rates)] = { FALSE, }; + bool supported[PA_ELEMENTSOF(all_rates)] = { false, }; snd_pcm_hw_params_t *hwparams; unsigned int i, j, n, *rates = NULL; int ret; @@ -1347,7 +1347,7 @@ unsigned int *pa_alsa_get_supported_rates(snd_pcm_t *pcm, unsigned int fallback_ for (i = 0, n = 0; i < PA_ELEMENTSOF(all_rates); i++) { if (snd_pcm_hw_params_test_rate(pcm, hwparams, all_rates[i], 0) == 0) { - supported[i] = TRUE; + supported[i] = true; n++; } } @@ -1377,26 +1377,26 @@ unsigned int *pa_alsa_get_supported_rates(snd_pcm_t *pcm, unsigned int fallback_ return rates; } -pa_bool_t pa_alsa_pcm_is_hw(snd_pcm_t *pcm) { +bool pa_alsa_pcm_is_hw(snd_pcm_t *pcm) { snd_pcm_info_t* info; snd_pcm_info_alloca(&info); pa_assert(pcm); if (snd_pcm_info(pcm, info) < 0) - return FALSE; + return false; return snd_pcm_info_get_card(info) >= 0; } -pa_bool_t pa_alsa_pcm_is_modem(snd_pcm_t *pcm) { +bool pa_alsa_pcm_is_modem(snd_pcm_t *pcm) { snd_pcm_info_t* info; snd_pcm_info_alloca(&info); pa_assert(pcm); if (snd_pcm_info(pcm, info) < 0) - return FALSE; + return false; return snd_pcm_info_get_class(info) == SND_PCM_CLASS_MODEM; } @@ -1428,26 +1428,26 @@ const char* pa_alsa_strerror(int errnum) { return translated; } -pa_bool_t pa_alsa_may_tsched(pa_bool_t want) { +bool pa_alsa_may_tsched(bool want) { if (!want) - return FALSE; + return false; if (!pa_rtclock_hrtimer()) { /* We cannot depend on being woken up in time when the timers are inaccurate, so let's fallback to classic IO based playback then. */ pa_log_notice("Disabling timer-based scheduling because high-resolution timers are not available from the kernel."); - return FALSE; } + return false; } if (pa_running_in_vm()) { /* We cannot depend on being woken up when we ask for in a VM, * so let's fallback to classic IO based playback then. */ pa_log_notice("Disabling timer-based scheduling because running inside a VM."); - return FALSE; + return false; } - return TRUE; + return true; } snd_hctl_elem_t* pa_alsa_find_jack(snd_hctl_t *hctl, const char* jack_name) { diff --git a/src/modules/alsa/alsa-util.h b/src/modules/alsa/alsa-util.h index 5b0a0bdc3..0520b6b79 100644 --- a/src/modules/alsa/alsa-util.h +++ b/src/modules/alsa/alsa-util.h @@ -41,14 +41,14 @@ int pa_alsa_set_hw_params( snd_pcm_uframes_t *period_size, /* modified at return */ snd_pcm_uframes_t *buffer_size, /* modified at return */ snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, /* modified at return */ - pa_bool_t *use_tsched, /* modified at return */ - pa_bool_t require_exact_channel_number); + bool *use_mmap, /* modified at return */ + bool *use_tsched, /* modified at return */ + bool require_exact_channel_number); int pa_alsa_set_sw_params( snd_pcm_t *pcm, snd_pcm_uframes_t avail_min, - pa_bool_t period_event); + bool period_event); /* Picks a working mapping from the profile set based on the specified ss/map */ snd_pcm_t *pa_alsa_open_by_device_id_auto( @@ -60,8 +60,8 @@ snd_pcm_t *pa_alsa_open_by_device_id_auto( snd_pcm_uframes_t *period_size, /* modified at return */ snd_pcm_uframes_t *buffer_size, /* modified at return */ snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, /* modified at return */ - pa_bool_t *use_tsched, /* modified at return */ + bool *use_mmap, /* modified at return */ + bool *use_tsched, /* modified at return */ pa_alsa_profile_set *ps, pa_alsa_mapping **mapping); /* modified at return */ @@ -75,8 +75,8 @@ snd_pcm_t *pa_alsa_open_by_device_id_mapping( snd_pcm_uframes_t *period_size, /* modified at return */ snd_pcm_uframes_t *buffer_size, /* modified at return */ snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, /* modified at return */ - pa_bool_t *use_tsched, /* modified at return */ + bool *use_mmap, /* modified at return */ + bool *use_tsched, /* modified at return */ pa_alsa_mapping *mapping); /* Opens the explicit ALSA device */ @@ -89,9 +89,9 @@ snd_pcm_t *pa_alsa_open_by_device_string( snd_pcm_uframes_t *period_size, /* modified at return */ snd_pcm_uframes_t *buffer_size, /* modified at return */ snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, /* modified at return */ - pa_bool_t *use_tsched, /* modified at return */ - pa_bool_t require_exact_channel_number); + bool *use_mmap, /* modified at return */ + bool *use_tsched, /* modified at return */ + bool require_exact_channel_number); /* Opens the explicit ALSA device with a fallback list */ snd_pcm_t *pa_alsa_open_by_template( @@ -104,9 +104,9 @@ snd_pcm_t *pa_alsa_open_by_template( snd_pcm_uframes_t *period_size, /* modified at return */ snd_pcm_uframes_t *buffer_size, /* modified at return */ snd_pcm_uframes_t tsched_size, - pa_bool_t *use_mmap, /* modified at return */ - pa_bool_t *use_tsched, /* modified at return */ - pa_bool_t require_exact_channel_number); + bool *use_mmap, /* modified at return */ + bool *use_tsched, /* modified at return */ + bool require_exact_channel_number); void pa_alsa_dump(pa_log_level_t level, snd_pcm_t *pcm); void pa_alsa_dump_status(snd_pcm_t *pcm); @@ -118,14 +118,14 @@ void pa_alsa_init_proplist_pcm_info(pa_core *c, pa_proplist *p, snd_pcm_info_t * void pa_alsa_init_proplist_card(pa_core *c, pa_proplist *p, int card); void pa_alsa_init_proplist_pcm(pa_core *c, pa_proplist *p, snd_pcm_t *pcm); void pa_alsa_init_proplist_ctl(pa_proplist *p, const char *name); -pa_bool_t pa_alsa_init_description(pa_proplist *p); +bool pa_alsa_init_description(pa_proplist *p); int pa_alsa_recover_from_poll(snd_pcm_t *pcm, int revents); pa_rtpoll_item* pa_alsa_build_pollfd(snd_pcm_t *pcm, pa_rtpoll *rtpoll); snd_pcm_sframes_t pa_alsa_safe_avail(snd_pcm_t *pcm, size_t hwbuf_size, const pa_sample_spec *ss); -int pa_alsa_safe_delay(snd_pcm_t *pcm, snd_pcm_status_t *status, snd_pcm_sframes_t *delay, size_t hwbuf_size, const pa_sample_spec *ss, pa_bool_t capture); +int pa_alsa_safe_delay(snd_pcm_t *pcm, snd_pcm_status_t *status, snd_pcm_sframes_t *delay, size_t hwbuf_size, const pa_sample_spec *ss, bool capture); int pa_alsa_safe_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, snd_pcm_uframes_t *offset, snd_pcm_uframes_t *frames, size_t hwbuf_size, const pa_sample_spec *ss); char *pa_alsa_get_driver_name(int card); @@ -135,12 +135,12 @@ char *pa_alsa_get_reserve_name(const char *device); unsigned int *pa_alsa_get_supported_rates(snd_pcm_t *pcm, unsigned int fallback_rate); -pa_bool_t pa_alsa_pcm_is_hw(snd_pcm_t *pcm); -pa_bool_t pa_alsa_pcm_is_modem(snd_pcm_t *pcm); +bool pa_alsa_pcm_is_hw(snd_pcm_t *pcm); +bool pa_alsa_pcm_is_modem(snd_pcm_t *pcm); const char* pa_alsa_strerror(int errnum); -pa_bool_t pa_alsa_may_tsched(pa_bool_t want); +bool pa_alsa_may_tsched(bool want); snd_hctl_elem_t* pa_alsa_find_jack(snd_hctl_t *hctl, const char* jack_name); snd_hctl_elem_t* pa_alsa_find_eld_ctl(snd_hctl_t *hctl, int device); diff --git a/src/modules/alsa/module-alsa-card.c b/src/modules/alsa/module-alsa-card.c index e5da45491..f4fb77f8d 100644 --- a/src/modules/alsa/module-alsa-card.c +++ b/src/modules/alsa/module-alsa-card.c @@ -45,7 +45,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("ALSA Card"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "name=<name for the card/sink/source, to be prefixed> " "card_name=<name for the card> " @@ -122,7 +122,7 @@ struct userdata { pa_alsa_profile_set *profile_set; /* ucm stuffs */ - pa_bool_t use_ucm; + bool use_ucm; pa_alsa_ucm_config ucm; /* hooks for modifier action */ @@ -158,7 +158,7 @@ static void add_profiles(struct userdata *u, pa_hashmap *h, pa_hashmap *ports) { PA_IDXSET_FOREACH(m, ap->output_mappings, idx) { if (u->use_ucm) - pa_alsa_ucm_add_ports_combination(NULL, &m->ucm_context, TRUE, ports, cp, u->core); + pa_alsa_ucm_add_ports_combination(NULL, &m->ucm_context, true, ports, cp, u->core); else pa_alsa_path_set_add_ports(m->output_path_set, cp, ports, NULL, u->core); if (m->channel_map.channels > cp->max_sink_channels) @@ -171,7 +171,7 @@ static void add_profiles(struct userdata *u, pa_hashmap *h, pa_hashmap *ports) { PA_IDXSET_FOREACH(m, ap->input_mappings, idx) { if (u->use_ucm) - pa_alsa_ucm_add_ports_combination(NULL, &m->ucm_context, FALSE, ports, cp, u->core); + pa_alsa_ucm_add_ports_combination(NULL, &m->ucm_context, false, ports, cp, u->core); else pa_alsa_path_set_add_ports(m->input_path_set, cp, ports, NULL, u->core); if (m->channel_map.channels > cp->max_source_channels) @@ -256,7 +256,7 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) { am->sink = pa_alsa_sink_new(c->module, u->modargs, __FILE__, c, am); if (sink_inputs && am->sink) { - pa_sink_move_all_finish(am->sink, sink_inputs, FALSE); + pa_sink_move_all_finish(am->sink, sink_inputs, false); sink_inputs = NULL; } } @@ -268,7 +268,7 @@ static int card_set_profile(pa_card *c, pa_card_profile *new_profile) { am->source = pa_alsa_source_new(c->module, u->modargs, __FILE__, c, am); if (source_outputs && am->source) { - pa_source_move_all_finish(am->source, source_outputs, FALSE); + pa_source_move_all_finish(am->source, source_outputs, false); source_outputs = NULL; } } @@ -349,7 +349,7 @@ static void report_port_state(pa_device_port *p, struct userdata *u) { static int report_jack_state(snd_hctl_elem_t *elem, unsigned int mask) { struct userdata *u = snd_hctl_elem_get_callback_private(elem); snd_ctl_elem_value_t *elem_value; - pa_bool_t plugged_in; + bool plugged_in; void *state; pa_alsa_jack *jack; pa_device_port *port; @@ -502,7 +502,7 @@ static void init_jacks(struct userdata *u) { jack->hctl_elem = pa_alsa_find_jack(u->hctl_handle, jack->alsa_name); if (!jack->hctl_elem) { pa_log_warn("Jack '%s' seems to have disappeared.", jack->alsa_name); - jack->has_control = FALSE; + jack->has_control = false; continue; } snd_hctl_elem_set_callback_private(jack->hctl_elem, u); @@ -525,15 +525,15 @@ static void set_card_name(pa_card_new_data *data, pa_modargs *ma, const char *de if ((n = pa_modargs_get_value(ma, "card_name", NULL))) { pa_card_new_data_set_name(data, n); - data->namereg_fail = TRUE; + data->namereg_fail = true; return; } if ((n = pa_modargs_get_value(ma, "name", NULL))) - data->namereg_fail = TRUE; + data->namereg_fail = true; else { n = device_id; - data->namereg_fail = FALSE; + data->namereg_fail = false; } t = pa_sprintf_malloc("alsa_card.%s", n); @@ -604,13 +604,13 @@ static pa_hook_result_t source_output_unlink_hook_callback(pa_core *c, pa_source int pa__init(pa_module *m) { pa_card_new_data data; pa_modargs *ma; - pa_bool_t ignore_dB = FALSE; + bool ignore_dB = false; struct userdata *u; pa_reserve_wrapper *reserve = NULL; const char *description; const char *profile = NULL; char *fn = NULL; - pa_bool_t namereg_fail = FALSE; + bool namereg_fail = false; pa_alsa_refcnt_inc(); @@ -632,7 +632,7 @@ int pa__init(pa_module *m) { u->device_id = pa_xstrdup(pa_modargs_get_value(ma, "device_id", DEFAULT_DEVICE_ID)); u->modargs = ma; - u->use_ucm = TRUE; + u->use_ucm = true; u->ucm.core = m->core; if ((u->alsa_card_index = snd_card_get_index(u->device_id)) < 0) { @@ -673,7 +673,7 @@ int pa__init(pa_module *m) { (pa_hook_cb_t) source_output_unlink_hook_callback, u); } else { - u->use_ucm = FALSE; + u->use_ucm = false; #ifdef HAVE_UDEV fn = pa_udev_get_property(u->alsa_card_index, "PULSE_PROFILE_SET"); #endif diff --git a/src/modules/alsa/module-alsa-sink.c b/src/modules/alsa/module-alsa-sink.c index 927f075ac..fdcb5cfd6 100644 --- a/src/modules/alsa/module-alsa-sink.c +++ b/src/modules/alsa/module-alsa-sink.c @@ -35,7 +35,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("ALSA Sink"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "name=<name of the sink, to be prefixed> " "sink_name=<name for the sink> " diff --git a/src/modules/alsa/module-alsa-source.c b/src/modules/alsa/module-alsa-source.c index efb2d0c53..7c8ace4e8 100644 --- a/src/modules/alsa/module-alsa-source.c +++ b/src/modules/alsa/module-alsa-source.c @@ -44,7 +44,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("ALSA Source"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "name=<name for the source, to be prefixed> " "source_name=<name for the source> " diff --git a/src/modules/dbus/iface-card.c b/src/modules/dbus/iface-card.c index 6b5366ac0..19dd4ed5c 100644 --- a/src/modules/dbus/iface-card.c +++ b/src/modules/dbus/iface-card.c @@ -336,7 +336,7 @@ static void handle_set_active_profile(DBusConnection *conn, DBusMessage *msg, DB return; } - if ((r = pa_card_set_profile(c->card, pa_dbusiface_card_profile_get_name(new_active), TRUE)) < 0) { + if ((r = pa_card_set_profile(c->card, pa_dbusiface_card_profile_get_name(new_active), true)) < 0) { pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED, "Internal error in PulseAudio: pa_card_set_profile() failed with error code %i.", r); return; diff --git a/src/modules/dbus/iface-client.c b/src/modules/dbus/iface-client.c index a7d2cb4ce..1264acdf4 100644 --- a/src/modules/dbus/iface-client.c +++ b/src/modules/dbus/iface-client.c @@ -364,7 +364,7 @@ static void handle_remove_properties(DBusConnection *conn, DBusMessage *msg, voi pa_dbusiface_client *c = userdata; char **keys = NULL; int n_keys = 0; - pa_bool_t changed = FALSE; + bool changed = false; int i = 0; pa_assert(conn); diff --git a/src/modules/dbus/iface-core.c b/src/modules/dbus/iface-core.c index 0a38272a2..be7881724 100644 --- a/src/modules/dbus/iface-core.c +++ b/src/modules/dbus/iface-core.c @@ -365,7 +365,7 @@ static dbus_bool_t get_is_local(DBusConnection *conn) { pa_assert(conn); if (!dbus_connection_get_socket(conn, &conn_fd)) - return FALSE; + return false; return pa_socket_is_local(conn_fd); } @@ -1407,9 +1407,9 @@ static void handle_upload_sample(DBusConnection *conn, DBusMessage *msg, void *u sample->volume.channels = n_channels; for (i = 0; i < n_volume_entries; ++i) sample->volume.values[i] = default_volume[i]; - sample->volume_is_set = TRUE; + sample->volume_is_set = true; } else { - sample->volume_is_set = FALSE; + sample->volume_is_set = false; } dbus_sample = pa_dbusiface_sample_new(c, sample); @@ -1427,17 +1427,17 @@ finish: pa_memblock_unref(chunk.memblock); } -static pa_bool_t contains_space(const char *string) { +static bool contains_space(const char *string) { const char *p; pa_assert(string); for (p = string; *p; ++p) { if (isspace(*p)) - return TRUE; + return true; } - return FALSE; + return false; } static void handle_load_module(DBusConnection *conn, DBusMessage *msg, void *userdata) { @@ -1530,7 +1530,7 @@ static void handle_exit(DBusConnection *conn, DBusMessage *msg, void *userdata) pa_dbus_send_empty_reply(conn, msg); - pa_core_exit(c->core, FALSE, 0); + pa_core_exit(c->core, false, 0); } static void handle_listen_for_signal(DBusConnection *conn, DBusMessage *msg, void *userdata) { diff --git a/src/modules/dbus/iface-device.c b/src/modules/dbus/iface-device.c index bedd6b832..f152ffe9c 100644 --- a/src/modules/dbus/iface-device.c +++ b/src/modules/dbus/iface-device.c @@ -440,29 +440,29 @@ static void handle_set_volume(DBusConnection *conn, DBusMessage *msg, DBusMessag } if (d->type == PA_DEVICE_TYPE_SINK) - pa_sink_set_volume(d->sink, &new_vol, TRUE, TRUE); + pa_sink_set_volume(d->sink, &new_vol, true, true); else - pa_source_set_volume(d->source, &new_vol, TRUE, TRUE); + pa_source_set_volume(d->source, &new_vol, true, true); pa_dbus_send_empty_reply(conn, msg); } static void handle_get_has_flat_volume(DBusConnection *conn, DBusMessage *msg, void *userdata) { pa_dbusiface_device *d = userdata; - dbus_bool_t has_flat_volume = FALSE; + dbus_bool_t has_flat_volume = false; pa_assert(conn); pa_assert(msg); pa_assert(d); - has_flat_volume = (d->type == PA_DEVICE_TYPE_SINK) ? (d->sink->flags & PA_SINK_FLAT_VOLUME) : FALSE; + has_flat_volume = (d->type == PA_DEVICE_TYPE_SINK) ? (d->sink->flags & PA_SINK_FLAT_VOLUME) : false; pa_dbus_send_basic_variant_reply(conn, msg, DBUS_TYPE_BOOLEAN, &has_flat_volume); } static void handle_get_has_convertible_to_decibel_volume(DBusConnection *conn, DBusMessage *msg, void *userdata) { pa_dbusiface_device *d = userdata; - dbus_bool_t has_convertible_to_decibel_volume = FALSE; + dbus_bool_t has_convertible_to_decibel_volume = false; pa_assert(conn); pa_assert(msg); @@ -513,7 +513,7 @@ static void handle_get_mute(DBusConnection *conn, DBusMessage *msg, void *userda static void handle_set_mute(DBusConnection *conn, DBusMessage *msg, DBusMessageIter *iter, void *userdata) { pa_dbusiface_device *d = userdata; - dbus_bool_t mute = FALSE; + dbus_bool_t mute = false; pa_assert(conn); pa_assert(msg); @@ -523,16 +523,16 @@ static void handle_set_mute(DBusConnection *conn, DBusMessage *msg, DBusMessageI dbus_message_iter_get_basic(iter, &mute); if (d->type == PA_DEVICE_TYPE_SINK) - pa_sink_set_mute(d->sink, mute, TRUE); + pa_sink_set_mute(d->sink, mute, true); else - pa_source_set_mute(d->source, mute, TRUE); + pa_source_set_mute(d->source, mute, true); pa_dbus_send_empty_reply(conn, msg); } static void handle_get_has_hardware_volume(DBusConnection *conn, DBusMessage *msg, void *userdata) { pa_dbusiface_device *d = userdata; - dbus_bool_t has_hardware_volume = FALSE; + dbus_bool_t has_hardware_volume = false; pa_assert(conn); pa_assert(msg); @@ -547,7 +547,7 @@ static void handle_get_has_hardware_volume(DBusConnection *conn, DBusMessage *ms static void handle_get_has_hardware_mute(DBusConnection *conn, DBusMessage *msg, void *userdata) { pa_dbusiface_device *d = userdata; - dbus_bool_t has_hardware_mute = FALSE; + dbus_bool_t has_hardware_mute = false; pa_assert(conn); pa_assert(msg); @@ -577,7 +577,7 @@ static void handle_get_configured_latency(DBusConnection *conn, DBusMessage *msg static void handle_get_has_dynamic_latency(DBusConnection *conn, DBusMessage *msg, void *userdata) { pa_dbusiface_device *d = userdata; - dbus_bool_t has_dynamic_latency = FALSE; + dbus_bool_t has_dynamic_latency = false; pa_assert(conn); pa_assert(msg); @@ -617,7 +617,7 @@ static void handle_get_latency(DBusConnection *conn, DBusMessage *msg, void *use static void handle_get_is_hardware_device(DBusConnection *conn, DBusMessage *msg, void *userdata) { pa_dbusiface_device *d = userdata; - dbus_bool_t is_hardware_device = FALSE; + dbus_bool_t is_hardware_device = false; pa_assert(conn); pa_assert(msg); @@ -632,7 +632,7 @@ static void handle_get_is_hardware_device(DBusConnection *conn, DBusMessage *msg static void handle_get_is_network_device(DBusConnection *conn, DBusMessage *msg, void *userdata) { pa_dbusiface_device *d = userdata; - dbus_bool_t is_network_device = FALSE; + dbus_bool_t is_network_device = false; pa_assert(conn); pa_assert(msg); @@ -753,13 +753,13 @@ static void handle_set_active_port(DBusConnection *conn, DBusMessage *msg, DBusM } if (d->type == PA_DEVICE_TYPE_SINK) { - if ((r = pa_sink_set_port(d->sink, pa_dbusiface_device_port_get_name(new_active), TRUE)) < 0) { + if ((r = pa_sink_set_port(d->sink, pa_dbusiface_device_port_get_name(new_active), true)) < 0) { pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED, "Internal error in PulseAudio: pa_sink_set_port() failed with error code %i.", r); return; } } else { - if ((r = pa_source_set_port(d->source, pa_dbusiface_device_port_get_name(new_active), TRUE)) < 0) { + if ((r = pa_source_set_port(d->source, pa_dbusiface_device_port_get_name(new_active), true)) < 0) { pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED, "Internal error in PulseAudio: pa_source_set_port() failed with error code %i.", r); return; @@ -796,17 +796,17 @@ static void handle_get_all(DBusConnection *conn, DBusMessage *msg, void *userdat pa_channel_map *channel_map = NULL; dbus_uint32_t channels[PA_CHANNELS_MAX]; dbus_uint32_t volume[PA_CHANNELS_MAX]; - dbus_bool_t has_flat_volume = FALSE; - dbus_bool_t has_convertible_to_decibel_volume = FALSE; + dbus_bool_t has_flat_volume = false; + dbus_bool_t has_convertible_to_decibel_volume = false; dbus_uint32_t base_volume = 0; dbus_uint32_t volume_steps = 0; - dbus_bool_t has_hardware_volume = FALSE; - dbus_bool_t has_hardware_mute = FALSE; + dbus_bool_t has_hardware_volume = false; + dbus_bool_t has_hardware_mute = false; dbus_uint64_t configured_latency = 0; - dbus_bool_t has_dynamic_latency = FALSE; + dbus_bool_t has_dynamic_latency = false; dbus_uint64_t latency = 0; - dbus_bool_t is_hardware_device = FALSE; - dbus_bool_t is_network_device = FALSE; + dbus_bool_t is_hardware_device = false; + dbus_bool_t is_network_device = false; dbus_uint32_t state = 0; const char **ports = NULL; unsigned n_ports = 0; @@ -847,7 +847,7 @@ static void handle_get_all(DBusConnection *conn, DBusMessage *msg, void *userdat sample_format = d->source->sample_spec.format; sample_rate = d->source->sample_spec.rate; channel_map = &d->source->channel_map; - has_flat_volume = FALSE; + has_flat_volume = false; has_convertible_to_decibel_volume = d->source->flags & PA_SOURCE_DECIBEL_VOLUME; base_volume = d->source->base_volume; volume_steps = d->source->n_volume_steps; @@ -922,7 +922,7 @@ static void handle_get_all(DBusConnection *conn, DBusMessage *msg, void *userdat static void handle_suspend(DBusConnection *conn, DBusMessage *msg, void *userdata) { pa_dbusiface_device *d = userdata; - dbus_bool_t suspend = FALSE; + dbus_bool_t suspend = false; pa_client *client; pa_assert(conn); @@ -1074,7 +1074,7 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t pa_dbusiface_device *d = userdata; DBusMessage *signal_msg = NULL; const pa_cvolume *new_volume = NULL; - pa_bool_t new_mute = FALSE; + bool new_mute = false; pa_sink_state_t new_sink_state = 0; pa_source_state_t new_source_state = 0; pa_device_port *new_active_port = NULL; @@ -1096,8 +1096,8 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t && ((t & PA_SUBSCRIPTION_EVENT_FACILITY_MASK) == PA_SUBSCRIPTION_EVENT_SOURCE))); new_volume = (d->type == PA_DEVICE_TYPE_SINK) - ? pa_sink_get_volume(d->sink, FALSE) - : pa_source_get_volume(d->source, FALSE); + ? pa_sink_get_volume(d->sink, false) + : pa_source_get_volume(d->source, false); if (!pa_cvolume_equal(&d->volume, new_volume)) { dbus_uint32_t volume[PA_CHANNELS_MAX]; @@ -1120,7 +1120,7 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t signal_msg = NULL; } - new_mute = (d->type == PA_DEVICE_TYPE_SINK) ? pa_sink_get_mute(d->sink, FALSE) : pa_source_get_mute(d->source, FALSE); + new_mute = (d->type == PA_DEVICE_TYPE_SINK) ? pa_sink_get_mute(d->sink, false) : pa_source_get_mute(d->source, false); if (d->mute != new_mute) { d->mute = new_mute; @@ -1211,8 +1211,8 @@ pa_dbusiface_device *pa_dbusiface_device_new_sink(pa_dbusiface_core *core, pa_si d->sink = pa_sink_ref(sink); d->type = PA_DEVICE_TYPE_SINK; d->path = pa_sprintf_malloc("%s/%s%u", PA_DBUS_CORE_OBJECT_PATH, SINK_OBJECT_NAME, sink->index); - d->volume = *pa_sink_get_volume(sink, FALSE); - d->mute = pa_sink_get_mute(sink, FALSE); + d->volume = *pa_sink_get_volume(sink, false); + d->mute = pa_sink_get_mute(sink, false); d->sink_state = pa_sink_get_state(sink); d->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); d->next_port_index = 0; @@ -1245,8 +1245,8 @@ pa_dbusiface_device *pa_dbusiface_device_new_source(pa_dbusiface_core *core, pa_ d->source = pa_source_ref(source); d->type = PA_DEVICE_TYPE_SOURCE; d->path = pa_sprintf_malloc("%s/%s%u", PA_DBUS_CORE_OBJECT_PATH, SOURCE_OBJECT_NAME, source->index); - d->volume = *pa_source_get_volume(source, FALSE); - d->mute = pa_source_get_mute(source, FALSE); + d->volume = *pa_source_get_volume(source, false); + d->mute = pa_source_get_mute(source, false); d->source_state = pa_source_get_state(source); d->ports = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); d->next_port_index = 0; diff --git a/src/modules/dbus/iface-module.c b/src/modules/dbus/iface-module.c index ab92a7343..fb1d5880d 100644 --- a/src/modules/dbus/iface-module.c +++ b/src/modules/dbus/iface-module.c @@ -261,7 +261,7 @@ static void handle_unload(DBusConnection *conn, DBusMessage *msg, void *userdata return; } - pa_module_unload_request(m->module, FALSE); + pa_module_unload_request(m->module, false); pa_dbus_send_empty_reply(conn, msg); } diff --git a/src/modules/dbus/iface-stream.c b/src/modules/dbus/iface-stream.c index 851d51f85..43bc7026b 100644 --- a/src/modules/dbus/iface-stream.c +++ b/src/modules/dbus/iface-stream.c @@ -56,7 +56,7 @@ struct pa_dbusiface_stream { dbus_bool_t mute; pa_proplist *proplist; - pa_bool_t has_volume; + bool has_volume; pa_dbus_protocol *dbus_protocol; pa_subscription *subscription; @@ -356,7 +356,7 @@ static void handle_get_volume(DBusConnection *conn, DBusMessage *msg, void *user static void handle_set_volume(DBusConnection *conn, DBusMessage *msg, DBusMessageIter *iter, void *userdata) { pa_dbusiface_stream *s = userdata; - pa_bool_t volume_writable = TRUE; + bool volume_writable = true; DBusMessageIter array_iter; int stream_channels = 0; dbus_uint32_t *volume = NULL; @@ -369,7 +369,7 @@ static void handle_set_volume(DBusConnection *conn, DBusMessage *msg, DBusMessag pa_assert(iter); pa_assert(s); - volume_writable = (s->type == STREAM_TYPE_PLAYBACK) ? s->sink_input->volume_writable : FALSE; + volume_writable = (s->type == STREAM_TYPE_PLAYBACK) ? s->sink_input->volume_writable : false; if (!s->has_volume || !volume_writable) { char *str = stream_to_string(s); @@ -405,7 +405,7 @@ static void handle_set_volume(DBusConnection *conn, DBusMessage *msg, DBusMessag new_vol.values[i] = volume[i]; } - pa_sink_input_set_volume(s->sink_input, &new_vol, TRUE, TRUE); + pa_sink_input_set_volume(s->sink_input, &new_vol, true, true); pa_dbus_send_empty_reply(conn, msg); } @@ -427,7 +427,7 @@ static void handle_get_mute(DBusConnection *conn, DBusMessage *msg, void *userda static void handle_set_mute(DBusConnection *conn, DBusMessage *msg, DBusMessageIter *iter, void *userdata) { pa_dbusiface_stream *s = userdata; - dbus_bool_t mute = FALSE; + dbus_bool_t mute = false; pa_assert(conn); pa_assert(msg); @@ -441,7 +441,7 @@ static void handle_set_mute(DBusConnection *conn, DBusMessage *msg, DBusMessageI return; } - pa_sink_input_set_mute(s->sink_input, mute, TRUE); + pa_sink_input_set_mute(s->sink_input, mute, true); pa_dbus_send_empty_reply(conn, msg); } @@ -621,7 +621,7 @@ static void handle_move(DBusConnection *conn, DBusMessage *msg, void *userdata) return; } - if (pa_sink_input_move_to(s->sink_input, sink, TRUE) < 0) { + if (pa_sink_input_move_to(s->sink_input, sink, true) < 0) { pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED, "Moving playback stream %u to sink %s failed.", s->sink_input->index, sink->name); return; @@ -634,7 +634,7 @@ static void handle_move(DBusConnection *conn, DBusMessage *msg, void *userdata) return; } - if (pa_source_output_move_to(s->source_output, source, TRUE) < 0) { + if (pa_source_output_move_to(s->source_output, source, true) < 0) { pa_dbus_send_error(conn, msg, DBUS_ERROR_FAILED, "Moving record stream %u to source %s failed.", s->source_output->index, source->name); return; @@ -736,12 +736,12 @@ static void subscription_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t } if (s->type == STREAM_TYPE_PLAYBACK) { - pa_bool_t new_mute = FALSE; + bool new_mute = false; if (s->has_volume) { pa_cvolume new_volume; - pa_sink_input_get_volume(s->sink_input, &new_volume, TRUE); + pa_sink_input_get_volume(s->sink_input, &new_volume, true); if (!pa_cvolume_equal(&s->volume, &new_volume)) { dbus_uint32_t volume[PA_CHANNELS_MAX]; @@ -857,7 +857,7 @@ pa_dbusiface_stream *pa_dbusiface_stream_new_playback(pa_dbusiface_core *core, p s->has_volume = pa_sink_input_is_volume_readable(sink_input); if (s->has_volume) - pa_sink_input_get_volume(sink_input, &s->volume, TRUE); + pa_sink_input_get_volume(sink_input, &s->volume, true); else pa_cvolume_init(&s->volume); @@ -889,9 +889,9 @@ pa_dbusiface_stream *pa_dbusiface_stream_new_record(pa_dbusiface_core *core, pa_ s->source = pa_source_ref(source_output->source); s->sample_rate = source_output->sample_spec.rate; pa_cvolume_init(&s->volume); - s->mute = FALSE; + s->mute = false; s->proplist = pa_proplist_copy(source_output->proplist); - s->has_volume = FALSE; + s->has_volume = false; s->dbus_protocol = pa_dbus_protocol_get(source_output->core); s->subscription = pa_subscription_new(source_output->core, PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT, subscription_cb, s); s->send_event_slot = pa_hook_connect(&source_output->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_SEND_EVENT], diff --git a/src/modules/dbus/module-dbus-protocol.c b/src/modules/dbus/module-dbus-protocol.c index 7bd86cfff..a061ad37a 100644 --- a/src/modules/dbus/module-dbus-protocol.c +++ b/src/modules/dbus/module-dbus-protocol.c @@ -50,7 +50,7 @@ PA_MODULE_USAGE( "access=local|remote|local,remote " "tcp_port=<port number> " "tcp_listen=<hostname>"); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_AUTHOR("Tanu Kaskinen"); PA_MODULE_VERSION(PACKAGE_VERSION); @@ -64,8 +64,8 @@ struct connection; struct userdata { pa_module *module; - pa_bool_t local_access; - pa_bool_t remote_access; + bool local_access; + bool remote_access; uint32_t tcp_port; char *tcp_listen; @@ -152,7 +152,7 @@ static void client_send_event_cb(pa_client *c, const char *name, pa_proplist *da static dbus_bool_t user_check_cb(DBusConnection *connection, unsigned long uid, void *data) { pa_log_debug("Allowing connection by user %lu.", uid); - return TRUE; + return true; } static DBusHandlerResult disconnection_filter_cb(DBusConnection *connection, DBusMessage *message, void *user_data) { @@ -198,12 +198,12 @@ static void connection_new_cb(DBusServer *dbus_server, DBusConnection *new_conne /* FIXME: Here we allow anyone from anywhere to access the server, * anonymously. Access control should be configurable. */ dbus_connection_set_unix_user_function(new_connection, user_check_cb, NULL, NULL); - dbus_connection_set_allow_anonymous(new_connection, TRUE); + dbus_connection_set_allow_anonymous(new_connection, true); } c = pa_xnew(struct connection, 1); c->server = s; - c->wrap_conn = pa_dbus_wrap_connection_new_from_existing(s->userdata->module->core->mainloop, TRUE, new_connection); + c->wrap_conn = pa_dbus_wrap_connection_new_from_existing(s->userdata->module->core->mainloop, true, new_connection); c->client = client; c->client->kill = client_kill_cb; @@ -302,7 +302,7 @@ static dbus_bool_t watch_add_cb(DBusWatch *watch, void *data) { dbus_watch_set_data(watch, ev, NULL); - return TRUE; + return true; } /* Called by D-Bus when a D-Bus fd watch event is removed. */ @@ -342,7 +342,7 @@ static dbus_bool_t timeout_add_cb(DBusTimeout *timeout, void *data) { pa_assert(s); if (!dbus_timeout_get_enabled(timeout)) - return FALSE; + return false; mainloop = s->userdata->module->core->mainloop; @@ -353,7 +353,7 @@ static dbus_bool_t timeout_add_cb(DBusTimeout *timeout, void *data) { dbus_timeout_set_data(timeout, ev, NULL); - return TRUE; + return true; } /* Called by D-Bus when a D-Bus timer event is removed. */ @@ -482,7 +482,7 @@ static struct server *start_tcp_server(struct userdata *u) { return s; } -static int get_access_arg(pa_modargs *ma, pa_bool_t *local_access, pa_bool_t *remote_access) { +static int get_access_arg(pa_modargs *ma, bool *local_access, bool *remote_access) { const char *value = NULL; pa_assert(ma); @@ -493,14 +493,14 @@ static int get_access_arg(pa_modargs *ma, pa_bool_t *local_access, pa_bool_t *re return 0; if (pa_streq(value, "local")) { - *local_access = TRUE; - *remote_access = FALSE; + *local_access = true; + *remote_access = false; } else if (pa_streq(value, "remote")) { - *local_access = FALSE; - *remote_access = TRUE; + *local_access = false; + *remote_access = true; } else if (pa_streq(value, "local,remote")) { - *local_access = TRUE; - *remote_access = TRUE; + *local_access = true; + *remote_access = true; } else return -1; @@ -536,8 +536,8 @@ int pa__init(pa_module *m) { m->userdata = u = pa_xnew0(struct userdata, 1); u->module = m; - u->local_access = TRUE; - u->remote_access = FALSE; + u->local_access = true; + u->remote_access = false; u->tcp_port = PA_DBUS_DEFAULT_PORT; if (get_access_arg(ma, &u->local_access, &u->remote_access) < 0) { diff --git a/src/modules/echo-cancel/adrian.c b/src/modules/echo-cancel/adrian.c index 2a795f1c5..c7f911f69 100644 --- a/src/modules/echo-cancel/adrian.c +++ b/src/modules/echo-cancel/adrian.c @@ -56,7 +56,7 @@ static void pa_adrian_ec_fixate_spec(pa_sample_spec *rec_ss, pa_channel_map *rec *rec_map = *out_map; } -pa_bool_t pa_adrian_ec_init(pa_core *c, pa_echo_canceller *ec, +bool pa_adrian_ec_init(pa_core *c, pa_echo_canceller *ec, pa_sample_spec *rec_ss, pa_channel_map *rec_map, pa_sample_spec *play_ss, pa_channel_map *play_map, pa_sample_spec *out_ss, pa_channel_map *out_map, @@ -93,12 +93,12 @@ pa_bool_t pa_adrian_ec_init(pa_core *c, pa_echo_canceller *ec, goto fail; pa_modargs_free(ma); - return TRUE; + return true; fail: if (ma) pa_modargs_free(ma); - return FALSE; + return false; } void pa_adrian_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out) { diff --git a/src/modules/echo-cancel/echo-cancel.h b/src/modules/echo-cancel/echo-cancel.h index cdc509d06..ffa5840fa 100644 --- a/src/modules/echo-cancel/echo-cancel.h +++ b/src/modules/echo-cancel/echo-cancel.h @@ -68,7 +68,7 @@ struct pa_echo_canceller_params { void *apm; uint32_t blocksize; pa_sample_spec sample_spec; - pa_bool_t agc; + bool agc; } webrtc; #endif /* each canceller-specific structure goes here */ @@ -76,14 +76,14 @@ struct pa_echo_canceller_params { /* Set this if canceller can do drift compensation. Also see set_drift() * below */ - pa_bool_t drift_compensation; + bool drift_compensation; }; typedef struct pa_echo_canceller pa_echo_canceller; struct pa_echo_canceller { /* Initialise canceller engine. */ - pa_bool_t (*init) (pa_core *c, + bool (*init) (pa_core *c, pa_echo_canceller *ec, pa_sample_spec *rec_ss, pa_channel_map *rec_map, @@ -138,7 +138,7 @@ void pa_echo_canceller_set_capture_volume(pa_echo_canceller *ec, pa_cvolume *v); uint32_t pa_echo_canceller_blocksize_power2(unsigned rate, unsigned ms); /* Null canceller functions */ -pa_bool_t pa_null_ec_init(pa_core *c, pa_echo_canceller *ec, +bool pa_null_ec_init(pa_core *c, pa_echo_canceller *ec, pa_sample_spec *rec_ss, pa_channel_map *rec_map, pa_sample_spec *play_ss, pa_channel_map *play_map, pa_sample_spec *out_ss, pa_channel_map *out_map, @@ -148,7 +148,7 @@ void pa_null_ec_done(pa_echo_canceller *ec); #ifdef HAVE_SPEEX /* Speex canceller functions */ -pa_bool_t pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec, +bool pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec, pa_sample_spec *rec_ss, pa_channel_map *rec_map, pa_sample_spec *play_ss, pa_channel_map *play_map, pa_sample_spec *out_ss, pa_channel_map *out_map, @@ -159,7 +159,7 @@ void pa_speex_ec_done(pa_echo_canceller *ec); #ifdef HAVE_ADRIAN_EC /* Adrian Andre's echo canceller */ -pa_bool_t pa_adrian_ec_init(pa_core *c, pa_echo_canceller *ec, +bool pa_adrian_ec_init(pa_core *c, pa_echo_canceller *ec, pa_sample_spec *rec_ss, pa_channel_map *rec_map, pa_sample_spec *play_ss, pa_channel_map *play_map, pa_sample_spec *out_ss, pa_channel_map *out_map, @@ -171,7 +171,7 @@ void pa_adrian_ec_done(pa_echo_canceller *ec); #ifdef HAVE_WEBRTC /* WebRTC canceller functions */ PA_C_DECL_BEGIN -pa_bool_t pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec, +bool pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec, pa_sample_spec *rec_ss, pa_channel_map *rec_map, pa_sample_spec *play_ss, pa_channel_map *play_map, pa_sample_spec *out_ss, pa_channel_map *out_map, diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c index 1477d4be6..fbdb3b3ad 100644 --- a/src/modules/echo-cancel/module-echo-cancel.c +++ b/src/modules/echo-cancel/module-echo-cancel.c @@ -58,7 +58,7 @@ PA_MODULE_AUTHOR("Wim Taymans"); PA_MODULE_DESCRIPTION("Echo Cancellation"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( _("source_name=<name for the source> " "source_properties=<properties for the source> " @@ -140,8 +140,8 @@ static const pa_echo_canceller ec_table[] = { #define DEFAULT_CHANNELS 1 #define DEFAULT_ADJUST_TIME_USEC (1*PA_USEC_PER_SEC) #define DEFAULT_ADJUST_TOLERANCE (5*PA_USEC_PER_MSEC) -#define DEFAULT_SAVE_AEC FALSE -#define DEFAULT_AUTOLOADED FALSE +#define DEFAULT_SAVE_AEC false +#define DEFAULT_AUTOLOADED false #define MEMBLOCKQ_MAXLENGTH (16*1024*1024) @@ -206,29 +206,29 @@ struct userdata { pa_core *core; pa_module *module; - pa_bool_t autoloaded; - pa_bool_t dead; - pa_bool_t save_aec; + bool autoloaded; + bool dead; + bool save_aec; pa_echo_canceller *ec; uint32_t source_output_blocksize; uint32_t source_blocksize; uint32_t sink_blocksize; - pa_bool_t need_realign; + bool need_realign; /* to wakeup the source I/O thread */ pa_asyncmsgq *asyncmsgq; pa_rtpoll_item *rtpoll_item_read, *rtpoll_item_write; pa_source *source; - pa_bool_t source_auto_desc; + bool source_auto_desc; pa_source_output *source_output; pa_memblockq *source_memblockq; /* echo canceler needs fixed sized chunks */ size_t source_skip; pa_sink *sink; - pa_bool_t sink_auto_desc; + bool sink_auto_desc; pa_sink_input *sink_input; pa_memblockq *sink_memblockq; int64_t send_counter; /* updated in sink IO thread */ @@ -250,7 +250,7 @@ struct userdata { FILE *canceled_file; FILE *drift_file; - pa_bool_t use_volume_sharing; + bool use_volume_sharing; struct { pa_cvolume current_volume; @@ -479,9 +479,9 @@ static int source_set_state_cb(pa_source *s, pa_source_state_t state) { pa_core_rttime_restart(u->core, u->time_event, pa_rtclock_now() + u->adjust_time); pa_atomic_store(&u->request_resync, 1); - pa_source_output_cork(u->source_output, FALSE); + pa_source_output_cork(u->source_output, false); } else if (state == PA_SOURCE_SUSPENDED) { - pa_source_output_cork(u->source_output, TRUE); + pa_source_output_cork(u->source_output, true); } return 0; @@ -504,9 +504,9 @@ static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state) { pa_core_rttime_restart(u->core, u->time_event, pa_rtclock_now() + u->adjust_time); pa_atomic_store(&u->request_resync, 1); - pa_sink_input_cork(u->sink_input, FALSE); + pa_sink_input_cork(u->sink_input, false); } else if (state == PA_SINK_SUSPENDED) { - pa_sink_input_cork(u->sink_input, TRUE); + pa_sink_input_cork(u->sink_input, true); } return 0; @@ -565,7 +565,7 @@ static void sink_request_rewind_cb(pa_sink *s) { /* Just hand this one over to the master sink */ pa_sink_input_request_rewind(u->sink_input, - s->thread_info.rewind_nbytes, TRUE, FALSE, FALSE); + s->thread_info.rewind_nbytes, true, false, false); } /* Called from main context */ @@ -579,7 +579,7 @@ static void source_set_volume_cb(pa_source *s) { !PA_SOURCE_OUTPUT_IS_LINKED(pa_source_output_get_state(u->source_output))) return; - pa_source_output_set_volume(u->source_output, &s->real_volume, s->save_volume, TRUE); + pa_source_output_set_volume(u->source_output, &s->real_volume, s->save_volume, true); } /* Called from main context */ @@ -593,7 +593,7 @@ static void sink_set_volume_cb(pa_sink *s) { !PA_SINK_INPUT_IS_LINKED(pa_sink_input_get_state(u->sink_input))) return; - pa_sink_input_set_volume(u->sink_input, &s->real_volume, s->save_volume, TRUE); + pa_sink_input_set_volume(u->sink_input, &s->real_volume, s->save_volume, true); } /* Called from main context. */ @@ -608,7 +608,7 @@ static void source_get_volume_cb(pa_source *s) { !PA_SOURCE_OUTPUT_IS_LINKED(pa_source_output_get_state(u->source_output))) return; - pa_source_output_get_volume(u->source_output, &v, TRUE); + pa_source_output_get_volume(u->source_output, &v, true); if (pa_cvolume_equal(&s->real_volume, &v)) /* no change */ @@ -1003,7 +1003,7 @@ static void source_output_process_rewind_cb(pa_source_output *o, size_t nbytes) pa_memblockq_rewind(u->sink_memblockq, nbytes); /* manipulate write index */ - pa_memblockq_seek(u->source_memblockq, -nbytes, PA_SEEK_RELATIVE, TRUE); + pa_memblockq_seek(u->source_memblockq, -nbytes, PA_SEEK_RELATIVE, true); pa_log_debug("Source rewind (%lld) %lld", (long long) nbytes, (long long) pa_memblockq_get_length (u->source_memblockq)); @@ -1058,7 +1058,7 @@ static int source_output_process_msg_cb(pa_msgobject *obj, int code, void *data, if (u->source_output->source->thread_info.state == PA_SOURCE_RUNNING) pa_memblockq_push_align(u->sink_memblockq, chunk); else - pa_memblockq_flush_write(u->sink_memblockq, TRUE); + pa_memblockq_flush_write(u->sink_memblockq, true); u->recv_counter += (int64_t) chunk->length; @@ -1069,9 +1069,9 @@ static int source_output_process_msg_cb(pa_msgobject *obj, int code, void *data, /* manipulate write index, never go past what we have */ if (PA_SOURCE_IS_OPENED(u->source_output->source->thread_info.state)) - pa_memblockq_seek(u->sink_memblockq, -offset, PA_SEEK_RELATIVE, TRUE); + pa_memblockq_seek(u->sink_memblockq, -offset, PA_SEEK_RELATIVE, true); else - pa_memblockq_flush_write(u->sink_memblockq, TRUE); + pa_memblockq_flush_write(u->sink_memblockq, true); pa_log_debug("Sink rewind (%lld)", (long long) offset); @@ -1363,7 +1363,7 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s if (PA_SINK_INPUT_IS_LINKED(state) && i->thread_info.state == PA_SINK_INPUT_INIT) { pa_log_debug("Requesting rewind due to state change."); - pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); + pa_sink_input_request_rewind(i, 0, false, true, true); } } @@ -1375,7 +1375,7 @@ static void source_output_kill_cb(pa_source_output *o) { pa_assert_ctl_context(); pa_assert_se(u = o->userdata); - u->dead = TRUE; + u->dead = true; /* The order here matters! We first kill the source output, followed * by the source. That means the source callbacks must be protected @@ -1391,7 +1391,7 @@ static void source_output_kill_cb(pa_source_output *o) { pa_log_debug("Source output kill %d", o->index); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } /* Called from main context */ @@ -1401,7 +1401,7 @@ static void sink_input_kill_cb(pa_sink_input *i) { pa_sink_input_assert_ref(i); pa_assert_se(u = i->userdata); - u->dead = TRUE; + u->dead = true; /* The order here matters! We first kill the sink input, followed * by the sink. That means the sink callbacks must be protected @@ -1417,11 +1417,11 @@ static void sink_input_kill_cb(pa_sink_input *i) { pa_log_debug("Sink input kill %d", i->index); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } /* Called from main context. */ -static pa_bool_t source_output_may_move_to_cb(pa_source_output *o, pa_source *dest) { +static bool source_output_may_move_to_cb(pa_source_output *o, pa_source *dest) { struct userdata *u; pa_source_output_assert_ref(o); @@ -1429,20 +1429,20 @@ static pa_bool_t source_output_may_move_to_cb(pa_source_output *o, pa_source *de pa_assert_se(u = o->userdata); if (u->dead || u->autoloaded) - return FALSE; + return false; return (u->source != dest) && (u->sink != dest->monitor_of); } /* Called from main context */ -static pa_bool_t sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) { +static bool sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) { struct userdata *u; pa_sink_input_assert_ref(i); pa_assert_se(u = i->userdata); if (u->dead || u->autoloaded) - return FALSE; + return false; return u->sink != dest; } @@ -1539,9 +1539,9 @@ static int canceller_process_msg_cb(pa_msgobject *o, int code, void *userdata, i pa_cvolume *v = (pa_cvolume *) userdata; if (u->use_volume_sharing) - pa_source_set_volume(u->source, v, TRUE, FALSE); + pa_source_set_volume(u->source, v, true, false); else - pa_source_output_set_volume(u->source_output, v, FALSE, TRUE); + pa_source_output_set_volume(u->source_output, v, false, true); break; } @@ -1698,9 +1698,9 @@ int pa__init(pa_module*m) { u->core = m->core; u->module = m; m->userdata = u; - u->dead = FALSE; + u->dead = false; - u->use_volume_sharing = TRUE; + u->use_volume_sharing = true; if (pa_modargs_get_value_boolean(ma, "use_volume_sharing", &u->use_volume_sharing) < 0) { pa_log("use_volume_sharing= expects a boolean argument"); goto fail; @@ -1744,7 +1744,7 @@ int pa__init(pa_module*m) { goto fail; u->asyncmsgq = pa_asyncmsgq_new(0); - u->need_realign = TRUE; + u->need_realign = true; source_output_ss = source_ss; source_output_map = source_map; @@ -1815,7 +1815,7 @@ int pa__init(pa_module*m) { if (!u->use_volume_sharing) { pa_source_set_get_volume_callback(u->source, source_get_volume_cb); pa_source_set_set_volume_callback(u->source, source_set_volume_cb); - pa_source_enable_decibel_volume(u->source, TRUE); + pa_source_enable_decibel_volume(u->source, true); } u->source->userdata = u; @@ -1865,7 +1865,7 @@ int pa__init(pa_module*m) { pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb); if (!u->use_volume_sharing) { pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb); - pa_sink_enable_decibel_volume(u->sink, TRUE); + pa_sink_enable_decibel_volume(u->sink, true); } u->sink->userdata = u; @@ -1875,7 +1875,7 @@ int pa__init(pa_module*m) { pa_source_output_new_data_init(&source_output_data); source_output_data.driver = __FILE__; source_output_data.module = m; - pa_source_output_new_data_set_source(&source_output_data, source_master, FALSE); + pa_source_output_new_data_set_source(&source_output_data, source_master, false); source_output_data.destination_source = u->source; pa_proplist_sets(source_output_data.proplist, PA_PROP_MEDIA_NAME, "Echo-Cancel Source Stream"); @@ -1910,7 +1910,7 @@ int pa__init(pa_module*m) { pa_sink_input_new_data_init(&sink_input_data); sink_input_data.driver = __FILE__; sink_input_data.module = m; - pa_sink_input_new_data_set_sink(&sink_input_data, sink_master, FALSE); + pa_sink_input_new_data_set_sink(&sink_input_data, sink_master, false); sink_input_data.origin_sink = u->sink; pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Echo-Cancel Sink Stream"); pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter"); @@ -2029,7 +2029,7 @@ void pa__done(pa_module*m) { if (!(u = m->userdata)) return; - u->dead = TRUE; + u->dead = true; /* See comments in source_output_kill_cb() above regarding * destruction order! */ diff --git a/src/modules/echo-cancel/null.c b/src/modules/echo-cancel/null.c index e89a4f4e4..642d5e86b 100644 --- a/src/modules/echo-cancel/null.c +++ b/src/modules/echo-cancel/null.c @@ -25,7 +25,7 @@ PA_C_DECL_BEGIN #include "echo-cancel.h" PA_C_DECL_END -pa_bool_t pa_null_ec_init(pa_core *c, pa_echo_canceller *ec, +bool pa_null_ec_init(pa_core *c, pa_echo_canceller *ec, pa_sample_spec *rec_ss, pa_channel_map *rec_map, pa_sample_spec *play_ss, pa_channel_map *play_map, pa_sample_spec *out_ss, pa_channel_map *out_map, @@ -43,7 +43,7 @@ pa_bool_t pa_null_ec_init(pa_core *c, pa_echo_canceller *ec, pa_sample_spec_snprint(strss_source, sizeof(strss_source), out_ss), pa_sample_spec_snprint(strss_sink, sizeof(strss_sink), play_ss)); - return TRUE; + return true; } void pa_null_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out) { diff --git a/src/modules/echo-cancel/speex.c b/src/modules/echo-cancel/speex.c index 37ce122a0..41875e150 100644 --- a/src/modules/echo-cancel/speex.c +++ b/src/modules/echo-cancel/speex.c @@ -33,9 +33,9 @@ #define DEFAULT_FRAME_SIZE_MS 20 /* should be between 100-500 ms */ #define DEFAULT_FILTER_SIZE_MS 200 -#define DEFAULT_AGC_ENABLED TRUE -#define DEFAULT_DENOISE_ENABLED TRUE -#define DEFAULT_ECHO_SUPPRESS_ENABLED TRUE +#define DEFAULT_AGC_ENABLED true +#define DEFAULT_DENOISE_ENABLED true +#define DEFAULT_ECHO_SUPPRESS_ENABLED true #define DEFAULT_ECHO_SUPPRESS_ATTENUATION 0 static const char* const valid_modargs[] = { @@ -60,10 +60,10 @@ static void pa_speex_ec_fixate_spec(pa_sample_spec *rec_ss, pa_channel_map *rec_ *rec_map = *out_map; } -static pa_bool_t pa_speex_ec_preprocessor_init(pa_echo_canceller *ec, pa_sample_spec *out_ss, uint32_t nframes, pa_modargs *ma) { - pa_bool_t agc; - pa_bool_t denoise; - pa_bool_t echo_suppress; +static bool pa_speex_ec_preprocessor_init(pa_echo_canceller *ec, pa_sample_spec *out_ss, uint32_t nframes, pa_modargs *ma) { + bool agc; + bool denoise; + bool echo_suppress; int32_t echo_suppress_attenuation; int32_t echo_suppress_attenuation_active; @@ -140,13 +140,13 @@ static pa_bool_t pa_speex_ec_preprocessor_init(pa_echo_canceller *ec, pa_sample_ } else pa_log_info("All preprocessing options are disabled"); - return TRUE; + return true; fail: - return FALSE; + return false; } -pa_bool_t pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec, +bool pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec, pa_sample_spec *rec_ss, pa_channel_map *rec_map, pa_sample_spec *play_ss, pa_channel_map *play_map, pa_sample_spec *out_ss, pa_channel_map *out_map, @@ -189,7 +189,7 @@ pa_bool_t pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec, goto fail; pa_modargs_free(ma); - return TRUE; + return true; fail: if (ma) @@ -202,7 +202,7 @@ fail: speex_echo_state_destroy(ec->params.priv.speex.state); ec->params.priv.speex.state = NULL; } - return FALSE; + return false; } void pa_speex_ec_run(pa_echo_canceller *ec, const uint8_t *rec, const uint8_t *play, uint8_t *out) { diff --git a/src/modules/echo-cancel/webrtc.cc b/src/modules/echo-cancel/webrtc.cc index 697e0baef..9de9fd2ea 100644 --- a/src/modules/echo-cancel/webrtc.cc +++ b/src/modules/echo-cancel/webrtc.cc @@ -40,14 +40,14 @@ PA_C_DECL_END #define BLOCK_SIZE_US 10000 -#define DEFAULT_HIGH_PASS_FILTER TRUE -#define DEFAULT_NOISE_SUPPRESSION TRUE -#define DEFAULT_ANALOG_GAIN_CONTROL TRUE -#define DEFAULT_DIGITAL_GAIN_CONTROL FALSE -#define DEFAULT_MOBILE FALSE +#define DEFAULT_HIGH_PASS_FILTER true +#define DEFAULT_NOISE_SUPPRESSION true +#define DEFAULT_ANALOG_GAIN_CONTROL true +#define DEFAULT_DIGITAL_GAIN_CONTROL false +#define DEFAULT_MOBILE false #define DEFAULT_ROUTING_MODE "speakerphone" -#define DEFAULT_COMFORT_NOISE TRUE -#define DEFAULT_DRIFT_COMPENSATION FALSE +#define DEFAULT_COMFORT_NOISE true +#define DEFAULT_DRIFT_COMPENSATION false static const char* const valid_modargs[] = { "high_pass_filter", @@ -76,13 +76,13 @@ static int routing_mode_from_string(const char *rmode) { return -1; } -pa_bool_t pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec, +bool pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec, pa_sample_spec *rec_ss, pa_channel_map *rec_map, pa_sample_spec *play_ss, pa_channel_map *play_map, pa_sample_spec *out_ss, pa_channel_map *out_map, uint32_t *nframes, const char *args) { webrtc::AudioProcessing *apm = NULL; - pa_bool_t hpf, ns, agc, dgc, mobile, cn; + bool hpf, ns, agc, dgc, mobile, cn; int rm = -1; pa_modargs *ma; @@ -109,7 +109,7 @@ pa_bool_t pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec, goto fail; } - dgc = agc ? FALSE : DEFAULT_DIGITAL_GAIN_CONTROL; + dgc = agc ? false : DEFAULT_DIGITAL_GAIN_CONTROL; if (pa_modargs_get_value_boolean(ma, "digital_gain_control", &dgc) < 0) { pa_log("Failed to parse digital_gain_control value"); goto fail; @@ -197,17 +197,17 @@ pa_bool_t pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec, if (mobile && rm <= webrtc::EchoControlMobile::kEarpiece) { /* Maybe this should be a knob, but we've got a lot of knobs already */ apm->gain_control()->set_mode(webrtc::GainControl::kFixedDigital); - ec->params.priv.webrtc.agc = FALSE; + ec->params.priv.webrtc.agc = false; } else if (dgc) { apm->gain_control()->set_mode(webrtc::GainControl::kAdaptiveDigital); - ec->params.priv.webrtc.agc = FALSE; + ec->params.priv.webrtc.agc = false; } else { apm->gain_control()->set_mode(webrtc::GainControl::kAdaptiveAnalog); if (apm->gain_control()->set_analog_level_limits(0, PA_VOLUME_NORM-1) != apm->kNoError) { pa_log("Failed to initialise AGC"); goto fail; } - ec->params.priv.webrtc.agc = TRUE; + ec->params.priv.webrtc.agc = true; } apm->gain_control()->Enable(true); @@ -221,7 +221,7 @@ pa_bool_t pa_webrtc_ec_init(pa_core *c, pa_echo_canceller *ec, *nframes = ec->params.priv.webrtc.blocksize / pa_frame_size(out_ss); pa_modargs_free(ma); - return TRUE; + return true; fail: if (ma) @@ -229,7 +229,7 @@ fail: if (apm) webrtc::AudioProcessing::Destroy(apm); - return FALSE; + return false; } void pa_webrtc_ec_play(pa_echo_canceller *ec, const uint8_t *play) { diff --git a/src/modules/gconf/module-gconf.c b/src/modules/gconf/module-gconf.c index d5d336824..448fde514 100644 --- a/src/modules/gconf/module-gconf.c +++ b/src/modules/gconf/module-gconf.c @@ -45,7 +45,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("GConf Adapter"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); #define MAX_MODULES 10 #define BUF_MAX 2048 @@ -143,7 +143,7 @@ static void unload_one_module(struct module_info *m, unsigned i) { return; pa_log_debug("Unloading module #%i", m->items[i].index); - pa_module_unload_by_index(u->core, m->items[i].index, TRUE); + pa_module_unload_by_index(u->core, m->items[i].index, true); m->items[i].index = PA_INVALID_INDEX; pa_xfree(m->items[i].name); pa_xfree(m->items[i].args); @@ -166,7 +166,7 @@ static void load_module( unsigned i, const char *name, const char *args, - pa_bool_t is_new) { + bool is_new) { struct userdata *u; pa_module *mod; @@ -324,7 +324,7 @@ static void io_event_cb( u->io_event = NULL; } - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } } diff --git a/src/modules/jack/module-jack-sink.c b/src/modules/jack/module-jack-sink.c index 1e34abd46..dccf03273 100644 --- a/src/modules/jack/module-jack-sink.c +++ b/src/modules/jack/module-jack-sink.c @@ -60,7 +60,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("JACK Sink"); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_USAGE( "sink_name=<name for the sink> " @@ -94,7 +94,7 @@ struct userdata { jack_nframes_t frames_in_buffer; jack_nframes_t saved_frame_time; - pa_bool_t saved_frame_time_valid; + bool saved_frame_time_valid; }; static const char* const valid_modargs[] = { @@ -154,7 +154,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse u->frames_in_buffer = (jack_nframes_t) offset; u->saved_frame_time = * (jack_nframes_t*) data; - u->saved_frame_time_valid = TRUE; + u->saved_frame_time_valid = true; return 0; @@ -232,7 +232,7 @@ static void thread_func(void *userdata) { if (PA_UNLIKELY(u->sink->thread_info.rewind_requested)) pa_sink_process_rewind(u->sink, 0); - if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) + if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) goto fail; if (ret == 0) @@ -293,7 +293,7 @@ int pa__init(pa_module*m) { jack_status_t status; const char *server_name, *client_name; uint32_t channels = 0; - pa_bool_t do_connect = TRUE; + bool do_connect = true; unsigned i; const char **ports = NULL, **p; pa_sink_new_data data; @@ -320,7 +320,7 @@ int pa__init(pa_module*m) { m->userdata = u = pa_xnew0(struct userdata, 1); u->core = m->core; u->module = m; - u->saved_frame_time_valid = FALSE; + u->saved_frame_time_valid = false; u->rtpoll = pa_rtpoll_new(); pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll); diff --git a/src/modules/jack/module-jack-source.c b/src/modules/jack/module-jack-source.c index cf62882e5..8f550e1fc 100644 --- a/src/modules/jack/module-jack-source.c +++ b/src/modules/jack/module-jack-source.c @@ -51,7 +51,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("JACK Source"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_USAGE( "source_name=<name for the source> " "source_properties=<properties for the source> " @@ -81,7 +81,7 @@ struct userdata { pa_thread *thread; jack_nframes_t saved_frame_time; - pa_bool_t saved_frame_time_valid; + bool saved_frame_time_valid; }; static const char* const valid_modargs[] = { @@ -115,7 +115,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off pa_source_post(u->source, chunk); u->saved_frame_time = (jack_nframes_t) offset; - u->saved_frame_time_valid = TRUE; + u->saved_frame_time_valid = true; return 0; @@ -198,7 +198,7 @@ static void thread_func(void *userdata) { for (;;) { int ret; - if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) + if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) goto fail; if (ret == 0) @@ -247,7 +247,7 @@ int pa__init(pa_module*m) { jack_status_t status; const char *server_name, *client_name; uint32_t channels = 0; - pa_bool_t do_connect = TRUE; + bool do_connect = true; unsigned i; const char **ports = NULL, **p; pa_source_new_data data; @@ -274,7 +274,7 @@ int pa__init(pa_module*m) { m->userdata = u = pa_xnew0(struct userdata, 1); u->core = m->core; u->module = m; - u->saved_frame_time_valid = FALSE; + u->saved_frame_time_valid = false; u->rtpoll = pa_rtpoll_new(); pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll); diff --git a/src/modules/jack/module-jackdbus-detect.c b/src/modules/jack/module-jackdbus-detect.c index cadf4c29a..5c2977257 100644 --- a/src/modules/jack/module-jackdbus-detect.c +++ b/src/modules/jack/module-jackdbus-detect.c @@ -38,7 +38,7 @@ PA_MODULE_AUTHOR("David Henningsson"); PA_MODULE_DESCRIPTION("Adds JACK sink/source ports when JACK is started"); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_USAGE( "channels=<number of channels> " @@ -80,9 +80,9 @@ struct userdata { pa_module *module; pa_core *core; pa_dbus_connection *connection; - pa_bool_t filter_added, match_added; - pa_bool_t is_service_started; - pa_bool_t autoconnect_ports; + bool filter_added, match_added; + bool is_service_started; + bool autoconnect_ports; uint32_t channels; /* Using index here protects us from module unloading without us knowing */ int jack_module_index[JACK_SS_COUNT]; @@ -94,7 +94,7 @@ static void ensure_ports_stopped(struct userdata* u) { for (i = 0; i < JACK_SS_COUNT; i++) if (u->jack_module_index[i]) { - pa_module_unload_request_by_index(u->core, u->jack_module_index[i], TRUE); + pa_module_unload_request_by_index(u->core, u->jack_module_index[i], true); u->jack_module_index[i] = 0; pa_log_info("Stopped %s.", modnames[i]); } @@ -125,10 +125,10 @@ static void ensure_ports_started(struct userdata* u) { } } -static pa_bool_t check_service_started(struct userdata* u) { +static bool check_service_started(struct userdata* u) { DBusError error; DBusMessage *m = NULL, *reply = NULL; - pa_bool_t new_status = FALSE; + bool new_status = false; dbus_bool_t call_result; pa_assert(u); @@ -230,7 +230,7 @@ int pa__init(pa_module *m) { m->userdata = u = pa_xnew0(struct userdata, 1); u->core = m->core; u->module = m; - u->autoconnect_ports = TRUE; + u->autoconnect_ports = true; u->channels = 0; if (pa_modargs_get_value_boolean(ma, "connect", &u->autoconnect_ports) < 0) { diff --git a/src/modules/macosx/module-bonjour-publish.c b/src/modules/macosx/module-bonjour-publish.c index d29d5185c..26081ec35 100644 --- a/src/modules/macosx/module-bonjour-publish.c +++ b/src/modules/macosx/module-bonjour-publish.c @@ -50,7 +50,7 @@ PA_MODULE_AUTHOR("Daniel Mack"); PA_MODULE_DESCRIPTION("Mac OS X Bonjour Service Publisher"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); #define SERVICE_TYPE_SINK "_pulse-sink._tcp" #define SERVICE_TYPE_SOURCE "_pulse-source._tcp" @@ -330,7 +330,7 @@ static void service_free(struct service *s) { pa_xfree(s); } -static pa_bool_t shall_ignore(pa_object *o) { +static bool shall_ignore(pa_object *o) { pa_object_assert_ref(o); if (pa_sink_isinstance(o)) diff --git a/src/modules/macosx/module-coreaudio-detect.c b/src/modules/macosx/module-coreaudio-detect.c index 849bc876f..81cd94c39 100644 --- a/src/modules/macosx/module-coreaudio-detect.c +++ b/src/modules/macosx/module-coreaudio-detect.c @@ -40,7 +40,7 @@ PA_MODULE_AUTHOR("Daniel Mack"); PA_MODULE_DESCRIPTION("CoreAudio device detection"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_USAGE("ioproc_frames=<passed on to module-coreaudio-device> "); static const char* const valid_modargs[] = { @@ -146,11 +146,11 @@ static int ca_update_device_list(struct pa_module *m) { /* scan for devices which are reported but not in our cached list */ for (i = 0; i < num_devices; i++) { - bool found = FALSE; + bool found = false; PA_LLIST_FOREACH(dev, u->devices) if (dev->id == device_id[i]) { - found = TRUE; + found = true; break; } @@ -162,17 +162,17 @@ static int ca_update_device_list(struct pa_module *m) { scan_removed: PA_LLIST_FOREACH(dev, u->devices) { - bool found = FALSE; + bool found = false; for (i = 0; i < num_devices; i++) if (dev->id == device_id[i]) { - found = TRUE; + found = true; break; } if (!found) { pa_log_debug("object id %d has been removed (module index %d) %p", (unsigned int) dev->id, dev->module_index, dev); - pa_module_unload_request_by_index(m->core, dev->module_index, TRUE); + pa_module_unload_request_by_index(m->core, dev->module_index, true); PA_LLIST_REMOVE(ca_device, u->devices, dev); pa_xfree(dev); /* the current list item pointer is not valid anymore, so start over. */ @@ -265,7 +265,7 @@ void pa__done(pa_module *m) { while (dev) { struct ca_device *next = dev->next; - pa_module_unload_request_by_index(m->core, dev->module_index, TRUE); + pa_module_unload_request_by_index(m->core, dev->module_index, true); pa_xfree(dev); dev = next; diff --git a/src/modules/macosx/module-coreaudio-device.c b/src/modules/macosx/module-coreaudio-device.c index be5664b31..7b3a00275 100644 --- a/src/modules/macosx/module-coreaudio-device.c +++ b/src/modules/macosx/module-coreaudio-device.c @@ -57,7 +57,7 @@ PA_MODULE_AUTHOR("Daniel Mack"); PA_MODULE_DESCRIPTION("CoreAudio device"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE("object_id=<the CoreAudio device id> " "ioproc_frames=<audio frames per IOProc call> "); @@ -86,7 +86,7 @@ struct userdata { pa_module *module; pa_card *card; - pa_bool_t running; + bool running; char *device_name, *vendor_name; @@ -105,7 +105,7 @@ struct coreaudio_sink { char *name; unsigned int channel_idx; - pa_bool_t active; + bool active; pa_channel_map map; pa_sample_spec ss; @@ -119,7 +119,7 @@ struct coreaudio_source { char *name; unsigned int channel_idx; - pa_bool_t active; + bool active; pa_channel_map map; pa_sample_spec ss; @@ -191,13 +191,13 @@ static pa_usec_t get_latency_us(pa_object *o) { u = sink->userdata; ss = &sink->ss; - is_source = FALSE; + is_source = false; } else if (pa_source_isinstance(o)) { coreaudio_source *source = PA_SOURCE(o)->userdata; u = source->userdata; ss = &source->ss; - is_source = TRUE; + is_source = true; } else pa_assert_not_reached(); @@ -256,17 +256,17 @@ static pa_usec_t get_latency_us(pa_object *o) { static void ca_device_check_device_state(struct userdata *u) { coreaudio_sink *ca_sink; coreaudio_source *ca_source; - pa_bool_t active = FALSE; + bool active = false; pa_assert(u); for (ca_sink = u->sinks; ca_sink; ca_sink = ca_sink->next) if (ca_sink->active) - active = TRUE; + active = true; for (ca_source = u->sources; ca_source; ca_source = ca_source->next) if (ca_source->active) - active = TRUE; + active = true; if (active && !u->running) AudioDeviceStart(u->object_id, u->proc_id); @@ -291,7 +291,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse pa_assert(sink); if (PA_SINK_IS_OPENED(sink->pa_sink->thread_info.state)) { - audio_chunk.memblock = pa_memblock_new_fixed(u->module->core->mempool, buf->mData, buf->mDataByteSize, FALSE); + audio_chunk.memblock = pa_memblock_new_fixed(u->module->core->mempool, buf->mData, buf->mDataByteSize, false); audio_chunk.length = buf->mDataByteSize; audio_chunk.index = 0; @@ -329,7 +329,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off pa_assert(source); if (PA_SOURCE_IS_OPENED(source->pa_source->thread_info.state)) { - audio_chunk.memblock = pa_memblock_new_fixed(u->module->core->mempool, buf->mData, buf->mDataByteSize, TRUE); + audio_chunk.memblock = pa_memblock_new_fixed(u->module->core->mempool, buf->mData, buf->mDataByteSize, true); audio_chunk.length = buf->mDataByteSize; audio_chunk.index = 0; @@ -358,11 +358,11 @@ static int ca_sink_set_state(pa_sink *s, pa_sink_state_t state) { switch (state) { case PA_SINK_SUSPENDED: case PA_SINK_IDLE: - sink->active = FALSE; + sink->active = false; break; case PA_SINK_RUNNING: - sink->active = TRUE; + sink->active = true; break; case PA_SINK_UNLINKED: @@ -432,7 +432,7 @@ static int ca_device_create_sink(pa_module *m, AudioBuffer *buf, int channel_idx new_data.card = u->card; new_data.driver = __FILE__; new_data.module = u->module; - new_data.namereg_fail = FALSE; + new_data.namereg_fail = false; pa_sink_new_data_set_name(&new_data, ca_sink->name); pa_sink_new_data_set_channel_map(&new_data, &ca_sink->map); pa_sink_new_data_set_sample_spec(&new_data, &ca_sink->ss); @@ -476,11 +476,11 @@ static int ca_source_set_state(pa_source *s, pa_source_state_t state) { switch (state) { case PA_SOURCE_SUSPENDED: case PA_SOURCE_IDLE: - source->active = FALSE; + source->active = false; break; case PA_SOURCE_RUNNING: - source->active = TRUE; + source->active = true; break; case PA_SOURCE_UNLINKED: @@ -550,7 +550,7 @@ static int ca_device_create_source(pa_module *m, AudioBuffer *buf, int channel_i new_data.card = u->card; new_data.driver = __FILE__; new_data.module = u->module; - new_data.namereg_fail = FALSE; + new_data.namereg_fail = false; pa_source_new_data_set_name(&new_data, ca_source->name); pa_source_new_data_set_channel_map(&new_data, &ca_source->map); pa_source_new_data_set_sample_spec(&new_data, &ca_source->ss); @@ -678,7 +678,7 @@ static void thread_func(void *userdata) { pa_sink_process_rewind(ca_sink->pa_sink, 0); } - ret = pa_rtpoll_run(u->rtpoll, TRUE); + ret = pa_rtpoll_run(u->rtpoll, true); if (ret < 0) goto fail; @@ -775,10 +775,10 @@ int pa__init(pa_module *m) { PA_LLIST_HEAD_INIT(coreaudio_sink, u->sinks); /* create sinks */ - ca_device_create_streams(m, FALSE); + ca_device_create_streams(m, false); /* create sources */ - ca_device_create_streams(m, TRUE); + ca_device_create_streams(m, true); /* create the message thread */ if (!(u->thread = pa_thread_new(u->device_name, thread_func, u))) { diff --git a/src/modules/module-always-sink.c b/src/modules/module-always-sink.c index 0df4890cd..e0a645108 100644 --- a/src/modules/module-always-sink.c +++ b/src/modules/module-always-sink.c @@ -37,7 +37,7 @@ PA_MODULE_AUTHOR("Colin Guthrie"); PA_MODULE_DESCRIPTION(_("Always keeps at least one sink loaded even if it's a null one")); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_USAGE( "sink_name=<name of sink>"); @@ -51,7 +51,7 @@ static const char* const valid_modargs[] = { struct userdata { pa_hook_slot *put_slot, *unlink_slot; uint32_t null_module; - pa_bool_t ignore; + bool ignore; char *sink_name; }; @@ -76,7 +76,7 @@ static void load_null_sink_if_needed(pa_core *c, pa_sink *sink, struct userdata* pa_log_debug("Autoloading null-sink as no other sinks detected."); - u->ignore = TRUE; + u->ignore = true; t = pa_sprintf_malloc("sink_name=%s sink_properties='device.description=\"%s\"'", u->sink_name, _("Dummy Output")); @@ -84,7 +84,7 @@ static void load_null_sink_if_needed(pa_core *c, pa_sink *sink, struct userdata* u->null_module = m ? m->index : PA_INVALID_INDEX; pa_xfree(t); - u->ignore = FALSE; + u->ignore = false; if (!m) pa_log_warn("Unable to load module-null-sink"); @@ -115,7 +115,7 @@ static pa_hook_result_t put_hook_callback(pa_core *c, pa_sink *sink, void* userd pa_log_info("A new sink has been discovered. Unloading null-sink."); - pa_module_unload_request_by_index(c, u->null_module, TRUE); + pa_module_unload_request_by_index(c, u->null_module, true); u->null_module = PA_INVALID_INDEX; return PA_HOOK_OK; @@ -160,7 +160,7 @@ int pa__init(pa_module*m) { u->put_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_PUT], PA_HOOK_LATE, (pa_hook_cb_t) put_hook_callback, u); u->unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_UNLINK], PA_HOOK_EARLY, (pa_hook_cb_t) unlink_hook_callback, u); u->null_module = PA_INVALID_INDEX; - u->ignore = FALSE; + u->ignore = false; pa_modargs_free(ma); @@ -182,7 +182,7 @@ void pa__done(pa_module*m) { if (u->unlink_slot) pa_hook_slot_free(u->unlink_slot); if (u->null_module != PA_INVALID_INDEX && m->core->state != PA_CORE_SHUTDOWN) - pa_module_unload_request_by_index(m->core, u->null_module, TRUE); + pa_module_unload_request_by_index(m->core, u->null_module, true); pa_xfree(u->sink_name); pa_xfree(u); diff --git a/src/modules/module-augment-properties.c b/src/modules/module-augment-properties.c index ee3b54c78..fcc3462fe 100644 --- a/src/modules/module-augment-properties.c +++ b/src/modules/module-augment-properties.c @@ -41,7 +41,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Augment the property sets of streams with additional static information"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); #define STAT_INTERVAL 30 #define MAX_CACHE_SIZE 50 @@ -52,7 +52,7 @@ static const char* const valid_modargs[] = { struct rule { time_t timestamp; - pa_bool_t good; + bool good; time_t mtime; char *process_name; char *application_name; @@ -145,13 +145,13 @@ static void update_rule(struct rule *r) { { NULL, catch_all, NULL, NULL }, { NULL, NULL, NULL, NULL }, }; - pa_bool_t found = FALSE; + bool found = false; pa_assert(r); fn = pa_sprintf_malloc(DESKTOPFILEDIR PA_PATH_SEP "%s.desktop", r->process_name); if (stat(fn, &st) == 0) - found = TRUE; + found = true; else { #ifdef DT_DIR DIR *desktopfiles_dir; @@ -169,7 +169,7 @@ static void update_rule(struct rule *r) { fn = pa_sprintf_malloc(DESKTOPFILEDIR PA_PATH_SEP "%s" PA_PATH_SEP "%s.desktop", dir->d_name, r->process_name); if (stat(fn, &st) == 0) { - found = TRUE; + found = true; break; } } @@ -178,7 +178,7 @@ static void update_rule(struct rule *r) { #endif } if (!found) { - r->good = FALSE; + r->good = false; pa_xfree(fn); return; } @@ -194,7 +194,7 @@ static void update_rule(struct rule *r) { } else pa_log_debug("Found %s.", fn); - r->good = TRUE; + r->good = true; r->mtime = st.st_mtime; pa_xfree(r->application_name); pa_xfree(r->icon_name); diff --git a/src/modules/module-card-restore.c b/src/modules/module-card-restore.c index 2b3235c57..928f15379 100644 --- a/src/modules/module-card-restore.c +++ b/src/modules/module-card-restore.c @@ -51,7 +51,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Automatically restore profile of cards"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); #define SAVE_INTERVAL (10 * PA_USEC_PER_SEC) @@ -184,10 +184,10 @@ static bool entrys_equal(struct entry *a, struct entry *b) { return true; } -static pa_bool_t entry_write(struct userdata *u, const char *name, const struct entry *e) { +static bool entry_write(struct userdata *u, const char *name, const struct entry *e) { pa_tagstruct *t; pa_datum key, data; - pa_bool_t r; + bool r; void *state; struct port_info *p_info; @@ -210,7 +210,7 @@ static pa_bool_t entry_write(struct userdata *u, const char *name, const struct data.data = (void*)pa_tagstruct_data(t, &data.size); - r = (pa_database_set(u->database, &key, &data, TRUE) == 0); + r = (pa_database_set(u->database, &key, &data, true) == 0); pa_tagstruct_free(t); @@ -449,7 +449,7 @@ static pa_hook_result_t card_new_hook_callback(pa_core *c, pa_card_new_data *new if (!new_data->active_profile) { pa_card_new_data_set_profile(new_data, e->profile); pa_log_info("Restored profile '%s' for card %s.", new_data->active_profile, new_data->name); - new_data->save_profile = TRUE; + new_data->save_profile = true; } else pa_log_debug("Not restoring profile for card %s, because already set.", new_data->name); @@ -491,10 +491,10 @@ int pa__init(pa_module*m) { u->port_offset_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_PORT_LATENCY_OFFSET_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) port_offset_change_callback, u); u->hooks_connected = true; - if (!(fname = pa_state_path("card-database", TRUE))) + if (!(fname = pa_state_path("card-database", true))) goto fail; - if (!(u->database = pa_database_open(fname, TRUE))) { + if (!(u->database = pa_database_open(fname, true))) { pa_log("Failed to open volume database '%s': %s", fname, pa_cstrerror(errno)); pa_xfree(fname); goto fail; diff --git a/src/modules/module-cli.c b/src/modules/module-cli.c index 2a1d17517..4e893d1a7 100644 --- a/src/modules/module-cli.c +++ b/src/modules/module-cli.c @@ -42,7 +42,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Command line interface"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_USAGE("exit_on_eof=<exit daemon after EOF?>"); static const char* const valid_modargs[] = { @@ -56,7 +56,7 @@ static void eof_and_unload_cb(pa_cli*c, void *userdata) { pa_assert(c); pa_assert(m); - pa_module_unload_request(m, TRUE); + pa_module_unload_request(m, true); } static void eof_and_exit_cb(pa_cli*c, void *userdata) { @@ -65,13 +65,13 @@ static void eof_and_exit_cb(pa_cli*c, void *userdata) { pa_assert(c); pa_assert(m); - pa_core_exit(m->core, FALSE, 0); + pa_core_exit(m->core, false, 0); } int pa__init(pa_module*m) { pa_iochannel *io; pa_modargs *ma; - pa_bool_t exit_on_eof = FALSE; + bool exit_on_eof = false; #ifndef OS_IS_WIN32 int fd; #endif @@ -115,7 +115,7 @@ int pa__init(pa_module*m) { #endif { io = pa_iochannel_new(m->core->mainloop, STDIN_FILENO, STDOUT_FILENO); - pa_iochannel_set_noclose(io, TRUE); + pa_iochannel_set_noclose(io, true); pa_log_debug("Failed to open /dev/tty, using stdin/stdout fds instead."); } diff --git a/src/modules/module-combine-sink.c b/src/modules/module-combine-sink.c index faf65c22c..9b71cfbc8 100644 --- a/src/modules/module-combine-sink.c +++ b/src/modules/module-combine-sink.c @@ -52,7 +52,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Combine multiple sinks to one"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "sink_name=<name for the sink> " "sink_properties=<properties for the sink> " @@ -90,7 +90,7 @@ struct output { pa_sink *sink; pa_sink_input *sink_input; - pa_bool_t ignore_state_change; + bool ignore_state_change; pa_asyncmsgq *inq, /* Message queue from the sink thread to this sink input */ *outq; /* Message queue from this sink input to the sink thread */ @@ -121,8 +121,8 @@ struct userdata { pa_time_event *time_event; pa_usec_t adjust_time; - pa_bool_t automatic; - pa_bool_t auto_desc; + bool automatic; + bool auto_desc; pa_strlist *unlinked_slaves; @@ -138,7 +138,7 @@ struct userdata { PA_LLIST_HEAD(struct output, active_outputs); /* managed in IO thread context */ pa_atomic_t running; /* we cache that value here, so that every thread can query it cheaply */ pa_usec_t timestamp; - pa_bool_t in_null_mode; + bool in_null_mode; pa_smoother *smoother; uint64_t counter; } thread_info; @@ -304,7 +304,7 @@ static void thread_func(void *userdata) { pa_thread_mq_install(&u->thread_mq); u->thread_info.timestamp = pa_rtclock_now(); - u->thread_info.in_null_mode = FALSE; + u->thread_info.in_null_mode = false; for (;;) { int ret; @@ -322,14 +322,14 @@ static void thread_func(void *userdata) { process_render_null(u, now); pa_rtpoll_set_timer_absolute(u->rtpoll, u->thread_info.timestamp); - u->thread_info.in_null_mode = TRUE; + u->thread_info.in_null_mode = true; } else { pa_rtpoll_set_timer_disabled(u->rtpoll); - u->thread_info.in_null_mode = FALSE; + u->thread_info.in_null_mode = false; } /* Hmm, nothing to do. Let's sleep */ - if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) { + if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) { pa_log_info("pa_rtpoll_run() = %i", ret); goto fail; } @@ -513,7 +513,7 @@ static void sink_input_attach_cb(pa_sink_input *i) { PA_RTPOLL_EARLY, o->outq); - pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); + pa_sink_input_request_rewind(i, 0, false, true, true); pa_atomic_store(&o->max_request, (int) pa_sink_input_get_max_request(i)); @@ -549,7 +549,7 @@ static void sink_input_kill_cb(pa_sink_input *i) { pa_sink_input_assert_ref(i); pa_assert_se(o = i->userdata); - pa_module_unload_request(o->userdata->module, TRUE); + pa_module_unload_request(o->userdata->module, true); pa_idxset_remove_by_data(o->userdata->outputs, o, NULL); output_free(o); } @@ -575,7 +575,7 @@ static int sink_input_process_msg(pa_msgobject *obj, int code, void *data, int64 if (PA_SINK_IS_OPENED(o->sink_input->sink->thread_info.state)) pa_memblockq_push_align(o->memblockq, chunk); else - pa_memblockq_flush_write(o->memblockq, TRUE); + pa_memblockq_flush_write(o->memblockq, true); return 0; } @@ -740,12 +740,12 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse switch (code) { case PA_SINK_MESSAGE_SET_STATE: { - pa_bool_t running = (PA_PTR_TO_UINT(data) == PA_SINK_RUNNING); + bool running = (PA_PTR_TO_UINT(data) == PA_SINK_RUNNING); pa_atomic_store(&u->thread_info.running, running); if (running) - pa_smoother_resume(u->thread_info.smoother, pa_rtclock_now(), TRUE); + pa_smoother_resume(u->thread_info.smoother, pa_rtclock_now(), true); else pa_smoother_pause(u->thread_info.smoother, pa_rtclock_now()); @@ -812,7 +812,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse } static void update_description(struct userdata *u) { - pa_bool_t first = TRUE; + bool first = true; char *t; struct output *o; uint32_t idx; @@ -834,7 +834,7 @@ static void update_description(struct userdata *u) { if (first) { e = pa_sprintf_malloc("%s %s", t, pa_strnull(pa_proplist_gets(o->sink->proplist, PA_PROP_DEVICE_DESCRIPTION))); - first = FALSE; + first = false; } else e = pa_sprintf_malloc("%s, %s", t, pa_strnull(pa_proplist_gets(o->sink->proplist, PA_PROP_DEVICE_DESCRIPTION))); @@ -855,7 +855,7 @@ static int output_create_sink_input(struct output *o) { return 0; pa_sink_input_new_data_init(&data); - pa_sink_input_new_data_set_sink(&data, o->sink, FALSE); + pa_sink_input_new_data_set_sink(&data, o->sink, false); data.driver = __FILE__; pa_proplist_setf(data.proplist, PA_PROP_MEDIA_NAME, "Simultaneous output on %s", pa_strnull(pa_proplist_gets(o->sink->proplist, PA_PROP_DEVICE_DESCRIPTION))); pa_proplist_sets(data.proplist, PA_PROP_MEDIA_ROLE, "filter"); @@ -958,7 +958,7 @@ static void output_enable(struct output *o) { * of the sink might hence be called from here, which might then * cause us to be called in a loop. Make sure that state changes * for this output don't cause this loop by setting a flag here */ - o->ignore_state_change = TRUE; + o->ignore_state_change = true; if (output_create_sink_input(o) >= 0) { @@ -977,7 +977,7 @@ static void output_enable(struct output *o) { output_add_within_thread(o); } - o->ignore_state_change = FALSE; + o->ignore_state_change = false; } /* Called from main context */ @@ -1000,9 +1000,9 @@ static void output_disable(struct output *o) { o->sink_input = NULL; /* Finally, drop all queued data */ - pa_memblockq_flush_write(o->memblockq, TRUE); - pa_asyncmsgq_flush(o->inq, FALSE); - pa_asyncmsgq_flush(o->outq, FALSE); + pa_memblockq_flush_write(o->memblockq, true); + pa_asyncmsgq_flush(o->inq, false); + pa_asyncmsgq_flush(o->outq, false); } /* Called from main context */ @@ -1016,25 +1016,25 @@ static void output_verify(struct output *o) { } /* Called from main context */ -static pa_bool_t is_suitable_sink(struct userdata *u, pa_sink *s) { +static bool is_suitable_sink(struct userdata *u, pa_sink *s) { const char *t; pa_sink_assert_ref(s); if (s == u->sink) - return FALSE; + return false; if (!(s->flags & PA_SINK_HARDWARE)) - return FALSE; + return false; if (!(s->flags & PA_SINK_LATENCY)) - return FALSE; + return false; if ((t = pa_proplist_gets(s->proplist, PA_PROP_DEVICE_CLASS))) if (!pa_streq(t, "sound")) - return FALSE; + return false; - return TRUE; + return true; } /* Called from main context */ @@ -1166,11 +1166,11 @@ int pa__init(pa_module*m) { u->thread_info.smoother = pa_smoother_new( PA_USEC_PER_SEC, PA_USEC_PER_SEC*2, - TRUE, - TRUE, + true, + true, 10, pa_rtclock_now(), - TRUE); + true); adjust_time_sec = DEFAULT_ADJUST_TIME_USEC / PA_USEC_PER_SEC; if (pa_modargs_get_value_u32(ma, "adjust_time", &adjust_time_sec) < 0) { @@ -1195,7 +1195,7 @@ int pa__init(pa_module*m) { char *n = NULL; pa_sample_spec slaves_spec; pa_channel_map slaves_map; - pa_bool_t is_first_slave = TRUE; + bool is_first_slave = true; pa_sample_spec_init(&slaves_spec); @@ -1213,7 +1213,7 @@ int pa__init(pa_module*m) { if (is_first_slave) { slaves_spec = slave_sink->sample_spec; slaves_map = slave_sink->channel_map; - is_first_slave = FALSE; + is_first_slave = false; } else { if (slaves_spec.format != slave_sink->sample_spec.format) slaves_spec.format = PA_SAMPLE_INVALID; @@ -1245,7 +1245,7 @@ int pa__init(pa_module*m) { } pa_sink_new_data_init(&data); - data.namereg_fail = FALSE; + data.namereg_fail = false; data.driver = __FILE__; data.module = m; pa_sink_new_data_set_name(&data, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME)); @@ -1263,9 +1263,9 @@ int pa__init(pa_module*m) { } /* Check proplist for a description & fill in a default value if not */ - u->auto_desc = FALSE; + u->auto_desc = false; if (NULL == pa_proplist_gets(data.proplist, PA_PROP_DEVICE_DESCRIPTION)) { - u->auto_desc = TRUE; + u->auto_desc = true; pa_proplist_sets(data.proplist, PA_PROP_DEVICE_DESCRIPTION, "Simultaneous Output"); } diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c index d3442359f..bd48bf441 100644 --- a/src/modules/module-combine.c +++ b/src/modules/module-combine.c @@ -34,7 +34,7 @@ PA_MODULE_AUTHOR("Colin Guthrie"); PA_MODULE_DESCRIPTION("Compatibility module (module-combine rename)"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_DEPRECATED("Please use module-combine-sink instead of module-combine!"); struct userdata { @@ -65,7 +65,7 @@ void pa__done(pa_module*m) { u = m->userdata; if (u && PA_INVALID_INDEX != u->module_index) - pa_module_unload_by_index(m->core, u->module_index, TRUE); + pa_module_unload_by_index(m->core, u->module_index, true); pa_xfree(u); } diff --git a/src/modules/module-console-kit.c b/src/modules/module-console-kit.c index 271af2a18..007d23b3f 100644 --- a/src/modules/module-console-kit.c +++ b/src/modules/module-console-kit.c @@ -44,7 +44,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Create a client for each ConsoleKit session of this user"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); static const char* const valid_modargs[] = { NULL @@ -60,7 +60,7 @@ struct userdata { pa_core *core; pa_dbus_connection *connection; pa_hashmap *sessions; - pa_bool_t filter_added; + bool filter_added; }; static void add_session(struct userdata *u, const char *id) { @@ -310,7 +310,7 @@ int pa__init(pa_module*m) { goto fail; } - u->filter_added = TRUE; + u->filter_added = true; if (pa_dbus_add_matches( pa_dbus_connection_get(connection), &error, diff --git a/src/modules/module-default-device-restore.c b/src/modules/module-default-device-restore.c index 73a4c48cc..fb18750f7 100644 --- a/src/modules/module-default-device-restore.c +++ b/src/modules/module-default-device-restore.c @@ -41,7 +41,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Automatically restore the default sink and source"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); #define SAVE_INTERVAL (5 * PA_USEC_PER_SEC) @@ -50,7 +50,7 @@ struct userdata { pa_subscription *subscription; pa_time_event *time_event; char *sink_filename, *source_filename; - pa_bool_t modified; + bool modified; }; static void load(struct userdata *u) { @@ -125,7 +125,7 @@ static void save(struct userdata *u) { pa_log("Failed to save default source: %s", pa_cstrerror(errno)); } - u->modified = FALSE; + u->modified = false; } static void time_cb(pa_mainloop_api *a, pa_time_event *e, const struct timeval *t, void *userdata) { @@ -145,7 +145,7 @@ static void subscribe_cb(pa_core *c, pa_subscription_event_type_t t, uint32_t id pa_assert(u); - u->modified = TRUE; + u->modified = true; if (!u->time_event) u->time_event = pa_core_rttime_new(u->core, pa_rtclock_now() + SAVE_INTERVAL, time_cb, u); @@ -159,10 +159,10 @@ int pa__init(pa_module *m) { m->userdata = u = pa_xnew0(struct userdata, 1); u->core = m->core; - if (!(u->sink_filename = pa_state_path("default-sink", TRUE))) + if (!(u->sink_filename = pa_state_path("default-sink", true))) goto fail; - if (!(u->source_filename = pa_state_path("default-source", TRUE))) + if (!(u->source_filename = pa_state_path("default-source", true))) goto fail; load(u); diff --git a/src/modules/module-defs.h.m4 b/src/modules/module-defs.h.m4 index b6a60b6ac..838b8e8f9 100644 --- a/src/modules/module-defs.h.m4 +++ b/src/modules/module-defs.h.m4 @@ -30,6 +30,6 @@ const char* pa__get_description(void); const char* pa__get_usage(void); const char* pa__get_version(void); const char* pa__get_deprecated(void); -pa_bool_t pa__load_once(void); +bool pa__load_once(void); #endif diff --git a/src/modules/module-detect.c b/src/modules/module-detect.c index a16f7fe18..7b42d1a0e 100644 --- a/src/modules/module-detect.c +++ b/src/modules/module-detect.c @@ -46,7 +46,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Detect available audio hardware and load matching drivers"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_USAGE("just-one=<boolean>"); PA_MODULE_DEPRECATED("Please use module-udev-detect instead of module-detect!"); @@ -219,7 +219,7 @@ static int detect_waveout(pa_core *c, int just_one) { #endif int pa__init(pa_module*m) { - pa_bool_t just_one = FALSE; + bool just_one = false; int n = 0; pa_modargs *ma; @@ -255,7 +255,7 @@ int pa__init(pa_module*m) { pa_log_info("loaded %i modules.", n); /* We were successful and can unload ourselves now. */ - pa_module_unload_request(m, TRUE); + pa_module_unload_request(m, true); pa_modargs_free(ma); diff --git a/src/modules/module-device-manager.c b/src/modules/module-device-manager.c index f57850226..6ae9ceea9 100644 --- a/src/modules/module-device-manager.c +++ b/src/modules/module-device-manager.c @@ -56,7 +56,7 @@ PA_MODULE_AUTHOR("Colin Guthrie"); PA_MODULE_DESCRIPTION("Keep track of devices (and their descriptions) both past and present and prioritise by role"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_USAGE( "do_routing=<Automatically route streams based on a priority list (unique per-role)?> " "on_hotplug=<When new device becomes available, recheck streams?> " @@ -120,9 +120,9 @@ struct userdata { pa_native_protocol *protocol; pa_idxset *subscribed; - pa_bool_t on_hotplug; - pa_bool_t on_rescue; - pa_bool_t do_routing; + bool on_hotplug; + bool on_rescue; + bool do_routing; role_indexes_t preferred_sinks; role_indexes_t preferred_sources; @@ -133,7 +133,7 @@ struct userdata { struct entry { uint8_t version; char *description; - pa_bool_t user_set_description; + bool user_set_description; char *icon; role_indexes_t priority; }; @@ -200,10 +200,10 @@ static void entry_free(struct entry* e) { pa_xfree(e); } -static pa_bool_t entry_write(struct userdata *u, const char *name, const struct entry *e) { +static bool entry_write(struct userdata *u, const char *name, const struct entry *e) { pa_tagstruct *t; pa_datum key, data; - pa_bool_t r; + bool r; pa_assert(u); pa_assert(name); @@ -222,7 +222,7 @@ static pa_bool_t entry_write(struct userdata *u, const char *name, const struct data.data = (void*)pa_tagstruct_data(t, &data.size); - r = (pa_database_set(u->database, &key, &data, TRUE) == 0); + r = (pa_database_set(u->database, &key, &data, true) == 0); pa_tagstruct_free(t); @@ -236,7 +236,7 @@ static struct entry* legacy_entry_read(struct userdata *u, pa_datum *data) { struct legacy_entry { uint8_t version; char description[PA_NAME_MAX]; - pa_bool_t user_set_description; + bool user_set_description; char icon[PA_NAME_MAX]; role_indexes_t priority; } PA_GCC_PACKED; @@ -360,7 +360,7 @@ fail: } #ifdef DUMP_DATABASE -static void dump_database_helper(struct userdata *u, uint32_t role_index, const char* human, pa_bool_t sink_mode) { +static void dump_database_helper(struct userdata *u, uint32_t role_index, const char* human, bool sink_mode) { pa_assert(u); pa_assert(human); @@ -381,7 +381,7 @@ static void dump_database_helper(struct userdata *u, uint32_t role_index, const static void dump_database(struct userdata *u) { pa_datum key; - pa_bool_t done; + bool done; pa_assert(u); @@ -423,7 +423,7 @@ static void dump_database(struct userdata *u) { strncpy(name, role_names[role], len); for (int i = len+1; i < 12; ++i) name[i] = ' '; name[len] = ':'; name[0] -= 32; name[12] = '\0'; - dump_database_helper(u, role, name, TRUE); + dump_database_helper(u, role, name, true); } pa_log_debug(" Sources:"); @@ -433,7 +433,7 @@ static void dump_database(struct userdata *u) { strncpy(name, role_names[role], len); for (int i = len+1; i < 12; ++i) name[i] = ' '; name[len] = ':'; name[0] -= 32; name[12] = '\0'; - dump_database_helper(u, role, name, FALSE); + dump_database_helper(u, role, name, false); } } @@ -462,7 +462,7 @@ static void notify_subscribers(struct userdata *u) { } } -static pa_bool_t entries_equal(const struct entry *a, const struct entry *b) { +static bool entries_equal(const struct entry *a, const struct entry *b) { pa_assert(a); pa_assert(b); @@ -470,13 +470,13 @@ static pa_bool_t entries_equal(const struct entry *a, const struct entry *b) { if (!pa_streq(a->description, b->description) || a->user_set_description != b->user_set_description || !pa_streq(a->icon, b->icon)) - return FALSE; + return false; for (int i=0; i < NUM_ROLES; ++i) if (a->priority[i] != b->priority[i]) - return FALSE; + return false; - return TRUE; + return true; } static char *get_name(const char *key, const char *prefix) { @@ -505,7 +505,7 @@ static inline struct entry *load_or_initialize_entry(struct userdata *u, struct /* This is a new device, so make sure we write it's priority list correctly */ role_indexes_t max_priority; pa_datum key; - pa_bool_t done; + bool done; pa_zero(max_priority); done = !pa_database_first(u->database, &key, NULL); @@ -540,7 +540,7 @@ static inline struct entry *load_or_initialize_entry(struct userdata *u, struct for (uint32_t i = 0; i < NUM_ROLES; ++i) { entry->priority[i] = max_priority[i] + 1; } - entry->user_set_description = FALSE; + entry->user_set_description = false; } return old; @@ -559,7 +559,7 @@ static uint32_t get_role_index(const char* role) { static void update_highest_priority_device_indexes(struct userdata *u, const char *prefix, void *ignore_device) { role_indexes_t *indexes, highest_priority_available; pa_datum key; - pa_bool_t done, sink_mode; + bool done, sink_mode; pa_assert(u); pa_assert(prefix); @@ -597,7 +597,7 @@ static void update_highest_priority_device_indexes(struct userdata *u, const cha /* We've found a device with a higher priority than that we've currently got, so see if it is currently available or not and update our list */ uint32_t idx; - pa_bool_t found = FALSE; + bool found = false; if (sink_mode) { pa_sink *sink; @@ -606,7 +606,7 @@ static void update_highest_priority_device_indexes(struct userdata *u, const cha if ((pa_sink*) ignore_device == sink) continue; if (pa_streq(sink->name, device_name)) { - found = TRUE; + found = true; idx = sink->index; /* Is this needed? */ break; } @@ -618,7 +618,7 @@ static void update_highest_priority_device_indexes(struct userdata *u, const cha if ((pa_source*) ignore_device == source) continue; if (pa_streq(source->name, device_name)) { - found = TRUE; + found = true; idx = source->index; /* Is this needed? */ break; } @@ -681,7 +681,7 @@ static void route_sink_input(struct userdata *u, pa_sink_input *si) { return; if (si->sink != sink) - pa_sink_input_move_to(si, sink, FALSE); + pa_sink_input_move_to(si, sink, false); } static pa_hook_result_t route_sink_inputs(struct userdata *u, pa_sink *ignore_sink) { @@ -742,7 +742,7 @@ static void route_source_output(struct userdata *u, pa_source_output *so) { return; if (so->source != source) - pa_source_output_move_to(so, source, FALSE); + pa_source_output_move_to(so, source, false); } static pa_hook_result_t route_source_outputs(struct userdata *u, pa_source* ignore_source) { @@ -966,7 +966,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n pa_sink *sink; if ((sink = pa_idxset_get_by_index(u->core->sinks, device_index))) { - if (!pa_sink_input_new_data_set_sink(new_data, sink, FALSE)) + if (!pa_sink_input_new_data_set_sink(new_data, sink, false)) pa_log_debug("Not restoring device for stream because no supported format was found"); } } @@ -1006,7 +1006,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou pa_source *source; if ((source = pa_idxset_get_by_index(u->core->sources, device_index))) - if (!pa_source_output_new_data_set_source(new_data, source, FALSE)) + if (!pa_source_output_new_data_set_source(new_data, source, false)) pa_log_debug("Not restoring device for stream because no supported format was found"); } } @@ -1143,7 +1143,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio case SUBCOMMAND_READ: { pa_datum key; - pa_bool_t done; + bool done; if (!pa_tagstruct_eof(t)) goto fail; @@ -1222,7 +1222,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio if ((e = entry_read(u, device))) { pa_xfree(e->description); e->description = pa_xstrdup(description); - e->user_set_description = TRUE; + e->user_set_description = true; if (entry_write(u, (char *)device, e)) { apply_entry(u, device, e); @@ -1262,7 +1262,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio case SUBCOMMAND_ROLE_DEVICE_PRIORITY_ROUTING: { - pa_bool_t enable; + bool enable; if (pa_tagstruct_get_boolean(t, &enable) < 0) goto fail; @@ -1282,14 +1282,14 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio struct entry *e; uint32_t role_index, n_devices; pa_datum key; - pa_bool_t done, sink_mode = TRUE; + bool done, sink_mode = true; struct device_t { uint32_t prio; char *device; }; struct device_t *device; struct device_t **devices; uint32_t i, idx, offset; pa_hashmap *h; /*void *state;*/ - pa_bool_t first; + bool first; if (pa_tagstruct_gets(t, &role) < 0 || pa_tagstruct_getu32(t, &n_devices) < 0 || @@ -1301,7 +1301,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio /* Cycle through the devices given and make sure they exist */ h = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); - first = TRUE; + first = true; idx = 0; for (i = 0; i < n_devices; ++i) { const char *s; @@ -1330,7 +1330,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio entry_free(e); if (first) { - first = FALSE; + first = false; sink_mode = (0 == strncmp("sink:", s, 5)); } else if ((sink_mode && 0 != strncmp("sink:", s, 5)) || (!sink_mode && 0 != strncmp("source:", s, 7))) { while ((device = pa_hashmap_steal_first(h))) { @@ -1432,7 +1432,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio /* Go through in order and write the new entry and cleanup our own list */ idx = 1; - first = TRUE; + first = true; for (i = 0; i < n_devices; ++i) { if ((e = entry_read(u, devices[i]->device))) { if (e->priority[role_index] == idx) @@ -1441,7 +1441,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio e->priority[role_index] = idx; if (entry_write(u, (char *) devices[i]->device, e)) { - first = FALSE; + first = false; idx++; } } @@ -1468,7 +1468,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio case SUBCOMMAND_SUBSCRIBE: { - pa_bool_t enabled; + bool enabled; if (pa_tagstruct_get_boolean(t, &enabled) < 0 || !pa_tagstruct_eof(t)) @@ -1518,7 +1518,7 @@ int pa__init(pa_module*m) { pa_sink *sink; pa_source *source; uint32_t idx; - pa_bool_t do_routing = FALSE, on_hotplug = TRUE, on_rescue = TRUE; + bool do_routing = false, on_hotplug = true, on_rescue = true; uint32_t total_devices; pa_assert(m); @@ -1571,10 +1571,10 @@ int pa__init(pa_module*m) { u->source_unlink_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_UNLINK], PA_HOOK_LATE+5, (pa_hook_cb_t) source_unlink_hook_callback, u); } - if (!(fname = pa_state_path("device-manager", TRUE))) + if (!(fname = pa_state_path("device-manager", true))) goto fail; - if (!(u->database = pa_database_open(fname, TRUE))) { + if (!(u->database = pa_database_open(fname, true))) { pa_log("Failed to open volume database '%s': %s", fname, pa_cstrerror(errno)); pa_xfree(fname); goto fail; diff --git a/src/modules/module-device-restore.c b/src/modules/module-device-restore.c index 17728307b..fd3e23c7b 100644 --- a/src/modules/module-device-restore.c +++ b/src/modules/module-device-restore.c @@ -59,7 +59,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Automatically restore the volume/mute state of devices"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_USAGE( "restore_port=<Save/restore port?> " "restore_volume=<Save/restore volumes?> " @@ -95,10 +95,10 @@ struct userdata { pa_native_protocol *protocol; pa_idxset *subscribed; - pa_bool_t restore_volume:1; - pa_bool_t restore_muted:1; - pa_bool_t restore_port:1; - pa_bool_t restore_formats:1; + bool restore_volume:1; + bool restore_muted:1; + bool restore_port:1; + bool restore_formats:1; }; /* Protocol extension commands */ @@ -115,7 +115,7 @@ enum { struct entry { uint8_t version; - pa_bool_t port_valid; + bool port_valid; char *port; }; @@ -123,8 +123,8 @@ struct entry { struct perportentry { uint8_t version; - pa_bool_t muted_valid, volume_valid; - pa_bool_t muted; + bool muted_valid, volume_valid; + bool muted; pa_channel_map channel_map; pa_cvolume volume; pa_idxset *formats; @@ -174,9 +174,9 @@ static void trigger_save(struct userdata *u, pa_device_type_t type, uint32_t sin #ifdef ENABLE_LEGACY_DATABASE_ENTRY_FORMAT /* Some forward declarations */ -static pa_bool_t legacy_entry_read(struct userdata *u, pa_datum *data, struct entry **entry, struct perportentry **perportentry); +static bool legacy_entry_read(struct userdata *u, pa_datum *data, struct entry **entry, struct perportentry **perportentry); static struct perportentry* perportentry_read(struct userdata *u, const char *basekeyname, const char *port); -static pa_bool_t perportentry_write(struct userdata *u, const char *basekeyname, const char *port, const struct perportentry *e); +static bool perportentry_write(struct userdata *u, const char *basekeyname, const char *port, const struct perportentry *e); static void perportentry_free(struct perportentry* e); #endif @@ -193,10 +193,10 @@ static void entry_free(struct entry* e) { pa_xfree(e); } -static pa_bool_t entry_write(struct userdata *u, const char *name, const struct entry *e) { +static bool entry_write(struct userdata *u, const char *name, const struct entry *e) { pa_tagstruct *t; pa_datum key, data; - pa_bool_t r; + bool r; pa_assert(u); pa_assert(name); @@ -212,7 +212,7 @@ static pa_bool_t entry_write(struct userdata *u, const char *name, const struct data.data = (void*)pa_tagstruct_data(t, &data.size); - r = (pa_database_set(u->database, &key, &data, TRUE) == 0); + r = (pa_database_set(u->database, &key, &data, true) == 0); pa_tagstruct_free(t); @@ -271,7 +271,7 @@ fail: struct perportentry *ppe; pa_log_debug("Attempting to load legacy (pre-v1.0) data for key: %s", name); if (legacy_entry_read(u, &data, &e, &ppe)) { - pa_bool_t written = FALSE; + bool written = false; pa_log_debug("Success. Saving new format for key: %s", name); written = entry_write(u, name, e); @@ -323,18 +323,18 @@ static struct entry* entry_copy(const struct entry *e) { return r; } -static pa_bool_t entries_equal(const struct entry *a, const struct entry *b) { +static bool entries_equal(const struct entry *a, const struct entry *b) { pa_assert(a && b); if (a->port_valid != b->port_valid || (a->port_valid && !pa_streq(a->port, b->port))) - return FALSE; + return false; - return TRUE; + return true; } -static struct perportentry* perportentry_new(pa_bool_t add_pcm_format) { +static struct perportentry* perportentry_new(bool add_pcm_format) { struct perportentry *r = pa_xnew0(struct perportentry, 1); r->version = PERPORTENTRY_VERSION; r->formats = pa_idxset_new(NULL, NULL); @@ -353,10 +353,10 @@ static void perportentry_free(struct perportentry* e) { pa_xfree(e); } -static pa_bool_t perportentry_write(struct userdata *u, const char *basekeyname, const char *port, const struct perportentry *e) { +static bool perportentry_write(struct userdata *u, const char *basekeyname, const char *port, const struct perportentry *e) { pa_tagstruct *t; pa_datum key, data; - pa_bool_t r; + bool r; uint32_t i; pa_format_info *f; uint8_t n_formats; @@ -389,7 +389,7 @@ static pa_bool_t perportentry_write(struct userdata *u, const char *basekeyname, data.data = (void*)pa_tagstruct_data(t, &data.size); - r = (pa_database_set(u->database, &key, &data, TRUE) == 0); + r = (pa_database_set(u->database, &key, &data, true) == 0); pa_tagstruct_free(t); pa_xfree(name); @@ -418,7 +418,7 @@ static struct perportentry* perportentry_read(struct userdata *u, const char *ba goto fail; t = pa_tagstruct_new(data.data, data.size); - e = perportentry_new(FALSE); + e = perportentry_new(false); if (pa_tagstruct_getu8(t, &e->version) < 0 || e->version > PERPORTENTRY_VERSION || @@ -490,7 +490,7 @@ static struct perportentry* perportentry_copy(const struct perportentry *e) { pa_format_info *f; pa_assert(e); - r = perportentry_new(FALSE); + r = perportentry_new(false); r->version = e->version; r->muted_valid = e->muted_valid; r->volume_valid = e->volume_valid; @@ -504,36 +504,36 @@ static struct perportentry* perportentry_copy(const struct perportentry *e) { return r; } -static pa_bool_t perportentries_equal(const struct perportentry *a, const struct perportentry *b) { +static bool perportentries_equal(const struct perportentry *a, const struct perportentry *b) { pa_cvolume t; pa_assert(a && b); if (a->muted_valid != b->muted_valid || (a->muted_valid && (a->muted != b->muted))) - return FALSE; + return false; t = b->volume; if (a->volume_valid != b->volume_valid || (a->volume_valid && !pa_cvolume_equal(pa_cvolume_remap(&t, &b->channel_map, &a->channel_map), &a->volume))) - return FALSE; + return false; if (pa_idxset_size(a->formats) != pa_idxset_size(b->formats)) - return FALSE; + return false; /** TODO: Compare a bit better */ - return TRUE; + return true; } #ifdef ENABLE_LEGACY_DATABASE_ENTRY_FORMAT #define LEGACY_ENTRY_VERSION 2 -static pa_bool_t legacy_entry_read(struct userdata *u, pa_datum *data, struct entry **entry, struct perportentry **perportentry) { +static bool legacy_entry_read(struct userdata *u, pa_datum *data, struct entry **entry, struct perportentry **perportentry) { struct legacy_entry { uint8_t version; - pa_bool_t muted_valid:1, volume_valid:1, port_valid:1; - pa_bool_t muted:1; + bool muted_valid:1, volume_valid:1, port_valid:1; + bool muted:1; pa_channel_map channel_map; pa_cvolume volume; char port[PA_NAME_MAX]; @@ -547,43 +547,43 @@ static pa_bool_t legacy_entry_read(struct userdata *u, pa_datum *data, struct en if (data->size != sizeof(struct legacy_entry)) { pa_log_debug("Size does not match."); - return FALSE; + return false; } le = (struct legacy_entry*)data->data; if (le->version != LEGACY_ENTRY_VERSION) { pa_log_debug("Version mismatch."); - return FALSE; + return false; } if (!memchr(le->port, 0, sizeof(le->port))) { pa_log_warn("Port has missing NUL byte."); - return FALSE; + return false; } if (le->volume_valid && !pa_channel_map_valid(&le->channel_map)) { pa_log_warn("Invalid channel map."); - return FALSE; + return false; } if (le->volume_valid && (!pa_cvolume_valid(&le->volume) || !pa_cvolume_compatible_with_channel_map(&le->volume, &le->channel_map))) { pa_log_warn("Volume and channel map don't match."); - return FALSE; + return false; } *entry = entry_new(); (*entry)->port_valid = le->port_valid; (*entry)->port = pa_xstrdup(le->port); - *perportentry = perportentry_new(TRUE); + *perportentry = perportentry_new(true); (*perportentry)->muted_valid = le->muted_valid; (*perportentry)->volume_valid = le->volume_valid; (*perportentry)->muted = le->muted; (*perportentry)->channel_map = le->channel_map; (*perportentry)->volume = le->volume; - return TRUE; + return true; } #endif @@ -594,7 +594,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3 char *name; const char *port = NULL; pa_device_type_t type; - pa_bool_t written = FALSE; + bool written = false; pa_assert(c); pa_assert(u); @@ -624,23 +624,23 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3 if (sink->save_port) { pa_xfree(e->port); e->port = pa_xstrdup(port ? port : ""); - e->port_valid = TRUE; + e->port_valid = true; } if ((oldppe = perportentry_read(u, name, port))) ppe = perportentry_copy(oldppe); else - ppe = perportentry_new(TRUE); + ppe = perportentry_new(true); if (sink->save_volume) { ppe->channel_map = sink->channel_map; - ppe->volume = *pa_sink_get_volume(sink, FALSE); - ppe->volume_valid = TRUE; + ppe->volume = *pa_sink_get_volume(sink, false); + ppe->volume_valid = true; } if (sink->save_muted) { - ppe->muted = pa_sink_get_mute(sink, FALSE); - ppe->muted_valid = TRUE; + ppe->muted = pa_sink_get_mute(sink, false); + ppe->muted_valid = true; } } else { pa_source *source; @@ -663,23 +663,23 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3 if (source->save_port) { pa_xfree(e->port); e->port = pa_xstrdup(port ? port : ""); - e->port_valid = TRUE; + e->port_valid = true; } if ((oldppe = perportentry_read(u, name, port))) ppe = perportentry_copy(oldppe); else - ppe = perportentry_new(TRUE); + ppe = perportentry_new(true); if (source->save_volume) { ppe->channel_map = source->channel_map; - ppe->volume = *pa_source_get_volume(source, FALSE); - ppe->volume_valid = TRUE; + ppe->volume = *pa_source_get_volume(source, false); + ppe->volume_valid = true; } if (source->save_muted) { - ppe->muted = pa_source_get_mute(source, FALSE); - ppe->muted_valid = TRUE; + ppe->muted = pa_source_get_mute(source, false); + ppe->muted_valid = true; } } @@ -745,7 +745,7 @@ static pa_hook_result_t sink_new_hook_callback(pa_core *c, pa_sink_new_data *new if (!new_data->active_port) { pa_log_info("Restoring port for sink %s.", name); pa_sink_new_data_set_port(new_data, e->port); - new_data->save_port = TRUE; + new_data->save_port = true; } else pa_log_debug("Not restoring port for sink %s, because already set.", name); } @@ -783,7 +783,7 @@ static pa_hook_result_t sink_fixate_hook_callback(pa_core *c, pa_sink_new_data * pa_sink_new_data_set_volume(new_data, &v); pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &new_data->volume)); - new_data->save_volume = TRUE; + new_data->save_volume = true; } else pa_log_debug("Not restoring volume for sink %s, because already set.", new_data->name); } @@ -793,7 +793,7 @@ static pa_hook_result_t sink_fixate_hook_callback(pa_core *c, pa_sink_new_data * if (!new_data->muted_is_set) { pa_log_info("Restoring mute state for sink %s.", new_data->name); pa_sink_new_data_set_muted(new_data, e->muted); - new_data->save_muted = TRUE; + new_data->save_muted = true; } else pa_log_debug("Not restoring mute state for sink %s, because already set.", new_data->name); } @@ -826,17 +826,17 @@ static pa_hook_result_t sink_port_hook_callback(pa_core *c, pa_sink *sink, struc pa_log_info("Restoring volume for sink %s.", sink->name); v = e->volume; pa_cvolume_remap(&v, &e->channel_map, &sink->channel_map); - pa_sink_set_volume(sink, &v, TRUE, FALSE); + pa_sink_set_volume(sink, &v, true, false); pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &sink->reference_volume)); - sink->save_volume = TRUE; + sink->save_volume = true; } if (u->restore_muted && e->muted_valid) { pa_log_info("Restoring mute state for sink %s.", sink->name); - pa_sink_set_mute(sink, e->muted, FALSE); - sink->save_muted = TRUE; + pa_sink_set_mute(sink, e->muted, false); + sink->save_muted = true; } perportentry_free(e); @@ -888,7 +888,7 @@ static pa_hook_result_t source_new_hook_callback(pa_core *c, pa_source_new_data if (!new_data->active_port) { pa_log_info("Restoring port for source %s.", name); pa_source_new_data_set_port(new_data, e->port); - new_data->save_port = TRUE; + new_data->save_port = true; } else pa_log_debug("Not restoring port for source %s, because already set.", name); } @@ -926,7 +926,7 @@ static pa_hook_result_t source_fixate_hook_callback(pa_core *c, pa_source_new_da pa_source_new_data_set_volume(new_data, &v); pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &new_data->volume)); - new_data->save_volume = TRUE; + new_data->save_volume = true; } else pa_log_debug("Not restoring volume for source %s, because already set.", new_data->name); } @@ -936,7 +936,7 @@ static pa_hook_result_t source_fixate_hook_callback(pa_core *c, pa_source_new_da if (!new_data->muted_is_set) { pa_log_info("Restoring mute state for source %s.", new_data->name); pa_source_new_data_set_muted(new_data, e->muted); - new_data->save_muted = TRUE; + new_data->save_muted = true; } else pa_log_debug("Not restoring mute state for source %s, because already set.", new_data->name); } @@ -969,17 +969,17 @@ static pa_hook_result_t source_port_hook_callback(pa_core *c, pa_source *source, pa_log_info("Restoring volume for source %s.", source->name); v = e->volume; pa_cvolume_remap(&v, &e->channel_map, &source->channel_map); - pa_source_set_volume(source, &v, TRUE, FALSE); + pa_source_set_volume(source, &v, true, false); pa_log_info("Restored volume: %s", pa_cvolume_snprint(buf, PA_CVOLUME_SNPRINT_MAX, &source->reference_volume)); - source->save_volume = TRUE; + source->save_volume = true; } if (u->restore_muted && e->muted_valid) { pa_log_info("Restoring mute state for source %s.", source->name); - pa_source_set_mute(source, e->muted, FALSE); - source->save_muted = TRUE; + pa_source_set_mute(source, e->muted, false); + source->save_muted = true; } perportentry_free(e); @@ -1057,7 +1057,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio case SUBCOMMAND_SUBSCRIBE: { - pa_bool_t enabled; + bool enabled; if (pa_tagstruct_get_boolean(t, &enabled) < 0 || !pa_tagstruct_eof(t)) @@ -1144,7 +1144,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio /* Read or create an entry */ name = pa_sprintf_malloc("sink:%s", sink->name); if (!(e = perportentry_read(u, name, (sink->active_port ? sink->active_port->name : NULL)))) - e = perportentry_new(FALSE); + e = perportentry_new(false); else { /* Clean out any saved formats */ pa_idxset_free(e->formats, (pa_free_cb_t) pa_format_info_free); @@ -1210,7 +1210,7 @@ int pa__init(pa_module*m) { pa_sink *sink; pa_source *source; uint32_t idx; - pa_bool_t restore_volume = TRUE, restore_muted = TRUE, restore_port = TRUE, restore_formats = TRUE; + bool restore_volume = true, restore_muted = true, restore_port = true, restore_formats = true; pa_assert(m); @@ -1263,10 +1263,10 @@ int pa__init(pa_module*m) { if (restore_formats) u->sink_put_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_PUT], PA_HOOK_EARLY, (pa_hook_cb_t) sink_put_hook_callback, u); - if (!(fname = pa_state_path("device-volumes", TRUE))) + if (!(fname = pa_state_path("device-volumes", true))) goto fail; - if (!(u->database = pa_database_open(fname, TRUE))) { + if (!(u->database = pa_database_open(fname, true))) { pa_log("Failed to open volume database '%s': %s", fname, pa_cstrerror(errno)); pa_xfree(fname); goto fail; diff --git a/src/modules/module-equalizer-sink.c b/src/modules/module-equalizer-sink.c index 59073ce2f..22043f073 100644 --- a/src/modules/module-equalizer-sink.c +++ b/src/modules/module-equalizer-sink.c @@ -71,7 +71,7 @@ PA_MODULE_AUTHOR("Jason Newton"); PA_MODULE_DESCRIPTION(_("General Purpose Equalizer")); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( _("sink_name=<name of the sink> " "sink_properties=<properties for the sink> " @@ -85,13 +85,13 @@ PA_MODULE_USAGE( )); #define MEMBLOCKQ_MAXLENGTH (16*1024*1024) -#define DEFAULT_AUTOLOADED FALSE +#define DEFAULT_AUTOLOADED false struct userdata { pa_module *module; pa_sink *sink; pa_sink_input *sink_input; - pa_bool_t autoloaded; + bool autoloaded; size_t channels; size_t fft_size;//length (res) of fft @@ -122,7 +122,7 @@ struct userdata { size_t output_buffer_length; size_t output_buffer_max_length; pa_memblockq *output_q; - pa_bool_t first_iteration; + bool first_iteration; pa_dbus_protocol *dbus_protocol; char *dbus_path; @@ -197,17 +197,17 @@ static void interpolate(float *samples, size_t length, uint32_t *xs, float *ys, samples[length-1] = ys[n_points-1]; } -static pa_bool_t is_monotonic(const uint32_t *xs, size_t length) { +static bool is_monotonic(const uint32_t *xs, size_t length) { pa_assert(xs); if (length < 2) - return TRUE; + return true; for(size_t i = 1; i < length; ++i) if (xs[i] <= xs[i-1]) - return FALSE; + return false; - return TRUE; + return true; } /* ensures memory allocated is a multiple of v_size and aligned */ @@ -301,7 +301,7 @@ static void sink_request_rewind_cb(pa_sink *s) { return; /* Just hand this one over to the master sink */ - pa_sink_input_request_rewind(u->sink_input, s->thread_info.rewind_nbytes+pa_memblockq_get_length(u->input_q), TRUE, FALSE, FALSE); + pa_sink_input_request_rewind(u->sink_input, s->thread_info.rewind_nbytes+pa_memblockq_get_length(u->input_q), true, false, false); } /* Called from I/O thread context */ @@ -332,7 +332,7 @@ static void sink_set_volume_cb(pa_sink *s) { !PA_SINK_INPUT_IS_LINKED(pa_sink_input_get_state(u->sink_input))) return; - pa_sink_input_set_volume(u->sink_input, &s->real_volume, s->save_volume, TRUE); + pa_sink_input_set_volume(u->sink_input, &s->real_volume, s->save_volume, true); } /* Called from main context */ @@ -564,7 +564,7 @@ static void process_samples(struct userdata *u) { pa_sample_clamp(PA_SAMPLE_FLOAT32NE, (uint8_t *) (((float *)u->output_buffer) + c) + offset, fs, u->work_buffer, sizeof(float), u->R); } if (u->first_iteration) { - u->first_iteration = FALSE; + u->first_iteration = false; } u->samples_gathered -= u->R; } @@ -711,7 +711,7 @@ static void reset_filter(struct userdata *u) { for(size_t i = 0; i < u->channels; ++i) pa_memzero(u->overlap_accum[i], u->overlap_size * sizeof(float)); - u->first_iteration = TRUE; + u->first_iteration = true; //set buffer size to max request, no overlap copy max_request = PA_ROUND_UP(pa_sink_input_get_max_request(u->sink_input) / fs , u->R); max_request = PA_MAX(max_request, u->window_size); @@ -739,7 +739,7 @@ static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) { if (amount > 0) { //invalidate the output q - pa_memblockq_seek(u->input_q, - (int64_t) amount, PA_SEEK_RELATIVE, TRUE); + pa_memblockq_seek(u->input_q, - (int64_t) amount, PA_SEEK_RELATIVE, true); pa_log("Resetting filter"); //reset_filter(u); //this is the "proper" thing to do... } @@ -851,7 +851,7 @@ static void sink_input_kill_cb(pa_sink_input *i) { /* Leave u->sink alone for now, it will be cleaned up on module * unload (and it is needed during unload as well). */ - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } /* Called from IO thread context */ @@ -866,7 +866,7 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s if (PA_SINK_INPUT_IS_LINKED(state) && i->thread_info.state == PA_SINK_INPUT_INIT) { pa_log_debug("Requesting rewind due to state change."); - pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); + pa_sink_input_request_rewind(i, 0, false, true, true); } } @@ -924,7 +924,7 @@ static void save_profile(struct userdata *u, size_t channel, char *name) { key.size = strlen(key.data); data.data = profile; data.size = profile_size; - pa_database_set(u->database, &key, &data, TRUE); + pa_database_set(u->database, &key, &data, true); pa_database_sync(u->database); if (u->base_profiles[channel]) { pa_xfree(u->base_profiles[channel]); @@ -962,11 +962,11 @@ static void save_state(struct userdata *u) { data.data = state; data.size = filter_state_size + packed_length; //thread safety for 0.9.17? - pa_assert_se(dbname = pa_state_path(EQ_STATE_DB, FALSE)); - pa_assert_se(database = pa_database_open(dbname, TRUE)); + pa_assert_se(dbname = pa_state_path(EQ_STATE_DB, false)); + pa_assert_se(database = pa_database_open(dbname, true)); pa_xfree(dbname); - pa_database_set(database, &key, &data, TRUE); + pa_database_set(database, &key, &data, true); pa_database_sync(database); pa_database_close(database); pa_xfree(state); @@ -1014,8 +1014,8 @@ static void load_state(struct userdata *u) { pa_datum key, value; pa_database *database; char *dbname; - pa_assert_se(dbname = pa_state_path(EQ_STATE_DB, FALSE)); - database = pa_database_open(dbname, FALSE); + pa_assert_se(dbname = pa_state_path(EQ_STATE_DB, false)); + database = pa_database_open(dbname, false); pa_xfree(dbname); if (!database) { pa_log("No resume state"); @@ -1053,14 +1053,14 @@ static void load_state(struct userdata *u) { } /* Called from main context */ -static pa_bool_t sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) { +static bool sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) { struct userdata *u; pa_sink_input_assert_ref(i); pa_assert_se(u = i->userdata); if (u->autoloaded) - return FALSE; + return false; return u->sink != dest; } @@ -1092,7 +1092,7 @@ int pa__init(pa_module*m) { unsigned c; float *H; unsigned a_i; - pa_bool_t use_volume_sharing = TRUE; + bool use_volume_sharing = true; pa_assert(m); @@ -1161,7 +1161,7 @@ int pa__init(pa_module*m) { u->inverse_plan = fftwf_plan_dft_c2r_1d(u->fft_size, u->output_window, u->work_buffer, FFTW_ESTIMATE); hanning_window(u->W, u->window_size); - u->first_iteration = TRUE; + u->first_iteration = true; u->base_profiles = pa_xnew0(char *, u->channels); for (c = 0; c < u->channels; ++c) @@ -1210,7 +1210,7 @@ int pa__init(pa_module*m) { pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb); if (!use_volume_sharing) { pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb); - pa_sink_enable_decibel_volume(u->sink, TRUE); + pa_sink_enable_decibel_volume(u->sink, true); } u->sink->userdata = u; @@ -1227,7 +1227,7 @@ int pa__init(pa_module*m) { pa_sink_input_new_data_init(&sink_input_data); sink_input_data.driver = __FILE__; sink_input_data.module = m; - pa_sink_input_new_data_set_sink(&sink_input_data, master, FALSE); + pa_sink_input_new_data_set_sink(&sink_input_data, master, false); sink_input_data.origin_sink = u->sink; pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Equalized Stream"); pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter"); @@ -1592,8 +1592,8 @@ void dbus_init(struct userdata *u) { char *dbname; sink_list=pa_idxset_new(&pa_idxset_trivial_hash_func, &pa_idxset_trivial_compare_func); pa_shared_set(u->sink->core, SINKLIST, sink_list); - pa_assert_se(dbname = pa_state_path("equalizer-presets", FALSE)); - pa_assert_se(u->database = pa_database_open(dbname, TRUE)); + pa_assert_se(dbname = pa_state_path("equalizer-presets", false)); + pa_assert_se(u->database = pa_database_open(dbname, true)); pa_xfree(dbname); pa_shared_set(u->sink->core, EQDB, u->database); pa_dbus_protocol_add_interface(u->dbus_protocol, MANAGER_PATH, &manager_info, u->sink->core); @@ -1702,7 +1702,7 @@ static void get_profiles(pa_core *c, char ***names, unsigned *n) { pa_database *database; pa_datum key, next_key; pa_strlist *head=NULL, *iter; - pa_bool_t done; + bool done; pa_assert_se(database = pa_shared_get(c, EQDB)); pa_assert(c); @@ -1790,7 +1790,7 @@ void equalizer_handle_seed_filter(DBusConnection *conn, DBusMessage *msg, void * double *_ys, preamp; unsigned x_npoints, y_npoints, a_i; float *H; - pa_bool_t points_good = TRUE; + bool points_good = true; pa_assert(conn); pa_assert(msg); @@ -1815,7 +1815,7 @@ void equalizer_handle_seed_filter(DBusConnection *conn, DBusMessage *msg, void * } for(size_t i = 0; i < x_npoints; ++i) { if (xs[i] >= FILTER_SIZE(u)) { - points_good = FALSE; + points_good = false; break; } } @@ -1868,7 +1868,7 @@ void equalizer_handle_get_filter_points(DBusConnection *conn, DBusMessage *msg, double *ys, preamp; unsigned x_npoints, a_i; float *H; - pa_bool_t points_good=TRUE; + bool points_good=true; DBusMessage *reply = NULL; DBusMessageIter msg_iter; DBusError error; @@ -1894,7 +1894,7 @@ void equalizer_handle_get_filter_points(DBusConnection *conn, DBusMessage *msg, for(size_t i = 0; i < x_npoints; ++i) { if (xs[i] >= FILTER_SIZE(u)) { - points_good=FALSE; + points_good=false; break; } } diff --git a/src/modules/module-esound-compat-spawnfd.c b/src/modules/module-esound-compat-spawnfd.c index e2488fc61..30776d7af 100644 --- a/src/modules/module-esound-compat-spawnfd.c +++ b/src/modules/module-esound-compat-spawnfd.c @@ -36,7 +36,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("ESOUND compatibility module: -spawnfd emulation"); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_VERSION(PACKAGE_VERSION); PA_MODULE_USAGE("fd=<file descriptor>"); @@ -66,7 +66,7 @@ int pa__init(pa_module*m) { pa_assert_se(pa_close(fd) == 0); - pa_module_unload_request(m, TRUE); + pa_module_unload_request(m, true); ret = 0; diff --git a/src/modules/module-esound-compat-spawnpid.c b/src/modules/module-esound-compat-spawnpid.c index 94ebdaadc..9d4249d11 100644 --- a/src/modules/module-esound-compat-spawnpid.c +++ b/src/modules/module-esound-compat-spawnpid.c @@ -38,7 +38,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("ESOUND compatibility module: -spawnpid emulation"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_USAGE("pid=<process id>"); static const char* const valid_modargs[] = { @@ -63,7 +63,7 @@ int pa__init(pa_module*m) { if (kill((pid_t) pid, SIGUSR1) < 0) pa_log_warn("kill(%u) failed: %s", pid, pa_cstrerror(errno)); - pa_module_unload_request(m, TRUE); + pa_module_unload_request(m, true); ret = 0; diff --git a/src/modules/module-esound-sink.c b/src/modules/module-esound-sink.c index 9cb7a717f..8b74ea433 100644 --- a/src/modules/module-esound-sink.c +++ b/src/modules/module-esound-sink.c @@ -72,7 +72,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("ESOUND Sink"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "sink_name=<name for the sink> " "sink_properties=<properties for the sink> " @@ -159,7 +159,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse case PA_SINK_RUNNING: if (u->sink->thread_info.state == PA_SINK_SUSPENDED) - pa_smoother_resume(u->smoother, pa_rtclock_now(), TRUE); + pa_smoother_resume(u->smoother, pa_rtclock_now(), true); break; @@ -307,7 +307,7 @@ static void thread_func(void *userdata) { pollfd->events = (short) (PA_SINK_IS_OPENED(u->sink->thread_info.state) ? POLLOUT : 0); } - if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) + if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) goto fail; if (ret == 0) @@ -370,7 +370,7 @@ static int do_write(struct userdata *u) { pa_assert(u->fd < 0); u->fd = pa_iochannel_get_send_fd(u->io); - pa_iochannel_set_noclose(u->io, TRUE); + pa_iochannel_set_noclose(u->io, true); pa_iochannel_free(u->io); u->io = NULL; @@ -497,7 +497,7 @@ static void io_callback(pa_iochannel *io, void*userdata) { u->io = NULL; } - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } } @@ -509,7 +509,7 @@ static void on_connection(pa_socket_client *c, pa_iochannel*io, void *userdata) if (!io) { pa_log("Connection failed: %s", pa_cstrerror(errno)); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); return; } @@ -555,11 +555,11 @@ int pa__init(pa_module*m) { u->smoother = pa_smoother_new( PA_USEC_PER_SEC, PA_USEC_PER_SEC*2, - TRUE, - TRUE, + true, + true, 10, 0, - FALSE); + false); pa_memchunk_reset(&u->memchunk); u->offset = 0; @@ -613,7 +613,7 @@ int pa__init(pa_module*m) { pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq); pa_sink_set_rtpoll(u->sink, u->rtpoll); - if (!(u->client = pa_socket_client_new_string(u->core->mainloop, TRUE, espeaker, ESD_DEFAULT_PORT))) { + if (!(u->client = pa_socket_client_new_string(u->core->mainloop, true, espeaker, ESD_DEFAULT_PORT))) { pa_log("Failed to connect to server."); goto fail; } @@ -622,7 +622,7 @@ int pa__init(pa_module*m) { /* Prepare the initial request */ u->write_data = pa_xmalloc(u->write_length = ESD_KEY_LEN + sizeof(int32_t)); - if (pa_authkey_load_auto(pa_modargs_get_value(ma, "cookie", ".esd_auth"), TRUE, u->write_data, ESD_KEY_LEN) < 0) { + if (pa_authkey_load_auto(pa_modargs_get_value(ma, "cookie", ".esd_auth"), true, u->write_data, ESD_KEY_LEN) < 0) { pa_log("Failed to load cookie"); goto fail; } diff --git a/src/modules/module-filter-apply.c b/src/modules/module-filter-apply.c index 4e85ea155..05d4284a1 100644 --- a/src/modules/module-filter-apply.c +++ b/src/modules/module-filter-apply.c @@ -44,7 +44,7 @@ PA_MODULE_AUTHOR("Colin Guthrie"); PA_MODULE_DESCRIPTION("Load filter sinks automatically when needed"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_USAGE(_("autoclean=<automatically unload unused filters?>")); static const char* const valid_modargs[] = { @@ -52,7 +52,7 @@ static const char* const valid_modargs[] = { NULL }; -#define DEFAULT_AUTOCLEAN TRUE +#define DEFAULT_AUTOCLEAN true #define HOUSEKEEPING_INTERVAL (10 * PA_USEC_PER_SEC) struct filter { @@ -78,7 +78,7 @@ struct userdata { *source_output_proplist_slot, *source_output_unlink_slot, *source_unlink_slot; - pa_bool_t autoclean; + bool autoclean; pa_time_event *housekeeping_time_event; }; @@ -128,7 +128,7 @@ static void filter_free(struct filter *f) { pa_xfree(f); } -static const char* should_filter(pa_object *o, pa_bool_t is_sink_input) { +static const char* should_filter(pa_object *o, bool is_sink_input) { const char *apply; pa_proplist *pl; @@ -148,11 +148,11 @@ static const char* should_filter(pa_object *o, pa_bool_t is_sink_input) { return NULL; } -static pa_bool_t should_group_filter(struct filter *filter) { +static bool should_group_filter(struct filter *filter) { return pa_streq(filter->name, "echo-cancel"); } -static char* get_group(pa_object *o, pa_bool_t is_sink_input) { +static char* get_group(pa_object *o, bool is_sink_input) { pa_proplist *pl; if (is_sink_input) @@ -170,7 +170,7 @@ static char* get_group(pa_object *o, pa_bool_t is_sink_input) { * looking up streams that belong to the same stream group as the original * object. The idea is that streams from the sam group are always routed * together. */ -static pa_bool_t find_paired_master(struct userdata *u, struct filter *filter, pa_object *o, pa_bool_t is_sink_input) { +static bool find_paired_master(struct userdata *u, struct filter *filter, pa_object *o, bool is_sink_input) { char *group; if ((group = get_group(o, is_sink_input))) { @@ -182,7 +182,7 @@ static pa_bool_t find_paired_master(struct userdata *u, struct filter *filter, p pa_source_output *so; PA_IDXSET_FOREACH(so, u->core->source_outputs, idx) { - g = get_group(PA_OBJECT(so), FALSE); + g = get_group(PA_OBJECT(so), false); if (pa_streq(g, group)) { if (pa_streq(module_name, so->source->module->name)) { @@ -203,7 +203,7 @@ static pa_bool_t find_paired_master(struct userdata *u, struct filter *filter, p pa_sink_input *si; PA_IDXSET_FOREACH(si, u->core->sink_inputs, idx) { - g = get_group(PA_OBJECT(si), TRUE); + g = get_group(PA_OBJECT(si), true); if (pa_streq(g, group)) { if (pa_streq(module_name, si->sink->module->name)) { @@ -226,14 +226,14 @@ static pa_bool_t find_paired_master(struct userdata *u, struct filter *filter, p pa_xfree(module_name); if (!filter->sink_master || !filter->source_master) - return FALSE; + return false; } - return TRUE; + return true; } -static pa_bool_t nothing_attached(struct filter *f) { - pa_bool_t no_si = TRUE, no_so = TRUE; +static bool nothing_attached(struct filter *f) { + bool no_si = true, no_so = true; if (f->sink) no_si = pa_idxset_isempty(f->sink->inputs); @@ -264,7 +264,7 @@ static void housekeeping_time_callback(pa_mainloop_api*a, pa_time_event* e, cons idx = filter->module_index; pa_hashmap_remove(u->filters, filter); filter_free(filter); - pa_module_unload_request_by_index(u->core, idx, TRUE); + pa_module_unload_request_by_index(u->core, idx, true); } } @@ -283,14 +283,14 @@ static void trigger_housekeeping(struct userdata *u) { u->housekeeping_time_event = pa_core_rttime_new(u->core, pa_rtclock_now() + HOUSEKEEPING_INTERVAL, housekeeping_time_callback, u); } -static int do_move(pa_object *obj, pa_object *parent, pa_bool_t restore, pa_bool_t is_input) { +static int do_move(pa_object *obj, pa_object *parent, bool restore, bool is_input) { if (is_input) return pa_sink_input_move_to(PA_SINK_INPUT(obj), PA_SINK(parent), restore); else return pa_source_output_move_to(PA_SOURCE_OUTPUT(obj), PA_SOURCE(parent), restore); } -static void move_object_for_filter(pa_object *o, struct filter* filter, pa_bool_t restore, pa_bool_t is_sink_input) { +static void move_object_for_filter(pa_object *o, struct filter* filter, bool restore, bool is_sink_input) { pa_object *parent; pa_proplist *pl; const char *name; @@ -314,7 +314,7 @@ static void move_object_for_filter(pa_object *o, struct filter* filter, pa_bool_ pa_proplist_sets(pl, PA_PROP_FILTER_APPLY_MOVING, "1"); - if (do_move(o, parent, FALSE, is_sink_input) < 0) + if (do_move(o, parent, false, is_sink_input) < 0) pa_log_info("Failed to move %s for \"%s\" to <%s>.", is_sink_input ? "sink-input" : "source-output", pa_strnull(pa_proplist_gets(pl, PA_PROP_APPLICATION_NAME)), name); else @@ -324,8 +324,8 @@ static void move_object_for_filter(pa_object *o, struct filter* filter, pa_bool_ pa_proplist_unset(pl, PA_PROP_FILTER_APPLY_MOVING); } -static void move_objects_for_filter(struct userdata *u, pa_object *o, struct filter* filter, pa_bool_t restore, - pa_bool_t is_sink_input) { +static void move_objects_for_filter(struct userdata *u, pa_object *o, struct filter* filter, bool restore, + bool is_sink_input) { if (!should_group_filter(filter)) move_object_for_filter(o, filter, restore, is_sink_input); @@ -338,19 +338,19 @@ static void move_objects_for_filter(struct userdata *u, pa_object *o, struct fil group = get_group(o, is_sink_input); PA_IDXSET_FOREACH(so, u->core->source_outputs, idx) { - g = get_group(PA_OBJECT(so), FALSE); + g = get_group(PA_OBJECT(so), false); if (pa_streq(g, group)) - move_object_for_filter(PA_OBJECT(so), filter, restore, FALSE); + move_object_for_filter(PA_OBJECT(so), filter, restore, false); pa_xfree(g); } PA_IDXSET_FOREACH(si, u->core->sink_inputs, idx) { - g = get_group(PA_OBJECT(si), TRUE); + g = get_group(PA_OBJECT(si), true); if (pa_streq(g, group)) - move_object_for_filter(PA_OBJECT(si), filter, restore, TRUE); + move_object_for_filter(PA_OBJECT(si), filter, restore, true); pa_xfree(g); } @@ -399,22 +399,22 @@ static void find_filters_for_module(struct userdata *u, pa_module *m, const char pa_hashmap_put(u->filters, fltr, fltr); } -static pa_bool_t can_unload_module(struct userdata *u, uint32_t idx) { +static bool can_unload_module(struct userdata *u, uint32_t idx) { void *state; struct filter *filter; /* Check if any other struct filters point to the same module */ PA_HASHMAP_FOREACH(filter, u->filters, state) { if (filter->module_index == idx && !nothing_attached(filter)) - return FALSE; + return false; } - return TRUE; + return true; } -static pa_hook_result_t process(struct userdata *u, pa_object *o, pa_bool_t is_sink_input) { +static pa_hook_result_t process(struct userdata *u, pa_object *o, bool is_sink_input) { const char *want; - pa_bool_t done_something = FALSE; + bool done_something = false; pa_sink *sink = NULL; pa_source *source = NULL; pa_module *module = NULL; @@ -475,7 +475,7 @@ static pa_hook_result_t process(struct userdata *u, pa_object *o, pa_bool_t is_s if ((m = pa_module_load(u->core, module_name, args))) { find_filters_for_module(u, m, want); filter = pa_hashmap_get(u->filters, fltr); - done_something = TRUE; + done_something = true; } pa_xfree(args); } @@ -492,8 +492,8 @@ static pa_hook_result_t process(struct userdata *u, pa_object *o, pa_bool_t is_s /* We can move the stream now as we know the destination. If this * isn't true, we will do it later when the sink appears. */ if ((is_sink_input && filter->sink) || (!is_sink_input && filter->source)) { - move_objects_for_filter(u, o, filter, FALSE, is_sink_input); - done_something = TRUE; + move_objects_for_filter(u, o, filter, false, is_sink_input); + done_something = true; } } else { void *state; @@ -503,8 +503,8 @@ static pa_hook_result_t process(struct userdata *u, pa_object *o, pa_bool_t is_s * This can happen if an input's proplist changes */ PA_HASHMAP_FOREACH(filter, u->filters, state) { if ((is_sink_input && sink == filter->sink) || (!is_sink_input && source == filter->source)) { - move_objects_for_filter(u, o, filter, TRUE, is_sink_input); - done_something = TRUE; + move_objects_for_filter(u, o, filter, true, is_sink_input); + done_something = true; break; } } @@ -520,7 +520,7 @@ static pa_hook_result_t sink_input_put_cb(pa_core *core, pa_sink_input *i, struc pa_core_assert_ref(core); pa_sink_input_assert_ref(i); - return process(u, PA_OBJECT(i), TRUE); + return process(u, PA_OBJECT(i), true); } static pa_hook_result_t sink_input_move_finish_cb(pa_core *core, pa_sink_input *i, struct userdata *u) { @@ -530,14 +530,14 @@ static pa_hook_result_t sink_input_move_finish_cb(pa_core *core, pa_sink_input * if (pa_proplist_gets(i->proplist, PA_PROP_FILTER_APPLY_MOVING)) return PA_HOOK_OK; - return process(u, PA_OBJECT(i), TRUE); + return process(u, PA_OBJECT(i), true); } static pa_hook_result_t sink_input_proplist_cb(pa_core *core, pa_sink_input *i, struct userdata *u) { pa_core_assert_ref(core); pa_sink_input_assert_ref(i); - return process(u, PA_OBJECT(i), TRUE); + return process(u, PA_OBJECT(i), true); } static pa_hook_result_t sink_input_unlink_cb(pa_core *core, pa_sink_input *i, struct userdata *u) { @@ -573,7 +573,7 @@ static pa_hook_result_t sink_unlink_cb(pa_core *core, pa_sink *sink, struct user pa_sink_input *i; PA_IDXSET_FOREACH(i, sink->inputs, idx) - move_objects_for_filter(u, PA_OBJECT(i), filter, TRUE, TRUE); + move_objects_for_filter(u, PA_OBJECT(i), filter, true, true); } idx = filter->module_index; @@ -581,7 +581,7 @@ static pa_hook_result_t sink_unlink_cb(pa_core *core, pa_sink *sink, struct user filter_free(filter); if (can_unload_module(u, idx)) - pa_module_unload_request_by_index(u->core, idx, TRUE); + pa_module_unload_request_by_index(u->core, idx, true); } } @@ -592,7 +592,7 @@ static pa_hook_result_t source_output_put_cb(pa_core *core, pa_source_output *o, pa_core_assert_ref(core); pa_source_output_assert_ref(o); - return process(u, PA_OBJECT(o), FALSE); + return process(u, PA_OBJECT(o), false); } static pa_hook_result_t source_output_move_finish_cb(pa_core *core, pa_source_output *o, struct userdata *u) { @@ -602,14 +602,14 @@ static pa_hook_result_t source_output_move_finish_cb(pa_core *core, pa_source_ou if (pa_proplist_gets(o->proplist, PA_PROP_FILTER_APPLY_MOVING)) return PA_HOOK_OK; - return process(u, PA_OBJECT(o), FALSE); + return process(u, PA_OBJECT(o), false); } static pa_hook_result_t source_output_proplist_cb(pa_core *core, pa_source_output *o, struct userdata *u) { pa_core_assert_ref(core); pa_source_output_assert_ref(o); - return process(u, PA_OBJECT(o), FALSE); + return process(u, PA_OBJECT(o), false); } static pa_hook_result_t source_output_unlink_cb(pa_core *core, pa_source_output *o, struct userdata *u) { @@ -645,7 +645,7 @@ static pa_hook_result_t source_unlink_cb(pa_core *core, pa_source *source, struc pa_source_output *o; PA_IDXSET_FOREACH(o, source->outputs, idx) - move_objects_for_filter(u, PA_OBJECT(o), filter, TRUE, FALSE); + move_objects_for_filter(u, PA_OBJECT(o), filter, true, false); } idx = filter->module_index; @@ -653,7 +653,7 @@ static pa_hook_result_t source_unlink_cb(pa_core *core, pa_source *source, struc filter_free(filter); if (can_unload_module(u, idx)) - pa_module_unload_request_by_index(u->core, idx, TRUE); + pa_module_unload_request_by_index(u->core, idx, true); } } @@ -743,7 +743,7 @@ void pa__done(pa_module *m) { struct filter *f; while ((f = pa_hashmap_steal_first(u->filters))) { - pa_module_unload_request_by_index(u->core, f->module_index, TRUE); + pa_module_unload_request_by_index(u->core, f->module_index, true); filter_free(f); } diff --git a/src/modules/module-filter-heuristics.c b/src/modules/module-filter-heuristics.c index 17e56030f..885b02ee2 100644 --- a/src/modules/module-filter-heuristics.c +++ b/src/modules/module-filter-heuristics.c @@ -40,7 +40,7 @@ PA_MODULE_AUTHOR("Colin Guthrie"); PA_MODULE_DESCRIPTION("Detect when various filters are desirable"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); static const char* const valid_modargs[] = { NULL @@ -55,7 +55,7 @@ struct userdata { *source_output_move_finish_slot; }; -static pa_hook_result_t process(struct userdata *u, pa_object *o, pa_bool_t is_sink_input) { +static pa_hook_result_t process(struct userdata *u, pa_object *o, bool is_sink_input) { const char *want; pa_proplist *pl, *parent_pl; @@ -99,7 +99,7 @@ static pa_hook_result_t sink_input_put_cb(pa_core *core, pa_sink_input *i, struc pa_sink_input_assert_ref(i); pa_assert(u); - return process(u, PA_OBJECT(i), TRUE); + return process(u, PA_OBJECT(i), true); } static pa_hook_result_t sink_input_move_finish_cb(pa_core *core, pa_sink_input *i, struct userdata *u) { @@ -111,7 +111,7 @@ static pa_hook_result_t sink_input_move_finish_cb(pa_core *core, pa_sink_input * if (pa_proplist_gets(i->proplist, PA_PROP_FILTER_APPLY_MOVING)) return PA_HOOK_OK; - return process(u, PA_OBJECT(i), TRUE); + return process(u, PA_OBJECT(i), true); } static pa_hook_result_t source_output_put_cb(pa_core *core, pa_source_output *i, struct userdata *u) { @@ -119,7 +119,7 @@ static pa_hook_result_t source_output_put_cb(pa_core *core, pa_source_output *i, pa_source_output_assert_ref(i); pa_assert(u); - return process(u, PA_OBJECT(i), FALSE); + return process(u, PA_OBJECT(i), false); } static pa_hook_result_t source_output_move_finish_cb(pa_core *core, pa_source_output *i, struct userdata *u) { @@ -131,7 +131,7 @@ static pa_hook_result_t source_output_move_finish_cb(pa_core *core, pa_source_ou if (pa_proplist_gets(i->proplist, PA_PROP_FILTER_APPLY_MOVING)) return PA_HOOK_OK; - return process(u, PA_OBJECT(i), FALSE); + return process(u, PA_OBJECT(i), false); } int pa__init(pa_module *m) { diff --git a/src/modules/module-hal-detect-compat.c b/src/modules/module-hal-detect-compat.c index 14cf8143b..3d674cff7 100644 --- a/src/modules/module-hal-detect-compat.c +++ b/src/modules/module-hal-detect-compat.c @@ -35,7 +35,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Compatibility module"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_DEPRECATED("Please use module-udev-detect instead of module-hal-detect!"); static const char* const valid_modargs[] = { @@ -47,7 +47,7 @@ static const char* const valid_modargs[] = { int pa__init(pa_module*m) { pa_modargs *ma = NULL; - pa_bool_t tsched = TRUE; + bool tsched = true; pa_module *n; char *t; @@ -70,7 +70,7 @@ int pa__init(pa_module*m) { pa_xfree(t); if (n) - pa_module_unload_request(m, TRUE); + pa_module_unload_request(m, true); pa_modargs_free(ma); diff --git a/src/modules/module-intended-roles.c b/src/modules/module-intended-roles.c index 5fa035538..a9704d188 100644 --- a/src/modules/module-intended-roles.c +++ b/src/modules/module-intended-roles.c @@ -38,7 +38,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Automatically set device of streams based on intended roles of devices"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_USAGE( "on_hotplug=<When new device becomes available, recheck streams?> " "on_rescue=<When device becomes unavailable, recheck streams?>"); @@ -61,11 +61,11 @@ struct userdata { *sink_unlink_hook_slot, *source_unlink_hook_slot; - pa_bool_t on_hotplug:1; - pa_bool_t on_rescue:1; + bool on_hotplug:1; + bool on_rescue:1; }; -static pa_bool_t role_match(pa_proplist *proplist, const char *role) { +static bool role_match(pa_proplist *proplist, const char *role) { return pa_str_in_list_spaces(pa_proplist_gets(proplist, PA_PROP_DEVICE_INTENDED_ROLES), role); } @@ -95,7 +95,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n /* Prefer the default sink over any other sink, just in case... */ if ((def = pa_namereg_get_default_sink(c))) - if (role_match(def->proplist, role) && pa_sink_input_new_data_set_sink(new_data, def, FALSE)) + if (role_match(def->proplist, role) && pa_sink_input_new_data_set_sink(new_data, def, false)) return PA_HOOK_OK; /* @todo: favour the highest priority device, not the first one we find? */ @@ -106,7 +106,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n if (!PA_SINK_IS_LINKED(pa_sink_get_state(s))) continue; - if (role_match(s->proplist, role) && pa_sink_input_new_data_set_sink(new_data, s, FALSE)) + if (role_match(s->proplist, role) && pa_sink_input_new_data_set_sink(new_data, s, false)) return PA_HOOK_OK; } @@ -140,7 +140,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou /* Prefer the default source over any other source, just in case... */ if ((def = pa_namereg_get_default_source(c))) if (role_match(def->proplist, role)) { - pa_source_output_new_data_set_source(new_data, def, FALSE); + pa_source_output_new_data_set_source(new_data, def, false); return PA_HOOK_OK; } @@ -156,7 +156,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou /* @todo: favour the highest priority device, not the first one we find? */ if (role_match(s->proplist, role)) { - pa_source_output_new_data_set_source(new_data, s, FALSE); + pa_source_output_new_data_set_source(new_data, s, false); return PA_HOOK_OK; } } @@ -202,7 +202,7 @@ static pa_hook_result_t sink_put_hook_callback(pa_core *c, pa_sink *sink, struct if (!role_match(sink->proplist, role)) continue; - pa_sink_input_move_to(si, sink, FALSE); + pa_sink_input_move_to(si, sink, false); } return PA_HOOK_OK; @@ -252,7 +252,7 @@ static pa_hook_result_t source_put_hook_callback(pa_core *c, pa_source *source, if (!role_match(source->proplist, role)) continue; - pa_source_output_move_to(so, source, FALSE); + pa_source_output_move_to(so, source, false); } return PA_HOOK_OK; @@ -289,7 +289,7 @@ static pa_hook_result_t sink_unlink_hook_callback(pa_core *c, pa_sink *sink, str /* Would the default sink fit? If so, let's use it */ if (def != sink && role_match(def->proplist, role)) - if (pa_sink_input_move_to(si, def, FALSE) >= 0) + if (pa_sink_input_move_to(si, def, false) >= 0) continue; /* Try to find some other fitting sink */ @@ -302,7 +302,7 @@ static pa_hook_result_t sink_unlink_hook_callback(pa_core *c, pa_sink *sink, str continue; if (role_match(d->proplist, role)) - if (pa_sink_input_move_to(si, d, FALSE) >= 0) + if (pa_sink_input_move_to(si, d, false) >= 0) break; } } @@ -344,7 +344,7 @@ static pa_hook_result_t source_unlink_hook_callback(pa_core *c, pa_source *sourc /* Would the default source fit? If so, let's use it */ if (def != source && role_match(def->proplist, role) && !source->monitor_of == !def->monitor_of) { - pa_source_output_move_to(so, def, FALSE); + pa_source_output_move_to(so, def, false); continue; } @@ -359,7 +359,7 @@ static pa_hook_result_t source_unlink_hook_callback(pa_core *c, pa_source *sourc /* If moving from a monitor, move to another monitor */ if (!source->monitor_of == !d->monitor_of && role_match(d->proplist, role)) { - pa_source_output_move_to(so, d, FALSE); + pa_source_output_move_to(so, d, false); break; } } @@ -371,7 +371,7 @@ static pa_hook_result_t source_unlink_hook_callback(pa_core *c, pa_source *sourc int pa__init(pa_module*m) { pa_modargs *ma = NULL; struct userdata *u; - pa_bool_t on_hotplug = TRUE, on_rescue = TRUE; + bool on_hotplug = true, on_rescue = true; pa_assert(m); diff --git a/src/modules/module-ladspa-sink.c b/src/modules/module-ladspa-sink.c index 2ffcd8da1..7c4c274e2 100644 --- a/src/modules/module-ladspa-sink.c +++ b/src/modules/module-ladspa-sink.c @@ -52,7 +52,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION(_("Virtual LADSPA sink")); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( _("sink_name=<name for the sink> " "sink_properties=<properties for the sink> " @@ -92,7 +92,7 @@ struct userdata { pa_memblockq *memblockq; - pa_bool_t *use_default; + bool *use_default; pa_sample_spec ss; #ifdef HAVE_DBUS @@ -100,7 +100,7 @@ struct userdata { char *dbus_path; #endif - pa_bool_t auto_desc; + bool auto_desc; }; static const char* const valid_modargs[] = { @@ -124,7 +124,7 @@ enum { LADSPA_SINK_MESSAGE_UPDATE_PARAMETERS = PA_SINK_MESSAGE_MAX }; -static int write_control_parameters(struct userdata *u, double *control_values, pa_bool_t *use_default); +static int write_control_parameters(struct userdata *u, double *control_values, bool *use_default); static void connect_control_ports(struct userdata *u); #ifdef HAVE_DBUS @@ -184,7 +184,7 @@ static void set_algorithm_parameters(DBusConnection *conn, DBusMessage *msg, DBu unsigned n_dbus_control, n_dbus_use_default; double *read_values = NULL; dbus_bool_t *read_defaults = NULL; - pa_bool_t *use_defaults = NULL; + bool *use_defaults = NULL; unsigned long i; pa_assert(conn); @@ -216,7 +216,7 @@ static void set_algorithm_parameters(DBusConnection *conn, DBusMessage *msg, DBu return; } - use_defaults = pa_xnew(pa_bool_t, n_control); + use_defaults = pa_xnew(bool, n_control); for (i = 0; i < u->n_control; i++) use_defaults[i] = read_defaults[i]; @@ -403,7 +403,7 @@ static void sink_request_rewind_cb(pa_sink *s) { /* Just hand this one over to the master sink */ pa_sink_input_request_rewind(u->sink_input, s->thread_info.rewind_nbytes + - pa_memblockq_get_length(u->memblockq), TRUE, FALSE, FALSE); + pa_memblockq_get_length(u->memblockq), true, false, false); } /* Called from I/O thread context */ @@ -511,7 +511,7 @@ static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) { if (amount > 0) { unsigned c; - pa_memblockq_seek(u->memblockq, - (int64_t) amount, PA_SEEK_RELATIVE, TRUE); + pa_memblockq_seek(u->memblockq, - (int64_t) amount, PA_SEEK_RELATIVE, true); pa_log_debug("Resetting plugin"); @@ -622,7 +622,7 @@ static void sink_input_kill_cb(pa_sink_input *i) { pa_sink_unref(u->sink); u->sink = NULL; - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } /* Called from IO thread context */ @@ -637,7 +637,7 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s if (PA_SINK_INPUT_IS_LINKED(state) && i->thread_info.state == PA_SINK_INPUT_INIT) { pa_log_debug("Requesting rewind due to state change."); - pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); + pa_sink_input_request_rewind(i, 0, false, true, true); } } @@ -678,7 +678,7 @@ static void sink_input_mute_changed_cb(pa_sink_input *i) { pa_sink_mute_changed(u->sink, i->muted); } -static int parse_control_parameters(struct userdata *u, const char *cdata, double *read_values, pa_bool_t *use_default) { +static int parse_control_parameters(struct userdata *u, const char *cdata, double *read_values, bool *use_default) { unsigned long p = 0; const char *state = NULL; char *k; @@ -699,7 +699,7 @@ static int parse_control_parameters(struct userdata *u, const char *cdata, doubl if (*k == 0) { pa_log_debug("Read empty config value (p=%lu)", p); - use_default[p++] = TRUE; + use_default[p++] = true; pa_xfree(k); continue; } @@ -714,7 +714,7 @@ static int parse_control_parameters(struct userdata *u, const char *cdata, doubl pa_log_debug("Read config value %f (p=%lu)", f, p); - use_default[p] = FALSE; + use_default[p] = false; read_values[p++] = f; } @@ -722,7 +722,7 @@ static int parse_control_parameters(struct userdata *u, const char *cdata, doubl if it is left empty, so we do it here. */ if (*cdata == 0 || cdata[strlen(cdata) - 1] == ',') { if (p < u->n_control) - use_default[p] = TRUE; + use_default[p] = true; p++; } @@ -771,7 +771,7 @@ static void connect_control_ports(struct userdata *u) { } } -static int validate_control_parameters(struct userdata *u, double *control_values, pa_bool_t *use_default) { +static int validate_control_parameters(struct userdata *u, double *control_values, bool *use_default) { unsigned long p = 0, h = 0; const LADSPA_Descriptor *d; pa_sample_spec ss; @@ -834,7 +834,7 @@ static int validate_control_parameters(struct userdata *u, double *control_value return 0; } -static int write_control_parameters(struct userdata *u, double *control_values, pa_bool_t *use_default) { +static int write_control_parameters(struct userdata *u, double *control_values, bool *use_default) { unsigned long p = 0, h = 0, c; const LADSPA_Descriptor *d; pa_sample_spec ss; @@ -1177,15 +1177,15 @@ int pa__init(pa_module*m) { if (u->n_control > 0) { double *control_values; - pa_bool_t *use_default; + bool *use_default; /* temporary storage for parser */ control_values = pa_xnew(double, (unsigned) u->n_control); - use_default = pa_xnew(pa_bool_t, (unsigned) u->n_control); + use_default = pa_xnew(bool, (unsigned) u->n_control); /* real storage */ u->control = pa_xnew(LADSPA_Data, (unsigned) u->n_control); - u->use_default = pa_xnew(pa_bool_t, (unsigned) u->n_control); + u->use_default = pa_xnew(bool, (unsigned) u->n_control); if ((parse_control_parameters(u, cdata, control_values, use_default) < 0) || (write_control_parameters(u, control_values, use_default) < 0)) { @@ -1257,7 +1257,7 @@ int pa__init(pa_module*m) { pa_sink_input_new_data_init(&sink_input_data); sink_input_data.driver = __FILE__; sink_input_data.module = m; - pa_sink_input_new_data_set_sink(&sink_input_data, master, FALSE); + pa_sink_input_new_data_set_sink(&sink_input_data, master, false); sink_input_data.origin_sink = u->sink; pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "LADSPA Stream"); pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter"); diff --git a/src/modules/module-lirc.c b/src/modules/module-lirc.c index 15f3442d9..d4d2b26d5 100644 --- a/src/modules/module-lirc.c +++ b/src/modules/module-lirc.c @@ -44,7 +44,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("LIRC volume control"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_USAGE("config=<config file> sink=<sink name> appname=<lirc application name> volume_limit=<volume limit> volume_step=<volume change step>"); static const char* const valid_modargs[] = { @@ -123,29 +123,29 @@ static void io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io_event if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK))) pa_log("Failed to get sink '%s'", u->sink_name); else { - pa_cvolume cv = *pa_sink_get_volume(s, FALSE); + pa_cvolume cv = *pa_sink_get_volume(s, false); switch (volchange) { case UP: pa_cvolume_inc_clamp(&cv, u->volume_step, u->volume_limit); - pa_sink_set_volume(s, &cv, TRUE, TRUE); + pa_sink_set_volume(s, &cv, true, true); break; case DOWN: pa_cvolume_dec(&cv, u->volume_step); - pa_sink_set_volume(s, &cv, TRUE, TRUE); + pa_sink_set_volume(s, &cv, true, true); break; case MUTE: - pa_sink_set_mute(s, TRUE, TRUE); + pa_sink_set_mute(s, true, true); break; case RESET: - pa_sink_set_mute(s, FALSE, TRUE); + pa_sink_set_mute(s, false, true); break; case MUTE_TOGGLE: - pa_sink_set_mute(s, !pa_sink_get_mute(s, FALSE), TRUE); + pa_sink_set_mute(s, !pa_sink_get_mute(s, false), true); break; case INVALID: @@ -164,7 +164,7 @@ fail: u->module->core->mainloop->io_free(u->io); u->io = NULL; - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); pa_xfree(code); } diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c index 4a32af4aa..5876f9dbc 100644 --- a/src/modules/module-loopback.c +++ b/src/modules/module-loopback.c @@ -43,7 +43,7 @@ PA_MODULE_AUTHOR("Pierre-Louis Bossart"); PA_MODULE_DESCRIPTION("Loopback from source to sink"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "source=<source to connect to> " "sink=<sink to connect to> " @@ -86,7 +86,7 @@ struct userdata { size_t skip; pa_usec_t latency; - pa_bool_t in_pop; + bool in_pop; size_t min_memblockq_length; struct { @@ -381,7 +381,7 @@ static void source_output_kill_cb(pa_source_output *o) { pa_assert_se(u = o->userdata); teardown(u); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } /* Called from main thread */ @@ -422,7 +422,7 @@ static void source_output_moving_cb(pa_source_output *o, pa_source *dest) { } /* Called from main thread */ -static void source_output_suspend_cb(pa_source_output *o, pa_bool_t suspended) { +static void source_output_suspend_cb(pa_source_output *o, bool suspended) { struct userdata *u; pa_source_output_assert_ref(o); @@ -457,10 +457,10 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk pa_assert_se(u = i->userdata); pa_assert(chunk); - u->in_pop = TRUE; + u->in_pop = true; while (pa_asyncmsgq_process_one(u->asyncmsgq) > 0) ; - u->in_pop = FALSE; + u->in_pop = false; if (pa_memblockq_peek(u->memblockq, chunk) < 0) { pa_log_info("Could not peek into queue"); @@ -511,7 +511,7 @@ static int sink_input_process_msg_cb(pa_msgobject *obj, int code, void *data, in if (PA_SINK_IS_OPENED(u->sink_input->sink->thread_info.state)) pa_memblockq_push_align(u->memblockq, chunk); else - pa_memblockq_flush_write(u->memblockq, TRUE); + pa_memblockq_flush_write(u->memblockq, true); update_min_memblockq_length(u); @@ -524,7 +524,7 @@ static int sink_input_process_msg_cb(pa_msgobject *obj, int code, void *data, in pa_log_debug("Requesting rewind due to end of underrun."); pa_sink_input_request_rewind(u->sink_input, (size_t) (u->sink_input->thread_info.underrun_for == (size_t) -1 ? 0 : u->sink_input->thread_info.underrun_for), - FALSE, TRUE, FALSE); + false, true, false); } u->recv_counter += (int64_t) chunk->length; @@ -536,9 +536,9 @@ static int sink_input_process_msg_cb(pa_msgobject *obj, int code, void *data, in pa_sink_input_assert_io_context(u->sink_input); if (PA_SINK_IS_OPENED(u->sink_input->sink->thread_info.state)) - pa_memblockq_seek(u->memblockq, -offset, PA_SEEK_RELATIVE, TRUE); + pa_memblockq_seek(u->memblockq, -offset, PA_SEEK_RELATIVE, true); else - pa_memblockq_flush_write(u->memblockq, TRUE); + pa_memblockq_flush_write(u->memblockq, true); u->recv_counter -= offset; @@ -649,7 +649,7 @@ static void sink_input_kill_cb(pa_sink_input *i) { pa_assert_se(u = i->userdata); teardown(u); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } /* Called from the output thread context */ @@ -701,7 +701,7 @@ static bool sink_input_may_move_to_cb(pa_sink_input *i, pa_sink *dest) { } /* Called from main thread */ -static void sink_input_suspend_cb(pa_sink_input *i, pa_bool_t suspended) { +static void sink_input_suspend_cb(pa_sink_input *i, bool suspended) { struct userdata *u; pa_sink_input_assert_ref(i); @@ -718,10 +718,10 @@ int pa__init(pa_module *m) { struct userdata *u; pa_sink *sink = NULL; pa_sink_input_new_data sink_input_data; - pa_bool_t sink_dont_move; + bool sink_dont_move; pa_source *source = NULL; pa_source_output_new_data source_output_data; - pa_bool_t source_dont_move; + bool source_dont_move; uint32_t latency_msec; pa_sample_spec ss; pa_channel_map map; @@ -731,7 +731,7 @@ int pa__init(pa_module *m) { pa_memchunk silence; uint32_t adjust_time_sec; const char *n; - pa_bool_t remix = TRUE; + bool remix = true; pa_assert(m); @@ -823,7 +823,7 @@ int pa__init(pa_module *m) { sink_input_data.module = m; if (sink) - pa_sink_input_new_data_set_sink(&sink_input_data, sink, FALSE); + pa_sink_input_new_data_set_sink(&sink_input_data, sink, false); if (pa_modargs_get_proplist(ma, "sink_input_properties", sink_input_data.proplist, PA_UPDATE_REPLACE) < 0) { pa_log("Failed to parse the sink_input_properties value."); @@ -850,7 +850,7 @@ int pa__init(pa_module *m) { if (!channels_set) sink_input_data.flags |= PA_SINK_INPUT_FIX_CHANNELS; - sink_dont_move = FALSE; + sink_dont_move = false; if (pa_modargs_get_value_boolean(ma, "sink_dont_move", &sink_dont_move) < 0) { pa_log("sink_dont_move= expects a boolean argument."); goto fail; @@ -890,7 +890,7 @@ int pa__init(pa_module *m) { source_output_data.driver = __FILE__; source_output_data.module = m; if (source) - pa_source_output_new_data_set_source(&source_output_data, source, FALSE); + pa_source_output_new_data_set_source(&source_output_data, source, false); if (pa_modargs_get_proplist(ma, "source_output_properties", source_output_data.proplist, PA_UPDATE_REPLACE) < 0) { pa_log("Failed to parse the source_output_properties value."); @@ -908,7 +908,7 @@ int pa__init(pa_module *m) { if (!remix) source_output_data.flags |= PA_SOURCE_OUTPUT_NO_REMIX; - source_dont_move = FALSE; + source_dont_move = false; if (pa_modargs_get_value_boolean(ma, "source_dont_move", &source_dont_move) < 0) { pa_log("source_dont_move= expects a boolean argument."); goto fail; @@ -972,10 +972,10 @@ int pa__init(pa_module *m) { pa_source_output_put(u->source_output); if (pa_source_get_state(u->source_output->source) != PA_SOURCE_SUSPENDED) - pa_sink_input_cork(u->sink_input, FALSE); + pa_sink_input_cork(u->sink_input, false); if (pa_sink_get_state(u->sink_input->sink) != PA_SINK_SUSPENDED) - pa_source_output_cork(u->source_output, FALSE); + pa_source_output_cork(u->source_output, false); update_adjust_timer(u); diff --git a/src/modules/module-match.c b/src/modules/module-match.c index e42f44eff..8ce3f0073 100644 --- a/src/modules/module-match.c +++ b/src/modules/module-match.c @@ -51,7 +51,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Playback stream expression matching module"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_USAGE("table=<filename> " "key=<property_key>"); diff --git a/src/modules/module-mmkbd-evdev.c b/src/modules/module-mmkbd-evdev.c index 6cfd3a52f..9ab7eb973 100644 --- a/src/modules/module-mmkbd-evdev.c +++ b/src/modules/module-mmkbd-evdev.c @@ -47,7 +47,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Multimedia keyboard support via Linux evdev"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE("device=<evdev device> sink=<sink name> volume_limit=<volume limit> volume_step=<volume change step>"); #define DEFAULT_DEVICE "/dev/input/event0" @@ -118,21 +118,21 @@ static void io_callback(pa_mainloop_api *io, pa_io_event *e, int fd, pa_io_event if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK))) pa_log("Failed to get sink '%s'", u->sink_name); else { - pa_cvolume cv = *pa_sink_get_volume(s, FALSE); + pa_cvolume cv = *pa_sink_get_volume(s, false); switch (volchange) { case UP: pa_cvolume_inc_clamp(&cv, u->volume_step, u->volume_limit); - pa_sink_set_volume(s, &cv, TRUE, TRUE); + pa_sink_set_volume(s, &cv, true, true); break; case DOWN: pa_cvolume_dec(&cv, u->volume_step); - pa_sink_set_volume(s, &cv, TRUE, TRUE); + pa_sink_set_volume(s, &cv, true, true); break; case MUTE_TOGGLE: - pa_sink_set_mute(s, !pa_sink_get_mute(s, FALSE), TRUE); + pa_sink_set_mute(s, !pa_sink_get_mute(s, false), true); break; case INVALID: @@ -149,7 +149,7 @@ fail: u->module->core->mainloop->io_free(u->io); u->io = NULL; - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } #define test_bit(bit, array) (array[bit/8] & (1<<(bit%8))) diff --git a/src/modules/module-native-protocol-fd.c b/src/modules/module-native-protocol-fd.c index 7021a26b9..5b082c397 100644 --- a/src/modules/module-native-protocol-fd.c +++ b/src/modules/module-native-protocol-fd.c @@ -38,7 +38,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Native protocol autospawn helper"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); static const char* const valid_modargs[] = { "fd", @@ -70,7 +70,7 @@ int pa__init(pa_module*m) { options = pa_native_options_new(); options->module = m; - options->auth_anonymous = TRUE; + options->auth_anonymous = true; pa_native_protocol_connect(m->userdata, io, options); diff --git a/src/modules/module-null-sink.c b/src/modules/module-null-sink.c index 10bc67f91..c038b6cf8 100644 --- a/src/modules/module-null-sink.c +++ b/src/modules/module-null-sink.c @@ -48,7 +48,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION(_("Clocked NULL sink")); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "sink_name=<name of sink> " "sink_properties=<properties for the sink> " @@ -226,7 +226,7 @@ static void thread_func(void *userdata) { pa_rtpoll_set_timer_disabled(u->rtpoll); /* Hmm, nothing to do. Let's sleep */ - if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) + if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) goto fail; if (ret == 0) diff --git a/src/modules/module-null-source.c b/src/modules/module-null-source.c index b3ece7b46..e3e016770 100644 --- a/src/modules/module-null-source.c +++ b/src/modules/module-null-source.c @@ -48,7 +48,7 @@ PA_MODULE_AUTHOR("Lennart Poettering & Marc-Andre Lureau"); PA_MODULE_DESCRIPTION("Clocked NULL source"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "format=<sample format> " "channels=<number of channels> " @@ -159,7 +159,7 @@ static void thread_func(void *userdata) { pa_rtpoll_set_timer_disabled(u->rtpoll); /* Hmm, nothing to do. Let's sleep */ - if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) + if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) goto fail; if (ret == 0) diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c index 54dceb4e7..4d82cc37b 100644 --- a/src/modules/module-pipe-sink.c +++ b/src/modules/module-pipe-sink.c @@ -53,7 +53,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("UNIX pipe sink"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "sink_name=<name for the sink> " "sink_properties=<properties for the sink> " @@ -196,7 +196,7 @@ static void thread_func(void *userdata) { /* Hmm, nothing to do. Let's sleep */ pollfd->events = (short) (u->sink->thread_info.state == PA_SINK_RUNNING ? POLLOUT : 0); - if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) + if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) goto fail; if (ret == 0) diff --git a/src/modules/module-pipe-source.c b/src/modules/module-pipe-source.c index 7a7dfb272..36e873227 100644 --- a/src/modules/module-pipe-source.c +++ b/src/modules/module-pipe-source.c @@ -53,7 +53,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("UNIX pipe source"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "source_name=<name for the source> " "source_properties=<properties for the source> " @@ -184,7 +184,7 @@ static void thread_func(void *userdata) { /* Hmm, nothing to do. Let's sleep */ pollfd->events = (short) (u->source->thread_info.state == PA_SOURCE_RUNNING ? POLLIN : 0); - if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) + if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) goto fail; if (ret == 0) diff --git a/src/modules/module-position-event-sounds.c b/src/modules/module-position-event-sounds.c index c298e74ff..bb62cbb93 100644 --- a/src/modules/module-position-event-sounds.c +++ b/src/modules/module-position-event-sounds.c @@ -44,7 +44,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Position event sounds between L and R depending on the position on screen of the widget triggering them."); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); static const char* const valid_modargs[] = { NULL diff --git a/src/modules/module-protocol-stub.c b/src/modules/module-protocol-stub.c index 1b7f6ed15..3218a01e1 100644 --- a/src/modules/module-protocol-stub.c +++ b/src/modules/module-protocol-stub.c @@ -169,7 +169,7 @@ # error "Broken build system" #endif -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_VERSION(PACKAGE_VERSION); @@ -239,7 +239,7 @@ int pa__init(pa_module*m) { #if defined(USE_TCP_SOCKETS) uint32_t port = IPV4_PORT; - pa_bool_t port_fallback = TRUE; + bool port_fallback = true; const char *listen_on; #else int r; @@ -289,7 +289,7 @@ int pa__init(pa_module*m) { #if defined(USE_TCP_SOCKETS) if (pa_in_system_mode() || pa_modargs_get_value(ma, "port", NULL)) - port_fallback = FALSE; + port_fallback = false; if (pa_modargs_get_value_u32(ma, "port", &port) < 0 || port < 1 || port > 0xFFFF) { pa_log("port= expects a numerical argument between 1 and 65535."); @@ -337,7 +337,7 @@ int pa__init(pa_module*m) { /* This socket doesn't reside in our own runtime dir but in * /tmp/.esd/, hence we have to create the dir first */ - if (pa_make_secure_parent_dir(u->socket_path, pa_in_system_mode() ? 0755U : 0700U, (uid_t)-1, (gid_t)-1, FALSE) < 0) { + if (pa_make_secure_parent_dir(u->socket_path, pa_in_system_mode() ? 0755U : 0700U, (uid_t)-1, (gid_t)-1, false) < 0) { pa_log("Failed to create socket directory '%s': %s\n", u->socket_path, pa_cstrerror(errno)); goto fail; } diff --git a/src/modules/module-remap-sink.c b/src/modules/module-remap-sink.c index 3d9567b79..67e8da87f 100644 --- a/src/modules/module-remap-sink.c +++ b/src/modules/module-remap-sink.c @@ -38,7 +38,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Virtual channel remapping sink"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "sink_name=<name for the sink> " "sink_properties=<properties for the sink> " @@ -56,7 +56,7 @@ struct userdata { pa_sink *sink; pa_sink_input *sink_input; - pa_bool_t auto_desc; + bool auto_desc; }; static const char* const valid_modargs[] = { @@ -127,7 +127,7 @@ static void sink_request_rewind(pa_sink *s) { !PA_SINK_INPUT_IS_LINKED(u->sink_input->thread_info.state)) return; - pa_sink_input_request_rewind(u->sink_input, s->thread_info.rewind_nbytes, TRUE, FALSE, FALSE); + pa_sink_input_request_rewind(u->sink_input, s->thread_info.rewind_nbytes, true, false, false); } /* Called from I/O thread context */ @@ -270,7 +270,7 @@ static void sink_input_kill_cb(pa_sink_input *i) { pa_sink_unref(u->sink); u->sink = NULL; - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } /* Called from IO thread context */ @@ -285,7 +285,7 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s if (PA_SINK_INPUT_IS_LINKED(state) && i->thread_info.state == PA_SINK_INPUT_INIT) { pa_log_debug("Requesting rewind due to state change."); - pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); + pa_sink_input_request_rewind(i, 0, false, true, true); } } @@ -323,7 +323,7 @@ int pa__init(pa_module*m) { pa_sink *master; pa_sink_input_new_data sink_input_data; pa_sink_new_data sink_data; - pa_bool_t remix = TRUE; + bool remix = true; pa_assert(m); @@ -411,7 +411,7 @@ int pa__init(pa_module*m) { pa_sink_input_new_data_init(&sink_input_data); sink_input_data.driver = __FILE__; sink_input_data.module = m; - pa_sink_input_new_data_set_sink(&sink_input_data, master, FALSE); + pa_sink_input_new_data_set_sink(&sink_input_data, master, false); sink_input_data.origin_sink = u->sink; pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Remapped Stream"); pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter"); diff --git a/src/modules/module-rescue-streams.c b/src/modules/module-rescue-streams.c index f3e742475..7035a3509 100644 --- a/src/modules/module-rescue-streams.c +++ b/src/modules/module-rescue-streams.c @@ -38,7 +38,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("When a sink/source is removed, try to move its streams to the default sink/source"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); static const char* const valid_modargs[] = { NULL, @@ -104,7 +104,7 @@ static pa_hook_result_t sink_unlink_hook_callback(pa_core *c, pa_sink *sink, voi if (!(target = find_evacuation_sink(c, i, sink))) continue; - if (pa_sink_input_move_to(i, target, FALSE) < 0) + if (pa_sink_input_move_to(i, target, false) < 0) pa_log_info("Failed to move sink input %u \"%s\" to %s.", i->index, pa_strnull(pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME)), target->name); else @@ -128,7 +128,7 @@ static pa_hook_result_t sink_input_move_fail_hook_callback(pa_core *c, pa_sink_i if (!(target = find_evacuation_sink(c, i, NULL))) return PA_HOOK_OK; - if (pa_sink_input_finish_move(i, target, FALSE) < 0) { + if (pa_sink_input_finish_move(i, target, false) < 0) { pa_log_info("Failed to move sink input %u \"%s\" to %s.", i->index, pa_strnull(pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME)), target->name); return PA_HOOK_OK; @@ -195,7 +195,7 @@ static pa_hook_result_t source_unlink_hook_callback(pa_core *c, pa_source *sourc if (!(target = find_evacuation_source(c, o, source))) continue; - if (pa_source_output_move_to(o, target, FALSE) < 0) + if (pa_source_output_move_to(o, target, false) < 0) pa_log_info("Failed to move source output %u \"%s\" to %s.", o->index, pa_strnull(pa_proplist_gets(o->proplist, PA_PROP_APPLICATION_NAME)), target->name); else @@ -219,7 +219,7 @@ static pa_hook_result_t source_output_move_fail_hook_callback(pa_core *c, pa_sou if (!(target = find_evacuation_source(c, i, NULL))) return PA_HOOK_OK; - if (pa_source_output_finish_move(i, target, FALSE) < 0) { + if (pa_source_output_finish_move(i, target, false) < 0) { pa_log_info("Failed to move source input %u \"%s\" to %s.", i->index, pa_strnull(pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME)), target->name); return PA_HOOK_OK; diff --git a/src/modules/module-role-cork.c b/src/modules/module-role-cork.c index ea71ea6eb..9906d2e27 100644 --- a/src/modules/module-role-cork.c +++ b/src/modules/module-role-cork.c @@ -38,7 +38,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Mute & cork streams with certain roles while others exist"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_USAGE( "trigger_roles=<Comma separated list of roles which will trigger a cork> " "cork_roles=<Comma separated list of roles which will be corked> " @@ -56,7 +56,7 @@ struct userdata { pa_hashmap *cork_state; pa_idxset *trigger_roles; pa_idxset *cork_roles; - pa_bool_t global:1; + bool global:1; pa_hook_slot *sink_input_put_slot, *sink_input_unlink_slot, @@ -64,7 +64,7 @@ struct userdata { *sink_input_move_finish_slot; }; -static pa_bool_t shall_cork(struct userdata *u, pa_sink *s, pa_sink_input *ignore) { +static bool shall_cork(struct userdata *u, pa_sink *s, pa_sink_input *ignore) { pa_sink_input *j; uint32_t idx, role_idx; const char *trigger_role; @@ -84,25 +84,25 @@ static pa_bool_t shall_cork(struct userdata *u, pa_sink *s, pa_sink_input *ignor PA_IDXSET_FOREACH(trigger_role, u->trigger_roles, role_idx) { if (pa_streq(role, trigger_role)) { pa_log_debug("Found a '%s' stream that will trigger the auto-cork.", trigger_role); - return TRUE; + return true; } } } - return FALSE; + return false; } -static inline void apply_cork_to_sink(struct userdata *u, pa_sink *s, pa_sink_input *ignore, pa_bool_t cork) { +static inline void apply_cork_to_sink(struct userdata *u, pa_sink *s, pa_sink_input *ignore, bool cork) { pa_sink_input *j; uint32_t idx, role_idx; const char *cork_role; - pa_bool_t trigger = FALSE; + bool trigger = false; pa_assert(u); pa_sink_assert_ref(s); for (j = PA_SINK_INPUT(pa_idxset_first(s->inputs, &idx)); j; j = PA_SINK_INPUT(pa_idxset_next(s->inputs, &idx))) { - pa_bool_t corked, muted, corked_here; + bool corked, muted, corked_here; const char *role; if (j == ignore) @@ -126,7 +126,7 @@ static inline void apply_cork_to_sink(struct userdata *u, pa_sink *s, pa_sink_in pa_log_debug("Found a '%s' stream that should be corked/muted.", cork_role); if (!corked_here) pa_hashmap_put(u->cork_state, j, PA_INT_TO_PTR(1)); - pa_sink_input_set_mute(j, TRUE, FALSE); + pa_sink_input_set_mute(j, true, false); pa_sink_input_send_event(j, PA_STREAM_EVENT_REQUEST_CORK, NULL); } else if (!cork) { pa_hashmap_remove(u->cork_state, j); @@ -134,7 +134,7 @@ static inline void apply_cork_to_sink(struct userdata *u, pa_sink *s, pa_sink_in if (corked_here && (corked || muted)) { pa_log_debug("Found a '%s' stream that should be uncorked/unmuted.", cork_role); if (muted) - pa_sink_input_set_mute(j, FALSE, FALSE); + pa_sink_input_set_mute(j, false, false); if (corked) pa_sink_input_send_event(j, PA_STREAM_EVENT_REQUEST_UNCORK, NULL); } @@ -142,7 +142,7 @@ static inline void apply_cork_to_sink(struct userdata *u, pa_sink *s, pa_sink_in } } -static void apply_cork(struct userdata *u, pa_sink *s, pa_sink_input *ignore, pa_bool_t cork) { +static void apply_cork(struct userdata *u, pa_sink *s, pa_sink_input *ignore, bool cork) { pa_assert(u); if (u->global) { @@ -153,8 +153,8 @@ static void apply_cork(struct userdata *u, pa_sink *s, pa_sink_input *ignore, pa apply_cork_to_sink(u, s, ignore, cork); } -static pa_hook_result_t process(struct userdata *u, pa_sink_input *i, pa_bool_t create) { - pa_bool_t cork = FALSE; +static pa_hook_result_t process(struct userdata *u, pa_sink_input *i, bool create) { + bool cork = false; const char *role; pa_assert(u); @@ -179,34 +179,34 @@ static pa_hook_result_t sink_input_put_cb(pa_core *core, pa_sink_input *i, struc pa_core_assert_ref(core); pa_sink_input_assert_ref(i); - return process(u, i, TRUE); + return process(u, i, true); } static pa_hook_result_t sink_input_unlink_cb(pa_core *core, pa_sink_input *i, struct userdata *u) { pa_sink_input_assert_ref(i); - return process(u, i, FALSE); + return process(u, i, false); } static pa_hook_result_t sink_input_move_start_cb(pa_core *core, pa_sink_input *i, struct userdata *u) { pa_core_assert_ref(core); pa_sink_input_assert_ref(i); - return process(u, i, FALSE); + return process(u, i, false); } static pa_hook_result_t sink_input_move_finish_cb(pa_core *core, pa_sink_input *i, struct userdata *u) { pa_core_assert_ref(core); pa_sink_input_assert_ref(i); - return process(u, i, TRUE); + return process(u, i, true); } int pa__init(pa_module *m) { pa_modargs *ma = NULL; struct userdata *u; const char *roles; - pa_bool_t global = FALSE; + bool global = false; pa_assert(m); diff --git a/src/modules/module-rygel-media-server.c b/src/modules/module-rygel-media-server.c index 4ba106a64..26266b73a 100644 --- a/src/modules/module-rygel-media-server.c +++ b/src/modules/module-rygel-media-server.c @@ -51,7 +51,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("UPnP MediaServer Plugin for Rygel"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_USAGE("display_name=<UPnP Media Server name>"); /* This implements http://live.gnome.org/Rygel/MediaServer2Spec */ @@ -170,7 +170,7 @@ struct userdata { pa_module *module; pa_dbus_connection *bus; - pa_bool_t got_name:1; + bool got_name:1; char *display_name; @@ -211,7 +211,7 @@ static pa_hook_result_t source_new_or_unlink_cb(pa_core *c, pa_source *s, struct return PA_HOOK_OK; } -static pa_bool_t message_is_property_get(DBusMessage *m, const char *interface, const char *property) { +static bool message_is_property_get(DBusMessage *m, const char *interface, const char *property) { const char *i, *p; DBusError error; @@ -220,17 +220,17 @@ static pa_bool_t message_is_property_get(DBusMessage *m, const char *interface, pa_assert(m); if (!dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "Get")) - return FALSE; + return false; if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &i, DBUS_TYPE_STRING, &p, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) { dbus_error_free(&error); - return FALSE; + return false; } return pa_streq(i, interface) && pa_streq(p, property); } -static pa_bool_t message_is_property_get_all(DBusMessage *m, const char *interface) { +static bool message_is_property_get_all(DBusMessage *m, const char *interface) { const char *i; DBusError error; @@ -239,11 +239,11 @@ static pa_bool_t message_is_property_get_all(DBusMessage *m, const char *interfa pa_assert(m); if (!dbus_message_is_method_call(m, "org.freedesktop.DBus.Properties", "GetAll")) - return FALSE; + return false; if (!dbus_message_get_args(m, &error, DBUS_TYPE_STRING, &i, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) { dbus_error_free(&error); - return FALSE; + return false; } return pa_streq(i, interface); @@ -473,7 +473,7 @@ static void append_property_dict_entry_item_display_name(DBusMessage *m, DBusMes pa_assert_se(dbus_message_iter_close_container(iter, &sub)); } -static pa_bool_t get_mediacontainer2_list_args(DBusMessage *m, unsigned *offset, unsigned *max_entries, char ***filter, int *filter_len) { +static bool get_mediacontainer2_list_args(DBusMessage *m, unsigned *offset, unsigned *max_entries, char ***filter, int *filter_len) { DBusError error; dbus_error_init(&error); @@ -485,10 +485,10 @@ static pa_bool_t get_mediacontainer2_list_args(DBusMessage *m, unsigned *offset, if (!dbus_message_get_args(m, &error, DBUS_TYPE_UINT32, offset, DBUS_TYPE_UINT32, max_entries, DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, filter, filter_len, DBUS_TYPE_INVALID) || dbus_error_is_set(&error)) { dbus_error_free(&error); - return FALSE; + return false; } - return TRUE; + return true; } static unsigned get_sinks_or_sources_count(const char *path, const struct userdata *u) { @@ -528,7 +528,7 @@ static void append_sink_or_source_container_properties( if (filter_len == 1 && (*filter)[0] == '*' && (*filter)[1] == '\0') { append_sink_or_source_container_mediaobject2_properties(r, &sub, path); append_property_dict_entry_unsigned(r, &sub, "ChildCount", get_sinks_or_sources_count(path, user_data)); - append_property_dict_entry_boolean(r, &sub, "Searchable", FALSE); + append_property_dict_entry_boolean(r, &sub, "Searchable", false); } else { for (int i = 0; i < filter_len; ++i) { @@ -552,7 +552,7 @@ static void append_sink_or_source_container_properties( append_property_dict_entry_unsigned(r, &sub, "ChildCount", get_sinks_or_sources_count(path, user_data)); } else if (pa_streq(property_name, "Searchable")) { - append_property_dict_entry_boolean(r, &sub, "Searchable", FALSE); + append_property_dict_entry_boolean(r, &sub, "Searchable", false); } } } @@ -642,7 +642,7 @@ static DBusHandlerResult root_handler(DBusConnection *c, DBusMessage *m, void *u } else if (message_is_property_get(m, "org.gnome.UPnP.MediaContainer2", "Searchable")) { pa_assert_se(r = dbus_message_new_method_return(m)); - append_variant_boolean(r, NULL, FALSE); + append_variant_boolean(r, NULL, false); } else if (message_is_property_get_all(m, "org.gnome.UPnP.MediaContainer2")) { DBusMessageIter iter, sub; @@ -654,7 +654,7 @@ static DBusHandlerResult root_handler(DBusConnection *c, DBusMessage *m, void *u append_property_dict_entry_unsigned(r, &sub, "ChildCount", PA_ELEMENTSOF(array_root_containers)); append_property_dict_entry_unsigned(r, &sub, "ItemCount", PA_ELEMENTSOF(array_no_children)); append_property_dict_entry_unsigned(r, &sub, "ContainerCount", PA_ELEMENTSOF(array_root_containers)); - append_property_dict_entry_boolean(r, &sub, "Searchable", FALSE); + append_property_dict_entry_boolean(r, &sub, "Searchable", false); pa_assert_se(dbus_message_iter_close_container(&iter, &sub)); } else if (dbus_message_is_method_call(m, "org.gnome.UPnP.MediaContainer2", "ListChildren") @@ -803,7 +803,7 @@ static DBusHandlerResult sinks_and_sources_handler(DBusConnection *c, DBusMessag } else if (message_is_property_get(m, "org.gnome.UPnP.MediaContainer2", "Searchable")) { pa_assert_se(r = dbus_message_new_method_return(m)); - append_variant_boolean(r, NULL, FALSE); + append_variant_boolean(r, NULL, false); } else if (message_is_property_get_all(m, "org.gnome.UPnP.MediaContainer2")) { DBusMessageIter iter, sub; @@ -819,7 +819,7 @@ static DBusHandlerResult sinks_and_sources_handler(DBusConnection *c, DBusMessag append_property_dict_entry_unsigned(r, &sub, "ChildCount", item_count); append_property_dict_entry_unsigned(r, &sub, "ItemCount", item_count); append_property_dict_entry_unsigned(r, &sub, "ContainerCount", 0); - append_property_dict_entry_boolean(r, &sub, "Searchable", FALSE); + append_property_dict_entry_boolean(r, &sub, "Searchable", false); pa_assert_se(dbus_message_iter_close_container(&iter, &sub)); @@ -1081,7 +1081,7 @@ int pa__init(pa_module *m) { goto fail; } - u->got_name = TRUE; + u->got_name = true; pa_modargs_free(ma); diff --git a/src/modules/module-sine-source.c b/src/modules/module-sine-source.c index 20a686805..bb3f8c411 100644 --- a/src/modules/module-sine-source.c +++ b/src/modules/module-sine-source.c @@ -46,7 +46,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Sine wave generator source"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "source_name=<name for the source> " "source_properties=<properties for the source> " @@ -178,7 +178,7 @@ static void thread_func(void *userdata) { pa_rtpoll_set_timer_disabled(u->rtpoll); /* Hmm, nothing to do. Let's sleep */ - if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) + if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) goto fail; if (ret == 0) diff --git a/src/modules/module-sine.c b/src/modules/module-sine.c index c6d73039a..573a7c0f1 100644 --- a/src/modules/module-sine.c +++ b/src/modules/module-sine.c @@ -38,7 +38,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Sine wave generator"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "sink=<sink to connect to> " "frequency=<frequency in Hz>"); @@ -99,7 +99,7 @@ static void sink_input_kill_cb(pa_sink_input *i) { pa_sink_input_unref(u->sink_input); u->sink_input = NULL; - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } /* Called from IO thread context */ @@ -113,7 +113,7 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s * we are heard right-away. */ if (PA_SINK_INPUT_IS_LINKED(state) && i->thread_info.state == PA_SINK_INPUT_INIT) - pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); + pa_sink_input_request_rewind(i, 0, false, true, true); } int pa__init(pa_module*m) { @@ -155,7 +155,7 @@ int pa__init(pa_module*m) { pa_sink_input_new_data_init(&data); data.driver = __FILE__; data.module = m; - pa_sink_input_new_data_set_sink(&data, sink, FALSE); + pa_sink_input_new_data_set_sink(&data, sink, false); pa_proplist_setf(data.proplist, PA_PROP_MEDIA_NAME, "%u Hz Sine", frequency); pa_proplist_sets(data.proplist, PA_PROP_MEDIA_ROLE, "abstract"); pa_proplist_setf(data.proplist, "sine.hz", "%u", frequency); diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c index 7f3342faf..b4fa73489 100644 --- a/src/modules/module-solaris.c +++ b/src/modules/module-solaris.c @@ -75,7 +75,7 @@ PA_MODULE_USAGE( "rate=<sample rate> " "buffer_length=<milliseconds> " "channel_map=<channel map>"); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); struct userdata { pa_core *core; @@ -100,7 +100,7 @@ struct userdata { pa_rtpoll_item *rtpoll_item; pa_module *module; - pa_bool_t sink_suspended, source_suspended; + bool sink_suspended, source_suspended; uint32_t play_samples_msw, record_samples_msw; uint32_t prev_playback_samples, prev_record_samples; @@ -404,14 +404,14 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse if (suspend(u) < 0) return -1; } - u->sink_suspended = TRUE; + u->sink_suspended = true; break; case PA_SINK_IDLE: case PA_SINK_RUNNING: if (u->sink->thread_info.state == PA_SINK_SUSPENDED) { - pa_smoother_resume(u->smoother, pa_rtclock_now(), TRUE); + pa_smoother_resume(u->smoother, pa_rtclock_now(), true); if (!u->source || u->source_suspended) { if (unsuspend(u) < 0) @@ -419,7 +419,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse u->sink->get_volume(u->sink); u->sink->get_mute(u->sink); } - u->sink_suspended = FALSE; + u->sink_suspended = false; } break; @@ -456,7 +456,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off if (suspend(u) < 0) return -1; } - u->source_suspended = TRUE; + u->source_suspended = true; break; case PA_SOURCE_IDLE: @@ -468,7 +468,7 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off return -1; u->source->get_volume(u->source); } - u->source_suspended = FALSE; + u->source_suspended = false; } break; @@ -652,7 +652,7 @@ static void thread_func(void *userdata) { if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) pa_log("AUDIO_SETINFO: %s", pa_cstrerror(errno)); - pa_smoother_reset(u->smoother, pa_rtclock_now(), TRUE); + pa_smoother_reset(u->smoother, pa_rtclock_now(), true); } for (;;) { @@ -778,7 +778,7 @@ static void thread_func(void *userdata) { } /* Hmm, nothing to do. Let's sleep */ - if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) + if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) goto fail; if (ret == 0) @@ -817,17 +817,17 @@ static void sig_callback(pa_mainloop_api *api, pa_signal_event*e, int sig, void pa_log_debug("caught signal"); if (u->sink) { - pa_sink_get_volume(u->sink, TRUE); - pa_sink_get_mute(u->sink, TRUE); + pa_sink_get_volume(u->sink, true); + pa_sink_get_mute(u->sink, true); } if (u->source) - pa_source_get_volume(u->source, TRUE); + pa_source_get_volume(u->source, true); } int pa__init(pa_module *m) { struct userdata *u = NULL; - pa_bool_t record = TRUE, playback = TRUE; + bool record = true, playback = true; pa_sample_spec ss; pa_channel_map map; pa_modargs *ma = NULL; @@ -837,7 +837,7 @@ int pa__init(pa_module *m) { pa_source_new_data source_new_data; char const *name; char *name_buf; - pa_bool_t namereg_fail; + bool namereg_fail; pa_assert(m); @@ -858,7 +858,7 @@ int pa__init(pa_module *m) { u = pa_xnew0(struct userdata, 1); - if (!(u->smoother = pa_smoother_new(PA_USEC_PER_SEC, PA_USEC_PER_SEC * 2, TRUE, TRUE, 10, pa_rtclock_now(), TRUE))) + if (!(u->smoother = pa_smoother_new(PA_USEC_PER_SEC, PA_USEC_PER_SEC * 2, true, true, 10, pa_rtclock_now(), true))) goto fail; /* @@ -913,11 +913,11 @@ int pa__init(pa_module *m) { if (u->mode != O_WRONLY) { name_buf = NULL; - namereg_fail = TRUE; + namereg_fail = true; if (!(name = pa_modargs_get_value(ma, "source_name", NULL))) { name = name_buf = pa_sprintf_malloc("solaris_input.%s", pa_path_get_filename(u->device_name)); - namereg_fail = FALSE; + namereg_fail = false; } pa_source_new_data_init(&source_new_data); @@ -957,16 +957,16 @@ int pa__init(pa_module *m) { pa_source_set_get_volume_callback(u->source, source_get_volume); pa_source_set_set_volume_callback(u->source, source_set_volume); - u->source->refresh_volume = TRUE; + u->source->refresh_volume = true; } else u->source = NULL; if (u->mode != O_RDONLY) { name_buf = NULL; - namereg_fail = TRUE; + namereg_fail = true; if (!(name = pa_modargs_get_value(ma, "sink_name", NULL))) { name = name_buf = pa_sprintf_malloc("solaris_output.%s", pa_path_get_filename(u->device_name)); - namereg_fail = FALSE; + namereg_fail = false; } pa_sink_new_data_init(&sink_new_data); @@ -1004,7 +1004,7 @@ int pa__init(pa_module *m) { pa_sink_set_set_volume_callback(u->sink, sink_set_volume); pa_sink_set_get_mute_callback(u->sink, sink_get_mute); pa_sink_set_set_mute_callback(u->sink, sink_set_mute); - u->sink->refresh_volume = u->sink->refresh_muted = TRUE; + u->sink->refresh_volume = u->sink->refresh_muted = true; } else u->sink = NULL; diff --git a/src/modules/module-stream-restore.c b/src/modules/module-stream-restore.c index 7b731323a..9a822579a 100644 --- a/src/modules/module-stream-restore.c +++ b/src/modules/module-stream-restore.c @@ -63,7 +63,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Automatically restore the volume/mute/device state of streams"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_USAGE( "restore_device=<Save/restore sinks/sources?> " "restore_volume=<Save/restore volumes?> " @@ -107,11 +107,11 @@ struct userdata { pa_time_event *save_time_event; pa_database* database; - pa_bool_t restore_device:1; - pa_bool_t restore_volume:1; - pa_bool_t restore_muted:1; - pa_bool_t on_hotplug:1; - pa_bool_t on_rescue:1; + bool restore_device:1; + bool restore_volume:1; + bool restore_muted:1; + bool on_hotplug:1; + bool on_rescue:1; pa_native_protocol *protocol; pa_idxset *subscribed; @@ -127,8 +127,8 @@ struct userdata { struct entry { uint8_t version; - pa_bool_t muted_valid, volume_valid, device_valid, card_valid; - pa_bool_t muted; + bool muted_valid, volume_valid, device_valid, card_valid; + bool muted; pa_channel_map channel_map; pa_cvolume volume; char* device; @@ -147,7 +147,7 @@ enum { static struct entry* entry_new(void); static void entry_free(struct entry *e); static struct entry *entry_read(struct userdata *u, const char *name); -static pa_bool_t entry_write(struct userdata *u, const char *name, const struct entry *e, pa_bool_t replace); +static bool entry_write(struct userdata *u, const char *name, const struct entry *e, bool replace); static struct entry* entry_copy(const struct entry *e); static void entry_apply(struct userdata *u, const char *name, struct entry *e); static void trigger_save(struct userdata *u); @@ -603,8 +603,8 @@ static void handle_add_entry(DBusConnection *conn, DBusMessage *msg, void *userd const char *device = NULL; pa_channel_map map; pa_cvolume vol; - dbus_bool_t muted = FALSE; - dbus_bool_t apply_immediately = FALSE; + dbus_bool_t muted = false; + dbus_bool_t apply_immediately = false; struct dbus_entry *dbus_entry = NULL; struct entry *e = NULL; @@ -633,14 +633,14 @@ static void handle_add_entry(DBusConnection *conn, DBusMessage *msg, void *userd } if ((dbus_entry = pa_hashmap_get(u->dbus_entries, name))) { - pa_bool_t mute_updated = FALSE; - pa_bool_t volume_updated = FALSE; - pa_bool_t device_updated = FALSE; + bool mute_updated = false; + bool volume_updated = false; + bool device_updated = false; pa_assert_se(e = entry_read(u, name)); mute_updated = e->muted != muted; e->muted = muted; - e->muted_valid = TRUE; + e->muted_valid = true; volume_updated = (e->volume_valid != !!map.channels) || !pa_cvolume_equal(&e->volume, &vol); e->volume = vol; @@ -664,7 +664,7 @@ static void handle_add_entry(DBusConnection *conn, DBusMessage *msg, void *userd pa_assert_se(pa_hashmap_put(u->dbus_entries, dbus_entry->entry_name, dbus_entry) == 0); e = entry_new(); - e->muted_valid = TRUE; + e->muted_valid = true; e->volume_valid = !!map.channels; e->device_valid = !!device[0]; e->muted = muted; @@ -675,7 +675,7 @@ static void handle_add_entry(DBusConnection *conn, DBusMessage *msg, void *userd send_new_entry_signal(dbus_entry); } - pa_assert_se(entry_write(u, name, e, TRUE)); + pa_assert_se(entry_write(u, name, e, true)); if (apply_immediately) entry_apply(u, name, e); @@ -748,7 +748,7 @@ static void handle_entry_set_device(DBusConnection *conn, DBusMessage *msg, DBus struct dbus_entry *de = userdata; const char *device; struct entry *e; - pa_bool_t updated; + bool updated; pa_assert(conn); pa_assert(msg); @@ -766,7 +766,7 @@ static void handle_entry_set_device(DBusConnection *conn, DBusMessage *msg, DBus e->device = pa_xstrdup(device); e->device_valid = !!device[0]; - pa_assert_se(entry_write(de->userdata, de->entry_name, e, TRUE)); + pa_assert_se(entry_write(de->userdata, de->entry_name, e, true)); entry_apply(de->userdata, de->entry_name, e); send_device_updated_signal(de, e); @@ -805,7 +805,7 @@ static void handle_entry_set_volume(DBusConnection *conn, DBusMessage *msg, DBus pa_channel_map map; pa_cvolume vol; struct entry *e = NULL; - pa_bool_t updated = FALSE; + bool updated = false; pa_assert(conn); pa_assert(msg); @@ -824,7 +824,7 @@ static void handle_entry_set_volume(DBusConnection *conn, DBusMessage *msg, DBus e->channel_map = map; e->volume_valid = !!map.channels; - pa_assert_se(entry_write(de->userdata, de->entry_name, e, TRUE)); + pa_assert_se(entry_write(de->userdata, de->entry_name, e, true)); entry_apply(de->userdata, de->entry_name, e); send_volume_updated_signal(de, e); @@ -847,7 +847,7 @@ static void handle_entry_get_mute(DBusConnection *conn, DBusMessage *msg, void * pa_assert_se(e = entry_read(de->userdata, de->entry_name)); - mute = e->muted_valid ? e->muted : FALSE; + mute = e->muted_valid ? e->muted : false; pa_dbus_send_basic_variant_reply(conn, msg, DBUS_TYPE_BOOLEAN, &mute); @@ -858,7 +858,7 @@ static void handle_entry_set_mute(DBusConnection *conn, DBusMessage *msg, DBusMe struct dbus_entry *de = userdata; dbus_bool_t mute; struct entry *e; - pa_bool_t updated; + bool updated; pa_assert(conn); pa_assert(msg); @@ -873,9 +873,9 @@ static void handle_entry_set_mute(DBusConnection *conn, DBusMessage *msg, DBusMe if (updated) { e->muted = mute; - e->muted_valid = TRUE; + e->muted_valid = true; - pa_assert_se(entry_write(de->userdata, de->entry_name, e, TRUE)); + pa_assert_se(entry_write(de->userdata, de->entry_name, e, true)); entry_apply(de->userdata, de->entry_name, e); send_mute_updated_signal(de, e); @@ -904,7 +904,7 @@ static void handle_entry_get_all(DBusConnection *conn, DBusMessage *msg, void *u pa_assert_se(e = entry_read(de->userdata, de->entry_name)); device = e->device_valid ? e->device : ""; - mute = e->muted_valid ? e->muted : FALSE; + mute = e->muted_valid ? e->muted : false; pa_assert_se((reply = dbus_message_new_method_return(msg))); @@ -986,10 +986,10 @@ static void entry_free(struct entry* e) { pa_xfree(e); } -static pa_bool_t entry_write(struct userdata *u, const char *name, const struct entry *e, pa_bool_t replace) { +static bool entry_write(struct userdata *u, const char *name, const struct entry *e, bool replace) { pa_tagstruct *t; pa_datum key, data; - pa_bool_t r; + bool r; pa_assert(u); pa_assert(name); @@ -1025,8 +1025,8 @@ static pa_bool_t entry_write(struct userdata *u, const char *name, const struct static struct entry *legacy_entry_read(struct userdata *u, const char *name) { struct legacy_entry { uint8_t version; - pa_bool_t muted_valid:1, volume_valid:1, device_valid:1, card_valid:1; - pa_bool_t muted:1; + bool muted_valid:1, volume_valid:1, device_valid:1, card_valid:1; + bool muted:1; pa_channel_map channel_map; pa_cvolume volume; char device[PA_NAME_MAX]; @@ -1220,7 +1220,7 @@ static void trigger_save(struct userdata *u) { u->save_time_event = pa_core_rttime_new(u->core, pa_rtclock_now() + SAVE_INTERVAL, save_time_callback, u); } -static pa_bool_t entries_equal(const struct entry *a, const struct entry *b) { +static bool entries_equal(const struct entry *a, const struct entry *b) { pa_cvolume t; pa_assert(a); @@ -1228,22 +1228,22 @@ static pa_bool_t entries_equal(const struct entry *a, const struct entry *b) { if (a->device_valid != b->device_valid || (a->device_valid && !pa_streq(a->device, b->device))) - return FALSE; + return false; if (a->card_valid != b->card_valid || (a->card_valid && !pa_streq(a->card, b->card))) - return FALSE; + return false; if (a->muted_valid != b->muted_valid || (a->muted_valid && (a->muted != b->muted))) - return FALSE; + return false; t = b->volume; if (a->volume_valid != b->volume_valid || (a->volume_valid && !pa_cvolume_equal(pa_cvolume_remap(&t, &b->channel_map, &a->channel_map), &a->volume))) - return FALSE; + return false; - return TRUE; + return true; } static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint32_t idx, void *userdata) { @@ -1253,10 +1253,10 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3 /* These are only used when D-Bus is enabled, but in order to reduce ifdef * clutter these are defined here unconditionally. */ - pa_bool_t created_new_entry = TRUE; - pa_bool_t device_updated = FALSE; - pa_bool_t volume_updated = FALSE; - pa_bool_t mute_updated = FALSE; + bool created_new_entry = true; + bool device_updated = false; + bool volume_updated = false; + bool mute_updated = false; #ifdef HAVE_DBUS struct dbus_entry *de = NULL; @@ -1282,7 +1282,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3 if ((old = entry_read(u, name))) { entry = entry_copy(old); - created_new_entry = FALSE; + created_new_entry = false; } else entry = entry_new(); @@ -1290,8 +1290,8 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3 pa_assert(sink_input->volume_writable); entry->channel_map = sink_input->channel_map; - pa_sink_input_get_volume(sink_input, &entry->volume, FALSE); - entry->volume_valid = TRUE; + pa_sink_input_get_volume(sink_input, &entry->volume, false); + entry->volume_valid = true; volume_updated = !created_new_entry && (!old->volume_valid @@ -1301,7 +1301,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3 if (sink_input->save_muted) { entry->muted = pa_sink_input_get_mute(sink_input); - entry->muted_valid = TRUE; + entry->muted_valid = true; mute_updated = !created_new_entry && (!old->muted_valid || entry->muted != old->muted); } @@ -1309,13 +1309,13 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3 if (sink_input->save_sink) { pa_xfree(entry->device); entry->device = pa_xstrdup(sink_input->sink->name); - entry->device_valid = TRUE; + entry->device_valid = true; device_updated = !created_new_entry && (!old->device_valid || !pa_streq(entry->device, old->device)); if (sink_input->sink->card) { pa_xfree(entry->card); entry->card = pa_xstrdup(sink_input->sink->card->name); - entry->card_valid = TRUE; + entry->card_valid = true; } } @@ -1332,7 +1332,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3 if ((old = entry_read(u, name))) { entry = entry_copy(old); - created_new_entry = FALSE; + created_new_entry = false; } else entry = entry_new(); @@ -1340,8 +1340,8 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3 pa_assert(source_output->volume_writable); entry->channel_map = source_output->channel_map; - pa_source_output_get_volume(source_output, &entry->volume, FALSE); - entry->volume_valid = TRUE; + pa_source_output_get_volume(source_output, &entry->volume, false); + entry->volume_valid = true; volume_updated = !created_new_entry && (!old->volume_valid @@ -1351,7 +1351,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3 if (source_output->save_muted) { entry->muted = pa_source_output_get_mute(source_output); - entry->muted_valid = TRUE; + entry->muted_valid = true; mute_updated = !created_new_entry && (!old->muted_valid || entry->muted != old->muted); } @@ -1359,14 +1359,14 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3 if (source_output->save_source) { pa_xfree(entry->device); entry->device = pa_xstrdup(source_output->source->name); - entry->device_valid = TRUE; + entry->device_valid = true; device_updated = !created_new_entry && (!old->device_valid || !pa_streq(entry->device, old->device)); if (source_output->source->card) { pa_xfree(entry->card); entry->card = pa_xstrdup(source_output->source->card->name); - entry->card_valid = TRUE; + entry->card_valid = true; } } } @@ -1387,7 +1387,7 @@ static void subscribe_callback(pa_core *c, pa_subscription_event_type_t t, uint3 pa_log_info("Storing volume/mute/device for stream %s.", name); - if (entry_write(u, name, entry, TRUE)) + if (entry_write(u, name, entry, true)) trigger_save(u); #ifdef HAVE_DBUS @@ -1442,7 +1442,7 @@ static pa_hook_result_t sink_input_new_hook_callback(pa_core *c, pa_sink_input_n same time, in which case we want to make sure we don't interfere with that */ if (s && PA_SINK_IS_LINKED(pa_sink_get_state(s))) - if (pa_sink_input_new_data_set_sink(new_data, s, TRUE)) + if (pa_sink_input_new_data_set_sink(new_data, s, true)) pa_log_info("Restoring device for stream %s.", name); entry_free(e); @@ -1481,8 +1481,8 @@ static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *c, pa_sink_inpu pa_cvolume_remap(&v, &e->channel_map, &new_data->channel_map); pa_sink_input_new_data_set_volume(new_data, &v); - new_data->volume_is_absolute = FALSE; - new_data->save_volume = TRUE; + new_data->volume_is_absolute = false; + new_data->save_volume = true; } } @@ -1491,7 +1491,7 @@ static pa_hook_result_t sink_input_fixate_hook_callback(pa_core *c, pa_sink_inpu if (!new_data->muted_is_set) { pa_log_info("Restoring mute state for sink input %s.", name); pa_sink_input_new_data_set_muted(new_data, e->muted); - new_data->save_muted = TRUE; + new_data->save_muted = true; } else pa_log_debug("Not restoring mute state for sink input %s, because already set.", name); } @@ -1539,7 +1539,7 @@ static pa_hook_result_t source_output_new_hook_callback(pa_core *c, pa_source_ou interfere with that */ if (s && PA_SOURCE_IS_LINKED(pa_source_get_state(s))) { pa_log_info("Restoring device for stream %s.", name); - pa_source_output_new_data_set_source(new_data, s, TRUE); + pa_source_output_new_data_set_source(new_data, s, true); } entry_free(e); @@ -1578,8 +1578,8 @@ static pa_hook_result_t source_output_fixate_hook_callback(pa_core *c, pa_source pa_cvolume_remap(&v, &e->channel_map, &new_data->channel_map); pa_source_output_new_data_set_volume(new_data, &v); - new_data->volume_is_absolute = FALSE; - new_data->save_volume = TRUE; + new_data->volume_is_absolute = false; + new_data->save_volume = true; } } @@ -1588,7 +1588,7 @@ static pa_hook_result_t source_output_fixate_hook_callback(pa_core *c, pa_source if (!new_data->muted_is_set) { pa_log_info("Restoring mute state for source output %s.", name); pa_source_output_new_data_set_muted(new_data, e->muted); - new_data->save_muted = TRUE; + new_data->save_muted = true; } else pa_log_debug("Not restoring mute state for source output %s, because already set.", name); } @@ -1636,7 +1636,7 @@ static pa_hook_result_t sink_put_hook_callback(pa_core *c, pa_sink *sink, struct if ((e = entry_read(u, name))) { if (e->device_valid && pa_streq(e->device, sink->name)) - pa_sink_input_move_to(si, sink, TRUE); + pa_sink_input_move_to(si, sink, true); entry_free(e); } @@ -1684,7 +1684,7 @@ static pa_hook_result_t source_put_hook_callback(pa_core *c, pa_source *source, if ((e = entry_read(u, name))) { if (e->device_valid && pa_streq(e->device, source->name)) - pa_source_output_move_to(so, source, TRUE); + pa_source_output_move_to(so, source, true); entry_free(e); } @@ -1726,7 +1726,7 @@ static pa_hook_result_t sink_unlink_hook_callback(pa_core *c, pa_sink *sink, str if ((d = pa_namereg_get(c, e->device, PA_NAMEREG_SINK)) && d != sink && PA_SINK_IS_LINKED(pa_sink_get_state(d))) - pa_sink_input_move_to(si, d, TRUE); + pa_sink_input_move_to(si, d, true); } entry_free(e); @@ -1772,7 +1772,7 @@ static pa_hook_result_t source_unlink_hook_callback(pa_core *c, pa_source *sourc if ((d = pa_namereg_get(c, e->device, PA_NAMEREG_SOURCE)) && d != source && PA_SOURCE_IS_LINKED(pa_source_get_state(d))) - pa_source_output_move_to(so, d, TRUE); + pa_source_output_move_to(so, d, true); } entry_free(e); @@ -1837,7 +1837,7 @@ static int fill_db(struct userdata *u, const char *filename) { pa_zero(e); e.version = ENTRY_VERSION; - e.volume_valid = TRUE; + e.volume_valid = true; pa_cvolume_set(&e.volume, 1, pa_sw_volume_from_dB(db)); pa_channel_map_init_mono(&e.channel_map); @@ -1847,7 +1847,7 @@ static int fill_db(struct userdata *u, const char *filename) { data.data = (void *) &e; data.size = sizeof(e); - if (pa_database_set(u->database, &key, &data, FALSE) == 0) + if (pa_database_set(u->database, &key, &data, false) == 0) pa_log_debug("Setting %s to %0.2f dB.", ln, db); } else pa_log_warn("[%s:%u] Positive dB values are not allowed, not setting entry %s.", fn, n, ln); @@ -1895,12 +1895,12 @@ static void entry_apply(struct userdata *u, const char *name, struct entry *e) { v = e->volume; pa_log_info("Restoring volume for sink input %s.", name); pa_cvolume_remap(&v, &e->channel_map, &si->channel_map); - pa_sink_input_set_volume(si, &v, TRUE, FALSE); + pa_sink_input_set_volume(si, &v, true, false); } if (u->restore_muted && e->muted_valid) { pa_log_info("Restoring mute state for sink input %s.", name); - pa_sink_input_set_mute(si, e->muted, TRUE); + pa_sink_input_set_mute(si, e->muted, true); } if (u->restore_device) { @@ -1910,7 +1910,7 @@ static void entry_apply(struct userdata *u, const char *name, struct entry *e) { /* If the device is not valid we should make sure the save flag is cleared as the user may have specifically removed the sink element from the rule. */ - si->save_sink = FALSE; + si->save_sink = false; /* This is cheating a bit. The sink input itself has not changed but the rules governing it's routing have, so we fire this event such that other routing modules (e.g. module-device-manager) @@ -1919,7 +1919,7 @@ static void entry_apply(struct userdata *u, const char *name, struct entry *e) { } } else if ((s = pa_namereg_get(u->core, e->device, PA_NAMEREG_SINK))) { pa_log_info("Restoring device for stream %s.", name); - pa_sink_input_move_to(si, s, TRUE); + pa_sink_input_move_to(si, s, true); } } } @@ -1943,12 +1943,12 @@ static void entry_apply(struct userdata *u, const char *name, struct entry *e) { v = e->volume; pa_log_info("Restoring volume for source output %s.", name); pa_cvolume_remap(&v, &e->channel_map, &so->channel_map); - pa_source_output_set_volume(so, &v, TRUE, FALSE); + pa_source_output_set_volume(so, &v, true, false); } if (u->restore_muted && e->muted_valid) { pa_log_info("Restoring mute state for source output %s.", name); - pa_source_output_set_mute(so, e->muted, TRUE); + pa_source_output_set_mute(so, e->muted, true); } if (u->restore_device) { @@ -1958,7 +1958,7 @@ static void entry_apply(struct userdata *u, const char *name, struct entry *e) { /* If the device is not valid we should make sure the save flag is cleared as the user may have specifically removed the source element from the rule. */ - so->save_source = FALSE; + so->save_source = false; /* This is cheating a bit. The source output itself has not changed but the rules governing it's routing have, so we fire this event such that other routing modules (e.g. module-device-manager) @@ -1967,7 +1967,7 @@ static void entry_apply(struct userdata *u, const char *name, struct entry *e) { } } else if ((s = pa_namereg_get(u->core, e->device, PA_NAMEREG_SOURCE))) { pa_log_info("Restoring device for stream %s.", name); - pa_source_output_move_to(so, s, TRUE); + pa_source_output_move_to(so, s, true); } } } @@ -1976,7 +1976,7 @@ static void entry_apply(struct userdata *u, const char *name, struct entry *e) { #ifdef DEBUG_VOLUME PA_GCC_UNUSED static void stream_restore_dump_database(struct userdata *u) { pa_datum key; - pa_bool_t done; + bool done; done = !pa_database_first(u->database, &key, NULL); @@ -2039,7 +2039,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio case SUBCOMMAND_READ: { pa_datum key; - pa_bool_t done; + bool done; if (!pa_tagstruct_eof(t)) goto fail; @@ -2064,7 +2064,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio pa_tagstruct_put_channel_map(reply, e->volume_valid ? &e->channel_map : pa_channel_map_init(&cm)); pa_tagstruct_put_cvolume(reply, e->volume_valid ? &e->volume : pa_cvolume_init(&r)); pa_tagstruct_puts(reply, e->device_valid ? e->device : NULL); - pa_tagstruct_put_boolean(reply, e->muted_valid ? e->muted : FALSE); + pa_tagstruct_put_boolean(reply, e->muted_valid ? e->muted : false); entry_free(e); } @@ -2079,7 +2079,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio case SUBCOMMAND_WRITE: { uint32_t mode; - pa_bool_t apply_immediately = FALSE; + bool apply_immediately = false; if (pa_tagstruct_getu32(t, &mode) < 0 || pa_tagstruct_get_boolean(t, &apply_immediately) < 0) @@ -2105,7 +2105,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio while (!pa_tagstruct_eof(t)) { const char *name, *device; - pa_bool_t muted; + bool muted; struct entry *entry; #ifdef HAVE_DBUS struct entry *old; @@ -2134,7 +2134,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio } entry->muted = muted; - entry->muted_valid = TRUE; + entry->muted_valid = true; entry->device = pa_xstrdup(device); entry->device_valid = device && !!entry->device[0]; @@ -2225,7 +2225,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio case SUBCOMMAND_SUBSCRIBE: { - pa_bool_t enabled; + bool enabled; if (pa_tagstruct_get_boolean(t, &enabled) < 0 || !pa_tagstruct_eof(t)) @@ -2274,7 +2274,7 @@ static void clean_up_db(struct userdata *u) { #ifdef ENABLE_LEGACY_DATABASE_ENTRY_FORMAT PA_LLIST_HEAD(struct clean_up_item, to_be_converted); #endif - pa_bool_t done = FALSE; + bool done = false; pa_datum key; struct clean_up_item *item = NULL; struct clean_up_item *next = NULL; @@ -2347,7 +2347,7 @@ static void clean_up_db(struct userdata *u) { PA_LLIST_FOREACH_SAFE(item, next, to_be_converted) { pa_log_debug("Upgrading a legacy entry to the current format: %s", item->entry_name); - pa_assert_se(entry_write(u, item->entry_name, item->entry, TRUE) >= 0); + pa_assert_se(entry_write(u, item->entry_name, item->entry, true) >= 0); trigger_save(u); PA_LLIST_REMOVE(struct clean_up_item, to_be_converted, item); @@ -2365,10 +2365,10 @@ int pa__init(pa_module*m) { pa_sink_input *si; pa_source_output *so; uint32_t idx; - pa_bool_t restore_device = TRUE, restore_volume = TRUE, restore_muted = TRUE, on_hotplug = TRUE, on_rescue = TRUE; + bool restore_device = true, restore_volume = true, restore_muted = true, on_hotplug = true, on_rescue = true; #ifdef HAVE_DBUS pa_datum key; - pa_bool_t done; + bool done; #endif pa_assert(m); @@ -2430,10 +2430,10 @@ int pa__init(pa_module*m) { u->source_output_fixate_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_FIXATE], PA_HOOK_EARLY, (pa_hook_cb_t) source_output_fixate_hook_callback, u); } - if (!(fname = pa_state_path("stream-volumes", TRUE))) + if (!(fname = pa_state_path("stream-volumes", true))) goto fail; - if (!(u->database = pa_database_open(fname, TRUE))) { + if (!(u->database = pa_database_open(fname, true))) { pa_log("Failed to open volume database '%s': %s", fname, pa_cstrerror(errno)); pa_xfree(fname); goto fail; diff --git a/src/modules/module-suspend-on-idle.c b/src/modules/module-suspend-on-idle.c index 02a6b913a..6d49acb31 100644 --- a/src/modules/module-suspend-on-idle.c +++ b/src/modules/module-suspend-on-idle.c @@ -39,7 +39,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("When a sink/source is idle for too long, suspend it"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_USAGE("timeout=<timeout>"); static const char* const valid_modargs[] = { @@ -89,13 +89,13 @@ static void timeout_cb(pa_mainloop_api*a, pa_time_event* e, const struct timeval if (d->sink && pa_sink_check_suspend(d->sink) <= 0 && !(d->sink->suspend_cause & PA_SUSPEND_IDLE)) { pa_log_info("Sink %s idle for too long, suspending ...", d->sink->name); - pa_sink_suspend(d->sink, TRUE, PA_SUSPEND_IDLE); + pa_sink_suspend(d->sink, true, PA_SUSPEND_IDLE); pa_core_maybe_vacuum(d->userdata->core); } if (d->source && pa_source_check_suspend(d->source) <= 0 && !(d->source->suspend_cause & PA_SUSPEND_IDLE)) { pa_log_info("Source %s idle for too long, suspending ...", d->source->name); - pa_source_suspend(d->source, TRUE, PA_SUSPEND_IDLE); + pa_source_suspend(d->source, true, PA_SUSPEND_IDLE); pa_core_maybe_vacuum(d->userdata->core); } } @@ -129,12 +129,12 @@ static void resume(struct device_info *d) { if (d->sink) { pa_log_debug("Sink %s becomes busy, resuming.", d->sink->name); - pa_sink_suspend(d->sink, FALSE, PA_SUSPEND_IDLE); + pa_sink_suspend(d->sink, false, PA_SUSPEND_IDLE); } if (d->source) { pa_log_debug("Source %s becomes busy, resuming.", d->source->name); - pa_source_suspend(d->source, FALSE, PA_SUSPEND_IDLE); + pa_source_suspend(d->source, false, PA_SUSPEND_IDLE); } } diff --git a/src/modules/module-switch-on-connect.c b/src/modules/module-switch-on-connect.c index efe1270b5..d9275d31b 100644 --- a/src/modules/module-switch-on-connect.c +++ b/src/modules/module-switch-on-connect.c @@ -40,7 +40,7 @@ PA_MODULE_AUTHOR("Michael Terry"); PA_MODULE_DESCRIPTION("When a sink/source is added, switch to it"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); static const char* const valid_modargs[] = { NULL, @@ -90,7 +90,7 @@ static pa_hook_result_t sink_put_hook_callback(pa_core *c, pa_sink *sink, void* if (i->save_sink || !PA_SINK_INPUT_IS_LINKED(i->state)) continue; - if (pa_sink_input_move_to(i, sink, FALSE) < 0) + if (pa_sink_input_move_to(i, sink, false) < 0) pa_log_info("Failed to move sink input %u \"%s\" to %s.", i->index, pa_strnull(pa_proplist_gets(i->proplist, PA_PROP_APPLICATION_NAME)), sink->name); else @@ -143,7 +143,7 @@ static pa_hook_result_t source_put_hook_callback(pa_core *c, pa_source *source, if (o->save_source || !PA_SOURCE_OUTPUT_IS_LINKED(o->state)) continue; - if (pa_source_output_move_to(o, source, FALSE) < 0) + if (pa_source_output_move_to(o, source, false) < 0) pa_log_info("Failed to move source output %u \"%s\" to %s.", o->index, pa_strnull(pa_proplist_gets(o->proplist, PA_PROP_APPLICATION_NAME)), source->name); else diff --git a/src/modules/module-switch-on-port-available.c b/src/modules/module-switch-on-port-available.c index df6ce97ba..dac599fa2 100644 --- a/src/modules/module-switch-on-port-available.c +++ b/src/modules/module-switch-on-port-available.c @@ -121,7 +121,7 @@ static int try_to_switch_profile(pa_device_port *port) { return -1; } - if (pa_card_set_profile(port->card, best_profile->name, FALSE) != 0) { + if (pa_card_set_profile(port->card, best_profile->name, false) != 0) { pa_log_debug("Could not set profile %s", best_profile->name); return -1; } @@ -157,7 +157,7 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port pa_card* card; pa_sink *sink; pa_source *source; - pa_bool_t is_active_profile, is_active_port; + bool is_active_profile, is_active_port; if (port->available == PA_AVAILABLE_UNKNOWN) return PA_HOOK_OK; @@ -196,9 +196,9 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port } if (source) - pa_source_set_port(source, port->name, FALSE); + pa_source_set_port(source, port->name, false); if (sink) - pa_sink_set_port(sink, port->name, FALSE); + pa_sink_set_port(sink, port->name, false); } if (port->available == PA_AVAILABLE_NO) { @@ -206,7 +206,7 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port pa_device_port *p2 = find_best_port(sink->ports); if (p2 && p2->available != PA_AVAILABLE_NO) - pa_sink_set_port(sink, p2->name, FALSE); + pa_sink_set_port(sink, p2->name, false); else { /* Maybe try to switch to another profile? */ } @@ -216,7 +216,7 @@ static pa_hook_result_t port_available_hook_callback(pa_core *c, pa_device_port pa_device_port *p2 = find_best_port(source->ports); if (p2 && p2->available != PA_AVAILABLE_NO) - pa_source_set_port(source, p2->name, FALSE); + pa_source_set_port(source, p2->name, false); else { /* Maybe try to switch to another profile? */ } diff --git a/src/modules/module-systemd-login.c b/src/modules/module-systemd-login.c index 72de47fc9..18f8cc5db 100644 --- a/src/modules/module-systemd-login.c +++ b/src/modules/module-systemd-login.c @@ -45,7 +45,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Create a client for each login session of this user"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); static const char* const valid_modargs[] = { NULL diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c index 7b430fba9..de6057306 100644 --- a/src/modules/module-tunnel.c +++ b/src/modules/module-tunnel.c @@ -89,7 +89,7 @@ PA_MODULE_USAGE( PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); static const char* const valid_modargs[] = { "server", @@ -205,8 +205,8 @@ struct userdata { int64_t counter, counter_delta; - pa_bool_t remote_corked:1; - pa_bool_t remote_suspended:1; + bool remote_corked:1; + bool remote_suspended:1; pa_usec_t transport_usec; /* maintained in the main thread */ pa_usec_t thread_transport_usec; /* maintained in the IO thread */ @@ -248,7 +248,7 @@ static void command_stream_killed(pa_pdispatch *pd, uint32_t command, uint32_t pa_assert(u->pdispatch == pd); pa_log_warn("Stream killed"); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } /* Called from main context */ @@ -268,7 +268,7 @@ static void command_overflow_or_underflow(pa_pdispatch *pd, uint32_t command, static void command_suspended(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { struct userdata *u = userdata; uint32_t channel; - pa_bool_t suspended; + bool suspended; pa_assert(pd); pa_assert(t); @@ -280,7 +280,7 @@ static void command_suspended(pa_pdispatch *pd, uint32_t command, uint32_t tag !pa_tagstruct_eof(t)) { pa_log("Invalid packet."); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); return; } @@ -300,7 +300,7 @@ static void command_moved(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa struct userdata *u = userdata; uint32_t channel, di; const char *dn; - pa_bool_t suspended; + bool suspended; pa_assert(pd); pa_assert(t); @@ -313,7 +313,7 @@ static void command_moved(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa pa_tagstruct_get_boolean(t, &suspended) < 0) { pa_log_error("Invalid packet."); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); return; } @@ -342,7 +342,7 @@ static void command_stream_buffer_attr_changed(pa_pdispatch *pd, uint32_t comman pa_tagstruct_getu32(t, &maxlength) < 0) { pa_log_error("Invalid packet."); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); return; } @@ -351,7 +351,7 @@ static void command_stream_buffer_attr_changed(pa_pdispatch *pd, uint32_t comman pa_tagstruct_get_usec(t, &usec) < 0) { pa_log_error("Invalid packet."); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); return; } } else { @@ -361,7 +361,7 @@ static void command_stream_buffer_attr_changed(pa_pdispatch *pd, uint32_t comman pa_tagstruct_get_usec(t, &usec) < 0) { pa_log_error("Invalid packet."); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); return; } } @@ -391,7 +391,7 @@ static void command_started(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa #endif /* Called from IO thread context */ -static void check_smoother_status(struct userdata *u, pa_bool_t past) { +static void check_smoother_status(struct userdata *u, bool past) { pa_usec_t x; pa_assert(u); @@ -410,22 +410,22 @@ static void check_smoother_status(struct userdata *u, pa_bool_t past) { if (u->remote_suspended || u->remote_corked) pa_smoother_pause(u->smoother, x); else - pa_smoother_resume(u->smoother, x, TRUE); + pa_smoother_resume(u->smoother, x, true); } /* Called from IO thread context */ -static void stream_cork_within_thread(struct userdata *u, pa_bool_t cork) { +static void stream_cork_within_thread(struct userdata *u, bool cork) { pa_assert(u); if (u->remote_corked == cork) return; u->remote_corked = cork; - check_smoother_status(u, FALSE); + check_smoother_status(u, false); } /* Called from main context */ -static void stream_cork(struct userdata *u, pa_bool_t cork) { +static void stream_cork(struct userdata *u, bool cork) { pa_tagstruct *t; pa_assert(u); @@ -447,14 +447,14 @@ static void stream_cork(struct userdata *u, pa_bool_t cork) { } /* Called from IO thread context */ -static void stream_suspend_within_thread(struct userdata *u, pa_bool_t suspend) { +static void stream_suspend_within_thread(struct userdata *u, bool suspend) { pa_assert(u); if (u->remote_suspended == suspend) return; u->remote_suspended = suspend; - check_smoother_status(u, TRUE); + check_smoother_status(u, true); } #ifdef TUNNEL_SINK @@ -567,13 +567,13 @@ static int sink_set_state(pa_sink *s, pa_sink_state_t state) { case PA_SINK_SUSPENDED: pa_assert(PA_SINK_IS_OPENED(s->state)); - stream_cork(u, TRUE); + stream_cork(u, true); break; case PA_SINK_IDLE: case PA_SINK_RUNNING: if (s->state == PA_SINK_SUSPENDED) - stream_cork(u, FALSE); + stream_cork(u, false); break; case PA_SINK_UNLINKED: @@ -663,13 +663,13 @@ static int source_set_state(pa_source *s, pa_source_state_t state) { case PA_SOURCE_SUSPENDED: pa_assert(PA_SOURCE_IS_OPENED(s->state)); - stream_cork(u, TRUE); + stream_cork(u, true); break; case PA_SOURCE_IDLE: case PA_SOURCE_RUNNING: if (s->state == PA_SOURCE_SUSPENDED) - stream_cork(u, FALSE); + stream_cork(u, false); break; case PA_SOURCE_UNLINKED: @@ -700,7 +700,7 @@ static void thread_func(void *userdata) { pa_sink_process_rewind(u->sink, 0); #endif - if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) + if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) goto fail; if (ret == 0) @@ -744,7 +744,7 @@ static void command_request(pa_pdispatch *pd, uint32_t command, uint32_t tag, p return; fail: - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } #endif @@ -753,7 +753,7 @@ fail: static void stream_get_latency_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { struct userdata *u = userdata; pa_usec_t sink_usec, source_usec; - pa_bool_t playing; + bool playing; int64_t write_index, read_index; struct timeval local, remote, now; pa_sample_spec *ss; @@ -855,7 +855,7 @@ static void stream_get_latency_callback(pa_pdispatch *pd, uint32_t command, uint fail: - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } /* Called from main context */ @@ -990,7 +990,7 @@ static void server_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa return; fail: - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } static int read_ports(struct userdata *u, pa_tagstruct *t) { @@ -1058,7 +1058,7 @@ static void sink_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_t pa_sample_spec ss; pa_channel_map cm; pa_cvolume volume; - pa_bool_t mute; + bool mute; pa_usec_t latency; pa_assert(pd); @@ -1137,7 +1137,7 @@ static void sink_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_t return; fail: - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } /* Called from main context */ @@ -1146,11 +1146,11 @@ static void sink_input_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag uint32_t idx, owner_module, client, sink; pa_usec_t buffer_usec, sink_usec; const char *name, *driver, *resample_method; - pa_bool_t mute = FALSE; + bool mute = false; pa_sample_spec sample_spec; pa_channel_map channel_map; pa_cvolume volume; - pa_bool_t b; + bool b; pa_assert(pd); pa_assert(u); @@ -1246,7 +1246,7 @@ static void sink_input_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag return; fail: - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } #else @@ -1259,7 +1259,7 @@ static void source_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa pa_sample_spec ss; pa_channel_map cm; pa_cvolume volume; - pa_bool_t mute; + bool mute; pa_usec_t latency, configured_latency; pa_assert(pd); @@ -1336,7 +1336,7 @@ static void source_info_cb(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa return; fail: - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } #endif @@ -1397,7 +1397,7 @@ static void command_subscribe_event(pa_pdispatch *pd, uint32_t command, uint32 if (pa_tagstruct_getu32(t, &e) < 0 || pa_tagstruct_getu32(t, &idx) < 0) { pa_log("Invalid protocol reply"); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); return; } @@ -1479,7 +1479,7 @@ static void create_stream_callback(pa_pdispatch *pd, uint32_t command, uint32_t pa_channel_map cm; uint32_t device_index; const char *dn; - pa_bool_t suspended; + bool suspended; if (pa_tagstruct_get_sample_spec(t, &ss) < 0 || pa_tagstruct_get_channel_map(t, &cm) < 0 || @@ -1544,7 +1544,7 @@ parse_error: pa_log("Invalid reply. (Create stream)"); fail: - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } @@ -1672,20 +1672,20 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t #endif if (u->version >= 12) { - pa_tagstruct_put_boolean(reply, FALSE); /* no_remap */ - pa_tagstruct_put_boolean(reply, FALSE); /* no_remix */ - pa_tagstruct_put_boolean(reply, FALSE); /* fix_format */ - pa_tagstruct_put_boolean(reply, FALSE); /* fix_rate */ - pa_tagstruct_put_boolean(reply, FALSE); /* fix_channels */ - pa_tagstruct_put_boolean(reply, TRUE); /* no_move */ - pa_tagstruct_put_boolean(reply, FALSE); /* variable_rate */ + pa_tagstruct_put_boolean(reply, false); /* no_remap */ + pa_tagstruct_put_boolean(reply, false); /* no_remix */ + pa_tagstruct_put_boolean(reply, false); /* fix_format */ + pa_tagstruct_put_boolean(reply, false); /* fix_rate */ + pa_tagstruct_put_boolean(reply, false); /* fix_channels */ + pa_tagstruct_put_boolean(reply, true); /* no_move */ + pa_tagstruct_put_boolean(reply, false); /* variable_rate */ } if (u->version >= 13) { pa_proplist *pl; - pa_tagstruct_put_boolean(reply, FALSE); /* start muted/peak detect*/ - pa_tagstruct_put_boolean(reply, TRUE); /* adjust_latency */ + pa_tagstruct_put_boolean(reply, false); /* start muted/peak detect*/ + pa_tagstruct_put_boolean(reply, true); /* adjust_latency */ pl = pa_proplist_new(); pa_proplist_sets(pl, PA_PROP_MEDIA_NAME, name); @@ -1700,25 +1700,25 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t if (u->version >= 14) { #ifdef TUNNEL_SINK - pa_tagstruct_put_boolean(reply, FALSE); /* volume_set */ + pa_tagstruct_put_boolean(reply, false); /* volume_set */ #endif - pa_tagstruct_put_boolean(reply, TRUE); /* early rquests */ + pa_tagstruct_put_boolean(reply, true); /* early rquests */ } if (u->version >= 15) { #ifdef TUNNEL_SINK - pa_tagstruct_put_boolean(reply, FALSE); /* muted_set */ + pa_tagstruct_put_boolean(reply, false); /* muted_set */ #endif - pa_tagstruct_put_boolean(reply, FALSE); /* don't inhibit auto suspend */ - pa_tagstruct_put_boolean(reply, FALSE); /* fail on suspend */ + pa_tagstruct_put_boolean(reply, false); /* don't inhibit auto suspend */ + pa_tagstruct_put_boolean(reply, false); /* fail on suspend */ } #ifdef TUNNEL_SINK if (u->version >= 17) - pa_tagstruct_put_boolean(reply, FALSE); /* relative volume */ + pa_tagstruct_put_boolean(reply, false); /* relative volume */ if (u->version >= 18) - pa_tagstruct_put_boolean(reply, FALSE); /* passthrough stream */ + pa_tagstruct_put_boolean(reply, false); /* passthrough stream */ #endif #ifdef TUNNEL_SINK @@ -1732,11 +1732,11 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t pa_tagstruct_putu8(reply, 0); pa_cvolume_reset(&volume, u->source->sample_spec.channels); pa_tagstruct_put_cvolume(reply, &volume); - pa_tagstruct_put_boolean(reply, FALSE); /* muted */ - pa_tagstruct_put_boolean(reply, FALSE); /* volume_set */ - pa_tagstruct_put_boolean(reply, FALSE); /* muted_set */ - pa_tagstruct_put_boolean(reply, FALSE); /* relative volume */ - pa_tagstruct_put_boolean(reply, FALSE); /* passthrough stream */ + pa_tagstruct_put_boolean(reply, false); /* muted */ + pa_tagstruct_put_boolean(reply, false); /* volume_set */ + pa_tagstruct_put_boolean(reply, false); /* muted_set */ + pa_tagstruct_put_boolean(reply, false); /* relative volume */ + pa_tagstruct_put_boolean(reply, false); /* passthrough stream */ } #endif @@ -1748,7 +1748,7 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t return; fail: - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } /* Called from main context */ @@ -1759,7 +1759,7 @@ static void pstream_die_callback(pa_pstream *p, void *userdata) { pa_assert(u); pa_log_warn("Stream died."); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } /* Called from main context */ @@ -1772,7 +1772,7 @@ static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, const pa_c if (pa_pdispatch_run(u->pdispatch, packet, creds, u) < 0) { pa_log("Invalid packet"); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); return; } } @@ -1788,7 +1788,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o if (channel != u->channel) { pa_log("Received memory block on bad channel."); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); return; } @@ -1813,12 +1813,12 @@ static void on_connection(pa_socket_client *sc, pa_iochannel *io, void *userdata if (!io) { pa_log("Connection failed: %s", pa_cstrerror(errno)); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); return; } u->pstream = pa_pstream_new(u->core->mainloop, io, u->core->mempool); - u->pdispatch = pa_pdispatch_new(u->core->mainloop, TRUE, command_table, PA_COMMAND_MAX); + u->pdispatch = pa_pdispatch_new(u->core->mainloop, true, command_table, PA_COMMAND_MAX); pa_pstream_set_die_callback(u->pstream, pstream_die_callback, u); pa_pstream_set_receive_packet_callback(u->pstream, pstream_packet_callback, u); @@ -1932,23 +1932,23 @@ int pa__init(pa_module*m) { u->smoother = pa_smoother_new( PA_USEC_PER_SEC, PA_USEC_PER_SEC*2, - TRUE, - TRUE, + true, + true, 10, pa_rtclock_now(), - FALSE); + false); u->ctag = 1; u->device_index = u->channel = PA_INVALID_INDEX; u->time_event = NULL; u->ignore_latency_before = 0; u->transport_usec = u->thread_transport_usec = 0; - u->remote_suspended = u->remote_corked = FALSE; + u->remote_suspended = u->remote_corked = false; u->counter = u->counter_delta = 0; u->rtpoll = pa_rtpoll_new(); pa_thread_mq_init(&u->thread_mq, m->core->mainloop, u->rtpoll); - if (!(u->auth_cookie = pa_auth_cookie_get(u->core, pa_modargs_get_value(ma, "cookie", PA_NATIVE_COOKIE_FILE), TRUE, PA_NATIVE_COOKIE_LENGTH))) + if (!(u->auth_cookie = pa_auth_cookie_get(u->core, pa_modargs_get_value(ma, "cookie", PA_NATIVE_COOKIE_FILE), true, PA_NATIVE_COOKIE_LENGTH))) goto fail; if (!(u->server_name = pa_xstrdup(pa_modargs_get_value(ma, "server", NULL)))) { @@ -1963,7 +1963,7 @@ int pa__init(pa_module*m) { goto fail; } - if (!(u->client = pa_socket_client_new_string(m->core->mainloop, TRUE, u->server_name, PA_NATIVE_DEFAULT_PORT))) { + if (!(u->client = pa_socket_client_new_string(m->core->mainloop, true, u->server_name, PA_NATIVE_DEFAULT_PORT))) { pa_log("Failed to connect to server '%s'", u->server_name); goto fail; } @@ -1978,7 +1978,7 @@ int pa__init(pa_module*m) { pa_sink_new_data_init(&data); data.driver = __FILE__; data.module = m; - data.namereg_fail = TRUE; + data.namereg_fail = true; pa_sink_new_data_set_name(&data, dn); pa_sink_new_data_set_sample_spec(&data, &ss); pa_sink_new_data_set_channel_map(&data, &map); @@ -2007,7 +2007,7 @@ int pa__init(pa_module*m) { pa_sink_set_set_volume_callback(u->sink, sink_set_volume); pa_sink_set_set_mute_callback(u->sink, sink_set_mute); - u->sink->refresh_volume = u->sink->refresh_muted = FALSE; + u->sink->refresh_volume = u->sink->refresh_muted = false; /* pa_sink_set_latency_range(u->sink, MIN_NETWORK_LATENCY_USEC, 0); */ @@ -2022,7 +2022,7 @@ int pa__init(pa_module*m) { pa_source_new_data_init(&data); data.driver = __FILE__; data.module = m; - data.namereg_fail = TRUE; + data.namereg_fail = true; pa_source_new_data_set_name(&data, dn); pa_source_new_data_set_sample_spec(&data, &ss); pa_source_new_data_set_channel_map(&data, &map); diff --git a/src/modules/module-udev-detect.c b/src/modules/module-udev-detect.c index 4f7a90d3c..fcedfcdcc 100644 --- a/src/modules/module-udev-detect.c +++ b/src/modules/module-udev-detect.c @@ -43,7 +43,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Detect available audio hardware and load matching drivers"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_USAGE( "tsched=<enable system timer based scheduling mode?> " "tsched_buffer_size=<buffer size when using timer based scheduling> " @@ -54,7 +54,7 @@ PA_MODULE_USAGE( struct device { char *path; - pa_bool_t need_verify; + bool need_verify; char *card_name; char *args; uint32_t module; @@ -65,11 +65,11 @@ struct userdata { pa_core *core; pa_hashmap *devices; - pa_bool_t use_tsched:1; + bool use_tsched:1; bool tsched_buffer_size_valid:1; - pa_bool_t fixed_latency_range:1; - pa_bool_t ignore_dB:1; - pa_bool_t deferred_volume:1; + bool fixed_latency_range:1; + bool ignore_dB:1; + bool deferred_volume:1; bool use_ucm:1; uint32_t tsched_buffer_size; @@ -155,9 +155,9 @@ finish: return r; } -static pa_bool_t pcm_is_modem(const char *card_idx, const char *pcm) { +static bool pcm_is_modem(const char *card_idx, const char *pcm) { char *sysfs_path, *pcm_class; - pa_bool_t is_modem; + bool is_modem; pa_assert(card_idx); pa_assert(pcm); @@ -175,13 +175,13 @@ static pa_bool_t pcm_is_modem(const char *card_idx, const char *pcm) { return is_modem; } -static pa_bool_t is_card_busy(const char *id) { +static bool is_card_busy(const char *id) { char *card_path = NULL, *pcm_path = NULL, *sub_status = NULL; DIR *card_dir = NULL, *pcm_dir = NULL; FILE *status_file = NULL; size_t len; struct dirent *space = NULL, *de; - pa_bool_t busy = FALSE; + bool busy = false; int r; pa_assert(id); @@ -258,7 +258,7 @@ static pa_bool_t is_card_busy(const char *id) { } if (!pa_streq(line, "closed\n")) { - busy = TRUE; + busy = true; break; } } @@ -286,7 +286,7 @@ fail: static void verify_access(struct userdata *u, struct device *d) { char *cd; pa_card *card; - pa_bool_t accessible; + bool accessible; pa_assert(u); pa_assert(d); @@ -303,7 +303,7 @@ static void verify_access(struct userdata *u, struct device *d) { if (accessible) { pa_module *m; - pa_bool_t busy; + bool busy; /* Check if any of the PCM devices that belong to this * card are currently busy. If they are, don't try to load @@ -442,7 +442,7 @@ static void remove_card(struct userdata *u, struct udev_device *dev) { pa_log_info("Card %s removed.", d->path); if (d->module != PA_INVALID_INDEX) - pa_module_unload_request_by_index(u->core, d->module, TRUE); + pa_module_unload_request_by_index(u->core, d->module, true); device_free(d); } @@ -521,12 +521,12 @@ fail: u->udev_io = NULL; } -static pa_bool_t pcm_node_belongs_to_device( +static bool pcm_node_belongs_to_device( struct device *d, const char *node) { char *cd; - pa_bool_t b; + bool b; cd = pa_sprintf_malloc("pcmC%sD", path_get_card_id(d->path)); b = pa_startswith(node, cd); @@ -535,12 +535,12 @@ static pa_bool_t pcm_node_belongs_to_device( return b; } -static pa_bool_t control_node_belongs_to_device( +static bool control_node_belongs_to_device( struct device *d, const char *node) { char *cd; - pa_bool_t b; + bool b; cd = pa_sprintf_malloc("controlC%s", path_get_card_id(d->path)); b = pa_streq(node, cd); @@ -562,7 +562,7 @@ static void inotify_cb( } buf; struct userdata *u = userdata; static int type = 0; - pa_bool_t deleted = FALSE; + bool deleted = false; struct device *d; void *state; @@ -602,18 +602,18 @@ static void inotify_cb( if (((event->mask & IN_ATTRIB) && pa_startswith(event->name, "controlC"))) PA_HASHMAP_FOREACH(d, u->devices, state) if (control_node_belongs_to_device(d, event->name)) - d->need_verify = TRUE; + d->need_verify = true; /* ALSA doesn't really give us any guarantee on the closing * order, so let's simply hope */ if (((event->mask & IN_CLOSE_WRITE) && pa_startswith(event->name, "pcmC"))) PA_HASHMAP_FOREACH(d, u->devices, state) if (pcm_node_belongs_to_device(d, event->name)) - d->need_verify = TRUE; + d->need_verify = true; /* /dev/snd/ might have been removed */ if ((event->mask & (IN_DELETE_SELF|IN_MOVE_SELF))) - deleted = TRUE; + deleted = true; event = (struct inotify_event*) ((uint8_t*) event + len); r -= len; @@ -622,7 +622,7 @@ static void inotify_cb( PA_HASHMAP_FOREACH(d, u->devices, state) if (d->need_verify) { - d->need_verify = FALSE; + d->need_verify = false; verify_access(u, d); } @@ -688,7 +688,7 @@ int pa__init(pa_module *m) { struct udev_enumerate *enumerate = NULL; struct udev_list_entry *item = NULL, *first = NULL; int fd; - pa_bool_t use_tsched = TRUE, fixed_latency_range = FALSE, ignore_dB = FALSE, deferred_volume = m->core->deferred_volume; + bool use_tsched = true, fixed_latency_range = false, ignore_dB = false, deferred_volume = m->core->deferred_volume; bool use_ucm = true; pa_assert(m); diff --git a/src/modules/module-virtual-sink.c b/src/modules/module-virtual-sink.c index 4f91fe057..66fd8a973 100644 --- a/src/modules/module-virtual-sink.c +++ b/src/modules/module-virtual-sink.c @@ -43,7 +43,7 @@ PA_MODULE_AUTHOR("Pierre-Louis Bossart"); PA_MODULE_DESCRIPTION(_("Virtual sink")); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( _("sink_name=<name for the sink> " "sink_properties=<properties for the sink> " @@ -61,14 +61,14 @@ struct userdata { pa_module *module; /* FIXME: Uncomment this and take "autoloaded" as a modarg if this is a filter */ - /* pa_bool_t autoloaded; */ + /* bool autoloaded; */ pa_sink *sink; pa_sink_input *sink_input; pa_memblockq *memblockq; - pa_bool_t auto_desc; + bool auto_desc; unsigned channels; }; @@ -144,7 +144,7 @@ static void sink_request_rewind_cb(pa_sink *s) { /* Just hand this one over to the master sink */ pa_sink_input_request_rewind(u->sink_input, s->thread_info.rewind_nbytes + - pa_memblockq_get_length(u->memblockq), TRUE, FALSE, FALSE); + pa_memblockq_get_length(u->memblockq), true, false, false); } /* Called from I/O thread context */ @@ -175,7 +175,7 @@ static void sink_set_volume_cb(pa_sink *s) { !PA_SINK_INPUT_IS_LINKED(pa_sink_input_get_state(u->sink_input))) return; - pa_sink_input_set_volume(u->sink_input, &s->real_volume, s->save_volume, TRUE); + pa_sink_input_set_volume(u->sink_input, &s->real_volume, s->save_volume, true); } /* Called from main context */ @@ -281,7 +281,7 @@ static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) { u->sink->thread_info.rewind_nbytes = 0; if (amount > 0) { - pa_memblockq_seek(u->memblockq, - (int64_t) amount, PA_SEEK_RELATIVE, TRUE); + pa_memblockq_seek(u->memblockq, - (int64_t) amount, PA_SEEK_RELATIVE, true); /* (5) PUT YOUR CODE HERE TO RESET YOUR FILTER */ } @@ -398,7 +398,7 @@ static void sink_input_kill_cb(pa_sink_input *i) { pa_sink_unref(u->sink); u->sink = NULL; - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } /* Called from IO thread context */ @@ -413,7 +413,7 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s if (PA_SINK_INPUT_IS_LINKED(state) && i->thread_info.state == PA_SINK_INPUT_INIT) { pa_log_debug("Requesting rewind due to state change."); - pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); + pa_sink_input_request_rewind(i, 0, false, true, true); } } @@ -472,8 +472,8 @@ int pa__init(pa_module*m) { pa_sink *master=NULL; pa_sink_input_new_data sink_input_data; pa_sink_new_data sink_data; - pa_bool_t use_volume_sharing = TRUE; - pa_bool_t force_flat_volume = FALSE; + bool use_volume_sharing = true; + bool force_flat_volume = false; pa_memchunk silence; pa_assert(m); @@ -559,7 +559,7 @@ int pa__init(pa_module*m) { pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb); if (!use_volume_sharing) { pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb); - pa_sink_enable_decibel_volume(u->sink, TRUE); + pa_sink_enable_decibel_volume(u->sink, true); } /* Normally this flag would be enabled automatically be we can force it. */ if (force_flat_volume) @@ -572,7 +572,7 @@ int pa__init(pa_module*m) { pa_sink_input_new_data_init(&sink_input_data); sink_input_data.driver = __FILE__; sink_input_data.module = m; - pa_sink_input_new_data_set_sink(&sink_input_data, master, FALSE); + pa_sink_input_new_data_set_sink(&sink_input_data, master, false); sink_input_data.origin_sink = u->sink; pa_proplist_setf(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Virtual Sink Stream from %s", pa_proplist_gets(u->sink->proplist, PA_PROP_DEVICE_DESCRIPTION)); pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter"); diff --git a/src/modules/module-virtual-source.c b/src/modules/module-virtual-source.c index 6720f8b00..6864a5ca9 100644 --- a/src/modules/module-virtual-source.c +++ b/src/modules/module-virtual-source.c @@ -46,7 +46,7 @@ PA_MODULE_AUTHOR("Pierre-Louis Bossart"); PA_MODULE_DESCRIPTION("Virtual source"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( _("source_name=<name for the source> " "source_properties=<properties for the source> " @@ -67,14 +67,14 @@ struct userdata { pa_module *module; /* FIXME: Uncomment this and take "autoloaded" as a modarg if this is a filter */ - /* pa_bool_t autoloaded; */ + /* bool autoloaded; */ pa_source *source; pa_source_output *source_output; pa_memblockq *memblockq; - pa_bool_t auto_desc; + bool auto_desc; unsigned channels; /* optional fields for uplink sink */ @@ -128,7 +128,7 @@ static int sink_set_state_cb(pa_sink *s, pa_sink_state_t state) { if (state == PA_SINK_RUNNING) { /* need to wake-up source if it was suspended */ pa_log_debug("Resuming source %s, because its uplink sink became active.", u->source->name); - pa_source_suspend(u->source, FALSE, PA_SUSPEND_ALL); + pa_source_suspend(u->source, false, PA_SUSPEND_ALL); /* FIXME: if there's no client connected, the source will suspend and playback will be stuck. You'd want to prevent the source from @@ -240,7 +240,7 @@ static void source_set_volume_cb(pa_source *s) { !PA_SOURCE_OUTPUT_IS_LINKED(pa_source_output_get_state(u->source_output))) return; - pa_source_output_set_volume(u->source_output, &s->real_volume, s->save_volume, TRUE); + pa_source_output_set_volume(u->source_output, &s->real_volume, s->save_volume, true); } /* Called from main context */ @@ -333,7 +333,7 @@ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk) chunk->length, /* same length as input */ (const pa_sample_spec *)&o->sample_spec, /* same sample spec for input and output */ NULL, /* no volume information */ - FALSE); /* no mute */ + false); /* no mute */ pa_memblock_release(target_chunk.memblock); pa_memblock_unref(tchunk.memblock); /* clean-up */ @@ -434,7 +434,7 @@ static void source_output_kill_cb(pa_source_output *o) { pa_source_unref(u->source); u->source = NULL; - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } /* Called from main thread */ @@ -473,8 +473,8 @@ int pa__init(pa_module*m) { pa_source *master=NULL; pa_source_output_new_data source_output_data; pa_source_new_data source_data; - pa_bool_t use_volume_sharing = TRUE; - pa_bool_t force_flat_volume = FALSE; + bool use_volume_sharing = true; + bool force_flat_volume = false; /* optional for uplink_sink */ pa_sink_new_data sink_data; @@ -568,7 +568,7 @@ int pa__init(pa_module*m) { pa_source_set_set_mute_callback(u->source, source_set_mute_cb); if (!use_volume_sharing) { pa_source_set_set_volume_callback(u->source, source_set_volume_cb); - pa_source_enable_decibel_volume(u->source, TRUE); + pa_source_enable_decibel_volume(u->source, true); } /* Normally this flag would be enabled automatically be we can force it. */ if (force_flat_volume) @@ -581,7 +581,7 @@ int pa__init(pa_module*m) { pa_source_output_new_data_init(&source_output_data); source_output_data.driver = __FILE__; source_output_data.module = m; - pa_source_output_new_data_set_source(&source_output_data, master, FALSE); + pa_source_output_new_data_set_source(&source_output_data, master, false); source_output_data.destination_source = u->source; pa_proplist_setf(source_output_data.proplist, PA_PROP_MEDIA_NAME, "Virtual Source Stream of %s", pa_proplist_gets(u->source->proplist, PA_PROP_DEVICE_DESCRIPTION)); diff --git a/src/modules/module-virtual-surround-sink.c b/src/modules/module-virtual-surround-sink.c index bcca8d0f4..356ca22e0 100644 --- a/src/modules/module-virtual-surround-sink.c +++ b/src/modules/module-virtual-surround-sink.c @@ -48,7 +48,7 @@ PA_MODULE_AUTHOR("Niels Ole Salscheider"); PA_MODULE_DESCRIPTION(_("Virtual surround sink")); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( _("sink_name=<name for the sink> " "sink_properties=<properties for the sink> " @@ -68,14 +68,14 @@ struct userdata { pa_module *module; /* FIXME: Uncomment this and take "autoloaded" as a modarg if this is a filter */ - /* pa_bool_t autoloaded; */ + /* bool autoloaded; */ pa_sink *sink; pa_sink_input *sink_input; pa_memblockq *memblockq; - pa_bool_t auto_desc; + bool auto_desc; unsigned channels; unsigned hrir_channels; @@ -165,7 +165,7 @@ static void sink_request_rewind_cb(pa_sink *s) { /* Just hand this one over to the master sink */ pa_sink_input_request_rewind(u->sink_input, s->thread_info.rewind_nbytes + - pa_memblockq_get_length(u->memblockq), TRUE, FALSE, FALSE); + pa_memblockq_get_length(u->memblockq), true, false, false); } /* Called from I/O thread context */ @@ -196,7 +196,7 @@ static void sink_set_volume_cb(pa_sink *s) { !PA_SINK_INPUT_IS_LINKED(pa_sink_input_get_state(u->sink_input))) return; - pa_sink_input_set_volume(u->sink_input, &s->real_volume, s->save_volume, TRUE); + pa_sink_input_set_volume(u->sink_input, &s->real_volume, s->save_volume, true); } /* Called from main context */ @@ -303,7 +303,7 @@ static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) { u->sink->thread_info.rewind_nbytes = 0; if (amount > 0) { - pa_memblockq_seek(u->memblockq, - (int64_t) amount, PA_SEEK_RELATIVE, TRUE); + pa_memblockq_seek(u->memblockq, - (int64_t) amount, PA_SEEK_RELATIVE, true); /* Reset the input buffer */ memset(u->input_buffer, 0, u->hrir_samples * u->sink_fs); @@ -410,7 +410,7 @@ static void sink_input_kill_cb(pa_sink_input *i) { pa_sink_unref(u->sink); u->sink = NULL; - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } /* Called from IO thread context */ @@ -425,7 +425,7 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s if (PA_SINK_INPUT_IS_LINKED(state) && i->thread_info.state == PA_SINK_INPUT_INIT) { pa_log_debug("Requesting rewind due to state change."); - pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); + pa_sink_input_request_rewind(i, 0, false, true, true); } } @@ -527,8 +527,8 @@ int pa__init(pa_module*m) { pa_sink *master=NULL; pa_sink_input_new_data sink_input_data; pa_sink_new_data sink_data; - pa_bool_t use_volume_sharing = TRUE; - pa_bool_t force_flat_volume = FALSE; + bool use_volume_sharing = true; + bool force_flat_volume = false; pa_memchunk silence; const char *hrir_file; @@ -661,7 +661,7 @@ int pa__init(pa_module*m) { pa_sink_set_set_mute_callback(u->sink, sink_set_mute_cb); if (!use_volume_sharing) { pa_sink_set_set_volume_callback(u->sink, sink_set_volume_cb); - pa_sink_enable_decibel_volume(u->sink, TRUE); + pa_sink_enable_decibel_volume(u->sink, true); } /* Normally this flag would be enabled automatically be we can force it. */ if (force_flat_volume) @@ -674,7 +674,7 @@ int pa__init(pa_module*m) { pa_sink_input_new_data_init(&sink_input_data); sink_input_data.driver = __FILE__; sink_input_data.module = m; - pa_sink_input_new_data_set_sink(&sink_input_data, master, FALSE); + pa_sink_input_new_data_set_sink(&sink_input_data, master, false); sink_input_data.origin_sink = u->sink; pa_proplist_setf(sink_input_data.proplist, PA_PROP_MEDIA_NAME, "Virtual Surround Sink Stream from %s", pa_proplist_gets(u->sink->proplist, PA_PROP_DEVICE_DESCRIPTION)); pa_proplist_sets(sink_input_data.proplist, PA_PROP_MEDIA_ROLE, "filter"); diff --git a/src/modules/module-volume-restore.c b/src/modules/module-volume-restore.c index a344c5eba..cd397e270 100644 --- a/src/modules/module-volume-restore.c +++ b/src/modules/module-volume-restore.c @@ -35,7 +35,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Compatibility module"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); PA_MODULE_DEPRECATED("Please use module-stream-restore instead of module-volume-restore!"); static const char* const valid_modargs[] = { @@ -47,7 +47,7 @@ static const char* const valid_modargs[] = { int pa__init(pa_module*m) { pa_modargs *ma = NULL; - pa_bool_t restore_device = TRUE, restore_volume = TRUE; + bool restore_device = true, restore_volume = true; pa_module *n; char *t; @@ -71,7 +71,7 @@ int pa__init(pa_module*m) { pa_xfree(t); if (n) - pa_module_unload_request(m, TRUE); + pa_module_unload_request(m, true); pa_modargs_free(ma); diff --git a/src/modules/module-waveout.c b/src/modules/module-waveout.c index 38d0a2014..b274271f1 100644 --- a/src/modules/module-waveout.c +++ b/src/modules/module-waveout.c @@ -253,7 +253,7 @@ static void thread_func(void *userdata) { for (;;) { int ret; - pa_bool_t need_timer = FALSE; + bool need_timer = false; if (u->sink) { if (PA_UNLIKELY(u->sink->thread_info.rewind_requested)) @@ -261,13 +261,13 @@ static void thread_func(void *userdata) { if (PA_SINK_IS_OPENED(u->sink->thread_info.state)) { do_write(u); - need_timer = TRUE; + need_timer = true; } } if (u->source && PA_SOURCE_IS_OPENED(u->source->thread_info.state)) { do_read(u); - need_timer = TRUE; + need_timer = true; } if (need_timer) @@ -276,7 +276,7 @@ static void thread_func(void *userdata) { pa_rtpoll_set_timer_disabled(u->rtpoll); /* Hmm, nothing to do. Let's sleep */ - if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) + if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) goto fail; if (ret == 0) @@ -499,7 +499,7 @@ int pa__init(pa_module *m) { WAVEOUTCAPS pwoc; MMRESULT result; int nfrags, frag_size; - pa_bool_t record = TRUE, playback = TRUE; + bool record = true, playback = true; unsigned int device; pa_sample_spec ss; pa_channel_map map; diff --git a/src/modules/module-zeroconf-discover.c b/src/modules/module-zeroconf-discover.c index 488751095..4ec37471b 100644 --- a/src/modules/module-zeroconf-discover.c +++ b/src/modules/module-zeroconf-discover.c @@ -49,7 +49,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("mDNS/DNS-SD Service Discovery"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); #define SERVICE_TYPE_SINK "_pulse-sink._tcp" #define SERVICE_TYPE_SOURCE "_non-monitor._sub._pulse-source._tcp" @@ -153,7 +153,7 @@ static void resolver_cb( pa_sample_spec ss; pa_channel_map cm; AvahiStringList *l; - pa_bool_t channel_map_set = FALSE; + bool channel_map_set = false; pa_module *m; ss = u->core->default_sample_spec; @@ -175,7 +175,7 @@ static void resolver_cb( ss.format = pa_parse_sample_format(value); else if (pa_streq(key, "channel_map")) { pa_channel_map_parse(&cm, value); - channel_map_set = TRUE; + channel_map_set = true; } avahi_free(key); @@ -281,7 +281,7 @@ static void browser_cb( struct tunnel *t2; if ((t2 = pa_hashmap_get(u->tunnels, t))) { - pa_module_unload_request_by_index(u->core, t2->module_index, TRUE); + pa_module_unload_request_by_index(u->core, t2->module_index, true); pa_hashmap_remove(u->tunnels, t2); tunnel_free(t2); } @@ -314,7 +314,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda browser_cb, u))) { pa_log("avahi_service_browser_new() failed: %s", avahi_strerror(avahi_client_errno(c))); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } } @@ -329,7 +329,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda browser_cb, u))) { pa_log("avahi_service_browser_new() failed: %s", avahi_strerror(avahi_client_errno(c))); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } } @@ -343,7 +343,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda if (!(u->client = avahi_client_new(u->avahi_poll, AVAHI_CLIENT_NO_FAIL, client_callback, u, &error))) { pa_log("avahi_client_new() failed: %s", avahi_strerror(error)); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } } @@ -422,7 +422,7 @@ void pa__done(pa_module*m) { struct tunnel *t; while ((t = pa_hashmap_steal_first(u->tunnels))) { - pa_module_unload_request_by_index(u->core, t->module_index, TRUE); + pa_module_unload_request_by_index(u->core, t->module_index, true); tunnel_free(t); } diff --git a/src/modules/module-zeroconf-publish.c b/src/modules/module-zeroconf-publish.c index b76a215c0..3350008e1 100644 --- a/src/modules/module-zeroconf-publish.c +++ b/src/modules/module-zeroconf-publish.c @@ -53,7 +53,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("mDNS/DNS-SD Service Publisher"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); #define SERVICE_TYPE_SINK "_pulse-sink._tcp" #define SERVICE_TYPE_SOURCE "_pulse-source._tcp" @@ -150,7 +150,7 @@ static void get_service_data(struct service *s, pa_object *device) { if (pa_sink_isinstance(device)) { pa_sink *sink = PA_SINK(device); - s->is_sink = TRUE; + s->is_sink = true; s->service_type = SERVICE_TYPE_SINK; s->ss = sink->sample_spec; s->cm = sink->channel_map; @@ -161,7 +161,7 @@ static void get_service_data(struct service *s, pa_object *device) { } else if (pa_source_isinstance(device)) { pa_source *source = PA_SOURCE(device); - s->is_sink = FALSE; + s->is_sink = false; s->service_type = SERVICE_TYPE_SOURCE; s->ss = source->sample_spec; s->cm = source->channel_map; @@ -439,7 +439,7 @@ static void service_free(struct service *s) { } /* Runs in PA mainloop context */ -static pa_bool_t shall_ignore(pa_object *o) { +static bool shall_ignore(pa_object *o) { pa_object_assert_ref(o); if (pa_sink_isinstance(o)) @@ -601,7 +601,7 @@ fail: } /* Runs in Avahi mainloop context */ -static void unpublish_all_services(struct userdata *u, pa_bool_t rem) { +static void unpublish_all_services(struct userdata *u, bool rem) { void *state = NULL; struct service *s; @@ -675,7 +675,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda case AVAHI_CLIENT_S_COLLISION: pa_log_debug("Host name collision"); - unpublish_all_services(u, FALSE); + unpublish_all_services(u, false); break; case AVAHI_CLIENT_FAILURE: @@ -684,12 +684,12 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda pa_log_debug("Avahi daemon disconnected."); - unpublish_all_services(u, TRUE); + unpublish_all_services(u, true); avahi_client_free(u->client); if (!(u->client = avahi_client_new(u->avahi_poll, AVAHI_CLIENT_NO_FAIL, client_callback, u, &error))) { pa_log("avahi_client_new() failed: %s", avahi_strerror(error)); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } } diff --git a/src/modules/oss/module-oss.c b/src/modules/oss/module-oss.c index 70834697f..03e51c879 100644 --- a/src/modules/oss/module-oss.c +++ b/src/modules/oss/module-oss.c @@ -78,7 +78,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("OSS Sink/Source"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "sink_name=<name for the sink> " "sink_properties=<properties for the sink> " @@ -116,10 +116,10 @@ struct userdata { size_t frame_size; uint32_t in_fragment_size, out_fragment_size, in_nfrags, out_nfrags, in_hwbuf_size, out_hwbuf_size; - pa_bool_t use_getospace, use_getispace; - pa_bool_t use_getodelay; + bool use_getospace, use_getispace; + bool use_getodelay; - pa_bool_t sink_suspended, source_suspended; + bool sink_suspended, source_suspended; int fd; int mode; @@ -129,7 +129,7 @@ struct userdata { int nfrags, frag_size, orig_frag_size; - pa_bool_t use_mmap; + bool use_mmap; unsigned out_mmap_current, in_mmap_current; void *in_mmap, *out_mmap; pa_memblock **in_mmap_memblocks, **out_mmap_memblocks; @@ -157,7 +157,7 @@ static const char* const valid_modargs[] = { NULL }; -static int trigger(struct userdata *u, pa_bool_t quick) { +static int trigger(struct userdata *u, bool quick) { int enable_bits = 0, zero = 0; pa_assert(u); @@ -647,7 +647,7 @@ fail: static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) { struct userdata *u = PA_SINK(o)->userdata; int ret; - pa_bool_t do_trigger = FALSE, quick = TRUE; + bool do_trigger = false, quick = true; switch (code) { @@ -678,16 +678,16 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse return -1; } - do_trigger = TRUE; + do_trigger = true; - u->sink_suspended = TRUE; + u->sink_suspended = true; break; case PA_SINK_IDLE: case PA_SINK_RUNNING: if (u->sink->thread_info.state == PA_SINK_INIT) { - do_trigger = TRUE; + do_trigger = true; quick = u->source && PA_SOURCE_IS_OPENED(u->source->thread_info.state); } @@ -696,15 +696,15 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse if (!u->source || u->source_suspended) { if (unsuspend(u) < 0) return -1; - quick = FALSE; + quick = false; } - do_trigger = TRUE; + do_trigger = true; u->out_mmap_current = 0; u->out_mmap_saved_nfrags = 0; - u->sink_suspended = FALSE; + u->sink_suspended = false; } break; @@ -732,7 +732,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t offset, pa_memchunk *chunk) { struct userdata *u = PA_SOURCE(o)->userdata; int ret; - int do_trigger = FALSE, quick = TRUE; + int do_trigger = false, quick = true; switch (code) { @@ -761,16 +761,16 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off return -1; } - do_trigger = TRUE; + do_trigger = true; - u->source_suspended = TRUE; + u->source_suspended = true; break; case PA_SOURCE_IDLE: case PA_SOURCE_RUNNING: if (u->source->thread_info.state == PA_SOURCE_INIT) { - do_trigger = TRUE; + do_trigger = true; quick = u->sink && PA_SINK_IS_OPENED(u->sink->thread_info.state); } @@ -779,15 +779,15 @@ static int source_process_msg(pa_msgobject *o, int code, void *data, int64_t off if (!u->sink || u->sink_suspended) { if (unsuspend(u) < 0) return -1; - quick = FALSE; + quick = false; } - do_trigger = TRUE; + do_trigger = true; u->in_mmap_current = 0; u->in_mmap_saved_nfrags = 0; - u->source_suspended = FALSE; + u->source_suspended = false; } break; @@ -921,7 +921,7 @@ static void thread_func(void *userdata) { } else { ssize_t l; - pa_bool_t loop = FALSE, work_done = FALSE; + bool loop = false, work_done = false; l = (ssize_t) u->out_fragment_size; @@ -930,14 +930,14 @@ static void thread_func(void *userdata) { if (ioctl(u->fd, SNDCTL_DSP_GETOSPACE, &info) < 0) { pa_log_info("Device doesn't support SNDCTL_DSP_GETOSPACE: %s", pa_cstrerror(errno)); - u->use_getospace = FALSE; + u->use_getospace = false; } else { l = info.bytes; /* We loop only if GETOSPACE worked and we * actually *know* that we can write more than * one fragment at a time */ - loop = TRUE; + loop = true; } } @@ -952,7 +952,7 @@ static void thread_func(void *userdata) { * avoid spinning forever. */ if (l <= 0 && (revents & POLLOUT)) { l = (ssize_t) u->out_fragment_size; - loop = FALSE; + loop = false; } while (l > 0) { @@ -1001,7 +1001,7 @@ static void thread_func(void *userdata) { l -= t; revents &= ~POLLOUT; - work_done = TRUE; + work_done = true; } if (!loop) @@ -1032,7 +1032,7 @@ static void thread_func(void *userdata) { void *p; ssize_t l; pa_memchunk memchunk; - pa_bool_t loop = FALSE, work_done = FALSE; + bool loop = false, work_done = false; l = (ssize_t) u->in_fragment_size; @@ -1041,10 +1041,10 @@ static void thread_func(void *userdata) { if (ioctl(u->fd, SNDCTL_DSP_GETISPACE, &info) < 0) { pa_log_info("Device doesn't support SNDCTL_DSP_GETISPACE: %s", pa_cstrerror(errno)); - u->use_getispace = FALSE; + u->use_getispace = false; } else { l = info.bytes; - loop = TRUE; + loop = true; } } @@ -1052,7 +1052,7 @@ static void thread_func(void *userdata) { if (l <= 0 && (revents & POLLIN)) { l = (ssize_t) u->in_fragment_size; - loop = FALSE; + loop = false; } while (l > 0) { @@ -1105,7 +1105,7 @@ static void thread_func(void *userdata) { l -= t; revents &= ~POLLIN; - work_done = TRUE; + work_done = true; } if (!loop) @@ -1131,7 +1131,7 @@ static void thread_func(void *userdata) { } /* Hmm, nothing to do. Let's sleep */ - if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) + if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) goto fail; if (ret == 0) @@ -1170,13 +1170,13 @@ int pa__init(pa_module*m) { int fd = -1; int nfrags, orig_frag_size, frag_size; int mode, caps; - pa_bool_t record = TRUE, playback = TRUE, use_mmap = TRUE; + bool record = true, playback = true, use_mmap = true; pa_sample_spec ss; pa_channel_map map; pa_modargs *ma = NULL; char hwdesc[64]; const char *name; - pa_bool_t namereg_fail; + bool namereg_fail; pa_sink_new_data sink_new_data; pa_source_new_data source_new_data; @@ -1226,12 +1226,12 @@ int pa__init(pa_module*m) { if (use_mmap && (!(caps & DSP_CAP_MMAP) || !(caps & DSP_CAP_TRIGGER))) { pa_log_info("OSS device not mmap capable, falling back to UNIX read/write mode."); - use_mmap = FALSE; + use_mmap = false; } if (use_mmap && mode == O_WRONLY) { pa_log_info("Device opened for playback only, cannot do memory mapping, falling back to UNIX write() mode."); - use_mmap = FALSE; + use_mmap = false; } if (pa_oss_get_hw_description(dev, hwdesc, sizeof(hwdesc)) >= 0) @@ -1262,8 +1262,8 @@ int pa__init(pa_module*m) { u->fd = fd; u->mixer_fd = -1; u->mixer_devmask = 0; - u->use_getospace = u->use_getispace = TRUE; - u->use_getodelay = TRUE; + u->use_getospace = u->use_getispace = true; + u->use_getodelay = true; u->mode = mode; u->frame_size = pa_frame_size(&ss); u->device_name = pa_xstrdup(dev); @@ -1280,14 +1280,14 @@ int pa__init(pa_module*m) { pa_log_info("Input -- %u fragments of size %u.", info.fragstotal, info.fragsize); u->in_fragment_size = (uint32_t) info.fragsize; u->in_nfrags = (uint32_t) info.fragstotal; - u->use_getispace = TRUE; + u->use_getispace = true; } if (ioctl(fd, SNDCTL_DSP_GETOSPACE, &info) >= 0) { pa_log_info("Output -- %u fragments of size %u.", info.fragstotal, info.fragsize); u->out_fragment_size = (uint32_t) info.fragsize; u->out_nfrags = (uint32_t) info.fragstotal; - u->use_getospace = TRUE; + u->use_getospace = true; } u->in_hwbuf_size = u->in_nfrags * u->in_fragment_size; @@ -1299,17 +1299,17 @@ int pa__init(pa_module*m) { if (use_mmap) { if ((u->in_mmap = mmap(NULL, u->in_hwbuf_size, PROT_READ, MAP_SHARED, fd, 0)) == MAP_FAILED) { pa_log_warn("mmap(PROT_READ) failed, reverting to non-mmap mode: %s", pa_cstrerror(errno)); - use_mmap = u->use_mmap = FALSE; + use_mmap = u->use_mmap = false; u->in_mmap = NULL; } else pa_log_debug("Successfully mmap()ed input buffer."); } if ((name = pa_modargs_get_value(ma, "source_name", NULL))) - namereg_fail = TRUE; + namereg_fail = true; else { name = name_buf = pa_sprintf_malloc("oss_input.%s", pa_path_get_filename(dev)); - namereg_fail = FALSE; + namereg_fail = false; } pa_source_new_data_init(&source_new_data); @@ -1347,7 +1347,7 @@ int pa__init(pa_module*m) { pa_source_set_asyncmsgq(u->source, u->thread_mq.inq); pa_source_set_rtpoll(u->source, u->rtpoll); pa_source_set_fixed_latency(u->source, pa_bytes_to_usec(u->in_hwbuf_size, &u->source->sample_spec)); - u->source->refresh_volume = TRUE; + u->source->refresh_volume = true; if (use_mmap) u->in_mmap_memblocks = pa_xnew0(pa_memblock*, u->in_nfrags); @@ -1364,7 +1364,7 @@ int pa__init(pa_module*m) { goto go_on; } else { pa_log_warn("mmap(PROT_WRITE) failed, reverting to non-mmap mode: %s", pa_cstrerror(errno)); - u->use_mmap = use_mmap = FALSE; + u->use_mmap = use_mmap = false; u->out_mmap = NULL; } } else { @@ -1374,10 +1374,10 @@ int pa__init(pa_module*m) { } if ((name = pa_modargs_get_value(ma, "sink_name", NULL))) - namereg_fail = TRUE; + namereg_fail = true; else { name = name_buf = pa_sprintf_malloc("oss_output.%s", pa_path_get_filename(dev)); - namereg_fail = FALSE; + namereg_fail = false; } pa_sink_new_data_init(&sink_new_data); @@ -1415,7 +1415,7 @@ int pa__init(pa_module*m) { pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq); pa_sink_set_rtpoll(u->sink, u->rtpoll); pa_sink_set_fixed_latency(u->sink, pa_bytes_to_usec(u->out_hwbuf_size, &u->sink->sample_spec)); - u->sink->refresh_volume = TRUE; + u->sink->refresh_volume = true; pa_sink_set_max_request(u->sink, u->out_hwbuf_size); @@ -1424,7 +1424,7 @@ int pa__init(pa_module*m) { } if ((u->mixer_fd = pa_oss_open_mixer_for_device(u->device_name)) >= 0) { - pa_bool_t do_close = TRUE; + bool do_close = true; if (ioctl(fd, SOUND_MIXER_READ_DEVMASK, &u->mixer_devmask) < 0) pa_log_warn("SOUND_MIXER_READ_DEVMASK failed: %s", pa_cstrerror(errno)); @@ -1434,7 +1434,7 @@ int pa__init(pa_module*m) { pa_sink_set_get_volume_callback(u->sink, sink_get_volume); pa_sink_set_set_volume_callback(u->sink, sink_set_volume); u->sink->n_volume_steps = 101; - do_close = FALSE; + do_close = false; } if (u->source && (u->mixer_devmask & (SOUND_MASK_RECLEV|SOUND_MASK_IGAIN))) { @@ -1442,7 +1442,7 @@ int pa__init(pa_module*m) { pa_source_set_get_volume_callback(u->source, source_get_volume); pa_source_set_set_volume_callback(u->source, source_set_volume); u->source->n_volume_steps = 101; - do_close = FALSE; + do_close = false; } } diff --git a/src/modules/raop/module-raop-discover.c b/src/modules/raop/module-raop-discover.c index 3db2c0e42..c7efe9a5a 100644 --- a/src/modules/raop/module-raop-discover.c +++ b/src/modules/raop/module-raop-discover.c @@ -50,7 +50,7 @@ PA_MODULE_AUTHOR("Colin Guthrie"); PA_MODULE_DESCRIPTION("mDNS/DNS-SD Service Discovery of RAOP devices"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(TRUE); +PA_MODULE_LOAD_ONCE(true); #define SERVICE_TYPE_SINK "_raop._tcp" @@ -256,7 +256,7 @@ static void browser_cb( struct tunnel *t2; if ((t2 = pa_hashmap_get(u->tunnels, t))) { - pa_module_unload_request_by_index(u->core, t2->module_index, TRUE); + pa_module_unload_request_by_index(u->core, t2->module_index, true); pa_hashmap_remove(u->tunnels, t2); tunnel_free(t2); } @@ -289,7 +289,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda browser_cb, u))) { pa_log("avahi_service_browser_new() failed: %s", avahi_strerror(avahi_client_errno(c))); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } } @@ -303,7 +303,7 @@ static void client_callback(AvahiClient *c, AvahiClientState state, void *userda if (!(u->client = avahi_client_new(u->avahi_poll, AVAHI_CLIENT_NO_FAIL, client_callback, u, &error))) { pa_log("avahi_client_new() failed: %s", avahi_strerror(error)); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } } @@ -377,7 +377,7 @@ void pa__done(pa_module*m) { struct tunnel *t; while ((t = pa_hashmap_steal_first(u->tunnels))) { - pa_module_unload_request_by_index(u->core, t->module_index, TRUE); + pa_module_unload_request_by_index(u->core, t->module_index, true); tunnel_free(t); } diff --git a/src/modules/raop/module-raop-sink.c b/src/modules/raop/module-raop-sink.c index 1816fee91..13d0c3bc8 100644 --- a/src/modules/raop/module-raop-sink.c +++ b/src/modules/raop/module-raop-sink.c @@ -63,7 +63,7 @@ PA_MODULE_AUTHOR("Colin Guthrie"); PA_MODULE_DESCRIPTION("RAOP Sink"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "sink_name=<name for the sink> " "sink_properties=<properties for the sink> " @@ -186,7 +186,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse case PA_SINK_RUNNING: if (u->sink->thread_info.state == PA_SINK_SUSPENDED) { - pa_smoother_resume(u->smoother, pa_rtclock_now(), TRUE); + pa_smoother_resume(u->smoother, pa_rtclock_now(), true); /* The connection can be closed when idle, so check to see if we need to reestablish it */ @@ -253,7 +253,7 @@ static int sink_process_msg(pa_msgobject *o, int code, void *data, int64_t offse /* Question: is this valid here: or should we do some sort of: return pa_sink_process_msg(PA_MSGOBJECT(u->core), PA_CORE_MESSAGE_UNLOAD_MODULE, u->module, 0, NULL); ?? */ - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } return 0; } @@ -465,7 +465,7 @@ static void thread_func(void *userdata) { pollfd->events = POLLOUT; /*PA_SINK_IS_OPENED(u->sink->thread_info.state) ? POLLOUT : 0;*/ } - if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) + if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) goto fail; if (ret == 0) @@ -537,11 +537,11 @@ int pa__init(pa_module*m) { u->smoother = pa_smoother_new( PA_USEC_PER_SEC, PA_USEC_PER_SEC*2, - TRUE, - TRUE, + true, + true, 10, 0, - FALSE); + false); pa_memchunk_reset(&u->raw_memchunk); pa_memchunk_reset(&u->encoded_memchunk); u->offset = 0; diff --git a/src/modules/raop/raop_client.c b/src/modules/raop/raop_client.c index 2c2aa1958..98a98224a 100644 --- a/src/modules/raop/raop_client.c +++ b/src/modules/raop/raop_client.c @@ -221,7 +221,7 @@ static void on_connection(pa_socket_client *sc, pa_iochannel *io, void *userdata c->fd = pa_iochannel_get_send_fd(io); - pa_iochannel_set_noclose(io, TRUE); + pa_iochannel_set_noclose(io, true); pa_iochannel_free(io); pa_make_tcp_socket_low_delay(c->fd); @@ -323,7 +323,7 @@ static void rtsp_cb(pa_rtsp_client *rtsp, pa_rtsp_state state, pa_headerlist* he uint32_t port = pa_rtsp_serverport(c->rtsp); pa_log_debug("RAOP: RECORDED"); - if (!(c->sc = pa_socket_client_new_string(c->core->mainloop, TRUE, c->host, port))) { + if (!(c->sc = pa_socket_client_new_string(c->core->mainloop, true, c->host, port))) { pa_log("failed to connect to server '%s:%d'", c->host, port); return; } diff --git a/src/modules/reserve-wrap.c b/src/modules/reserve-wrap.c index 1411d272d..9c69d59c2 100644 --- a/src/modules/reserve-wrap.c +++ b/src/modules/reserve-wrap.c @@ -331,7 +331,7 @@ pa_hook* pa_reserve_monitor_wrapper_hook(pa_reserve_monitor_wrapper *w) { return &w->hook; } -pa_bool_t pa_reserve_monitor_wrapper_busy(pa_reserve_monitor_wrapper *w) { +bool pa_reserve_monitor_wrapper_busy(pa_reserve_monitor_wrapper *w) { pa_assert(w); pa_assert(PA_REFCNT_VALUE(w) >= 1); @@ -339,6 +339,6 @@ pa_bool_t pa_reserve_monitor_wrapper_busy(pa_reserve_monitor_wrapper *w) { #ifdef HAVE_DBUS return rm_busy(w->monitor) > 0; #else - return FALSE; + return false; #endif } diff --git a/src/modules/reserve-wrap.h b/src/modules/reserve-wrap.h index 2de6c0933..6c52ed8f4 100644 --- a/src/modules/reserve-wrap.h +++ b/src/modules/reserve-wrap.h @@ -40,6 +40,6 @@ pa_reserve_monitor_wrapper* pa_reserve_monitor_wrapper_get(pa_core *c, const cha void pa_reserve_monitor_wrapper_unref(pa_reserve_monitor_wrapper *m); pa_hook* pa_reserve_monitor_wrapper_hook(pa_reserve_monitor_wrapper *m); -pa_bool_t pa_reserve_monitor_wrapper_busy(pa_reserve_monitor_wrapper *m); +bool pa_reserve_monitor_wrapper_busy(pa_reserve_monitor_wrapper *m); #endif diff --git a/src/modules/rtp/headerlist.c b/src/modules/rtp/headerlist.c index 300751855..9e95e3c91 100644 --- a/src/modules/rtp/headerlist.c +++ b/src/modules/rtp/headerlist.c @@ -61,7 +61,7 @@ void pa_headerlist_free(pa_headerlist* p) { int pa_headerlist_puts(pa_headerlist *p, const char *key, const char *value) { struct header *hdr; - pa_bool_t add = FALSE; + bool add = false; pa_assert(p); pa_assert(key); @@ -69,7 +69,7 @@ int pa_headerlist_puts(pa_headerlist *p, const char *key, const char *value) { if (!(hdr = pa_hashmap_get(MAKE_HASHMAP(p), key))) { hdr = pa_xnew(struct header, 1); hdr->key = pa_xstrdup(key); - add = TRUE; + add = true; } else pa_xfree(hdr->value); @@ -84,7 +84,7 @@ int pa_headerlist_puts(pa_headerlist *p, const char *key, const char *value) { int pa_headerlist_putsappend(pa_headerlist *p, const char *key, const char *value) { struct header *hdr; - pa_bool_t add = FALSE; + bool add = false; pa_assert(p); pa_assert(key); @@ -93,7 +93,7 @@ int pa_headerlist_putsappend(pa_headerlist *p, const char *key, const char *valu hdr = pa_xnew(struct header, 1); hdr->key = pa_xstrdup(key); hdr->value = pa_xstrdup(value); - add = TRUE; + add = true; } else { void *newval = pa_sprintf_malloc("%s%s", (char*)hdr->value, value); pa_xfree(hdr->value); diff --git a/src/modules/rtp/module-rtp-recv.c b/src/modules/rtp/module-rtp-recv.c index 45d03f5d0..7ff2c7521 100644 --- a/src/modules/rtp/module-rtp-recv.c +++ b/src/modules/rtp/module-rtp-recv.c @@ -64,7 +64,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Receive data from a network via RTP/SAP/SDP"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "sink=<name of the sink> " "sap_address=<multicast address to listen on> " @@ -91,7 +91,7 @@ struct session { pa_sink_input *sink_input; pa_memblockq *memblockq; - pa_bool_t first_packet; + bool first_packet; uint32_t ssrc; uint32_t offset; @@ -191,7 +191,7 @@ static void sink_input_kill(pa_sink_input* i) { } /* Called from IO context */ -static void sink_input_suspend_within_thread(pa_sink_input* i, pa_bool_t b) { +static void sink_input_suspend_within_thread(pa_sink_input* i, bool b) { struct session *s; pa_sink_input_assert_ref(i); pa_assert_se(s = i->userdata); @@ -199,7 +199,7 @@ static void sink_input_suspend_within_thread(pa_sink_input* i, pa_bool_t b) { if (b) pa_memblockq_flush_read(s->memblockq); else - s->first_packet = FALSE; + s->first_packet = false; } /* Called from I/O thread context */ @@ -234,7 +234,7 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) { } if (!s->first_packet) { - s->first_packet = TRUE; + s->first_packet = true; s->ssrc = s->rtp_context.ssrc; s->offset = s->rtp_context.timestamp; @@ -257,7 +257,7 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) { else delta = j; - pa_memblockq_seek(s->memblockq, delta * (int64_t) s->rtp_context.frame_size, PA_SEEK_RELATIVE, TRUE); + pa_memblockq_seek(s->memblockq, delta * (int64_t) s->rtp_context.frame_size, PA_SEEK_RELATIVE, true); if (now.tv_sec == 0) { PA_ONCE_BEGIN { @@ -269,7 +269,7 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) { if (pa_memblockq_push(s->memblockq, &chunk) < 0) { pa_log_warn("Queue overrun"); - pa_memblockq_seek(s->memblockq, (int64_t) chunk.length, PA_SEEK_RELATIVE, TRUE); + pa_memblockq_seek(s->memblockq, (int64_t) chunk.length, PA_SEEK_RELATIVE, true); } /* pa_log("blocks in q: %u", pa_memblockq_get_nblocks(s->memblockq)); */ @@ -378,7 +378,7 @@ static int rtpoll_work_cb(pa_rtpoll_item *i) { pa_log_debug("Requesting rewind due to end of underrun"); pa_sink_input_request_rewind(s->sink_input, (size_t) (s->sink_input->thread_info.underrun_for == (uint64_t) -1 ? 0 : s->sink_input->thread_info.underrun_for), - FALSE, TRUE, FALSE); + false, true, false); } return 1; @@ -505,7 +505,7 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in s = pa_xnew0(struct session, 1); s->userdata = u; - s->first_packet = FALSE; + s->first_packet = false; s->sdp_info = *sdp_info; s->rtpoll_item = NULL; s->intended_latency = LATENCY_USEC; @@ -519,7 +519,7 @@ static struct session *session_new(struct userdata *u, const pa_sdp_info *sdp_in goto fail; pa_sink_input_new_data_init(&data); - pa_sink_input_new_data_set_sink(&data, sink, FALSE); + pa_sink_input_new_data_set_sink(&data, sink, false); data.driver = __FILE__; pa_proplist_sets(data.proplist, PA_PROP_MEDIA_ROLE, "stream"); pa_proplist_setf(data.proplist, PA_PROP_MEDIA_NAME, @@ -617,7 +617,7 @@ static void session_free(struct session *s) { static void sap_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event_flags_t flags, void *userdata) { struct userdata *u = userdata; - pa_bool_t goodbye = FALSE; + bool goodbye = false; pa_sdp_info info; struct session *s; diff --git a/src/modules/rtp/module-rtp-send.c b/src/modules/rtp/module-rtp-send.c index acabcf5bf..7f052778d 100644 --- a/src/modules/rtp/module-rtp-send.c +++ b/src/modules/rtp/module-rtp-send.c @@ -57,7 +57,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Read data from source and send it to the network via RTP/SAP/SDP"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "source=<name of the source> " "format=<sample format> " @@ -145,7 +145,7 @@ static void source_output_kill(pa_source_output* o) { pa_source_output_assert_ref(o); pa_assert_se(u = o->userdata); - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); pa_source_output_unlink(u->source_output); pa_source_output_unref(u->source_output); @@ -187,7 +187,7 @@ int pa__init(pa_module*m) { int r, j; socklen_t k; char hn[128], *n; - pa_bool_t loop = FALSE; + bool loop = false; pa_source_output_new_data data; pa_assert(m); @@ -368,7 +368,7 @@ int pa__init(pa_module*m) { pa_proplist_setf(data.proplist, "rtp.ttl", "%lu", (unsigned long) ttl); data.driver = __FILE__; data.module = m; - pa_source_output_new_data_set_source(&data, s, FALSE); + pa_source_output_new_data_set_source(&data, s, false); pa_source_output_new_data_set_sample_spec(&data, &ss); pa_source_output_new_data_set_channel_map(&data, &cm); data.flags = PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND; diff --git a/src/modules/rtp/rtp.c b/src/modules/rtp/rtp.c index 91954939b..570737e44 100644 --- a/src/modules/rtp/rtp.c +++ b/src/modules/rtp/rtp.c @@ -170,7 +170,7 @@ int pa_rtp_recv(pa_rtp_context *c, pa_memchunk *chunk, pa_mempool *pool, struct unsigned cc; ssize_t r; uint8_t aux[1024]; - pa_bool_t found_tstamp = FALSE; + bool found_tstamp = false; pa_assert(c); pa_assert(chunk); @@ -280,7 +280,7 @@ int pa_rtp_recv(pa_rtp_context *c, pa_memchunk *chunk, pa_mempool *pool, struct for (cm = CMSG_FIRSTHDR(&m); cm; cm = CMSG_NXTHDR(&m, cm)) if (cm->cmsg_level == SOL_SOCKET && cm->cmsg_type == SCM_TIMESTAMP) { memcpy(tstamp, CMSG_DATA(cm), sizeof(struct timeval)); - found_tstamp = TRUE; + found_tstamp = true; break; } diff --git a/src/modules/rtp/rtsp_client.c b/src/modules/rtp/rtsp_client.c index 50724391d..6edb0e476 100644 --- a/src/modules/rtp/rtsp_client.c +++ b/src/modules/rtp/rtsp_client.c @@ -329,7 +329,7 @@ int pa_rtsp_connect(pa_rtsp_client *c) { c->session = NULL; pa_log_debug("Attempting to connect to server '%s:%d'", c->hostname, c->port); - if (!(c->sc = pa_socket_client_new_string(c->mainloop, TRUE, c->hostname, c->port))) { + if (!(c->sc = pa_socket_client_new_string(c->mainloop, true, c->hostname, c->port))) { pa_log("failed to connect to server '%s:%d'", c->hostname, c->port); return -1; } diff --git a/src/modules/rtp/sap.c b/src/modules/rtp/sap.c index f02d53fb0..80a4a5d4b 100644 --- a/src/modules/rtp/sap.c +++ b/src/modules/rtp/sap.c @@ -72,7 +72,7 @@ void pa_sap_context_destroy(pa_sap_context *c) { pa_xfree(c->sdp_data); } -int pa_sap_send(pa_sap_context *c, pa_bool_t goodbye) { +int pa_sap_send(pa_sap_context *c, bool goodbye) { uint32_t header; struct sockaddr_storage sa_buf; struct sockaddr *sa = (struct sockaddr*) &sa_buf; @@ -141,7 +141,7 @@ pa_sap_context* pa_sap_context_init_recv(pa_sap_context *c, int fd) { return c; } -int pa_sap_recv(pa_sap_context *c, pa_bool_t *goodbye) { +int pa_sap_recv(pa_sap_context *c, bool *goodbye) { struct msghdr m; struct iovec iov; int size; diff --git a/src/modules/rtp/sap.h b/src/modules/rtp/sap.h index ae4ad4266..e7f7182cb 100644 --- a/src/modules/rtp/sap.h +++ b/src/modules/rtp/sap.h @@ -38,9 +38,9 @@ typedef struct pa_sap_context { pa_sap_context* pa_sap_context_init_send(pa_sap_context *c, int fd, char *sdp_data); void pa_sap_context_destroy(pa_sap_context *c); -int pa_sap_send(pa_sap_context *c, pa_bool_t goodbye); +int pa_sap_send(pa_sap_context *c, bool goodbye); pa_sap_context* pa_sap_context_init_recv(pa_sap_context *c, int fd); -int pa_sap_recv(pa_sap_context *c, pa_bool_t *goodbye); +int pa_sap_recv(pa_sap_context *c, bool *goodbye); #endif diff --git a/src/modules/rtp/sdp.c b/src/modules/rtp/sdp.c index 3e61d9b83..e47a41b2e 100644 --- a/src/modules/rtp/sdp.c +++ b/src/modules/rtp/sdp.c @@ -120,7 +120,7 @@ static pa_sample_spec *parse_sdp_sample_spec(pa_sample_spec *ss, char *c) { pa_sdp_info *pa_sdp_parse(const char *t, pa_sdp_info *i, int is_goodbye) { uint16_t port = 0; - pa_bool_t ss_valid = FALSE; + bool ss_valid = false; pa_assert(t); pa_assert(i); @@ -207,7 +207,7 @@ pa_sdp_info *pa_sdp_parse(const char *t, pa_sdp_info *i, int is_goodbye) { i->payload = (uint8_t) _payload; if (pa_rtp_sample_spec_from_payload(i->payload, &i->sample_spec)) - ss_valid = TRUE; + ss_valid = true; } } } else if (pa_startswith(t, "a=rtpmap:")) { @@ -227,7 +227,7 @@ pa_sdp_info *pa_sdp_parse(const char *t, pa_sdp_info *i, int is_goodbye) { c[strcspn(c, "\n")] = 0; if (parse_sdp_sample_spec(&i->sample_spec, c)) - ss_valid = TRUE; + ss_valid = true; } } } diff --git a/src/modules/x11/module-x11-bell.c b/src/modules/x11/module-x11-bell.c index 37ab2e78b..001732bad 100644 --- a/src/modules/x11/module-x11-bell.c +++ b/src/modules/x11/module-x11-bell.c @@ -41,7 +41,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("X11 bell interceptor"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE("sink=<sink to connect to> sample=<sample name> display=<X11 display>"); static const char* const valid_modargs[] = { @@ -102,7 +102,7 @@ static void x11_kill_cb(pa_x11_wrapper *w, void *userdata) { u->x11_client = NULL; u->x11_wrapper = NULL; - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } int pa__init(pa_module*m) { diff --git a/src/modules/x11/module-x11-cork-request.c b/src/modules/x11/module-x11-cork-request.c index 0e67db00c..5bd3c6c3f 100644 --- a/src/modules/x11/module-x11-cork-request.c +++ b/src/modules/x11/module-x11-cork-request.c @@ -45,7 +45,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("Synthesize X11 media key events when cork/uncork is requested"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE("display=<X11 display>"); static const char* const valid_modargs[] = { @@ -79,7 +79,7 @@ static void x11_kill_cb(pa_x11_wrapper *w, void *userdata) { u->x11_wrapper = NULL; } - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } static pa_hook_result_t sink_input_send_event_hook_cb( diff --git a/src/modules/x11/module-x11-publish.c b/src/modules/x11/module-x11-publish.c index 16ea977ed..cae8e3a50 100644 --- a/src/modules/x11/module-x11-publish.c +++ b/src/modules/x11/module-x11-publish.c @@ -48,7 +48,7 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("X11 credential publisher"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "display=<X11 display> " "sink=<Sink to publish> " @@ -128,7 +128,7 @@ static void x11_kill_cb(pa_x11_wrapper *w, void *userdata) { u->x11_client = NULL; u->x11_wrapper = NULL; - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } int pa__init(pa_module*m) { @@ -157,7 +157,7 @@ int pa__init(pa_module*m) { u->hook_slot = pa_hook_connect(&pa_native_protocol_hooks(u->protocol)[PA_NATIVE_HOOK_SERVERS_CHANGED], PA_HOOK_NORMAL, servers_changed_cb, u); - if (!(u->auth_cookie = pa_auth_cookie_get(m->core, pa_modargs_get_value(ma, "cookie", PA_NATIVE_COOKIE_FILE), TRUE, PA_NATIVE_COOKIE_LENGTH))) + if (!(u->auth_cookie = pa_auth_cookie_get(m->core, pa_modargs_get_value(ma, "cookie", PA_NATIVE_COOKIE_FILE), true, PA_NATIVE_COOKIE_LENGTH))) goto fail; if (!(u->x11_wrapper = pa_x11_wrapper_get(m->core, pa_modargs_get_value(ma, "display", NULL)))) diff --git a/src/modules/x11/module-x11-xsmp.c b/src/modules/x11/module-x11-xsmp.c index 5cce47d84..63401e5b3 100644 --- a/src/modules/x11/module-x11-xsmp.c +++ b/src/modules/x11/module-x11-xsmp.c @@ -42,10 +42,10 @@ PA_MODULE_AUTHOR("Lennart Poettering"); PA_MODULE_DESCRIPTION("X11 session management"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE("session_manager=<session manager string> display=<X11 display>"); -static pa_bool_t ice_in_use = FALSE; +static bool ice_in_use = false; static const char* const valid_modargs[] = { "session_manager", @@ -72,7 +72,7 @@ static void die_cb(SmcConn connection, SmPointer client_data) { pa_x11_wrapper_unref(u->x11); u->x11 = NULL; - pa_module_unload_request(u->module, TRUE); + pa_module_unload_request(u->module, true); } static void save_complete_cb(SmcConn connection, SmPointer client_data) { @@ -129,7 +129,7 @@ int pa__init(pa_module*m) { } IceAddConnectionWatch(new_ice_connection, m->core); - ice_in_use = TRUE; + ice_in_use = true; m->userdata = u = pa_xnew(struct userdata, 1); u->core = m->core; @@ -244,6 +244,6 @@ void pa__done(pa_module*m) { if (ice_in_use) { IceRemoveConnectionWatch(new_ice_connection, m->core); - ice_in_use = FALSE; + ice_in_use = false; } } diff --git a/src/modules/xen/module-xenpv-sink.c b/src/modules/xen/module-xenpv-sink.c index 2d4879f97..9dbd660f6 100644 --- a/src/modules/xen/module-xenpv-sink.c +++ b/src/modules/xen/module-xenpv-sink.c @@ -60,7 +60,7 @@ PA_MODULE_AUTHOR("Giorgos Boutsioukis"); PA_MODULE_DESCRIPTION("Xen PV audio sink"); PA_MODULE_VERSION(PACKAGE_VERSION); -PA_MODULE_LOAD_ONCE(FALSE); +PA_MODULE_LOAD_ONCE(false); PA_MODULE_USAGE( "sink_name=<name for the sink> " "sink_properties=<properties for the sink> " @@ -353,7 +353,7 @@ static void thread_func(void *userdata) { pollfd->events = (short) (u->sink->thread_info.state == PA_SINK_RUNNING ? POLLOUT : 0); - if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0) + if ((ret = pa_rtpoll_run(u->rtpoll, true)) < 0) goto fail; if (ret == 0) diff --git a/src/pulse/channelmap.c b/src/pulse/channelmap.c index f635cc17e..fec062385 100644 --- a/src/pulse/channelmap.c +++ b/src/pulse/channelmap.c @@ -470,7 +470,7 @@ int pa_channel_map_equal(const pa_channel_map *a, const pa_channel_map *b) { char* pa_channel_map_snprint(char *s, size_t l, const pa_channel_map *map) { unsigned channel; - pa_bool_t first = TRUE; + bool first = true; char *e; pa_assert(s); @@ -492,7 +492,7 @@ char* pa_channel_map_snprint(char *s, size_t l, const pa_channel_map *map) { pa_channel_position_to_string(map->map[channel])); e = strchr(e, 0); - first = FALSE; + first = false; } return s; @@ -693,7 +693,7 @@ const char* pa_channel_map_to_name(const pa_channel_map *map) { memset(in_map, 0, sizeof(in_map)); for (c = 0; c < map->channels; c++) - pa_bitset_set(in_map, map->map[c], TRUE); + pa_bitset_set(in_map, map->map[c], true); if (pa_bitset_equals(in_map, PA_CHANNEL_POSITION_MAX, PA_CHANNEL_POSITION_MONO, -1)) @@ -747,7 +747,7 @@ const char* pa_channel_map_to_pretty_name(const pa_channel_map *map) { memset(in_map, 0, sizeof(in_map)); for (c = 0; c < map->channels; c++) - pa_bitset_set(in_map, map->map[c], TRUE); + pa_bitset_set(in_map, map->map[c], true); pa_init_i18n(); diff --git a/src/pulse/channelmap.h b/src/pulse/channelmap.h index 97e919d40..da46556f3 100644 --- a/src/pulse/channelmap.h +++ b/src/pulse/channelmap.h @@ -351,7 +351,7 @@ mapping, i.e.\ "Stereo", "Surround 7.1" and so on. If the channel mapping is unknown NULL will be returned. \since 0.9.15 */ const char* pa_channel_map_to_pretty_name(const pa_channel_map *map) PA_GCC_PURE; -/** Returns TRUE if the specified channel position is available at +/** Returns true if the specified channel position is available at * least once in the channel map. \since 0.9.16 */ int pa_channel_map_has_position(const pa_channel_map *map, pa_channel_position_t p) PA_GCC_PURE; diff --git a/src/pulse/client-conf-x11.c b/src/pulse/client-conf-x11.c index 76b9f6fbb..99265c557 100644 --- a/src/pulse/client-conf-x11.c +++ b/src/pulse/client-conf-x11.c @@ -61,7 +61,7 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) { } if (pa_x11_get_prop(xcb, screen, "PULSE_SERVER", t, sizeof(t))) { - pa_bool_t disable_autospawn = TRUE; + bool disable_autospawn = true; pa_xfree(c->default_server); c->default_server = pa_xstrdup(t); @@ -71,13 +71,13 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) { if ((id = pa_session_id())) { if (pa_streq(t, id)) - disable_autospawn = FALSE; + disable_autospawn = false; pa_xfree(id); } } if (disable_autospawn) - c->autospawn = FALSE; + c->autospawn = false; } if (pa_x11_get_prop(xcb, screen, "PULSE_SINK", t, sizeof(t))) { @@ -101,7 +101,7 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) { pa_assert(sizeof(cookie) == sizeof(c->cookie)); memcpy(c->cookie, cookie, sizeof(cookie)); - c->cookie_valid = TRUE; + c->cookie_valid = true; pa_xfree(c->cookie_file); c->cookie_file = NULL; diff --git a/src/pulse/client-conf.c b/src/pulse/client-conf.c index 8988dafd5..8301981ba 100644 --- a/src/pulse/client-conf.c +++ b/src/pulse/client-conf.c @@ -57,13 +57,13 @@ static const pa_client_conf default_conf = { .default_source = NULL, .default_server = NULL, .default_dbus_server = NULL, - .autospawn = TRUE, - .disable_shm = FALSE, + .autospawn = true, + .disable_shm = false, .cookie_file = NULL, - .cookie_valid = FALSE, + .cookie_valid = false, .shm_size = 0, - .auto_connect_localhost = FALSE, - .auto_connect_display = FALSE + .auto_connect_localhost = false, + .auto_connect_display = false }; pa_client_conf *pa_client_conf_new(void) { @@ -159,7 +159,7 @@ int pa_client_conf_env(pa_client_conf *c) { c->default_server = pa_xstrdup(e); /* We disable autospawning automatically if a specific server was set */ - c->autospawn = FALSE; + c->autospawn = false; } if ((e = getenv(ENV_DAEMON_BINARY))) { @@ -182,24 +182,24 @@ int pa_client_conf_load_cookie(pa_client_conf* c) { pa_assert(c); - c->cookie_valid = FALSE; + c->cookie_valid = false; if (c->cookie_file) - k = pa_authkey_load_auto(c->cookie_file, TRUE, c->cookie, sizeof(c->cookie)); + k = pa_authkey_load_auto(c->cookie_file, true, c->cookie, sizeof(c->cookie)); else { - k = pa_authkey_load_auto(PA_NATIVE_COOKIE_FILE, FALSE, c->cookie, sizeof(c->cookie)); + k = pa_authkey_load_auto(PA_NATIVE_COOKIE_FILE, false, c->cookie, sizeof(c->cookie)); if (k < 0) { - k = pa_authkey_load_auto(PA_NATIVE_COOKIE_FILE_FALLBACK, FALSE, c->cookie, sizeof(c->cookie)); + k = pa_authkey_load_auto(PA_NATIVE_COOKIE_FILE_FALLBACK, false, c->cookie, sizeof(c->cookie)); if (k < 0) - k = pa_authkey_load_auto(PA_NATIVE_COOKIE_FILE, TRUE, c->cookie, sizeof(c->cookie)); + k = pa_authkey_load_auto(PA_NATIVE_COOKIE_FILE, true, c->cookie, sizeof(c->cookie)); } } if (k < 0) return k; - c->cookie_valid = TRUE; + c->cookie_valid = true; return 0; } diff --git a/src/pulse/client-conf.h b/src/pulse/client-conf.h index f281f4eba..9c509f7cc 100644 --- a/src/pulse/client-conf.h +++ b/src/pulse/client-conf.h @@ -29,9 +29,9 @@ typedef struct pa_client_conf { char *daemon_binary, *extra_arguments, *default_sink, *default_source, *default_server, *default_dbus_server, *cookie_file; - pa_bool_t autospawn, disable_shm, auto_connect_localhost, auto_connect_display; + bool autospawn, disable_shm, auto_connect_localhost, auto_connect_display; uint8_t cookie[PA_NATIVE_COOKIE_LENGTH]; - pa_bool_t cookie_valid; /* non-zero, when cookie is valid */ + bool cookie_valid; /* non-zero, when cookie is valid */ size_t shm_size; } pa_client_conf; diff --git a/src/pulse/context.c b/src/pulse/context.c index 11dac151b..1ba2672bc 100644 --- a/src/pulse/context.c +++ b/src/pulse/context.c @@ -175,7 +175,7 @@ pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char * if (!(c->mempool = pa_mempool_new(!c->conf->disable_shm, c->conf->shm_size))) { if (!c->conf->disable_shm) - c->mempool = pa_mempool_new(FALSE, c->conf->shm_size); + c->mempool = pa_mempool_new(false, c->conf->shm_size); if (!c->mempool) { context_free(c); @@ -353,10 +353,10 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o if ((s = pa_hashmap_get(c->record_streams, PA_UINT32_TO_PTR(channel)))) { if (chunk->memblock) { - pa_memblockq_seek(s->record_memblockq, offset, seek, TRUE); + pa_memblockq_seek(s->record_memblockq, offset, seek, true); pa_memblockq_push_align(s->record_memblockq, chunk); } else - pa_memblockq_seek(s->record_memblockq, offset+chunk->length, seek, TRUE); + pa_memblockq_seek(s->record_memblockq, offset+chunk->length, seek, true); if (s->read_callback) { size_t l; @@ -369,7 +369,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o pa_context_unref(c); } -int pa_context_handle_error(pa_context *c, uint32_t command, pa_tagstruct *t, pa_bool_t fail) { +int pa_context_handle_error(pa_context *c, uint32_t command, pa_tagstruct *t, bool fail) { uint32_t err; pa_assert(c); pa_assert(PA_REFCNT_VALUE(c) >= 1); @@ -418,14 +418,14 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t pa_context_ref(c); if (command != PA_COMMAND_REPLY) { - pa_context_handle_error(c, command, t, TRUE); + pa_context_handle_error(c, command, t, true); goto finish; } switch(c->state) { case PA_CONTEXT_AUTHORIZING: { pa_tagstruct *reply; - pa_bool_t shm_on_remote = FALSE; + bool shm_on_remote = false; if (pa_tagstruct_getu32(t, &c->version) < 0 || !pa_tagstruct_eof(t)) { @@ -452,7 +452,7 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t /* Enable shared memory support if possible */ if (c->do_shm) if (c->version < 10 || (c->version >= 13 && !shm_on_remote)) - c->do_shm = FALSE; + c->do_shm = false; if (c->do_shm) { @@ -463,7 +463,7 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t #ifdef HAVE_CREDS const pa_creds *creds; if (!(creds = pa_pdispatch_creds(pd)) || getuid() != creds->uid) - c->do_shm = FALSE; + c->do_shm = false; #endif } @@ -707,7 +707,7 @@ static void track_pulseaudio_on_dbus(pa_context *c, DBusBusType type, pa_dbus_wr pa_log_warn("Failed to add filter function"); goto fail; } - c->filter_added = TRUE; + c->filter_added = true; if (pa_dbus_add_matches( pa_dbus_wrap_connection_get(*conn), &error, @@ -751,7 +751,7 @@ static int try_next_connection(pa_context *c) { goto finish; /* Autospawn only once */ - c->do_autospawn = FALSE; + c->do_autospawn = false; /* Connect only to per-user sockets this time */ c->server_list = prepend_per_user(c->server_list); @@ -830,7 +830,7 @@ finish: #ifdef HAVE_DBUS static DBusHandlerResult filter_cb(DBusConnection *bus, DBusMessage *message, void *userdata) { pa_context *c = userdata; - pa_bool_t is_session; + bool is_session; pa_assert(bus); pa_assert(message); @@ -879,7 +879,7 @@ int pa_context_connect( PA_CHECK_VALIDITY(c, !server || *server, PA_ERR_INVALID); if (server) - c->conf->autospawn = FALSE; + c->conf->autospawn = false; else server = c->conf->default_server; @@ -932,7 +932,7 @@ int pa_context_connect( if (getuid() == 0) pa_log_debug("Not doing autospawn since we are root."); else { - c->do_autospawn = TRUE; + c->do_autospawn = true; if (api) c->spawn_api = *api; @@ -1088,7 +1088,7 @@ void pa_context_simple_ack_callback(pa_pdispatch *pd, uint32_t command, uint32_t goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; success = 0; diff --git a/src/pulse/ext-device-manager.c b/src/pulse/ext-device-manager.c index f2ea63a57..7fbb7de23 100644 --- a/src/pulse/ext-device-manager.c +++ b/src/pulse/ext-device-manager.c @@ -58,7 +58,7 @@ static void ext_device_manager_test_cb(pa_pdispatch *pd, uint32_t command, uint3 goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; } else if (pa_tagstruct_getu32(t, &version) < 0 || @@ -118,7 +118,7 @@ static void ext_device_manager_read_cb(pa_pdispatch *pd, uint32_t command, uint3 goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; eol = -1; diff --git a/src/pulse/ext-device-restore.c b/src/pulse/ext-device-restore.c index 25d33d129..e40ea884e 100644 --- a/src/pulse/ext-device-restore.c +++ b/src/pulse/ext-device-restore.c @@ -59,7 +59,7 @@ static void ext_device_restore_test_cb(pa_pdispatch *pd, uint32_t command, uint3 goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; } else if (pa_tagstruct_getu32(t, &version) < 0 || @@ -164,7 +164,7 @@ static void ext_device_restore_read_device_formats_cb(pa_pdispatch *pd, uint32_t goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; eol = -1; diff --git a/src/pulse/ext-stream-restore.c b/src/pulse/ext-stream-restore.c index 1f72c1c40..3362a5f51 100644 --- a/src/pulse/ext-stream-restore.c +++ b/src/pulse/ext-stream-restore.c @@ -54,7 +54,7 @@ static void ext_stream_restore_test_cb(pa_pdispatch *pd, uint32_t command, uint3 goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; } else if (pa_tagstruct_getu32(t, &version) < 0 || @@ -114,7 +114,7 @@ static void ext_stream_restore_read_cb(pa_pdispatch *pd, uint32_t command, uint3 goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; eol = -1; @@ -122,7 +122,7 @@ static void ext_stream_restore_read_cb(pa_pdispatch *pd, uint32_t command, uint3 while (!pa_tagstruct_eof(t)) { pa_ext_stream_restore_info i; - pa_bool_t mute = FALSE; + bool mute = false; memset(&i, 0, sizeof(i)); diff --git a/src/pulse/fork-detect.c b/src/pulse/fork-detect.c index a4e0dd16c..0ebc3864a 100644 --- a/src/pulse/fork-detect.c +++ b/src/pulse/fork-detect.c @@ -46,14 +46,14 @@ int pa_detect_fork(void) { /* First let's check whether the current pid matches the stored one */ if (stored_pid == getpid()) - return FALSE; + return false; /* Does it contain a different PID than ours? Then the process got forked. */ if ((int) stored_pid != (int) -1) - return TRUE; + return true; /* Ok, it still contains no PID, then store it */ if (pa_atomic_cmpxchg(&pid, (int) -1, (int) getpid())) - return FALSE; + return false; } } diff --git a/src/pulse/format.c b/src/pulse/format.c index a72f78bde..c0c53bf74 100644 --- a/src/pulse/format.c +++ b/src/pulse/format.c @@ -178,7 +178,7 @@ int pa_format_info_is_compatible(pa_format_info *first, pa_format_info *second) pa_assert(second); if (first->encoding != second->encoding) - return FALSE; + return false; while ((key = pa_proplist_iterate(first->plist, &state))) { const char *value_one, *value_two; @@ -187,10 +187,10 @@ int pa_format_info_is_compatible(pa_format_info *first, pa_format_info *second) value_two = pa_proplist_gets(second->plist, key); if (!value_two || !pa_format_info_prop_compatible(value_one, value_two)) - return FALSE; + return false; } - return TRUE; + return true; } pa_format_info* pa_format_info_from_sample_spec(pa_sample_spec *ss, pa_channel_map *map) { @@ -640,14 +640,14 @@ void pa_format_info_set_prop_string_array(pa_format_info *f, const char *key, co json_object_put(o); } -static pa_bool_t pa_json_is_fixed_type(json_object *o) { +static bool pa_json_is_fixed_type(json_object *o) { switch(json_object_get_type(o)) { case json_type_object: case json_type_array: - return FALSE; + return false; default: - return TRUE; + return true; } } @@ -669,7 +669,7 @@ static int pa_format_info_prop_compatible(const char *one, const char *two) { goto out; /* We don't deal with both values being non-fixed - just because there is no immediate need (FIXME) */ - pa_return_val_if_fail(pa_json_is_fixed_type(o1) || pa_json_is_fixed_type(o2), FALSE); + pa_return_val_if_fail(pa_json_is_fixed_type(o1) || pa_json_is_fixed_type(o2), false); if (pa_json_is_fixed_type(o1) && pa_json_is_fixed_type(o2)) { ret = pa_json_value_equal(o1, o2); diff --git a/src/pulse/internal.h b/src/pulse/internal.h index dd27f5f0a..c5084d5f3 100644 --- a/src/pulse/internal.h +++ b/src/pulse/internal.h @@ -85,13 +85,13 @@ struct pa_context { pa_mempool *mempool; - pa_bool_t is_local:1; - pa_bool_t do_shm:1; - pa_bool_t server_specified:1; - pa_bool_t no_fail:1; - pa_bool_t do_autospawn:1; - pa_bool_t use_rtclock:1; - pa_bool_t filter_added:1; + bool is_local:1; + bool do_shm:1; + bool server_specified:1; + bool no_fail:1; + bool do_autospawn:1; + bool use_rtclock:1; + bool filter_added:1; pa_spawn_api spawn_api; pa_strlist *server_list; @@ -122,9 +122,9 @@ struct pa_context { typedef struct pa_index_correction { uint32_t tag; int64_t value; - pa_bool_t valid:1; - pa_bool_t absolute:1; - pa_bool_t corrupt:1; + bool valid:1; + bool absolute:1; + bool corrupt:1; } pa_index_correction; #define PA_MAX_FORMATS (PA_ENCODING_MAX) @@ -150,11 +150,11 @@ struct pa_stream { pa_proplist *proplist; - pa_bool_t channel_valid:1; - pa_bool_t suspended:1; - pa_bool_t corked:1; - pa_bool_t timing_info_valid:1; - pa_bool_t auto_timing_update_requested:1; + bool channel_valid:1; + bool suspended:1; + bool corked:1; + bool timing_info_valid:1; + bool auto_timing_update_requested:1; uint32_t channel; uint32_t syncid; @@ -262,7 +262,7 @@ void pa_stream_simple_ack_callback(pa_pdispatch *pd, uint32_t command, uint32_t void pa_context_fail(pa_context *c, int error); int pa_context_set_error(pa_context *c, int error); void pa_context_set_state(pa_context *c, pa_context_state_t st); -int pa_context_handle_error(pa_context *c, uint32_t command, pa_tagstruct *t, pa_bool_t fail); +int pa_context_handle_error(pa_context *c, uint32_t command, pa_tagstruct *t, bool fail); pa_operation* pa_context_send_simple_command(pa_context *c, uint32_t command, void (*internal_callback)(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata), void (*cb)(void), void *userdata); void pa_stream_set_state(pa_stream *s, pa_stream_state_t st); @@ -273,7 +273,7 @@ pa_tagstruct *pa_tagstruct_command(pa_context *c, uint32_t command, uint32_t *ta do { \ if (!(expression)) \ return -pa_context_set_error((context), (error)); \ - } while(FALSE) + } while(false) #define PA_CHECK_VALIDITY_RETURN_ANY(context, expression, error, value) \ do { \ @@ -281,7 +281,7 @@ pa_tagstruct *pa_tagstruct_command(pa_context *c, uint32_t command, uint32_t *ta pa_context_set_error((context), (error)); \ return value; \ } \ - } while(FALSE) + } while(false) #define PA_CHECK_VALIDITY_RETURN_NULL(context, expression, error) \ PA_CHECK_VALIDITY_RETURN_ANY(context, expression, error, NULL) @@ -289,13 +289,13 @@ pa_tagstruct *pa_tagstruct_command(pa_context *c, uint32_t command, uint32_t *ta #define PA_FAIL(context, error) \ do { \ return -pa_context_set_error((context), (error)); \ - } while(FALSE) + } while(false) #define PA_FAIL_RETURN_ANY(context, error, value) \ do { \ pa_context_set_error((context), (error)); \ return value; \ - } while(FALSE) + } while(false) #define PA_FAIL_RETURN_NULL(context, error) \ PA_FAIL_RETURN_ANY(context, error, NULL) @@ -304,6 +304,6 @@ void pa_ext_device_manager_command(pa_context *c, uint32_t tag, pa_tagstruct *t) void pa_ext_device_restore_command(pa_context *c, uint32_t tag, pa_tagstruct *t); void pa_ext_stream_restore_command(pa_context *c, uint32_t tag, pa_tagstruct *t); -pa_bool_t pa_mainloop_is_our_api(pa_mainloop_api*m); +bool pa_mainloop_is_our_api(pa_mainloop_api*m); #endif diff --git a/src/pulse/introspect.c b/src/pulse/introspect.c index 704e96eaa..334ffd966 100644 --- a/src/pulse/introspect.c +++ b/src/pulse/introspect.c @@ -51,7 +51,7 @@ static void context_stat_callback(pa_pdispatch *pd, uint32_t command, uint32_t t goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; p = NULL; @@ -95,7 +95,7 @@ static void context_get_server_info_callback(pa_pdispatch *pd, uint32_t command, goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; p = NULL; @@ -151,14 +151,14 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; eol = -1; } else { while (!pa_tagstruct_eof(t)) { - pa_bool_t mute; + bool mute; uint32_t flags; uint32_t state; const char *ap = NULL; @@ -167,7 +167,7 @@ static void context_get_sink_info_callback(pa_pdispatch *pd, uint32_t command, u i.proplist = pa_proplist_new(); i.base_volume = PA_VOLUME_NORM; i.n_volume_steps = PA_VOLUME_NORM+1; - mute = FALSE; + mute = false; state = PA_SINK_INVALID_STATE; i.card = PA_INVALID_INDEX; @@ -424,14 +424,14 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command, goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; eol = -1; } else { while (!pa_tagstruct_eof(t)) { - pa_bool_t mute; + bool mute; uint32_t flags; uint32_t state; const char *ap; @@ -440,7 +440,7 @@ static void context_get_source_info_callback(pa_pdispatch *pd, uint32_t command, i.proplist = pa_proplist_new(); i.base_volume = PA_VOLUME_NORM; i.n_volume_steps = PA_VOLUME_NORM+1; - mute = FALSE; + mute = false; state = PA_SOURCE_INVALID_STATE; i.card = PA_INVALID_INDEX; @@ -692,7 +692,7 @@ static void context_get_client_info_callback(pa_pdispatch *pd, uint32_t command, goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; eol = -1; @@ -870,7 +870,7 @@ static void context_get_card_info_callback(pa_pdispatch *pd, uint32_t command, u goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; eol = -1; @@ -1080,7 +1080,7 @@ static void context_get_module_info_callback(pa_pdispatch *pd, uint32_t command, goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; eol = -1; @@ -1088,7 +1088,7 @@ static void context_get_module_info_callback(pa_pdispatch *pd, uint32_t command, while (!pa_tagstruct_eof(t)) { pa_module_info i; - pa_bool_t auto_unload = FALSE; + bool auto_unload = false; pa_zero(i); i.proplist = pa_proplist_new(); @@ -1165,7 +1165,7 @@ static void context_get_sink_input_info_callback(pa_pdispatch *pd, uint32_t comm goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; eol = -1; @@ -1173,7 +1173,7 @@ static void context_get_sink_input_info_callback(pa_pdispatch *pd, uint32_t comm while (!pa_tagstruct_eof(t)) { pa_sink_input_info i; - pa_bool_t mute = FALSE, corked = FALSE, has_volume = FALSE, volume_writable = TRUE; + bool mute = false, corked = false, has_volume = false, volume_writable = true; pa_zero(i); i.proplist = pa_proplist_new(); @@ -1270,7 +1270,7 @@ static void context_get_source_output_info_callback(pa_pdispatch *pd, uint32_t c goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; eol = -1; @@ -1278,7 +1278,7 @@ static void context_get_source_output_info_callback(pa_pdispatch *pd, uint32_t c while (!pa_tagstruct_eof(t)) { pa_source_output_info i; - pa_bool_t mute = FALSE, corked = FALSE, has_volume = FALSE, volume_writable = TRUE; + bool mute = false, corked = false, has_volume = false, volume_writable = true; pa_zero(i); i.proplist = pa_proplist_new(); @@ -1676,7 +1676,7 @@ static void context_get_sample_info_callback(pa_pdispatch *pd, uint32_t command, goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; eol = -1; @@ -1684,7 +1684,7 @@ static void context_get_sample_info_callback(pa_pdispatch *pd, uint32_t command, while (!pa_tagstruct_eof(t)) { pa_sample_info i; - pa_bool_t lazy = FALSE; + bool lazy = false; pa_zero(i); i.proplist = pa_proplist_new(); @@ -1823,7 +1823,7 @@ static void context_index_callback(pa_pdispatch *pd, uint32_t command, uint32_t goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; idx = PA_INVALID_INDEX; diff --git a/src/pulse/mainloop.c b/src/pulse/mainloop.c index f1ce076a6..60fbbb906 100644 --- a/src/pulse/mainloop.c +++ b/src/pulse/mainloop.c @@ -53,7 +53,7 @@ struct pa_io_event { pa_mainloop *mainloop; - pa_bool_t dead:1; + bool dead:1; int fd; pa_io_event_flags_t events; @@ -68,10 +68,10 @@ struct pa_io_event { struct pa_time_event { pa_mainloop *mainloop; - pa_bool_t dead:1; + bool dead:1; - pa_bool_t enabled:1; - pa_bool_t use_rtclock:1; + bool enabled:1; + bool use_rtclock:1; pa_usec_t time; pa_time_event_cb_t callback; @@ -83,9 +83,9 @@ struct pa_time_event { struct pa_defer_event { pa_mainloop *mainloop; - pa_bool_t dead:1; + bool dead:1; - pa_bool_t enabled:1; + bool enabled:1; pa_defer_event_cb_t callback; void *userdata; @@ -102,7 +102,7 @@ struct pa_mainloop { unsigned n_enabled_defer_events, n_enabled_time_events, n_io_events; unsigned io_events_please_scan, time_events_please_scan, defer_events_please_scan; - pa_bool_t rebuild_pollfds:1; + bool rebuild_pollfds:1; struct pollfd *pollfds; unsigned max_pollfds, n_pollfds; @@ -112,7 +112,7 @@ struct pa_mainloop { pa_mainloop_api api; int retval; - pa_bool_t quit:1; + bool quit:1; pa_atomic_t wakeup_requested; int wakeup_pipe[2]; @@ -176,7 +176,7 @@ static pa_io_event* mainloop_io_new( e->userdata = userdata; PA_LLIST_PREPEND(pa_io_event, m->io_events, e); - m->rebuild_pollfds = TRUE; + m->rebuild_pollfds = true; m->n_io_events ++; pa_mainloop_wakeup(m); @@ -196,7 +196,7 @@ static void mainloop_io_enable(pa_io_event *e, pa_io_event_flags_t events) { if (e->pollfd) e->pollfd->events = map_flags_to_libc(events); else - e->mainloop->rebuild_pollfds = TRUE; + e->mainloop->rebuild_pollfds = true; pa_mainloop_wakeup(e->mainloop); } @@ -205,11 +205,11 @@ static void mainloop_io_free(pa_io_event *e) { pa_assert(e); pa_assert(!e->dead); - e->dead = TRUE; + e->dead = true; e->mainloop->io_events_please_scan ++; e->mainloop->n_io_events --; - e->mainloop->rebuild_pollfds = TRUE; + e->mainloop->rebuild_pollfds = true; pa_mainloop_wakeup(e->mainloop); } @@ -239,7 +239,7 @@ static pa_defer_event* mainloop_defer_new( e = pa_xnew0(pa_defer_event, 1); e->mainloop = m; - e->enabled = TRUE; + e->enabled = true; m->n_enabled_defer_events++; e->callback = callback; @@ -271,13 +271,13 @@ static void mainloop_defer_free(pa_defer_event *e) { pa_assert(e); pa_assert(!e->dead); - e->dead = TRUE; + e->dead = true; e->mainloop->defer_events_please_scan ++; if (e->enabled) { pa_assert(e->mainloop->n_enabled_defer_events > 0); e->mainloop->n_enabled_defer_events--; - e->enabled = FALSE; + e->enabled = false; } } @@ -289,11 +289,11 @@ static void mainloop_defer_set_destroy(pa_defer_event *e, pa_defer_event_destroy } /* Time events */ -static pa_usec_t make_rt(const struct timeval *tv, pa_bool_t *use_rtclock) { +static pa_usec_t make_rt(const struct timeval *tv, bool *use_rtclock) { struct timeval ttv; if (!tv) { - *use_rtclock = FALSE; + *use_rtclock = false; return PA_USEC_INVALID; } @@ -317,7 +317,7 @@ static pa_time_event* mainloop_time_new( pa_mainloop *m; pa_time_event *e; pa_usec_t t; - pa_bool_t use_rtclock = FALSE; + bool use_rtclock = false; pa_assert(a); pa_assert(a->userdata); @@ -357,9 +357,9 @@ static pa_time_event* mainloop_time_new( } static void mainloop_time_restart(pa_time_event *e, const struct timeval *tv) { - pa_bool_t valid; + bool valid; pa_usec_t t; - pa_bool_t use_rtclock = FALSE; + bool use_rtclock = false; pa_assert(e); pa_assert(!e->dead); @@ -392,13 +392,13 @@ static void mainloop_time_free(pa_time_event *e) { pa_assert(e); pa_assert(!e->dead); - e->dead = TRUE; + e->dead = true; e->mainloop->time_events_please_scan ++; if (e->enabled) { pa_assert(e->mainloop->n_enabled_time_events > 0); e->mainloop->n_enabled_time_events--; - e->enabled = FALSE; + e->enabled = false; } if (e->mainloop->cached_next_time_event == e) @@ -464,7 +464,7 @@ pa_mainloop *pa_mainloop_new(void) { pa_make_fd_nonblock(m->wakeup_pipe[0]); pa_make_fd_nonblock(m->wakeup_pipe[1]); - m->rebuild_pollfds = TRUE; + m->rebuild_pollfds = true; m->api = vtable; m->api.userdata = m; @@ -476,7 +476,7 @@ pa_mainloop *pa_mainloop_new(void) { return m; } -static void cleanup_io_events(pa_mainloop *m, pa_bool_t force) { +static void cleanup_io_events(pa_mainloop *m, bool force) { pa_io_event *e, *n; PA_LLIST_FOREACH_SAFE(e, n, m->io_events) { @@ -497,14 +497,14 @@ static void cleanup_io_events(pa_mainloop *m, pa_bool_t force) { pa_xfree(e); - m->rebuild_pollfds = TRUE; + m->rebuild_pollfds = true; } } pa_assert(m->io_events_please_scan == 0); } -static void cleanup_time_events(pa_mainloop *m, pa_bool_t force) { +static void cleanup_time_events(pa_mainloop *m, bool force) { pa_time_event *e, *n; PA_LLIST_FOREACH_SAFE(e, n, m->time_events) { @@ -523,7 +523,7 @@ static void cleanup_time_events(pa_mainloop *m, pa_bool_t force) { if (!e->dead && e->enabled) { pa_assert(m->n_enabled_time_events > 0); m->n_enabled_time_events--; - e->enabled = FALSE; + e->enabled = false; } if (e->destroy_callback) @@ -536,7 +536,7 @@ static void cleanup_time_events(pa_mainloop *m, pa_bool_t force) { pa_assert(m->time_events_please_scan == 0); } -static void cleanup_defer_events(pa_mainloop *m, pa_bool_t force) { +static void cleanup_defer_events(pa_mainloop *m, bool force) { pa_defer_event *e, *n; PA_LLIST_FOREACH_SAFE(e, n, m->defer_events) { @@ -555,7 +555,7 @@ static void cleanup_defer_events(pa_mainloop *m, pa_bool_t force) { if (!e->dead && e->enabled) { pa_assert(m->n_enabled_defer_events > 0); m->n_enabled_defer_events--; - e->enabled = FALSE; + e->enabled = false; } if (e->destroy_callback) @@ -571,9 +571,9 @@ static void cleanup_defer_events(pa_mainloop *m, pa_bool_t force) { void pa_mainloop_free(pa_mainloop *m) { pa_assert(m); - cleanup_io_events(m, TRUE); - cleanup_defer_events(m, TRUE); - cleanup_time_events(m, TRUE); + cleanup_io_events(m, true); + cleanup_defer_events(m, true); + cleanup_time_events(m, true); pa_xfree(m->pollfds); @@ -586,13 +586,13 @@ static void scan_dead(pa_mainloop *m) { pa_assert(m); if (m->io_events_please_scan) - cleanup_io_events(m, FALSE); + cleanup_io_events(m, false); if (m->time_events_please_scan) - cleanup_time_events(m, FALSE); + cleanup_time_events(m, false); if (m->defer_events_please_scan) - cleanup_defer_events(m, FALSE); + cleanup_defer_events(m, false); } static void rebuild_pollfds(pa_mainloop *m) { @@ -631,7 +631,7 @@ static void rebuild_pollfds(pa_mainloop *m) { m->n_pollfds++; } - m->rebuild_pollfds = FALSE; + m->rebuild_pollfds = false; } static unsigned dispatch_pollfds(pa_mainloop *m) { @@ -773,7 +773,7 @@ void pa_mainloop_wakeup(pa_mainloop *m) { /* Not much options for recovering from the error. Let's at least log something. */ pa_log("pa_write() failed while trying to wake up the mainloop: %s", pa_cstrerror(errno)); - pa_atomic_store(&m->wakeup_requested, TRUE); + pa_atomic_store(&m->wakeup_requested, true); } static void clear_wakeup(pa_mainloop *m) { @@ -781,7 +781,7 @@ static void clear_wakeup(pa_mainloop *m) { pa_assert(m); - if (pa_atomic_cmpxchg(&m->wakeup_requested, TRUE, FALSE)) { + if (pa_atomic_cmpxchg(&m->wakeup_requested, true, false)) { while (pa_read(m->wakeup_pipe[0], &c, sizeof(c), &m->wakeup_pipe_type) == sizeof(c)) ; } @@ -960,7 +960,7 @@ int pa_mainloop_run(pa_mainloop *m, int *retval) { void pa_mainloop_quit(pa_mainloop *m, int retval) { pa_assert(m); - m->quit = TRUE; + m->quit = true; m->retval = retval; pa_mainloop_wakeup(m); } @@ -978,7 +978,7 @@ void pa_mainloop_set_poll_func(pa_mainloop *m, pa_poll_func poll_func, void *use m->poll_func_userdata = userdata; } -pa_bool_t pa_mainloop_is_our_api(pa_mainloop_api *m) { +bool pa_mainloop_is_our_api(pa_mainloop_api *m) { pa_assert(m); return m->io_new == mainloop_io_new; diff --git a/src/pulse/proplist.c b/src/pulse/proplist.c index abd551bc8..6e9110355 100644 --- a/src/pulse/proplist.c +++ b/src/pulse/proplist.c @@ -76,7 +76,7 @@ void pa_proplist_free(pa_proplist* p) { /** Will accept only valid UTF-8 */ int pa_proplist_sets(pa_proplist *p, const char *key, const char *value) { struct property *prop; - pa_bool_t add = FALSE; + bool add = false; pa_assert(p); pa_assert(key); @@ -88,7 +88,7 @@ int pa_proplist_sets(pa_proplist *p, const char *key, const char *value) { if (!(prop = pa_hashmap_get(MAKE_HASHMAP(p), key))) { prop = pa_xnew(struct property, 1); prop->key = pa_xstrdup(key); - add = TRUE; + add = true; } else pa_xfree(prop->value); @@ -104,7 +104,7 @@ int pa_proplist_sets(pa_proplist *p, const char *key, const char *value) { /** Will accept only valid UTF-8 */ static int proplist_setn(pa_proplist *p, const char *key, size_t key_length, const char *value, size_t value_length) { struct property *prop; - pa_bool_t add = FALSE; + bool add = false; char *k, *v; pa_assert(p); @@ -123,7 +123,7 @@ static int proplist_setn(pa_proplist *p, const char *key, size_t key_length, con if (!(prop = pa_hashmap_get(MAKE_HASHMAP(p), k))) { prop = pa_xnew(struct property, 1); prop->key = k; - add = TRUE; + add = true; } else { pa_xfree(prop->value); pa_xfree(k); @@ -155,7 +155,7 @@ int pa_proplist_setp(pa_proplist *p, const char *pair) { static int proplist_sethex(pa_proplist *p, const char *key, size_t key_length, const char *value, size_t value_length) { struct property *prop; - pa_bool_t add = FALSE; + bool add = false; char *k, *v; uint8_t *d; size_t dn; @@ -186,7 +186,7 @@ static int proplist_sethex(pa_proplist *p, const char *key, size_t key_length, c if (!(prop = pa_hashmap_get(MAKE_HASHMAP(p), k))) { prop = pa_xnew(struct property, 1); prop->key = k; - add = TRUE; + add = true; } else { pa_xfree(prop->value); pa_xfree(k); @@ -205,7 +205,7 @@ static int proplist_sethex(pa_proplist *p, const char *key, size_t key_length, c /** Will accept only valid UTF-8 */ int pa_proplist_setf(pa_proplist *p, const char *key, const char *format, ...) { struct property *prop; - pa_bool_t add = FALSE; + bool add = false; va_list ap; char *v; @@ -226,7 +226,7 @@ int pa_proplist_setf(pa_proplist *p, const char *key, const char *format, ...) { if (!(prop = pa_hashmap_get(MAKE_HASHMAP(p), key))) { prop = pa_xnew(struct property, 1); prop->key = pa_xstrdup(key); - add = TRUE; + add = true; } else pa_xfree(prop->value); @@ -245,7 +245,7 @@ fail: int pa_proplist_set(pa_proplist *p, const char *key, const void *data, size_t nbytes) { struct property *prop; - pa_bool_t add = FALSE; + bool add = false; pa_assert(p); pa_assert(key); @@ -257,7 +257,7 @@ int pa_proplist_set(pa_proplist *p, const char *key, const void *data, size_t nb if (!(prop = pa_hashmap_get(MAKE_HASHMAP(p), key))) { prop = pa_xnew(struct property, 1); prop->key = pa_xstrdup(key); - add = TRUE; + add = true; } else pa_xfree(prop->value); diff --git a/src/pulse/scache.c b/src/pulse/scache.c index 8902642fd..6a26ce565 100644 --- a/src/pulse/scache.c +++ b/src/pulse/scache.c @@ -114,7 +114,7 @@ static void play_sample_ack_callback(pa_pdispatch *pd, uint32_t command, uint32_ goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; success = 0; @@ -147,7 +147,7 @@ static void play_sample_with_proplist_ack_callback(pa_pdispatch *pd, uint32_t co goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; idx = PA_INVALID_INDEX; diff --git a/src/pulse/simple.c b/src/pulse/simple.c index 860cd185d..9b8d14bf7 100644 --- a/src/pulse/simple.c +++ b/src/pulse/simple.c @@ -56,7 +56,7 @@ struct pa_simple { *(rerror) = error; \ return (ret); \ } \ - } while(FALSE); + } while(false); #define CHECK_SUCCESS_GOTO(p, rerror, expression, label) \ do { \ @@ -65,7 +65,7 @@ struct pa_simple { *(rerror) = pa_context_errno((p)->context); \ goto label; \ } \ - } while(FALSE); + } while(false); #define CHECK_DEAD_GOTO(p, rerror, label) \ do { \ @@ -80,7 +80,7 @@ struct pa_simple { *(rerror) = PA_ERR_BADSTATE; \ goto label; \ } \ - } while(FALSE); + } while(false); static void context_state_cb(pa_context *c, void *userdata) { pa_simple *p = userdata; diff --git a/src/pulse/stream.c b/src/pulse/stream.c index 811b3c10e..746179b44 100644 --- a/src/pulse/stream.c +++ b/src/pulse/stream.c @@ -138,7 +138,7 @@ static pa_stream *pa_stream_new_with_proplist_internal( pa_proplist_sets(s->proplist, PA_PROP_MEDIA_NAME, name); s->channel = 0; - s->channel_valid = FALSE; + s->channel_valid = false; s->syncid = c->csyncid++; s->stream_index = PA_INVALID_INDEX; @@ -168,8 +168,8 @@ static pa_stream *pa_stream_new_with_proplist_internal( s->device_index = PA_INVALID_INDEX; s->device_name = NULL; - s->suspended = FALSE; - s->corked = FALSE; + s->suspended = false; + s->corked = false; s->write_memblock = NULL; s->write_data = NULL; @@ -179,7 +179,7 @@ static pa_stream *pa_stream_new_with_proplist_internal( s->record_memblockq = NULL; memset(&s->timing_info, 0, sizeof(s->timing_info)); - s->timing_info_valid = FALSE; + s->timing_info_valid = false; s->previous_time = 0; s->latest_underrun_at_index = -1; @@ -191,7 +191,7 @@ static pa_stream *pa_stream_new_with_proplist_internal( s->current_write_index_correction = 0; s->auto_timing_update_event = NULL; - s->auto_timing_update_requested = FALSE; + s->auto_timing_update_requested = false; s->auto_timing_interval_usec = AUTO_TIMING_INTERVAL_START_USEC; reset_callbacks(s); @@ -262,7 +262,7 @@ static void stream_unlink(pa_stream *s) { if (s->channel_valid) { pa_hashmap_remove((s->direction == PA_STREAM_RECORD) ? s->context->record_streams : s->context->playback_streams, PA_UINT32_TO_PTR(s->channel)); s->channel = 0; - s->channel_valid = FALSE; + s->channel_valid = false; } PA_LLIST_REMOVE(pa_stream, s->context->streams, s); @@ -376,7 +376,7 @@ void pa_stream_set_state(pa_stream *s, pa_stream_state_t st) { pa_stream_unref(s); } -static void request_auto_timing_update(pa_stream *s, pa_bool_t force) { +static void request_auto_timing_update(pa_stream *s, bool force) { pa_assert(s); pa_assert(PA_REFCNT_VALUE(s) >= 1); @@ -393,7 +393,7 @@ static void request_auto_timing_update(pa_stream *s, pa_bool_t force) { if ((o = pa_stream_update_timing_info(s, NULL, NULL))) { pa_operation_unref(o); - s->auto_timing_update_requested = TRUE; + s->auto_timing_update_requested = true; } } @@ -445,7 +445,7 @@ finish: pa_context_unref(c); } -static void check_smoother_status(pa_stream *s, pa_bool_t aposteriori, pa_bool_t force_start, pa_bool_t force_stop) { +static void check_smoother_status(pa_stream *s, bool aposteriori, bool force_start, bool force_stop) { pa_usec_t x; pa_assert(s); @@ -483,7 +483,7 @@ static void check_smoother_status(pa_stream *s, pa_bool_t aposteriori, pa_bool_t return; } - pa_smoother_resume(s->smoother, x, TRUE); + pa_smoother_resume(s->smoother, x, true); } /* Please note that we have no idea if playback actually started @@ -497,7 +497,7 @@ void pa_command_stream_moved(pa_pdispatch *pd, uint32_t command, uint32_t tag, p pa_stream *s; uint32_t channel; const char *dn; - pa_bool_t suspended; + bool suspended; uint32_t di; pa_usec_t usec = 0; uint32_t maxlength = 0, fragsize = 0, minreq = 0, tlength = 0, prebuf = 0; @@ -582,11 +582,11 @@ void pa_command_stream_moved(pa_pdispatch *pd, uint32_t command, uint32_t tag, p if ((s->flags & PA_STREAM_AUTO_TIMING_UPDATE) && !suspended && !s->auto_timing_update_event) { s->auto_timing_interval_usec = AUTO_TIMING_INTERVAL_START_USEC; s->auto_timing_update_event = pa_context_rttime_new(s->context, pa_rtclock_now() + s->auto_timing_interval_usec, &auto_timing_update_callback, s); - request_auto_timing_update(s, TRUE); + request_auto_timing_update(s, true); } - check_smoother_status(s, TRUE, FALSE, FALSE); - request_auto_timing_update(s, TRUE); + check_smoother_status(s, true, false, false); + request_auto_timing_update(s, true); if (s->moved_callback) s->moved_callback(s, s->moved_userdata); @@ -660,7 +660,7 @@ void pa_command_stream_buffer_attr(pa_pdispatch *pd, uint32_t command, uint32_t s->buffer_attr.prebuf = prebuf; s->buffer_attr.minreq = minreq; - request_auto_timing_update(s, TRUE); + request_auto_timing_update(s, true); if (s->buffer_attr_callback) s->buffer_attr_callback(s, s->buffer_attr_userdata); @@ -673,7 +673,7 @@ void pa_command_stream_suspended(pa_pdispatch *pd, uint32_t command, uint32_t ta pa_context *c = userdata; pa_stream *s; uint32_t channel; - pa_bool_t suspended; + bool suspended; pa_assert(pd); pa_assert(command == PA_COMMAND_PLAYBACK_STREAM_SUSPENDED || command == PA_COMMAND_RECORD_STREAM_SUSPENDED); @@ -706,11 +706,11 @@ void pa_command_stream_suspended(pa_pdispatch *pd, uint32_t command, uint32_t ta if ((s->flags & PA_STREAM_AUTO_TIMING_UPDATE) && !suspended && !s->auto_timing_update_event) { s->auto_timing_interval_usec = AUTO_TIMING_INTERVAL_START_USEC; s->auto_timing_update_event = pa_context_rttime_new(s->context, pa_rtclock_now() + s->auto_timing_interval_usec, &auto_timing_update_callback, s); - request_auto_timing_update(s, TRUE); + request_auto_timing_update(s, true); } - check_smoother_status(s, TRUE, FALSE, FALSE); - request_auto_timing_update(s, TRUE); + check_smoother_status(s, true, false, false); + request_auto_timing_update(s, true); if (s->suspended_callback) s->suspended_callback(s, s->suspended_userdata); @@ -749,8 +749,8 @@ void pa_command_stream_started(pa_pdispatch *pd, uint32_t command, uint32_t tag, if (s->state != PA_STREAM_READY) goto finish; - check_smoother_status(s, TRUE, TRUE, FALSE); - request_auto_timing_update(s, TRUE); + check_smoother_status(s, true, true, false); + request_auto_timing_update(s, true); if (s->started_callback) s->started_callback(s, s->started_userdata); @@ -897,9 +897,9 @@ void pa_command_overflow_or_underflow(pa_pdispatch *pd, uint32_t command, uint32 s->latest_underrun_at_index = offset; if (s->buffer_attr.prebuf > 0) - check_smoother_status(s, TRUE, FALSE, TRUE); + check_smoother_status(s, true, false, true); - request_auto_timing_update(s, TRUE); + request_auto_timing_update(s, true); if (command == PA_COMMAND_OVERFLOW) { if (s->overflow_callback) @@ -913,7 +913,7 @@ finish: pa_context_unref(c); } -static void invalidate_indexes(pa_stream *s, pa_bool_t r, pa_bool_t w) { +static void invalidate_indexes(pa_stream *s, bool r, bool w) { pa_assert(s); pa_assert(PA_REFCNT_VALUE(s) >= 1); @@ -928,7 +928,7 @@ static void invalidate_indexes(pa_stream *s, pa_bool_t r, pa_bool_t w) { s->write_index_not_before = s->context->ctag; if (s->timing_info_valid) - s->timing_info.write_index_corrupt = TRUE; + s->timing_info.write_index_corrupt = true; #ifdef STREAM_DEBUG pa_log_debug("write_index invalidated"); @@ -939,14 +939,14 @@ static void invalidate_indexes(pa_stream *s, pa_bool_t r, pa_bool_t w) { s->read_index_not_before = s->context->ctag; if (s->timing_info_valid) - s->timing_info.read_index_corrupt = TRUE; + s->timing_info.read_index_corrupt = true; #ifdef STREAM_DEBUG pa_log_debug("read_index invalidated"); #endif } - request_auto_timing_update(s, TRUE); + request_auto_timing_update(s, true); } static void auto_timing_update_callback(pa_mainloop_api *m, pa_time_event *e, const struct timeval *t, void *userdata) { @@ -956,7 +956,7 @@ static void auto_timing_update_callback(pa_mainloop_api *m, pa_time_event *e, co pa_assert(PA_REFCNT_VALUE(s) >= 1); pa_stream_ref(s); - request_auto_timing_update(s, FALSE); + request_auto_timing_update(s, false); pa_stream_unref(s); } @@ -975,10 +975,10 @@ static void create_stream_complete(pa_stream *s) { pa_assert(!s->auto_timing_update_event); s->auto_timing_update_event = pa_context_rttime_new(s->context, pa_rtclock_now() + s->auto_timing_interval_usec, &auto_timing_update_callback, s); - request_auto_timing_update(s, TRUE); + request_auto_timing_update(s, true); } - check_smoother_status(s, TRUE, FALSE, FALSE); + check_smoother_status(s, true, false, false); } static void patch_buffer_attr(pa_stream *s, pa_buffer_attr *attr, pa_stream_flags_t *flags) { @@ -1041,7 +1041,7 @@ void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_stream_ref(s); if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(s->context, command, t, FALSE) < 0) + if (pa_context_handle_error(s->context, command, t, false) < 0) goto finish; pa_stream_set_state(s, PA_STREAM_FAILED); @@ -1080,7 +1080,7 @@ void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_sample_spec ss; pa_channel_map cm; const char *dn = NULL; - pa_bool_t suspended; + bool suspended; if (pa_tagstruct_get_sample_spec(t, &ss) < 0 || pa_tagstruct_get_channel_map(t, &cm) < 0 || @@ -1163,7 +1163,7 @@ void pa_create_stream_callback(pa_pdispatch *pd, uint32_t command, uint32_t tag, NULL); } - s->channel_valid = TRUE; + s->channel_valid = true; pa_hashmap_put((s->direction == PA_STREAM_RECORD) ? s->context->record_streams : s->context->playback_streams, PA_UINT32_TO_PTR(s->channel), s); create_stream_complete(s); @@ -1183,7 +1183,7 @@ static int create_stream( pa_tagstruct *t; uint32_t tag; - pa_bool_t volume_set = !!volume; + bool volume_set = !!volume; pa_cvolume cv; uint32_t i; @@ -1252,10 +1252,10 @@ static int create_stream( SMOOTHER_ADJUST_TIME, SMOOTHER_HISTORY_TIME, !(flags & PA_STREAM_NOT_MONOTONIC), - TRUE, + true, SMOOTHER_MIN_HISTORY, x, - TRUE); + true); } if (!dev) @@ -1562,31 +1562,31 @@ int pa_stream_write( if (s->write_index_corrections[s->current_write_index_correction].valid) { if (seek == PA_SEEK_ABSOLUTE) { - s->write_index_corrections[s->current_write_index_correction].corrupt = FALSE; - s->write_index_corrections[s->current_write_index_correction].absolute = TRUE; + s->write_index_corrections[s->current_write_index_correction].corrupt = false; + s->write_index_corrections[s->current_write_index_correction].absolute = true; s->write_index_corrections[s->current_write_index_correction].value = offset + (int64_t) length; } else if (seek == PA_SEEK_RELATIVE) { if (!s->write_index_corrections[s->current_write_index_correction].corrupt) s->write_index_corrections[s->current_write_index_correction].value += offset + (int64_t) length; } else - s->write_index_corrections[s->current_write_index_correction].corrupt = TRUE; + s->write_index_corrections[s->current_write_index_correction].corrupt = true; } /* Update the write index in the already available latency data */ if (s->timing_info_valid) { if (seek == PA_SEEK_ABSOLUTE) { - s->timing_info.write_index_corrupt = FALSE; + s->timing_info.write_index_corrupt = false; s->timing_info.write_index = offset + (int64_t) length; } else if (seek == PA_SEEK_RELATIVE) { if (!s->timing_info.write_index_corrupt) s->timing_info.write_index += offset + (int64_t) length; } else - s->timing_info.write_index_corrupt = TRUE; + s->timing_info.write_index_corrupt = true; } if (!s->timing_info_valid || s->timing_info.write_index_corrupt) - request_auto_timing_update(s, TRUE); + request_auto_timing_update(s, true); } return 0; @@ -1691,7 +1691,7 @@ pa_operation * pa_stream_drain(pa_stream *s, pa_stream_success_cb_t cb, void *us /* Ask for a timing update before we cork/uncork to get the best * accuracy for the transport latency suitable for the * check_smoother_status() call in the started callback */ - request_auto_timing_update(s, TRUE); + request_auto_timing_update(s, true); o = pa_operation_new(s->context, s, (pa_operation_cb_t) cb, userdata); @@ -1702,12 +1702,12 @@ pa_operation * pa_stream_drain(pa_stream *s, pa_stream_success_cb_t cb, void *us /* This might cause the read index to continue again, hence * let's request a timing update */ - request_auto_timing_update(s, TRUE); + request_auto_timing_update(s, true); return o; } -static pa_usec_t calc_time(pa_stream *s, pa_bool_t ignore_transport) { +static pa_usec_t calc_time(pa_stream *s, bool ignore_transport) { pa_usec_t usec; pa_assert(s); @@ -1772,7 +1772,7 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command, pa_operation *o = userdata; struct timeval local, remote, now; pa_timing_info *i; - pa_bool_t playing = FALSE; + bool playing = false; uint64_t underrun_for = 0, playing_for = 0; pa_assert(pd); @@ -1784,12 +1784,12 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command, i = &o->stream->timing_info; - o->stream->timing_info_valid = FALSE; - i->write_index_corrupt = TRUE; - i->read_index_corrupt = TRUE; + o->stream->timing_info_valid = false; + i->write_index_corrupt = true; + i->read_index_corrupt = true; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; } else { @@ -1819,9 +1819,9 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command, pa_context_fail(o->context, PA_ERR_PROTOCOL); goto finish; } - o->stream->timing_info_valid = TRUE; - i->write_index_corrupt = FALSE; - i->read_index_corrupt = FALSE; + o->stream->timing_info_valid = true; + i->write_index_corrupt = false; + i->read_index_corrupt = false; i->playing = (int) playing; i->since_underrun = (int64_t) (playing ? playing_for : underrun_for); @@ -1837,22 +1837,22 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command, else i->transport_usec = pa_timeval_diff(&now, &remote); - i->synchronized_clocks = TRUE; + i->synchronized_clocks = true; i->timestamp = remote; } else { /* clocks are not synchronized, let's estimate latency then */ i->transport_usec = pa_timeval_diff(&now, &local)/2; - i->synchronized_clocks = FALSE; + i->synchronized_clocks = false; i->timestamp = local; pa_timeval_add(&i->timestamp, i->transport_usec); } /* Invalidate read and write indexes if necessary */ if (tag < o->stream->read_index_not_before) - i->read_index_corrupt = TRUE; + i->read_index_corrupt = true; if (tag < o->stream->write_index_not_before) - i->write_index_corrupt = TRUE; + i->write_index_corrupt = true; if (o->stream->direction == PA_STREAM_PLAYBACK) { /* Write index correction */ @@ -1877,11 +1877,11 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command, /* Now fix the write index */ if (o->stream->write_index_corrections[j].corrupt) { /* A corrupting seek was made */ - i->write_index_corrupt = TRUE; + i->write_index_corrupt = true; } else if (o->stream->write_index_corrections[j].absolute) { /* An absolute seek was made */ i->write_index = o->stream->write_index_corrections[j].value; - i->write_index_corrupt = FALSE; + i->write_index_corrupt = false; } else if (!i->write_index_corrupt) { /* A relative seek was made */ i->write_index += o->stream->write_index_corrections[j].value; @@ -1894,7 +1894,7 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command, continue; if (o->stream->write_index_corrections[n].tag <= tag) - o->stream->write_index_corrections[n].valid = FALSE; + o->stream->write_index_corrections[n].valid = false; } } @@ -1931,14 +1931,14 @@ static void stream_get_timing_info_callback(pa_pdispatch *pd, uint32_t command, /* Update the smoother */ if ((o->stream->direction == PA_STREAM_PLAYBACK && !i->read_index_corrupt) || (o->stream->direction == PA_STREAM_RECORD && !i->write_index_corrupt)) - pa_smoother_put(o->stream->smoother, u, calc_time(o->stream, TRUE)); + pa_smoother_put(o->stream->smoother, u, calc_time(o->stream, true)); if (i->playing) - pa_smoother_resume(o->stream->smoother, x, TRUE); + pa_smoother_resume(o->stream->smoother, x, true); } } - o->stream->auto_timing_update_requested = FALSE; + o->stream->auto_timing_update_requested = false; if (o->stream->latency_update_callback) o->stream->latency_update_callback(o->stream, o->stream->latency_update_userdata); @@ -1992,9 +1992,9 @@ pa_operation* pa_stream_update_timing_info(pa_stream *s, pa_stream_success_cb_t s->current_write_index_correction = cidx; - s->write_index_corrections[cidx].valid = TRUE; - s->write_index_corrections[cidx].absolute = FALSE; - s->write_index_corrections[cidx].corrupt = FALSE; + s->write_index_corrections[cidx].valid = true; + s->write_index_corrections[cidx].absolute = false; + s->write_index_corrections[cidx].corrupt = false; s->write_index_corrections[cidx].tag = tag; s->write_index_corrections[cidx].value = 0; } @@ -2012,7 +2012,7 @@ void pa_stream_disconnect_callback(pa_pdispatch *pd, uint32_t command, uint32_t pa_stream_ref(s); if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(s->context, command, t, FALSE) < 0) + if (pa_context_handle_error(s->context, command, t, false) < 0) goto finish; pa_stream_set_state(s, PA_STREAM_FAILED); @@ -2220,7 +2220,7 @@ void pa_stream_simple_ack_callback(pa_pdispatch *pd, uint32_t command, uint32_t goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; success = 0; @@ -2254,7 +2254,7 @@ pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, voi /* Ask for a timing update before we cork/uncork to get the best * accuracy for the transport latency suitable for the * check_smoother_status() call in the started callback */ - request_auto_timing_update(s, TRUE); + request_auto_timing_update(s, true); s->corked = b; @@ -2269,11 +2269,11 @@ pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, voi pa_pstream_send_tagstruct(s->context->pstream, t); pa_pdispatch_register_reply(s->context->pdispatch, tag, DEFAULT_TIMEOUT, pa_stream_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref); - check_smoother_status(s, FALSE, FALSE, FALSE); + check_smoother_status(s, false, false, false); /* This might cause the indexes to hang/start again, hence let's * request a timing update, after the cork/uncork, too */ - request_auto_timing_update(s, TRUE); + request_auto_timing_update(s, true); return o; } @@ -2312,7 +2312,7 @@ pa_operation* pa_stream_flush(pa_stream *s, pa_stream_success_cb_t cb, void *use /* Ask for a timing update *before* the flush, so that the * transport usec is as up to date as possible when we get the * underflow message and update the smoother status*/ - request_auto_timing_update(s, TRUE); + request_auto_timing_update(s, true); if (!(o = stream_send_simple_command(s, (uint32_t) (s->direction == PA_STREAM_PLAYBACK ? PA_COMMAND_FLUSH_PLAYBACK_STREAM : PA_COMMAND_FLUSH_RECORD_STREAM), cb, userdata))) return NULL; @@ -2320,19 +2320,19 @@ pa_operation* pa_stream_flush(pa_stream *s, pa_stream_success_cb_t cb, void *use if (s->direction == PA_STREAM_PLAYBACK) { if (s->write_index_corrections[s->current_write_index_correction].valid) - s->write_index_corrections[s->current_write_index_correction].corrupt = TRUE; + s->write_index_corrections[s->current_write_index_correction].corrupt = true; if (s->buffer_attr.prebuf > 0) - check_smoother_status(s, FALSE, FALSE, TRUE); + check_smoother_status(s, false, false, true); /* This will change the write index, but leave the * read index untouched. */ - invalidate_indexes(s, FALSE, TRUE); + invalidate_indexes(s, false, true); } else /* For record streams this has no influence on the write * index, but the read index might jump. */ - invalidate_indexes(s, TRUE, FALSE); + invalidate_indexes(s, true, false); /* Note that we do not update requested_bytes here. This is * because we cannot really know how data actually was dropped @@ -2356,14 +2356,14 @@ pa_operation* pa_stream_prebuf(pa_stream *s, pa_stream_success_cb_t cb, void *us /* Ask for a timing update before we cork/uncork to get the best * accuracy for the transport latency suitable for the * check_smoother_status() call in the started callback */ - request_auto_timing_update(s, TRUE); + request_auto_timing_update(s, true); if (!(o = stream_send_simple_command(s, PA_COMMAND_PREBUF_PLAYBACK_STREAM, cb, userdata))) return NULL; /* This might cause the read index to hang again, hence * let's request a timing update */ - request_auto_timing_update(s, TRUE); + request_auto_timing_update(s, true); return o; } @@ -2382,14 +2382,14 @@ pa_operation* pa_stream_trigger(pa_stream *s, pa_stream_success_cb_t cb, void *u /* Ask for a timing update before we cork/uncork to get the best * accuracy for the transport latency suitable for the * check_smoother_status() call in the started callback */ - request_auto_timing_update(s, TRUE); + request_auto_timing_update(s, true); if (!(o = stream_send_simple_command(s, PA_COMMAND_TRIGGER_PLAYBACK_STREAM, cb, userdata))) return NULL; /* This might cause the read index to start moving again, hence * let's request a timing update */ - request_auto_timing_update(s, TRUE); + request_auto_timing_update(s, true); return o; } @@ -2445,7 +2445,7 @@ int pa_stream_get_time(pa_stream *s, pa_usec_t *r_usec) { if (s->smoother) usec = pa_smoother_get(s->smoother, pa_rtclock_now()); else - usec = calc_time(s, FALSE); + usec = calc_time(s, false); /* Make sure the time runs monotonically */ if (!(s->flags & PA_STREAM_NOT_MONOTONIC)) { @@ -2579,7 +2579,7 @@ static void stream_set_buffer_attr_callback(pa_pdispatch *pd, uint32_t command, goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; success = 0; @@ -2648,7 +2648,7 @@ pa_operation* pa_stream_set_buffer_attr(pa_stream *s, const pa_buffer_attr *attr /* Ask for a timing update before we cork/uncork to get the best * accuracy for the transport latency suitable for the * check_smoother_status() call in the started callback */ - request_auto_timing_update(s, TRUE); + request_auto_timing_update(s, true); o = pa_operation_new(s->context, s, (pa_operation_cb_t) cb, userdata); @@ -2685,7 +2685,7 @@ pa_operation* pa_stream_set_buffer_attr(pa_stream *s, const pa_buffer_attr *attr /* This might cause changes in the read/write index, hence let's * request a timing update */ - request_auto_timing_update(s, TRUE); + request_auto_timing_update(s, true); return o; } @@ -2751,7 +2751,7 @@ static void stream_update_sample_rate_callback(pa_pdispatch *pd, uint32_t comman goto finish; if (command != PA_COMMAND_REPLY) { - if (pa_context_handle_error(o->context, command, t, FALSE) < 0) + if (pa_context_handle_error(o->context, command, t, false) < 0) goto finish; success = 0; diff --git a/src/pulse/thread-mainloop.c b/src/pulse/thread-mainloop.c index a05d95980..435e9f6d4 100644 --- a/src/pulse/thread-mainloop.c +++ b/src/pulse/thread-mainloop.c @@ -104,7 +104,7 @@ pa_threaded_mainloop *pa_threaded_mainloop_new(void) { return NULL; } - m->mutex = pa_mutex_new(TRUE, TRUE); + m->mutex = pa_mutex_new(true, true); m->cond = pa_cond_new(); m->accept_cond = pa_cond_new(); m->thread = NULL; diff --git a/src/pulse/utf8.c b/src/pulse/utf8.c index 773a1f838..afefe80c7 100644 --- a/src/pulse/utf8.c +++ b/src/pulse/utf8.c @@ -64,24 +64,24 @@ #define FILTER_CHAR '_' -static inline pa_bool_t is_unicode_valid(uint32_t ch) { +static inline bool is_unicode_valid(uint32_t ch) { if (ch >= 0x110000) /* End of unicode space */ - return FALSE; + return false; if ((ch & 0xFFFFF800) == 0xD800) /* Reserved area for UTF-16 */ - return FALSE; + return false; if ((ch >= 0xFDD0) && (ch <= 0xFDEF)) /* Reserved */ - return FALSE; + return false; if ((ch & 0xFFFE) == 0xFFFE) /* BOM (Byte Order Mark) */ - return FALSE; + return false; - return TRUE; + return true; } -static inline pa_bool_t is_continuation_char(uint8_t ch) { +static inline bool is_continuation_char(uint8_t ch) { if ((ch & 0xc0) != 0x80) /* 10xxxxxx */ - return FALSE; - return TRUE; + return false; + return true; } static inline void merge_continuation_char(uint32_t *u_ch, uint8_t ch) { diff --git a/src/pulse/volume.c b/src/pulse/volume.c index 0e765ed59..d7a86c6a8 100644 --- a/src/pulse/volume.c +++ b/src/pulse/volume.c @@ -284,7 +284,7 @@ double pa_sw_volume_to_linear(pa_volume_t v) { char *pa_cvolume_snprint(char *s, size_t l, const pa_cvolume *c) { unsigned channel; - pa_bool_t first = TRUE; + bool first = true; char *e; pa_assert(s); @@ -307,7 +307,7 @@ char *pa_cvolume_snprint(char *s, size_t l, const pa_cvolume *c) { (c->values[channel]*100+PA_VOLUME_NORM/2)/PA_VOLUME_NORM); e = strchr(e, 0); - first = FALSE; + first = false; } return s; @@ -330,7 +330,7 @@ char *pa_volume_snprint(char *s, size_t l, pa_volume_t v) { char *pa_sw_cvolume_snprint_dB(char *s, size_t l, const pa_cvolume *c) { unsigned channel; - pa_bool_t first = TRUE; + bool first = true; char *e; pa_assert(s); @@ -355,7 +355,7 @@ char *pa_sw_cvolume_snprint_dB(char *s, size_t l, const pa_cvolume *c) { isinf(f) < 0 || f <= PA_DECIBEL_MININFTY ? -INFINITY : f); e = strchr(e, 0); - first = FALSE; + first = false; } return s; @@ -479,27 +479,27 @@ int pa_cvolume_valid(const pa_cvolume *v) { return 1; } -static pa_bool_t on_left(pa_channel_position_t p) { +static bool on_left(pa_channel_position_t p) { return !!(PA_CHANNEL_POSITION_MASK(p) & PA_CHANNEL_POSITION_MASK_LEFT); } -static pa_bool_t on_right(pa_channel_position_t p) { +static bool on_right(pa_channel_position_t p) { return !!(PA_CHANNEL_POSITION_MASK(p) & PA_CHANNEL_POSITION_MASK_RIGHT); } -static pa_bool_t on_center(pa_channel_position_t p) { +static bool on_center(pa_channel_position_t p) { return !!(PA_CHANNEL_POSITION_MASK(p) & PA_CHANNEL_POSITION_MASK_CENTER); } -static pa_bool_t on_lfe(pa_channel_position_t p) { +static bool on_lfe(pa_channel_position_t p) { return p == PA_CHANNEL_POSITION_LFE; } -static pa_bool_t on_front(pa_channel_position_t p) { +static bool on_front(pa_channel_position_t p) { return !!(PA_CHANNEL_POSITION_MASK(p) & PA_CHANNEL_POSITION_MASK_FRONT); } -static pa_bool_t on_rear(pa_channel_position_t p) { +static bool on_rear(pa_channel_position_t p) { return !!(PA_CHANNEL_POSITION_MASK(p) & PA_CHANNEL_POSITION_MASK_REAR); } @@ -828,7 +828,7 @@ pa_cvolume* pa_cvolume_set_position( pa_volume_t v) { unsigned c; - pa_bool_t good = FALSE; + bool good = false; pa_assert(cv); pa_assert(map); @@ -840,7 +840,7 @@ pa_cvolume* pa_cvolume_set_position( for (c = 0; c < map->channels; c++) if (map->map[c] == t) { cv->values[c] = v; - good = TRUE; + good = true; } return good ? cv : NULL; diff --git a/src/pulse/volume.h b/src/pulse/volume.h index 95c287a9f..fa952c6d1 100644 --- a/src/pulse/volume.h +++ b/src/pulse/volume.h @@ -224,7 +224,7 @@ pa_volume_t pa_cvolume_min(const pa_cvolume *a) PA_GCC_PURE; * \since 0.9.16 */ pa_volume_t pa_cvolume_min_mask(const pa_cvolume *a, const pa_channel_map *cm, pa_channel_position_mask_t mask) PA_GCC_PURE; -/** Return TRUE when the passed cvolume structure is valid, FALSE otherwise */ +/** Return true when the passed cvolume structure is valid, false otherwise */ int pa_cvolume_valid(const pa_cvolume *v) PA_GCC_PURE; /** Return non-zero if the volume of all channels is equal to the specified value */ diff --git a/src/pulsecore/asyncmsgq.c b/src/pulsecore/asyncmsgq.c index 408416c91..58cd7ac0b 100644 --- a/src/pulsecore/asyncmsgq.c +++ b/src/pulsecore/asyncmsgq.c @@ -66,7 +66,7 @@ pa_asyncmsgq *pa_asyncmsgq_new(unsigned size) { PA_REFCNT_INIT(a); pa_assert_se(a->asyncq = pa_asyncq_new(size)); - pa_assert_se(a->mutex = pa_mutex_new(FALSE, TRUE)); + pa_assert_se(a->mutex = pa_mutex_new(false, true)); a->current = NULL; return a; @@ -76,7 +76,7 @@ static void asyncmsgq_free(pa_asyncmsgq *a) { struct asyncmsgq_item *i; pa_assert(a); - while ((i = pa_asyncq_pop(a->asyncq, FALSE))) { + while ((i = pa_asyncq_pop(a->asyncq, false))) { pa_assert(!i->semaphore); @@ -161,7 +161,7 @@ int pa_asyncmsgq_send(pa_asyncmsgq *a, pa_msgobject *object, int code, const voi /* This mutex makes the queue multiple-writer safe. This lock is only used on the writing side */ pa_mutex_lock(a->mutex); - pa_assert_se(pa_asyncq_push(a->asyncq, &i, TRUE) == 0); + pa_assert_se(pa_asyncq_push(a->asyncq, &i, true) == 0); pa_mutex_unlock(a->mutex); pa_semaphore_wait(i.semaphore); @@ -172,7 +172,7 @@ int pa_asyncmsgq_send(pa_asyncmsgq *a, pa_msgobject *object, int code, const voi return i.ret; } -int pa_asyncmsgq_get(pa_asyncmsgq *a, pa_msgobject **object, int *code, void **userdata, int64_t *offset, pa_memchunk *chunk, pa_bool_t wait_op) { +int pa_asyncmsgq_get(pa_asyncmsgq *a, pa_msgobject **object, int *code, void **userdata, int64_t *offset, pa_memchunk *chunk, bool wait_op) { pa_assert(PA_REFCNT_VALUE(a) > 0); pa_assert(!a->current); @@ -246,7 +246,7 @@ int pa_asyncmsgq_wait_for(pa_asyncmsgq *a, int code) { pa_memchunk chunk; int ret; - if (pa_asyncmsgq_get(a, &o, &c, &data, &offset, &chunk, TRUE) < 0) + if (pa_asyncmsgq_get(a, &o, &c, &data, &offset, &chunk, true) < 0) return -1; ret = pa_asyncmsgq_dispatch(o, c, data, offset, &chunk); @@ -269,7 +269,7 @@ int pa_asyncmsgq_process_one(pa_asyncmsgq *a) { pa_assert(PA_REFCNT_VALUE(a) > 0); - if (pa_asyncmsgq_get(a, &object, &code, &data, &offset, &chunk, FALSE) < 0) + if (pa_asyncmsgq_get(a, &object, &code, &data, &offset, &chunk, false) < 0) return 0; pa_asyncmsgq_ref(a); @@ -324,7 +324,7 @@ int pa_asyncmsgq_dispatch(pa_msgobject *object, int code, void *userdata, int64_ return 0; } -void pa_asyncmsgq_flush(pa_asyncmsgq *a, pa_bool_t run) { +void pa_asyncmsgq_flush(pa_asyncmsgq *a, bool run) { pa_assert(PA_REFCNT_VALUE(a) > 0); for (;;) { @@ -335,7 +335,7 @@ void pa_asyncmsgq_flush(pa_asyncmsgq *a, pa_bool_t run) { pa_memchunk chunk; int ret; - if (pa_asyncmsgq_get(a, &object, &code, &data, &offset, &chunk, FALSE) < 0) + if (pa_asyncmsgq_get(a, &object, &code, &data, &offset, &chunk, false) < 0) return; if (!run) { @@ -350,7 +350,7 @@ void pa_asyncmsgq_flush(pa_asyncmsgq *a, pa_bool_t run) { } } -pa_bool_t pa_asyncmsgq_dispatching(pa_asyncmsgq *a) { +bool pa_asyncmsgq_dispatching(pa_asyncmsgq *a) { pa_assert(PA_REFCNT_VALUE(a) > 0); return !!a->current; diff --git a/src/pulsecore/asyncmsgq.h b/src/pulsecore/asyncmsgq.h index 1085c2f02..1251c735e 100644 --- a/src/pulsecore/asyncmsgq.h +++ b/src/pulsecore/asyncmsgq.h @@ -60,13 +60,13 @@ void pa_asyncmsgq_unref(pa_asyncmsgq* q); void pa_asyncmsgq_post(pa_asyncmsgq *q, pa_msgobject *object, int code, const void *userdata, int64_t offset, const pa_memchunk *memchunk, pa_free_cb_t userdata_free_cb); int pa_asyncmsgq_send(pa_asyncmsgq *q, pa_msgobject *object, int code, const void *userdata, int64_t offset, const pa_memchunk *memchunk); -int pa_asyncmsgq_get(pa_asyncmsgq *q, pa_msgobject **object, int *code, void **userdata, int64_t *offset, pa_memchunk *memchunk, pa_bool_t wait); +int pa_asyncmsgq_get(pa_asyncmsgq *q, pa_msgobject **object, int *code, void **userdata, int64_t *offset, pa_memchunk *memchunk, bool wait); int pa_asyncmsgq_dispatch(pa_msgobject *object, int code, void *userdata, int64_t offset, pa_memchunk *memchunk); void pa_asyncmsgq_done(pa_asyncmsgq *q, int ret); int pa_asyncmsgq_wait_for(pa_asyncmsgq *a, int code); int pa_asyncmsgq_process_one(pa_asyncmsgq *a); -void pa_asyncmsgq_flush(pa_asyncmsgq *a, pa_bool_t run); +void pa_asyncmsgq_flush(pa_asyncmsgq *a, bool run); /* For the reading side */ int pa_asyncmsgq_read_fd(pa_asyncmsgq *q); @@ -78,6 +78,6 @@ int pa_asyncmsgq_write_fd(pa_asyncmsgq *q); void pa_asyncmsgq_write_before_poll(pa_asyncmsgq *a); void pa_asyncmsgq_write_after_poll(pa_asyncmsgq *a); -pa_bool_t pa_asyncmsgq_dispatching(pa_asyncmsgq *a); +bool pa_asyncmsgq_dispatching(pa_asyncmsgq *a); #endif diff --git a/src/pulsecore/asyncq.c b/src/pulsecore/asyncq.c index 8c2d58a03..559b57744 100644 --- a/src/pulsecore/asyncq.c +++ b/src/pulsecore/asyncq.c @@ -65,7 +65,7 @@ struct pa_asyncq { PA_LLIST_HEAD(struct localq, localq); struct localq *last_localq; - pa_bool_t waiting_for_post; + bool waiting_for_post; }; PA_STATIC_FLIST_DECLARE(localq, 0, pa_xfree); @@ -90,7 +90,7 @@ pa_asyncq *pa_asyncq_new(unsigned size) { PA_LLIST_HEAD_INIT(struct localq, l->localq); l->last_localq = NULL; - l->waiting_for_post = FALSE; + l->waiting_for_post = false; if (!(l->read_fdsem = pa_fdsem_new())) { pa_xfree(l); @@ -132,7 +132,7 @@ void pa_asyncq_free(pa_asyncq *l, pa_free_cb_t free_cb) { pa_xfree(l); } -static int push(pa_asyncq*l, void *p, pa_bool_t wait_op) { +static int push(pa_asyncq*l, void *p, bool wait_op) { unsigned idx; pa_atomic_ptr_t *cells; @@ -164,7 +164,7 @@ static int push(pa_asyncq*l, void *p, pa_bool_t wait_op) { return 0; } -static pa_bool_t flush_postq(pa_asyncq *l, pa_bool_t wait_op) { +static bool flush_postq(pa_asyncq *l, bool wait_op) { struct localq *q; pa_assert(l); @@ -172,7 +172,7 @@ static pa_bool_t flush_postq(pa_asyncq *l, pa_bool_t wait_op) { while ((q = l->last_localq)) { if (push(l, q->data, wait_op) < 0) - return FALSE; + return false; l->last_localq = q->prev; @@ -182,10 +182,10 @@ static pa_bool_t flush_postq(pa_asyncq *l, pa_bool_t wait_op) { pa_xfree(q); } - return TRUE; + return true; } -int pa_asyncq_push(pa_asyncq*l, void *p, pa_bool_t wait_op) { +int pa_asyncq_push(pa_asyncq*l, void *p, bool wait_op) { pa_assert(l); if (!flush_postq(l, wait_op)) @@ -200,8 +200,8 @@ void pa_asyncq_post(pa_asyncq*l, void *p) { pa_assert(l); pa_assert(p); - if (flush_postq(l, FALSE)) - if (pa_asyncq_push(l, p, FALSE) >= 0) + if (flush_postq(l, false)) + if (pa_asyncq_push(l, p, false) >= 0) return; /* OK, we couldn't push anything in the queue. So let's queue it @@ -222,7 +222,7 @@ void pa_asyncq_post(pa_asyncq*l, void *p) { return; } -void* pa_asyncq_pop(pa_asyncq*l, pa_bool_t wait_op) { +void* pa_asyncq_pop(pa_asyncq*l, bool wait_op) { unsigned idx; void *ret; pa_atomic_ptr_t *cells; @@ -302,11 +302,11 @@ void pa_asyncq_write_before_poll(pa_asyncq *l) { for (;;) { - if (flush_postq(l, FALSE)) + if (flush_postq(l, false)) break; if (pa_fdsem_before_poll(l->read_fdsem) >= 0) { - l->waiting_for_post = TRUE; + l->waiting_for_post = true; break; } } @@ -317,6 +317,6 @@ void pa_asyncq_write_after_poll(pa_asyncq *l) { if (l->waiting_for_post) { pa_fdsem_after_poll(l->read_fdsem); - l->waiting_for_post = FALSE; + l->waiting_for_post = false; } } diff --git a/src/pulsecore/asyncq.h b/src/pulsecore/asyncq.h index 47ccbf030..026379f86 100644 --- a/src/pulsecore/asyncq.h +++ b/src/pulsecore/asyncq.h @@ -45,8 +45,8 @@ typedef struct pa_asyncq pa_asyncq; pa_asyncq* pa_asyncq_new(unsigned size); void pa_asyncq_free(pa_asyncq* q, pa_free_cb_t free_cb); -void* pa_asyncq_pop(pa_asyncq *q, pa_bool_t wait); -int pa_asyncq_push(pa_asyncq *q, void *p, pa_bool_t wait); +void* pa_asyncq_pop(pa_asyncq *q, bool wait); +int pa_asyncq_push(pa_asyncq *q, void *p, bool wait); /* Similar to pa_asyncq_push(), but if the queue is full, postpone the * appending of the item locally and delay until diff --git a/src/pulsecore/atomic.h b/src/pulsecore/atomic.h index bca95768d..419783d64 100644 --- a/src/pulsecore/atomic.h +++ b/src/pulsecore/atomic.h @@ -82,8 +82,8 @@ static inline int pa_atomic_dec(pa_atomic_t *a) { return pa_atomic_sub(a, 1); } -/* Returns TRUE when the operation was successful. */ -static inline pa_bool_t pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) { +/* Returns true when the operation was successful. */ +static inline bool pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) { return __sync_bool_compare_and_swap(&a->value, old_i, new_i); } @@ -103,7 +103,7 @@ static inline void pa_atomic_ptr_store(pa_atomic_ptr_t *a, void *p) { __sync_synchronize(); } -static inline pa_bool_t pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) { +static inline bool pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) { return __sync_bool_compare_and_swap(&a->value, (long) old_p, (long) new_p); } @@ -153,8 +153,8 @@ static inline int pa_atomic_dec(pa_atomic_t *a) { return nv + 1; } -/* Returns TRUE when the operation was successful. */ -static inline pa_bool_t pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) { +/* Returns true when the operation was successful. */ +static inline bool pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) { unsigned int r = atomic_cas_uint(&a->value, (unsigned int) old_i, (unsigned int) new_i); return (int) r == old_i; } @@ -175,7 +175,7 @@ static inline void pa_atomic_ptr_store(pa_atomic_ptr_t *a, void *p) { membar_sync(); } -static inline pa_bool_t pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) { +static inline bool pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) { void *r = atomic_cas_ptr(&a->value, old_p, new_p); return r == old_p; } @@ -326,7 +326,7 @@ static inline int pa_atomic_dec(pa_atomic_t *a) { return pa_atomic_sub(a, 1); } -static inline pa_bool_t pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) { +static inline bool pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) { int result; __asm__ __volatile__ ("lock; cmpxchgl %2, %1" @@ -350,7 +350,7 @@ static inline void pa_atomic_ptr_store(pa_atomic_ptr_t *a, void *p) { a->value = (unsigned long) p; } -static inline pa_bool_t pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) { +static inline bool pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) { void *result; __asm__ __volatile__ ("lock; cmpxchgq %q2, %1" @@ -434,7 +434,7 @@ static inline int pa_atomic_dec(pa_atomic_t *a) { return pa_atomic_sub(a, 1); } -static inline pa_bool_t pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) { +static inline bool pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) { unsigned long not_equal, not_exclusive; pa_memory_barrier(); @@ -468,7 +468,7 @@ static inline void pa_atomic_ptr_store(pa_atomic_ptr_t *a, void *p) { pa_memory_barrier(); } -static inline pa_bool_t pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) { +static inline bool pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) { unsigned long not_equal, not_exclusive; pa_memory_barrier(); @@ -556,9 +556,9 @@ static inline int pa_atomic_dec(pa_atomic_t *a) { return pa_atomic_sub(a, 1); } -/* Returns TRUE when the operation was successful. */ -static inline pa_bool_t pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) { - pa_bool_t failed; +/* Returns true when the operation was successful. */ +static inline bool pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) { + bool failed; do { failed = !!__kernel_cmpxchg(old_i, new_i, &a->value); } while(failed && a->value == old_i); @@ -581,8 +581,8 @@ static inline void pa_atomic_ptr_store(pa_atomic_ptr_t *a, void *p) { pa_memory_barrier(); } -static inline pa_bool_t pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) { - pa_bool_t failed; +static inline bool pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) { + bool failed; do { failed = !!__kernel_cmpxchg_u((unsigned long) old_p, (unsigned long) new_p, &a->value); } while(failed && a->value == (unsigned long) old_p); @@ -625,7 +625,7 @@ static inline int pa_atomic_dec(pa_atomic_t *a) { return (int) AO_fetch_and_sub1_full(&a->value); } -static inline pa_bool_t pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) { +static inline bool pa_atomic_cmpxchg(pa_atomic_t *a, int old_i, int new_i) { return AO_compare_and_swap_full(&a->value, (unsigned long) old_i, (unsigned long) new_i); } @@ -643,7 +643,7 @@ static inline void pa_atomic_ptr_store(pa_atomic_ptr_t *a, void *p) { AO_store_full(&a->value, (AO_t) p); } -static inline pa_bool_t pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) { +static inline bool pa_atomic_ptr_cmpxchg(pa_atomic_ptr_t *a, void *old_p, void* new_p) { return AO_compare_and_swap_full(&a->value, (AO_t) old_p, (AO_t) new_p); } diff --git a/src/pulsecore/aupdate.c b/src/pulsecore/aupdate.c index 85b6e00e8..2a7241a80 100644 --- a/src/pulsecore/aupdate.c +++ b/src/pulsecore/aupdate.c @@ -39,7 +39,7 @@ struct pa_aupdate { pa_atomic_t read_lock; pa_mutex *write_lock; pa_semaphore *semaphore; - pa_bool_t swapped; + bool swapped; }; pa_aupdate *pa_aupdate_new(void) { @@ -47,7 +47,7 @@ pa_aupdate *pa_aupdate_new(void) { a = pa_xnew(pa_aupdate, 1); pa_atomic_store(&a->read_lock, 0); - a->write_lock = pa_mutex_new(FALSE, FALSE); + a->write_lock = pa_mutex_new(false, false); a->semaphore = pa_semaphore_new(0); return a; @@ -102,7 +102,7 @@ unsigned pa_aupdate_write_begin(pa_aupdate *a) { n = (unsigned) pa_atomic_load(&a->read_lock); - a->swapped = FALSE; + a->swapped = false; return !WHICH(n); } @@ -122,7 +122,7 @@ unsigned pa_aupdate_write_swap(pa_aupdate *a) { break; } - a->swapped = TRUE; + a->swapped = true; return WHICH(n); } diff --git a/src/pulsecore/auth-cookie.c b/src/pulsecore/auth-cookie.c index 97ea351bf..c5e5d7c6a 100644 --- a/src/pulsecore/auth-cookie.c +++ b/src/pulsecore/auth-cookie.c @@ -42,7 +42,7 @@ struct pa_auth_cookie { size_t size; }; -pa_auth_cookie* pa_auth_cookie_get(pa_core *core, const char *cn, pa_bool_t create, size_t size) { +pa_auth_cookie* pa_auth_cookie_get(pa_core *core, const char *cn, bool create, size_t size) { pa_auth_cookie *c; char *t; diff --git a/src/pulsecore/auth-cookie.h b/src/pulsecore/auth-cookie.h index 5f871b10a..7c689a4ea 100644 --- a/src/pulsecore/auth-cookie.h +++ b/src/pulsecore/auth-cookie.h @@ -26,7 +26,7 @@ typedef struct pa_auth_cookie pa_auth_cookie; -pa_auth_cookie* pa_auth_cookie_get(pa_core *c, const char *cn, pa_bool_t create, size_t size); +pa_auth_cookie* pa_auth_cookie_get(pa_core *c, const char *cn, bool create, size_t size); pa_auth_cookie* pa_auth_cookie_ref(pa_auth_cookie *c); void pa_auth_cookie_unref(pa_auth_cookie *c); diff --git a/src/pulsecore/authkey.c b/src/pulsecore/authkey.c index fdf49de51..03c0c4bf0 100644 --- a/src/pulsecore/authkey.c +++ b/src/pulsecore/authkey.c @@ -72,7 +72,7 @@ static int generate(int fd, void *ret_data, size_t length) { /* Load an authorization cookie from file fn and store it in data. If * the cookie file doesn't exist, create it */ -static int load(const char *fn, pa_bool_t create, void *data, size_t length) { +static int load(const char *fn, bool create, void *data, size_t length) { int fd = -1; int writable = 1; int unlock = 0, ret = -1; @@ -83,7 +83,7 @@ static int load(const char *fn, pa_bool_t create, void *data, size_t length) { pa_assert(length > 0); if (create) - pa_make_secure_parent_dir(fn, pa_in_system_mode() ? 0755U : 0700U, -1, -1, FALSE); + pa_make_secure_parent_dir(fn, pa_in_system_mode() ? 0755U : 0700U, -1, -1, false); if ((fd = pa_open_cloexec(fn, (create ? O_RDWR|O_CREAT : O_RDONLY)|O_BINARY, S_IRUSR|S_IWUSR)) < 0) { @@ -132,7 +132,7 @@ finish: } /* Load a cookie from a cookie file. If the file doesn't exist, create it. */ -int pa_authkey_load(const char *path, pa_bool_t create, void *data, size_t length) { +int pa_authkey_load(const char *path, bool create, void *data, size_t length) { int ret; pa_assert(path); @@ -172,7 +172,7 @@ static char *normalize_path(const char *fn) { /* Load a cookie from a file in the home directory. If the specified * path starts with /, use it as absolute path instead. */ -int pa_authkey_load_auto(const char *fn, pa_bool_t create, void *data, size_t length) { +int pa_authkey_load_auto(const char *fn, bool create, void *data, size_t length) { char *p; int ret; diff --git a/src/pulsecore/authkey.h b/src/pulsecore/authkey.h index 22ec990de..df62d0c36 100644 --- a/src/pulsecore/authkey.h +++ b/src/pulsecore/authkey.h @@ -24,8 +24,8 @@ #include <sys/types.h> -int pa_authkey_load(const char *path, pa_bool_t create, void *data, size_t len); -int pa_authkey_load_auto(const char *fn, pa_bool_t create, void *data, size_t length); +int pa_authkey_load(const char *path, bool create, void *data, size_t len); +int pa_authkey_load_auto(const char *fn, bool create, void *data, size_t length); int pa_authkey_save(const char *path, const void *data, size_t length); diff --git a/src/pulsecore/bitset.c b/src/pulsecore/bitset.c index 4b62fc4f1..bcfd69335 100644 --- a/src/pulsecore/bitset.c +++ b/src/pulsecore/bitset.c @@ -29,7 +29,7 @@ #include "bitset.h" -void pa_bitset_set(pa_bitset_t *b, unsigned k, pa_bool_t v) { +void pa_bitset_set(pa_bitset_t *b, unsigned k, bool v) { pa_assert(b); if (v) @@ -38,14 +38,14 @@ void pa_bitset_set(pa_bitset_t *b, unsigned k, pa_bool_t v) { b[k >> 5] &= ~((uint32_t) (1 << (k & 31))); } -pa_bool_t pa_bitset_get(const pa_bitset_t *b, unsigned k) { +bool pa_bitset_get(const pa_bitset_t *b, unsigned k) { return !!(b[k >> 5] & (1 << (k & 31))); } -pa_bool_t pa_bitset_equals(const pa_bitset_t *b, unsigned n, ...) { +bool pa_bitset_equals(const pa_bitset_t *b, unsigned n, ...) { va_list ap; pa_bitset_t *a; - pa_bool_t equal; + bool equal; a = pa_xnew0(pa_bitset_t, PA_BITSET_ELEMENTS(n)); @@ -56,7 +56,7 @@ pa_bool_t pa_bitset_equals(const pa_bitset_t *b, unsigned n, ...) { if (j < 0) break; - pa_bitset_set(a, j, TRUE); + pa_bitset_set(a, j, true); } va_end(ap); diff --git a/src/pulsecore/bitset.h b/src/pulsecore/bitset.h index a86a15e7e..ae31afe68 100644 --- a/src/pulsecore/bitset.h +++ b/src/pulsecore/bitset.h @@ -30,8 +30,8 @@ typedef uint32_t pa_bitset_t; -void pa_bitset_set(pa_bitset_t *b, unsigned k, pa_bool_t v); -pa_bool_t pa_bitset_get(const pa_bitset_t *b, unsigned k); -pa_bool_t pa_bitset_equals(const pa_bitset_t *b, unsigned n, ...); +void pa_bitset_set(pa_bitset_t *b, unsigned k, bool v); +bool pa_bitset_get(const pa_bitset_t *b, unsigned k); +bool pa_bitset_equals(const pa_bitset_t *b, unsigned n, ...); #endif diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c index 7cf45dfe0..c771cac77 100644 --- a/src/pulsecore/card.c +++ b/src/pulsecore/card.c @@ -188,7 +188,7 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) { port->card = c; c->active_profile = NULL; - c->save_profile = FALSE; + c->save_profile = false; if (data->active_profile) if ((c->active_profile = pa_hashmap_get(c->profiles, data->active_profile))) @@ -204,7 +204,7 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) { c->set_profile = NULL; pa_device_init_description(c->proplist); - pa_device_init_icon(c->proplist, TRUE); + pa_device_init_icon(c->proplist, true); pa_device_init_intended_roles(c->proplist); pa_assert_se(pa_idxset_put(core->cards, c, &c->index) >= 0); @@ -250,7 +250,7 @@ void pa_card_free(pa_card *c) { pa_xfree(c); } -int pa_card_set_profile(pa_card *c, const char *name, pa_bool_t save) { +int pa_card_set_profile(pa_card *c, const char *name, bool save) { pa_card_profile *profile; int r; @@ -287,7 +287,7 @@ int pa_card_set_profile(pa_card *c, const char *name, pa_bool_t save) { return 0; } -int pa_card_suspend(pa_card *c, pa_bool_t suspend, pa_suspend_cause_t cause) { +int pa_card_suspend(pa_card *c, bool suspend, pa_suspend_cause_t cause) { pa_sink *sink; pa_source *source; uint32_t idx; diff --git a/src/pulsecore/card.h b/src/pulsecore/card.h index 32deb7b58..a0f8a7d2e 100644 --- a/src/pulsecore/card.h +++ b/src/pulsecore/card.h @@ -75,7 +75,7 @@ struct pa_card { pa_hashmap *ports; - pa_bool_t save_profile:1; + bool save_profile:1; void *userdata; @@ -94,9 +94,9 @@ typedef struct pa_card_new_data { pa_hashmap *ports; - pa_bool_t namereg_fail:1; + bool namereg_fail:1; - pa_bool_t save_profile:1; + bool save_profile:1; } pa_card_new_data; pa_card_profile *pa_card_profile_new(const char *name, const char *description, size_t extra); @@ -115,8 +115,8 @@ void pa_card_free(pa_card *c); void pa_card_add_profile(pa_card *c, pa_card_profile *profile); -int pa_card_set_profile(pa_card *c, const char *name, pa_bool_t save); +int pa_card_set_profile(pa_card *c, const char *name, bool save); -int pa_card_suspend(pa_card *c, pa_bool_t suspend, pa_suspend_cause_t cause); +int pa_card_suspend(pa_card *c, bool suspend, pa_suspend_cause_t cause); #endif diff --git a/src/pulsecore/cli-command.c b/src/pulsecore/cli-command.c index 6644d641e..ad9bb7d6d 100644 --- a/src/pulsecore/cli-command.c +++ b/src/pulsecore/cli-command.c @@ -63,7 +63,7 @@ struct command { const char *name; - int (*proc) (pa_core *c, pa_tokenizer*t, pa_strbuf *buf, pa_bool_t *fail); + int (*proc) (pa_core *c, pa_tokenizer*t, pa_strbuf *buf, bool *fail); const char *help; unsigned args; }; @@ -82,61 +82,61 @@ enum { }; /* Prototypes for all available commands */ -static int pa_cli_command_exit(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_help(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_modules(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_clients(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_cards(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_sinks(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_sources(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_sink_inputs(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_source_outputs(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_info(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_unload(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_describe(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_sink_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_sink_input_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_source_output_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_source_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_sink_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_source_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_sink_input_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_source_output_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_sink_default(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_source_default(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_kill_client(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_kill_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_kill_source_output(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_scache_play(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_scache_remove(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_scache_list(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_scache_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_scache_load_dir(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_play_file(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_list_shared_props(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_move_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_move_source_output(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_vacuum(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_suspend_sink(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_suspend_source(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_suspend(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_log_target(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_log_level(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_log_meta(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_log_time(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_log_backtrace(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_update_sink_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_update_source_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_update_sink_input_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_update_source_output_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_card_profile(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_sink_port(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_source_port(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_port_offset(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); -static int pa_cli_command_dump_volumes(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail); +static int pa_cli_command_exit(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_help(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_modules(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_clients(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_cards(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_sinks(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_sources(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_sink_inputs(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_source_outputs(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_info(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_unload(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_describe(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_sink_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_sink_input_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_source_output_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_source_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_sink_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_source_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_sink_input_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_source_output_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_sink_default(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_source_default(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_kill_client(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_kill_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_kill_source_output(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_scache_play(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_scache_remove(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_scache_list(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_scache_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_scache_load_dir(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_play_file(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_list_shared_props(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_move_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_move_source_output(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_vacuum(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_suspend_sink(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_suspend_source(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_suspend(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_log_target(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_log_level(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_log_meta(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_log_time(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_log_backtrace(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_update_sink_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_update_source_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_update_sink_input_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_update_source_output_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_card_profile(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_sink_port(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_source_port(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_port_offset(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); +static int pa_cli_command_dump_volumes(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail); /* A method table for all available commands */ @@ -214,19 +214,19 @@ static uint32_t parse_index(const char *n) { return idx; } -static int pa_cli_command_exit(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_exit(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { pa_core_assert_ref(c); pa_assert(t); pa_assert(buf); pa_assert(fail); - if (pa_core_exit(c, FALSE, 0) < 0) + if (pa_core_exit(c, false, 0) < 0) pa_strbuf_puts(buf, "Not allowed to terminate daemon.\n"); return 0; } -static int pa_cli_command_help(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_help(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const struct command*command; pa_core_assert_ref(c); @@ -242,7 +242,7 @@ static int pa_cli_command_help(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b return 0; } -static int pa_cli_command_modules(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_modules(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { char *s; pa_core_assert_ref(c); @@ -256,7 +256,7 @@ static int pa_cli_command_modules(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, p return 0; } -static int pa_cli_command_clients(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_clients(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { char *s; pa_core_assert_ref(c); @@ -270,7 +270,7 @@ static int pa_cli_command_clients(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, p return 0; } -static int pa_cli_command_cards(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_cards(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { char *s; pa_core_assert_ref(c); @@ -284,7 +284,7 @@ static int pa_cli_command_cards(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_ return 0; } -static int pa_cli_command_sinks(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_sinks(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { char *s; pa_core_assert_ref(c); @@ -298,7 +298,7 @@ static int pa_cli_command_sinks(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_ return 0; } -static int pa_cli_command_sources(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_sources(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { char *s; pa_core_assert_ref(c); @@ -312,7 +312,7 @@ static int pa_cli_command_sources(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, p return 0; } -static int pa_cli_command_sink_inputs(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_sink_inputs(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { char *s; pa_core_assert_ref(c); @@ -326,7 +326,7 @@ static int pa_cli_command_sink_inputs(pa_core *c, pa_tokenizer *t, pa_strbuf *bu return 0; } -static int pa_cli_command_source_outputs(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_source_outputs(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { char *s; pa_core_assert_ref(c); @@ -340,7 +340,7 @@ static int pa_cli_command_source_outputs(pa_core *c, pa_tokenizer *t, pa_strbuf return 0; } -static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { char ss[PA_SAMPLE_SPEC_SNPRINT_MAX]; char cm[PA_CHANNEL_MAP_SNPRINT_MAX]; char bytes[PA_BYTES_SNPRINT_MAX]; @@ -407,7 +407,7 @@ static int pa_cli_command_stat(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b return 0; } -static int pa_cli_command_info(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_info(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { pa_core_assert_ref(c); pa_assert(t); pa_assert(buf); @@ -425,7 +425,7 @@ static int pa_cli_command_info(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b return 0; } -static int pa_cli_command_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *name; pa_core_assert_ref(c); @@ -446,11 +446,11 @@ static int pa_cli_command_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b return 0; } -static int pa_cli_command_unload(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_unload(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { pa_module *m; uint32_t idx; const char *i; - pa_bool_t unloaded = FALSE; + bool unloaded = false; pa_core_assert_ref(c); pa_assert(t); @@ -468,16 +468,16 @@ static int pa_cli_command_unload(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa return -1; } - pa_module_unload_request(m, FALSE); + pa_module_unload_request(m, false); } else { PA_IDXSET_FOREACH(m, c->modules, idx) if (pa_streq(i, m->name)) { - unloaded = TRUE; - pa_module_unload_request(m, FALSE); + unloaded = true; + pa_module_unload_request(m, false); } - if (unloaded == FALSE) { + if (unloaded == false) { pa_strbuf_printf(buf, "Module %s not loaded.\n", i); return -1; } @@ -486,7 +486,7 @@ static int pa_cli_command_unload(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa return 0; } -static int pa_cli_command_describe(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_describe(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *name; pa_modinfo *i; @@ -527,7 +527,7 @@ static int pa_cli_command_describe(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, return 0; } -static int pa_cli_command_sink_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_sink_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *v; pa_sink *sink; uint32_t volume; @@ -564,11 +564,11 @@ static int pa_cli_command_sink_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *bu } pa_cvolume_set(&cvolume, 1, volume); - pa_sink_set_volume(sink, &cvolume, TRUE, TRUE); + pa_sink_set_volume(sink, &cvolume, true, true); return 0; } -static int pa_cli_command_sink_input_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_sink_input_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *v; pa_sink_input *si; pa_volume_t volume; @@ -616,11 +616,11 @@ static int pa_cli_command_sink_input_volume(pa_core *c, pa_tokenizer *t, pa_strb } pa_cvolume_set(&cvolume, 1, volume); - pa_sink_input_set_volume(si, &cvolume, TRUE, TRUE); + pa_sink_input_set_volume(si, &cvolume, true, true); return 0; } -static int pa_cli_command_source_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_source_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *v; pa_source *source; uint32_t volume; @@ -657,11 +657,11 @@ static int pa_cli_command_source_volume(pa_core *c, pa_tokenizer *t, pa_strbuf * } pa_cvolume_set(&cvolume, 1, volume); - pa_source_set_volume(source, &cvolume, TRUE, TRUE); + pa_source_set_volume(source, &cvolume, true, true); return 0; } -static int pa_cli_command_source_output_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_source_output_volume(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *v; pa_source_output *so; pa_volume_t volume; @@ -709,11 +709,11 @@ static int pa_cli_command_source_output_volume(pa_core *c, pa_tokenizer *t, pa_s } pa_cvolume_set(&cvolume, 1, volume); - pa_source_output_set_volume(so, &cvolume, TRUE, TRUE); + pa_source_output_set_volume(so, &cvolume, true, true); return 0; } -static int pa_cli_command_sink_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_sink_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *m; pa_sink *sink; int mute; @@ -743,11 +743,11 @@ static int pa_cli_command_sink_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, return -1; } - pa_sink_set_mute(sink, mute, TRUE); + pa_sink_set_mute(sink, mute, true); return 0; } -static int pa_cli_command_source_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_source_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *m; pa_source *source; int mute; @@ -777,11 +777,11 @@ static int pa_cli_command_source_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *bu return -1; } - pa_source_set_mute(source, mute, TRUE); + pa_source_set_mute(source, mute, true); return 0; } -static int pa_cli_command_update_sink_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_update_sink_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *s; pa_sink *sink; pa_proplist *p; @@ -818,7 +818,7 @@ static int pa_cli_command_update_sink_proplist(pa_core *c, pa_tokenizer *t, pa_s return 0; } -static int pa_cli_command_update_source_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_update_source_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *s; pa_source *source; pa_proplist *p; @@ -855,7 +855,7 @@ static int pa_cli_command_update_source_proplist(pa_core *c, pa_tokenizer *t, pa return 0; } -static int pa_cli_command_update_sink_input_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_update_sink_input_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *s; pa_sink_input *si; uint32_t idx; @@ -898,7 +898,7 @@ static int pa_cli_command_update_sink_input_proplist(pa_core *c, pa_tokenizer *t return 0; } -static int pa_cli_command_update_source_output_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_update_source_output_proplist(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *s; pa_source_output *so; uint32_t idx; @@ -941,7 +941,7 @@ static int pa_cli_command_update_source_output_proplist(pa_core *c, pa_tokenizer return 0; } -static int pa_cli_command_sink_input_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_sink_input_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *v; pa_sink_input *si; uint32_t idx; @@ -977,11 +977,11 @@ static int pa_cli_command_sink_input_mute(pa_core *c, pa_tokenizer *t, pa_strbuf return -1; } - pa_sink_input_set_mute(si, mute, TRUE); + pa_sink_input_set_mute(si, mute, true); return 0; } -static int pa_cli_command_source_output_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_source_output_mute(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *v; pa_source_output *so; uint32_t idx; @@ -1017,11 +1017,11 @@ static int pa_cli_command_source_output_mute(pa_core *c, pa_tokenizer *t, pa_str return -1; } - pa_source_output_set_mute(so, mute, TRUE); + pa_source_output_set_mute(so, mute, true); return 0; } -static int pa_cli_command_sink_default(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_sink_default(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n; pa_sink *s; @@ -1043,7 +1043,7 @@ static int pa_cli_command_sink_default(pa_core *c, pa_tokenizer *t, pa_strbuf *b return 0; } -static int pa_cli_command_source_default(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_source_default(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n; pa_source *s; @@ -1064,7 +1064,7 @@ static int pa_cli_command_source_default(pa_core *c, pa_tokenizer *t, pa_strbuf return 0; } -static int pa_cli_command_kill_client(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_kill_client(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n; pa_client *client; uint32_t idx; @@ -1093,7 +1093,7 @@ static int pa_cli_command_kill_client(pa_core *c, pa_tokenizer *t, pa_strbuf *bu return 0; } -static int pa_cli_command_kill_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_kill_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n; pa_sink_input *sink_input; uint32_t idx; @@ -1122,7 +1122,7 @@ static int pa_cli_command_kill_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf return 0; } -static int pa_cli_command_kill_source_output(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_kill_source_output(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n; pa_source_output *source_output; uint32_t idx; @@ -1151,7 +1151,7 @@ static int pa_cli_command_kill_source_output(pa_core *c, pa_tokenizer *t, pa_str return 0; } -static int pa_cli_command_scache_list(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_scache_list(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { char *s; pa_core_assert_ref(c); @@ -1166,7 +1166,7 @@ static int pa_cli_command_scache_list(pa_core *c, pa_tokenizer *t, pa_strbuf *bu return 0; } -static int pa_cli_command_scache_play(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_scache_play(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *sink_name; pa_sink *sink; uint32_t idx; @@ -1196,7 +1196,7 @@ static int pa_cli_command_scache_play(pa_core *c, pa_tokenizer *t, pa_strbuf *bu return 0; } -static int pa_cli_command_scache_remove(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_scache_remove(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n; pa_core_assert_ref(c); @@ -1217,7 +1217,7 @@ static int pa_cli_command_scache_remove(pa_core *c, pa_tokenizer *t, pa_strbuf * return 0; } -static int pa_cli_command_scache_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_scache_load(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *fname, *n; int r; @@ -1242,7 +1242,7 @@ static int pa_cli_command_scache_load(pa_core *c, pa_tokenizer *t, pa_strbuf *bu return 0; } -static int pa_cli_command_scache_load_dir(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_scache_load_dir(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *pname; pa_core_assert_ref(c); @@ -1263,7 +1263,7 @@ static int pa_cli_command_scache_load_dir(pa_core *c, pa_tokenizer *t, pa_strbuf return 0; } -static int pa_cli_command_play_file(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_play_file(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *fname, *sink_name; pa_sink *sink; @@ -1285,7 +1285,7 @@ static int pa_cli_command_play_file(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, return pa_play_file(sink, fname, NULL); } -static int pa_cli_command_list_shared_props(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_list_shared_props(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { pa_core_assert_ref(c); pa_assert(t); pa_assert(buf); @@ -1295,7 +1295,7 @@ static int pa_cli_command_list_shared_props(pa_core *c, pa_tokenizer *t, pa_strb return 0; } -static int pa_cli_command_vacuum(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_vacuum(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { pa_core_assert_ref(c); pa_assert(t); pa_assert(buf); @@ -1306,7 +1306,7 @@ static int pa_cli_command_vacuum(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa return 0; } -static int pa_cli_command_move_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_move_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *k; pa_sink_input *si; pa_sink *sink; @@ -1342,14 +1342,14 @@ static int pa_cli_command_move_sink_input(pa_core *c, pa_tokenizer *t, pa_strbuf return -1; } - if (pa_sink_input_move_to(si, sink, TRUE) < 0) { + if (pa_sink_input_move_to(si, sink, true) < 0) { pa_strbuf_puts(buf, "Moved failed.\n"); return -1; } return 0; } -static int pa_cli_command_move_source_output(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_move_source_output(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *k; pa_source_output *so; pa_source *source; @@ -1385,14 +1385,14 @@ static int pa_cli_command_move_source_output(pa_core *c, pa_tokenizer *t, pa_str return -1; } - if (pa_source_output_move_to(so, source, TRUE) < 0) { + if (pa_source_output_move_to(so, source, true) < 0) { pa_strbuf_puts(buf, "Moved failed.\n"); return -1; } return 0; } -static int pa_cli_command_suspend_sink(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_suspend_sink(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *m; pa_sink *sink; int suspend, r; @@ -1430,7 +1430,7 @@ static int pa_cli_command_suspend_sink(pa_core *c, pa_tokenizer *t, pa_strbuf *b return 0; } -static int pa_cli_command_suspend_source(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_suspend_source(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *m; pa_source *source; int suspend, r; @@ -1468,7 +1468,7 @@ static int pa_cli_command_suspend_source(pa_core *c, pa_tokenizer *t, pa_strbuf return 0; } -static int pa_cli_command_suspend(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_suspend(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *m; int suspend, r; @@ -1498,7 +1498,7 @@ static int pa_cli_command_suspend(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, p return 0; } -static int pa_cli_command_log_target(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_log_target(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *m; pa_log_target *log_target = NULL; @@ -1535,7 +1535,7 @@ static int pa_cli_command_log_target(pa_core *c, pa_tokenizer *t, pa_strbuf *buf return 0; } -static int pa_cli_command_log_level(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_log_level(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *m; uint32_t level; @@ -1559,7 +1559,7 @@ static int pa_cli_command_log_level(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, return 0; } -static int pa_cli_command_log_meta(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_log_meta(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *m; int b; @@ -1583,7 +1583,7 @@ static int pa_cli_command_log_meta(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, return 0; } -static int pa_cli_command_log_time(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_log_time(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *m; int b; @@ -1607,7 +1607,7 @@ static int pa_cli_command_log_time(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, return 0; } -static int pa_cli_command_log_backtrace(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_log_backtrace(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *m; uint32_t nframes; @@ -1631,7 +1631,7 @@ static int pa_cli_command_log_backtrace(pa_core *c, pa_tokenizer *t, pa_strbuf * return 0; } -static int pa_cli_command_card_profile(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_card_profile(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *p; pa_card *card; @@ -1655,7 +1655,7 @@ static int pa_cli_command_card_profile(pa_core *c, pa_tokenizer *t, pa_strbuf *b return -1; } - if (pa_card_set_profile(card, p, TRUE) < 0) { + if (pa_card_set_profile(card, p, true) < 0) { pa_strbuf_printf(buf, "Failed to set card profile to '%s'.\n", p); return -1; } @@ -1663,7 +1663,7 @@ static int pa_cli_command_card_profile(pa_core *c, pa_tokenizer *t, pa_strbuf *b return 0; } -static int pa_cli_command_sink_port(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_sink_port(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *p; pa_sink *sink; @@ -1687,7 +1687,7 @@ static int pa_cli_command_sink_port(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, return -1; } - if (pa_sink_set_port(sink, p, TRUE) < 0) { + if (pa_sink_set_port(sink, p, true) < 0) { pa_strbuf_printf(buf, "Failed to set sink port to '%s'.\n", p); return -1; } @@ -1695,7 +1695,7 @@ static int pa_cli_command_sink_port(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, return 0; } -static int pa_cli_command_source_port(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_source_port(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *p; pa_source *source; @@ -1719,7 +1719,7 @@ static int pa_cli_command_source_port(pa_core *c, pa_tokenizer *t, pa_strbuf *bu return -1; } - if (pa_source_set_port(source, p, TRUE) < 0) { + if (pa_source_set_port(source, p, true) < 0) { pa_strbuf_printf(buf, "Failed to set source port to '%s'.\n", p); return -1; } @@ -1727,7 +1727,7 @@ static int pa_cli_command_source_port(pa_core *c, pa_tokenizer *t, pa_strbuf *bu return 0; } -static int pa_cli_command_port_offset(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_port_offset(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { const char *n, *p, *l; pa_device_port *port; pa_card *card; @@ -1773,12 +1773,12 @@ static int pa_cli_command_port_offset(pa_core *c, pa_tokenizer *t, pa_strbuf *bu return 0; } -static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { pa_module *m; pa_sink *sink; pa_source *source; pa_card *card; - pa_bool_t nl; + bool nl; uint32_t idx; time_t now; #ifdef HAVE_CTIME_R @@ -1808,48 +1808,48 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b pa_strbuf_puts(buf, "\n"); } - nl = FALSE; + nl = false; PA_IDXSET_FOREACH(sink, c->sinks, idx) { if (!nl) { pa_strbuf_puts(buf, "\n"); - nl = TRUE; + nl = true; } - pa_strbuf_printf(buf, "set-sink-volume %s 0x%03x\n", sink->name, pa_cvolume_max(pa_sink_get_volume(sink, FALSE))); - pa_strbuf_printf(buf, "set-sink-mute %s %s\n", sink->name, pa_yes_no(pa_sink_get_mute(sink, FALSE))); + pa_strbuf_printf(buf, "set-sink-volume %s 0x%03x\n", sink->name, pa_cvolume_max(pa_sink_get_volume(sink, false))); + pa_strbuf_printf(buf, "set-sink-mute %s %s\n", sink->name, pa_yes_no(pa_sink_get_mute(sink, false))); pa_strbuf_printf(buf, "suspend-sink %s %s\n", sink->name, pa_yes_no(pa_sink_get_state(sink) == PA_SINK_SUSPENDED)); } - nl = FALSE; + nl = false; PA_IDXSET_FOREACH(source, c->sources, idx) { if (!nl) { pa_strbuf_puts(buf, "\n"); - nl = TRUE; + nl = true; } - pa_strbuf_printf(buf, "set-source-volume %s 0x%03x\n", source->name, pa_cvolume_max(pa_source_get_volume(source, FALSE))); - pa_strbuf_printf(buf, "set-source-mute %s %s\n", source->name, pa_yes_no(pa_source_get_mute(source, FALSE))); + pa_strbuf_printf(buf, "set-source-volume %s 0x%03x\n", source->name, pa_cvolume_max(pa_source_get_volume(source, false))); + pa_strbuf_printf(buf, "set-source-mute %s %s\n", source->name, pa_yes_no(pa_source_get_mute(source, false))); pa_strbuf_printf(buf, "suspend-source %s %s\n", source->name, pa_yes_no(pa_source_get_state(source) == PA_SOURCE_SUSPENDED)); } - nl = FALSE; + nl = false; PA_IDXSET_FOREACH(card, c->cards, idx) { if (!nl) { pa_strbuf_puts(buf, "\n"); - nl = TRUE; + nl = true; } pa_strbuf_printf(buf, "set-card-profile %s %s\n", card->name, card->active_profile->name); } - nl = FALSE; + nl = false; if ((sink = pa_namereg_get_default_sink(c))) { if (!nl) { pa_strbuf_puts(buf, "\n"); - nl = TRUE; + nl = true; } pa_strbuf_printf(buf, "set-default-sink %s\n", sink->name); @@ -1867,7 +1867,7 @@ static int pa_cli_command_dump(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_b return 0; } -static int pa_cli_command_dump_volumes(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, pa_bool_t *fail) { +static int pa_cli_command_dump_volumes(pa_core *c, pa_tokenizer *t, pa_strbuf *buf, bool *fail) { pa_sink *s; pa_source *so; pa_sink_input *i; @@ -1923,7 +1923,7 @@ static int pa_cli_command_dump_volumes(pa_core *c, pa_tokenizer *t, pa_strbuf *b return 0; } -int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *buf, pa_bool_t *fail, int *ifstate) { +int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *buf, bool *fail, int *ifstate) { const char *cs; pa_assert(c); @@ -1955,9 +1955,9 @@ int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *b if (ifstate && *ifstate == IFSTATE_FALSE) return 0; if (!strcmp(cs, META_FAIL)) - *fail = TRUE; + *fail = true; else if (!strcmp(cs, META_NOFAIL)) - *fail = FALSE; + *fail = false; else { size_t l; l = strcspn(cs, whitespace); @@ -1982,7 +1982,7 @@ int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *b unsigned i, count; char **sorted_files; struct dirent *de; - pa_bool_t failed = FALSE; + bool failed = false; pa_dynarray *files = pa_dynarray_new(NULL); while ((de = readdir(d))) { @@ -2018,7 +2018,7 @@ int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *b for (i = 0; i < count; ++i) { if (!failed) { if (pa_cli_command_execute_file(c, sorted_files[i], buf, fail) < 0 && *fail) - failed = TRUE; + failed = true; } pa_xfree(sorted_files[i]); @@ -2121,15 +2121,15 @@ int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *b return 0; } -int pa_cli_command_execute_line(pa_core *c, const char *s, pa_strbuf *buf, pa_bool_t *fail) { +int pa_cli_command_execute_line(pa_core *c, const char *s, pa_strbuf *buf, bool *fail) { return pa_cli_command_execute_line_stateful(c, s, buf, fail, NULL); } -int pa_cli_command_execute_file_stream(pa_core *c, FILE *f, pa_strbuf *buf, pa_bool_t *fail) { +int pa_cli_command_execute_file_stream(pa_core *c, FILE *f, pa_strbuf *buf, bool *fail) { char line[2048]; int ifstate = IFSTATE_NONE; int ret = -1; - pa_bool_t _fail = TRUE; + bool _fail = true; pa_assert(c); pa_assert(f); @@ -2152,10 +2152,10 @@ fail: return ret; } -int pa_cli_command_execute_file(pa_core *c, const char *fn, pa_strbuf *buf, pa_bool_t *fail) { +int pa_cli_command_execute_file(pa_core *c, const char *fn, pa_strbuf *buf, bool *fail) { FILE *f = NULL; int ret = -1; - pa_bool_t _fail = TRUE; + bool _fail = true; pa_assert(c); pa_assert(fn); @@ -2181,10 +2181,10 @@ fail: return ret; } -int pa_cli_command_execute(pa_core *c, const char *s, pa_strbuf *buf, pa_bool_t *fail) { +int pa_cli_command_execute(pa_core *c, const char *s, pa_strbuf *buf, bool *fail) { const char *p; int ifstate = IFSTATE_NONE; - pa_bool_t _fail = TRUE; + bool _fail = true; pa_assert(c); pa_assert(s); diff --git a/src/pulsecore/cli-command.h b/src/pulsecore/cli-command.h index 8c33ec089..a2b35d41e 100644 --- a/src/pulsecore/cli-command.h +++ b/src/pulsecore/cli-command.h @@ -29,18 +29,18 @@ * buffer *buf. If *fail is non-zero the function will return -1 when * one or more of the executed commands failed. *fail * may be modified by the function call. */ -int pa_cli_command_execute_line(pa_core *c, const char *s, pa_strbuf *buf, pa_bool_t *fail); +int pa_cli_command_execute_line(pa_core *c, const char *s, pa_strbuf *buf, bool *fail); /* Execute a whole file of CLI commands */ -int pa_cli_command_execute_file(pa_core *c, const char *fn, pa_strbuf *buf, pa_bool_t *fail); +int pa_cli_command_execute_file(pa_core *c, const char *fn, pa_strbuf *buf, bool *fail); /* Execute a whole file of CLI commands */ -int pa_cli_command_execute_file_stream(pa_core *c, FILE *f, pa_strbuf *buf, pa_bool_t *fail); +int pa_cli_command_execute_file_stream(pa_core *c, FILE *f, pa_strbuf *buf, bool *fail); /* Split the specified string into lines and run pa_cli_command_execute_line() for each. */ -int pa_cli_command_execute(pa_core *c, const char *s, pa_strbuf *buf, pa_bool_t *fail); +int pa_cli_command_execute(pa_core *c, const char *s, pa_strbuf *buf, bool *fail); /* Same as pa_cli_command_execute_line() but also take ifstate var. */ -int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *buf, pa_bool_t *fail, int *ifstate); +int pa_cli_command_execute_line_stateful(pa_core *c, const char *s, pa_strbuf *buf, bool *fail, int *ifstate); #endif diff --git a/src/pulsecore/cli-text.c b/src/pulsecore/cli-text.c index 1cf68d019..3ca4cbf0e 100644 --- a/src/pulsecore/cli-text.c +++ b/src/pulsecore/cli-text.c @@ -295,15 +295,15 @@ char *pa_sink_list_to_string(pa_core *c) { sink->suspend_cause & PA_SUSPEND_IDLE ? "IDLE " : "", sink->suspend_cause & PA_SUSPEND_SESSION ? "SESSION" : "", sink->priority, - pa_cvolume_snprint(cv, sizeof(cv), pa_sink_get_volume(sink, FALSE)), + pa_cvolume_snprint(cv, sizeof(cv), pa_sink_get_volume(sink, false)), sink->flags & PA_SINK_DECIBEL_VOLUME ? "\n\t " : "", - sink->flags & PA_SINK_DECIBEL_VOLUME ? pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), pa_sink_get_volume(sink, FALSE)) : "", - pa_cvolume_get_balance(pa_sink_get_volume(sink, FALSE), &sink->channel_map), + sink->flags & PA_SINK_DECIBEL_VOLUME ? pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), pa_sink_get_volume(sink, false)) : "", + pa_cvolume_get_balance(pa_sink_get_volume(sink, false), &sink->channel_map), pa_volume_snprint(v, sizeof(v), sink->base_volume), sink->flags & PA_SINK_DECIBEL_VOLUME ? "\n\t " : "", sink->flags & PA_SINK_DECIBEL_VOLUME ? pa_sw_volume_snprint_dB(vdb, sizeof(vdb), sink->base_volume) : "", sink->n_volume_steps, - pa_yes_no(pa_sink_get_mute(sink, FALSE)), + pa_yes_no(pa_sink_get_mute(sink, false)), (double) pa_sink_get_latency(sink) / (double) PA_USEC_PER_MSEC, (unsigned long) pa_sink_get_max_request(sink) / 1024, (unsigned long) pa_sink_get_max_rewind(sink) / 1024, @@ -412,15 +412,15 @@ char *pa_source_list_to_string(pa_core *c) { source->suspend_cause & PA_SUSPEND_IDLE ? "IDLE " : "", source->suspend_cause & PA_SUSPEND_SESSION ? "SESSION" : "", source->priority, - pa_cvolume_snprint(cv, sizeof(cv), pa_source_get_volume(source, FALSE)), + pa_cvolume_snprint(cv, sizeof(cv), pa_source_get_volume(source, false)), source->flags & PA_SOURCE_DECIBEL_VOLUME ? "\n\t " : "", - source->flags & PA_SOURCE_DECIBEL_VOLUME ? pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), pa_source_get_volume(source, FALSE)) : "", - pa_cvolume_get_balance(pa_source_get_volume(source, FALSE), &source->channel_map), + source->flags & PA_SOURCE_DECIBEL_VOLUME ? pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), pa_source_get_volume(source, false)) : "", + pa_cvolume_get_balance(pa_source_get_volume(source, false), &source->channel_map), pa_volume_snprint(v, sizeof(v), source->base_volume), source->flags & PA_SOURCE_DECIBEL_VOLUME ? "\n\t " : "", source->flags & PA_SOURCE_DECIBEL_VOLUME ? pa_sw_volume_snprint_dB(vdb, sizeof(vdb), source->base_volume) : "", source->n_volume_steps, - pa_yes_no(pa_source_get_mute(source, FALSE)), + pa_yes_no(pa_source_get_mute(source, false)), (double) pa_source_get_latency(source) / PA_USEC_PER_MSEC, (unsigned long) pa_source_get_max_rewind(source) / 1024, pa_sample_spec_snprint(ss, sizeof(ss), &source->sample_spec), @@ -502,7 +502,7 @@ char *pa_source_output_list_to_string(pa_core *c) { pa_assert(o->source); if (pa_source_output_is_volume_readable(o)) { - pa_source_output_get_volume(o, &v, TRUE); + pa_source_output_get_volume(o, &v, true); volume_str = pa_sprintf_malloc("%s\n\t %s\n\t balance %0.2f", pa_cvolume_snprint(cv, sizeof(cv), &v), pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), &v), @@ -601,7 +601,7 @@ char *pa_sink_input_list_to_string(pa_core *c) { pa_assert(i->sink); if (pa_sink_input_is_volume_readable(i)) { - pa_sink_input_get_volume(i, &v, TRUE); + pa_sink_input_get_volume(i, &v, true); volume_str = pa_sprintf_malloc("%s\n\t %s\n\t balance %0.2f", pa_cvolume_snprint(cv, sizeof(cv), &v), pa_sw_cvolume_snprint_dB(cvdb, sizeof(cvdb), &v), diff --git a/src/pulsecore/cli.c b/src/pulsecore/cli.c index 53aa65110..af2f87185 100644 --- a/src/pulsecore/cli.c +++ b/src/pulsecore/cli.c @@ -52,7 +52,7 @@ struct pa_cli { pa_client *client; - pa_bool_t fail, kill_requested; + bool fail, kill_requested; int defer_kill; char *last_line; @@ -95,7 +95,7 @@ pa_cli* pa_cli_new(pa_core *core, pa_iochannel *io, pa_module *m) { pa_ioline_set_callback(c->line, line_callback, c); pa_ioline_puts(c->line, "Welcome to PulseAudio! Use \"help\" for usage information.\n"PROMPT); - c->fail = c->kill_requested = FALSE; + c->fail = c->kill_requested = false; c->defer_kill = 0; c->last_line = NULL; @@ -122,7 +122,7 @@ static void client_kill(pa_client *client) { pa_log_debug("CLI client killed."); if (c->defer_kill) - c->kill_requested = TRUE; + c->kill_requested = true; else if (c->eof_callback) c->eof_callback(c, c->userdata); } diff --git a/src/pulsecore/conf-parser.c b/src/pulsecore/conf-parser.c index 062fa8e5d..200252bb7 100644 --- a/src/pulsecore/conf-parser.c +++ b/src/pulsecore/conf-parser.c @@ -130,9 +130,9 @@ static int parse_line(pa_config_parser_state *state) { return -1; } - state->in_proplist = TRUE; + state->in_proplist = true; } else - state->in_proplist = FALSE; + state->in_proplist = false; return 0; } @@ -157,7 +157,7 @@ static int parse_line(pa_config_parser_state *state) { /* Go through the file and parse each line */ int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, pa_proplist *proplist, void *userdata) { int r = -1; - pa_bool_t do_close = !f; + bool do_close = !f; pa_config_parser_state state; pa_assert(filename); @@ -268,7 +268,7 @@ int pa_config_parse_size(pa_config_parser_state *state) { int pa_config_parse_bool(pa_config_parser_state *state) { int k; - pa_bool_t *b; + bool *b; pa_assert(state); @@ -286,7 +286,7 @@ int pa_config_parse_bool(pa_config_parser_state *state) { int pa_config_parse_not_bool(pa_config_parser_state *state) { int k; - pa_bool_t *b; + bool *b; pa_assert(state); diff --git a/src/pulsecore/conf-parser.h b/src/pulsecore/conf-parser.h index 7892a0710..30ff4e326 100644 --- a/src/pulsecore/conf-parser.h +++ b/src/pulsecore/conf-parser.h @@ -54,7 +54,7 @@ struct pa_config_parser_state { const pa_config_item *item_table; char buf[4096]; pa_proplist *proplist; - pa_bool_t in_proplist; + bool in_proplist; }; /* The configuration file parsing routine. Expects a table of diff --git a/src/pulsecore/core-rtclock.c b/src/pulsecore/core-rtclock.c index 6632cc6de..ee045549c 100644 --- a/src/pulsecore/core-rtclock.c +++ b/src/pulsecore/core-rtclock.c @@ -84,11 +84,11 @@ struct timeval *pa_rtclock_get(struct timeval *tv) { #ifdef CLOCK_MONOTONIC /* No locking or atomic ops for no_monotonic here */ - static pa_bool_t no_monotonic = FALSE; + static bool no_monotonic = false; if (!no_monotonic) if (clock_gettime(CLOCK_MONOTONIC, &ts) < 0) - no_monotonic = TRUE; + no_monotonic = true; if (no_monotonic) #endif /* CLOCK_MONOTONIC */ @@ -116,7 +116,7 @@ struct timeval *pa_rtclock_get(struct timeval *tv) { return pa_gettimeofday(tv); } -pa_bool_t pa_rtclock_hrtimer(void) { +bool pa_rtclock_hrtimer(void) { #if defined (OS_IS_DARWIN) mach_timebase_info_data_t tbi; @@ -148,7 +148,7 @@ pa_bool_t pa_rtclock_hrtimer(void) { #endif /* HAVE_CLOCK_GETTIME */ - return FALSE; + return false; } #define TIMER_SLACK_NS (int) ((500 * PA_NSEC_PER_USEC)) @@ -252,7 +252,7 @@ static struct timeval* wallclock_from_rtclock(struct timeval *tv) { return tv; } -struct timeval* pa_timeval_rtstore(struct timeval *tv, pa_usec_t v, pa_bool_t rtclock) { +struct timeval* pa_timeval_rtstore(struct timeval *tv, pa_usec_t v, bool rtclock) { pa_assert(tv); if (v == PA_USEC_INVALID) diff --git a/src/pulsecore/core-rtclock.h b/src/pulsecore/core-rtclock.h index 625353680..74d5e0351 100644 --- a/src/pulsecore/core-rtclock.h +++ b/src/pulsecore/core-rtclock.h @@ -32,7 +32,7 @@ struct timeval; struct timeval *pa_rtclock_get(struct timeval *ts); pa_usec_t pa_rtclock_age(const struct timeval *tv); -pa_bool_t pa_rtclock_hrtimer(void); +bool pa_rtclock_hrtimer(void); void pa_rtclock_hrtimer_enable(void); /* timer with a resolution better than this are considered high-resolution */ @@ -48,6 +48,6 @@ pa_usec_t pa_timespec_load(const struct timespec *ts); struct timespec* pa_timespec_store(struct timespec *ts, pa_usec_t v); #endif -struct timeval* pa_timeval_rtstore(struct timeval *tv, pa_usec_t v, pa_bool_t rtclock); +struct timeval* pa_timeval_rtstore(struct timeval *tv, pa_usec_t v, bool rtclock); #endif diff --git a/src/pulsecore/core-scache.c b/src/pulsecore/core-scache.c index 64bc4b3d0..a622616c2 100644 --- a/src/pulsecore/core-scache.c +++ b/src/pulsecore/core-scache.c @@ -109,7 +109,7 @@ static pa_scache_entry* scache_add_item(pa_core *c, const char *name) { } else { e = pa_xnew(pa_scache_entry, 1); - if (!pa_namereg_register(c, name, PA_NAMEREG_SAMPLE, e, TRUE)) { + if (!pa_namereg_register(c, name, PA_NAMEREG_SAMPLE, e, true)) { pa_xfree(e); return NULL; } @@ -126,13 +126,13 @@ static pa_scache_entry* scache_add_item(pa_core *c, const char *name) { e->last_used_time = 0; pa_memchunk_reset(&e->memchunk); e->filename = NULL; - e->lazy = FALSE; + e->lazy = false; e->last_used_time = 0; pa_sample_spec_init(&e->sample_spec); pa_channel_map_init(&e->channel_map); pa_cvolume_init(&e->volume); - e->volume_is_set = FALSE; + e->volume_is_set = false; pa_proplist_sets(e->proplist, PA_PROP_MEDIA_ROLE, "event"); @@ -171,7 +171,7 @@ int pa_scache_add_item( pa_sample_spec_init(&e->sample_spec); pa_channel_map_init(&e->channel_map); pa_cvolume_init(&e->volume); - e->volume_is_set = FALSE; + e->volume_is_set = false; if (ss) { e->sample_spec = *ss; @@ -249,7 +249,7 @@ int pa_scache_add_file_lazy(pa_core *c, const char *name, const char *filename, if (!(e = scache_add_item(c, name))) return -1; - e->lazy = TRUE; + e->lazy = true; e->filename = pa_xstrdup(filename); pa_proplist_sets(e->proplist, PA_PROP_MEDIA_FILENAME, filename); @@ -296,7 +296,7 @@ int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t pa_scache_entry *e; pa_cvolume r; pa_proplist *merged; - pa_bool_t pass_volume; + bool pass_volume; pa_assert(c); pa_assert(name); @@ -330,7 +330,7 @@ int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t pa_log_debug("Playing sample \"%s\" on \"%s\"", name, sink->name); - pass_volume = TRUE; + pass_volume = true; if (e->volume_is_set && PA_VOLUME_IS_VALID(volume)) { pa_cvolume_set(&r, e->sample_spec.channels, volume); @@ -340,7 +340,7 @@ int pa_scache_play_item(pa_core *c, const char *name, pa_sink *sink, pa_volume_t else if (PA_VOLUME_IS_VALID(volume)) pa_cvolume_set(&r, e->sample_spec.channels, volume); else - pass_volume = FALSE; + pass_volume = false; pa_proplist_update(merged, PA_UPDATE_REPLACE, e->proplist); diff --git a/src/pulsecore/core-scache.h b/src/pulsecore/core-scache.h index fdfc7754a..1b67d0dbe 100644 --- a/src/pulsecore/core-scache.h +++ b/src/pulsecore/core-scache.h @@ -36,14 +36,14 @@ typedef struct pa_scache_entry { char *name; pa_cvolume volume; - pa_bool_t volume_is_set; + bool volume_is_set; pa_sample_spec sample_spec; pa_channel_map channel_map; pa_memchunk memchunk; char *filename; - pa_bool_t lazy; + bool lazy; time_t last_used_time; pa_proplist *proplist; diff --git a/src/pulsecore/core-subscribe.c b/src/pulsecore/core-subscribe.c index 4f98eb4c9..134761dde 100644 --- a/src/pulsecore/core-subscribe.c +++ b/src/pulsecore/core-subscribe.c @@ -41,7 +41,7 @@ struct pa_subscription { pa_core *core; - pa_bool_t dead; + bool dead; pa_subscription_cb_t callback; void *userdata; @@ -71,7 +71,7 @@ pa_subscription* pa_subscription_new(pa_core *c, pa_subscription_mask_t m, pa_su s = pa_xnew(pa_subscription, 1); s->core = c; - s->dead = FALSE; + s->dead = false; s->callback = callback; s->userdata = userdata; s->mask = m; @@ -85,7 +85,7 @@ void pa_subscription_free(pa_subscription*s) { pa_assert(s); pa_assert(!s->dead); - s->dead = TRUE; + s->dead = true; sched_event(s->core); } diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c index 53149bb9c..08932b621 100644 --- a/src/pulsecore/core-util.c +++ b/src/pulsecore/core-util.c @@ -221,10 +221,10 @@ void pa_make_fd_cloexec(int fd) { /** Creates a directory securely. Will create parent directories recursively if * required. This will not update permissions on parent directories if they * already exist, however. */ -int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid, pa_bool_t update_perms) { +int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid, bool update_perms) { struct stat st; int r, saved_errno; - pa_bool_t retry = TRUE; + bool retry = true; pa_assert(dir); @@ -243,8 +243,8 @@ again: if (r < 0 && errno == ENOENT && retry) { /* If a parent directory in the path doesn't exist, try to create that * first, then try again. */ - pa_make_secure_parent_dir(dir, m, uid, gid, FALSE); - retry = FALSE; + pa_make_secure_parent_dir(dir, m, uid, gid, false); + retry = false; goto again; } @@ -342,7 +342,7 @@ char *pa_parent_dir(const char *fn) { } /* Creates a the parent directory of the specified path securely */ -int pa_make_secure_parent_dir(const char *fn, mode_t m, uid_t uid, gid_t gid, pa_bool_t update_perms) { +int pa_make_secure_parent_dir(const char *fn, mode_t m, uid_t uid, gid_t gid, bool update_perms) { int ret = -1; char *dir; @@ -723,7 +723,7 @@ static int set_scheduler(int rtprio) { /* We need to disable exit on disconnect because otherwise * dbus_shutdown will kill us. See * https://bugs.freedesktop.org/show_bug.cgi?id=16924 */ - dbus_connection_set_exit_on_disconnect(bus, FALSE); + dbus_connection_set_exit_on_disconnect(bus, false); rttime = rtkit_get_rttime_usec_max(bus); if (rttime >= 0) { @@ -860,7 +860,7 @@ static int set_nice(int nice_level) { /* We need to disable exit on disconnect because otherwise * dbus_shutdown will kill us. See * https://bugs.freedesktop.org/show_bug.cgi?id=16924 */ - dbus_connection_set_exit_on_disconnect(bus, FALSE); + dbus_connection_set_exit_on_disconnect(bus, false); r = rtkit_make_high_priority(bus, 0, nice_level); dbus_connection_unref(bus); @@ -1605,7 +1605,7 @@ char *pa_get_state_dir(void) { /* If PULSE_STATE_PATH and PULSE_RUNTIME_PATH point to the same * dir then this will break. */ - if (pa_make_secure_dir(d, 0700U, (uid_t) -1, (gid_t) -1, TRUE) < 0) { + if (pa_make_secure_dir(d, 0700U, (uid_t) -1, (gid_t) -1, true) < 0) { pa_log_error("Failed to create secure directory (%s): %s", d, pa_cstrerror(errno)); pa_xfree(d); return NULL; @@ -1747,7 +1747,7 @@ char *pa_get_runtime_dir(void) { d = getenv("PULSE_RUNTIME_PATH"); if (d) { - if (pa_make_secure_dir(d, m, (uid_t) -1, (gid_t) -1, TRUE) < 0) { + if (pa_make_secure_dir(d, m, (uid_t) -1, (gid_t) -1, true) < 0) { pa_log_error("Failed to create secure directory (%s): %s", d, pa_cstrerror(errno)); goto fail; } @@ -1760,7 +1760,7 @@ char *pa_get_runtime_dir(void) { if (d) { k = pa_sprintf_malloc("%s" PA_PATH_SEP "pulse", d); - if (pa_make_secure_dir(k, m, (uid_t) -1, (gid_t) -1, TRUE) < 0) { + if (pa_make_secure_dir(k, m, (uid_t) -1, (gid_t) -1, true) < 0) { pa_log_error("Failed to create secure directory (%s): %s", k, pa_cstrerror(errno)); goto fail; } @@ -1773,7 +1773,7 @@ char *pa_get_runtime_dir(void) { if (!d) goto fail; - if (pa_make_secure_dir(d, m, (uid_t) -1, (gid_t) -1, TRUE) < 0) { + if (pa_make_secure_dir(d, m, (uid_t) -1, (gid_t) -1, true) < 0) { pa_log_error("Failed to create secure directory (%s): %s", d, pa_cstrerror(errno)); pa_xfree(d); goto fail; @@ -2113,7 +2113,7 @@ size_t pa_parsehex(const char *p, uint8_t *d, size_t dlength) { } /* Returns nonzero when *s starts with *pfx */ -pa_bool_t pa_startswith(const char *s, const char *pfx) { +bool pa_startswith(const char *s, const char *pfx) { size_t l; pa_assert(s); @@ -2125,7 +2125,7 @@ pa_bool_t pa_startswith(const char *s, const char *pfx) { } /* Returns nonzero when *s ends with *sfx */ -pa_bool_t pa_endswith(const char *s, const char *sfx) { +bool pa_endswith(const char *s, const char *sfx) { size_t l1, l2; pa_assert(s); @@ -2137,7 +2137,7 @@ pa_bool_t pa_endswith(const char *s, const char *sfx) { return l1 >= l2 && pa_streq(s + l1 - l2, sfx); } -pa_bool_t pa_is_path_absolute(const char *fn) { +bool pa_is_path_absolute(const char *fn) { pa_assert(fn); #ifndef OS_IS_WIN32 @@ -2167,7 +2167,7 @@ char *pa_make_path_absolute(const char *p) { /* If fn is NULL, return the PulseAudio runtime or state dir (depending on the * rt parameter). If fn is non-NULL and starts with /, return fn. Otherwise, * append fn to the runtime/state dir and return it. */ -static char *get_path(const char *fn, pa_bool_t prependmid, pa_bool_t rt) { +static char *get_path(const char *fn, bool prependmid, bool rt) { char *rtp; rtp = rt ? pa_get_runtime_dir() : pa_get_state_dir(); @@ -2214,11 +2214,11 @@ static char *get_path(const char *fn, pa_bool_t prependmid, pa_bool_t rt) { } char *pa_runtime_path(const char *fn) { - return get_path(fn, FALSE, TRUE); + return get_path(fn, false, true); } -char *pa_state_path(const char *fn, pa_bool_t appendmid) { - return get_path(fn, appendmid, FALSE); +char *pa_state_path(const char *fn, bool appendmid) { + return get_path(fn, appendmid, false); } /* Convert the string s to a signed integer in *ret_i */ @@ -2567,7 +2567,7 @@ int pa_close_allv(const int except_fds[]) { struct dirent *de; while ((de = readdir(d))) { - pa_bool_t found; + bool found; long l; char *e = NULL; int i; @@ -2597,10 +2597,10 @@ int pa_close_allv(const int except_fds[]) { if (fd == dirfd(d)) continue; - found = FALSE; + found = false; for (i = 0; except_fds[i] >= 0; i++) if (except_fds[i] == fd) { - found = TRUE; + found = true; break; } @@ -2629,12 +2629,12 @@ int pa_close_allv(const int except_fds[]) { for (fd = 3; fd < maxfd; fd++) { int i; - pa_bool_t found; + bool found; - found = FALSE; + found = false; for (i = 0; except_fds[i] >= 0; i++) if (except_fds[i] == fd) { - found = TRUE; + found = true; break; } @@ -2742,12 +2742,12 @@ int pa_reset_sigsv(const int except[]) { int sig; for (sig = 1; sig < NSIG; sig++) { - pa_bool_t reset = TRUE; + bool reset = true; switch (sig) { case SIGKILL: case SIGSTOP: - reset = FALSE; + reset = false; break; default: { @@ -2755,7 +2755,7 @@ int pa_reset_sigsv(const int except[]) { for (i = 0; except[i] > 0; i++) { if (sig == except[i]) { - reset = FALSE; + reset = false; break; } } @@ -2824,33 +2824,33 @@ void pa_unset_env_recorded(void) { } } -pa_bool_t pa_in_system_mode(void) { +bool pa_in_system_mode(void) { const char *e; if (!(e = getenv("PULSE_SYSTEM"))) - return FALSE; + return false; return !!atoi(e); } /* Checks a whitespace-separated list of words in haystack for needle */ -pa_bool_t pa_str_in_list_spaces(const char *haystack, const char *needle) { +bool pa_str_in_list_spaces(const char *haystack, const char *needle) { char *s; const char *state = NULL; if (!haystack || !needle) - return FALSE; + return false; while ((s = pa_split_spaces(haystack, &state))) { if (pa_streq(needle, s)) { pa_xfree(s); - return TRUE; + return true; } pa_xfree(s); } - return FALSE; + return false; } char *pa_get_user_name_malloc(void) { @@ -2978,7 +2978,7 @@ char *pa_uname_string(void) { } #ifdef HAVE_VALGRIND_MEMCHECK_H -pa_bool_t pa_in_valgrind(void) { +bool pa_in_valgrind(void) { static int b = 0; /* To make heisenbugs a bit simpler to find we check for $VALGRIND @@ -3079,16 +3079,16 @@ char *pa_escape(const char *p, const char *chars) { char *pa_unescape(char *p) { char *s, *d; - pa_bool_t escaped = FALSE; + bool escaped = false; for (s = p, d = p; *s; s++) { if (!escaped && *s == '\\') { - escaped = TRUE; + escaped = true; continue; } *(d++) = *s; - escaped = FALSE; + escaped = false; } *d = 0; @@ -3233,9 +3233,9 @@ void pa_reset_personality(void) { } -pa_bool_t pa_run_from_build_tree(void) { +bool pa_run_from_build_tree(void) { char *rp; - static pa_bool_t b = FALSE; + static bool b = false; PA_ONCE_BEGIN { if ((rp = pa_readlink("/proc/self/exe"))) { @@ -3419,7 +3419,7 @@ char *pa_read_line_from_file(const char *fn) { return pa_xstrdup(ln); } -pa_bool_t pa_running_in_vm(void) { +bool pa_running_in_vm(void) { #if defined(__i386__) || defined(__x86_64__) @@ -3454,7 +3454,7 @@ pa_bool_t pa_running_in_vm(void) { pa_startswith(s, "Xen")) { pa_xfree(s); - return TRUE; + return true; } pa_xfree(s); @@ -3483,9 +3483,9 @@ pa_bool_t pa_running_in_vm(void) { pa_streq(sig.text, "VMwareVMware") || /* http://msdn.microsoft.com/en-us/library/bb969719.aspx */ pa_streq(sig.text, "Microsoft Hv")) - return TRUE; + return true; #endif - return FALSE; + return false; } diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h index 2c86ac237..e117e9f24 100644 --- a/src/pulsecore/core-util.h +++ b/src/pulsecore/core-util.h @@ -59,8 +59,8 @@ struct timeval; void pa_make_fd_nonblock(int fd); void pa_make_fd_cloexec(int fd); -int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid, pa_bool_t update_perms); -int pa_make_secure_parent_dir(const char *fn, mode_t, uid_t uid, gid_t gid, pa_bool_t update_perms); +int pa_make_secure_dir(const char* dir, mode_t m, uid_t uid, gid_t gid, bool update_perms); +int pa_make_secure_parent_dir(const char *fn, mode_t, uid_t uid, gid_t gid, bool update_perms); ssize_t pa_read(int fd, void *buf, size_t count, int *type); ssize_t pa_write(int fd, const void *buf, size_t count, int *type); @@ -86,7 +86,7 @@ int pa_parse_boolean(const char *s) PA_GCC_PURE; int pa_parse_volume(const char *s, pa_volume_t *volume); -static inline const char *pa_yes_no(pa_bool_t b) { +static inline const char *pa_yes_no(bool b) { return b ? "yes" : "no"; } @@ -124,8 +124,8 @@ int pa_unlock_lockfile(const char *fn, int fd); char *pa_hexstr(const uint8_t* d, size_t dlength, char *s, size_t slength); size_t pa_parsehex(const char *p, uint8_t *d, size_t dlength); -pa_bool_t pa_startswith(const char *s, const char *pfx) PA_GCC_PURE; -pa_bool_t pa_endswith(const char *s, const char *sfx) PA_GCC_PURE; +bool pa_startswith(const char *s, const char *pfx) PA_GCC_PURE; +bool pa_endswith(const char *s, const char *sfx) PA_GCC_PURE; FILE *pa_open_config_file(const char *global, const char *local, const char *env, char **result); char* pa_find_config_file(const char *global, const char *local, const char *env); @@ -135,7 +135,7 @@ char *pa_get_state_dir(void); char *pa_get_home_dir_malloc(void); char *pa_get_binary_name_malloc(void); char *pa_runtime_path(const char *fn); -char *pa_state_path(const char *fn, pa_bool_t prepend_machine_id); +char *pa_state_path(const char *fn, bool prepend_machine_id); int pa_atoi(const char *s, int32_t *ret_i); int pa_atou(const char *s, uint32_t *ret_u); @@ -151,7 +151,7 @@ int pa_match(const char *expr, const char *v); char *pa_getcwd(void); char *pa_make_path_absolute(const char *p); -pa_bool_t pa_is_path_absolute(const char *p); +bool pa_is_path_absolute(const char *p); void *pa_will_need(const void *p, size_t l); @@ -205,7 +205,7 @@ void pa_set_env(const char *key, const char *value); void pa_set_env_and_record(const char *key, const char *value); void pa_unset_env_recorded(void); -pa_bool_t pa_in_system_mode(void); +bool pa_in_system_mode(void); #define pa_streq(a,b) (!strcmp((a),(b))) @@ -216,7 +216,7 @@ static inline bool pa_safe_streq(const char *a, const char *b) { return pa_streq(a, b); } -pa_bool_t pa_str_in_list_spaces(const char *needle, const char *haystack); +bool pa_str_in_list_spaces(const char *needle, const char *haystack); char *pa_get_host_name_malloc(void); char *pa_get_user_name_malloc(void); @@ -226,10 +226,10 @@ char *pa_session_id(void); char *pa_uname_string(void); #ifdef HAVE_VALGRIND_MEMCHECK_H -pa_bool_t pa_in_valgrind(void); +bool pa_in_valgrind(void); #else -static inline pa_bool_t pa_in_valgrind(void) { - return FALSE; +static inline bool pa_in_valgrind(void) { + return false; } #endif @@ -268,7 +268,7 @@ size_t pa_pipe_buf(int fd); void pa_reset_personality(void); -pa_bool_t pa_run_from_build_tree(void) PA_GCC_CONST; +bool pa_run_from_build_tree(void) PA_GCC_CONST; const char *pa_get_temp_dir(void); @@ -281,7 +281,7 @@ FILE* pa_fopen_cloexec(const char *path, const char *mode); void pa_nullify_stdfds(void); char *pa_read_line_from_file(const char *fn); -pa_bool_t pa_running_in_vm(void); +bool pa_running_in_vm(void); #ifdef OS_IS_WIN32 char *pa_win32_get_toplevel(HANDLE handle); diff --git a/src/pulsecore/core.c b/src/pulsecore/core.c index 2ca50c238..b19882285 100644 --- a/src/pulsecore/core.c +++ b/src/pulsecore/core.c @@ -53,7 +53,7 @@ static int core_process_msg(pa_msgobject *o, int code, void *userdata, int64_t o switch (code) { case PA_CORE_MESSAGE_UNLOAD_MODULE: - pa_module_unload(c, userdata, TRUE); + pa_module_unload(c, userdata, true); return 0; default: @@ -63,7 +63,7 @@ static int core_process_msg(pa_msgobject *o, int code, void *userdata, int64_t o static void core_free(pa_object *o); -pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size) { +pa_core* pa_core_new(pa_mainloop_api *m, bool shared, size_t shm_size) { pa_core* c; pa_mempool *pool; int j; @@ -73,7 +73,7 @@ pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size) { if (shared) { if (!(pool = pa_mempool_new(shared, shm_size))) { pa_log_warn("failed to allocate shared memory pool. Falling back to a normal memory pool."); - shared = FALSE; + shared = false; } } @@ -132,15 +132,15 @@ pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size) { c->exit_idle_time = -1; c->scache_idle_time = 20; - c->flat_volumes = TRUE; - c->disallow_module_loading = FALSE; - c->disallow_exit = FALSE; - c->running_as_daemon = FALSE; - c->realtime_scheduling = FALSE; + c->flat_volumes = true; + c->disallow_module_loading = false; + c->disallow_exit = false; + c->running_as_daemon = false; + c->realtime_scheduling = false; c->realtime_priority = 5; - c->disable_remixing = FALSE; - c->disable_lfe_remixing = FALSE; - c->deferred_volume = TRUE; + c->disable_remixing = false; + c->disable_lfe_remixing = false; + c->deferred_volume = true; c->resample_method = PA_RESAMPLER_SPEEX_FLOAT_BASE + 1; for (j = 0; j < PA_CORE_HOOK_MAX; j++) @@ -221,7 +221,7 @@ static void exit_callback(pa_mainloop_api *m, pa_time_event *e, const struct tim pa_assert(c->exit_event == e); pa_log_info("We are idle, quitting..."); - pa_core_exit(c, TRUE, 0); + pa_core_exit(c, true, 0); } void pa_core_check_idle(pa_core *c) { @@ -239,7 +239,7 @@ void pa_core_check_idle(pa_core *c) { } } -int pa_core_exit(pa_core *c, pa_bool_t force, int retval) { +int pa_core_exit(pa_core *c, bool force, int retval) { pa_assert(c); if (c->disallow_exit && !force) @@ -281,7 +281,7 @@ pa_time_event* pa_core_rttime_new(pa_core *c, pa_usec_t usec, pa_time_event_cb_t pa_assert(c); pa_assert(c->mainloop); - return c->mainloop->time_new(c->mainloop, pa_timeval_rtstore(&tv, usec, TRUE), cb, userdata); + return c->mainloop->time_new(c->mainloop, pa_timeval_rtstore(&tv, usec, true), cb, userdata); } void pa_core_rttime_restart(pa_core *c, pa_time_event *e, pa_usec_t usec) { @@ -290,5 +290,5 @@ void pa_core_rttime_restart(pa_core *c, pa_time_event *e, pa_usec_t usec) { pa_assert(c); pa_assert(c->mainloop); - c->mainloop->time_restart(e, pa_timeval_rtstore(&tv, usec, TRUE)); + c->mainloop->time_restart(e, pa_timeval_rtstore(&tv, usec, true)); } diff --git a/src/pulsecore/core.h b/src/pulsecore/core.h index 261cc9985..f268e4249 100644 --- a/src/pulsecore/core.h +++ b/src/pulsecore/core.h @@ -170,14 +170,14 @@ struct pa_core { int exit_idle_time, scache_idle_time; - pa_bool_t flat_volumes:1; - pa_bool_t disallow_module_loading:1; - pa_bool_t disallow_exit:1; - pa_bool_t running_as_daemon:1; - pa_bool_t realtime_scheduling:1; - pa_bool_t disable_remixing:1; - pa_bool_t disable_lfe_remixing:1; - pa_bool_t deferred_volume:1; + bool flat_volumes:1; + bool disallow_module_loading:1; + bool disallow_exit:1; + bool running_as_daemon:1; + bool realtime_scheduling:1; + bool disable_remixing:1; + bool disable_lfe_remixing:1; + bool deferred_volume:1; pa_resample_method_t resample_method; int realtime_priority; @@ -197,12 +197,12 @@ enum { PA_CORE_MESSAGE_MAX }; -pa_core* pa_core_new(pa_mainloop_api *m, pa_bool_t shared, size_t shm_size); +pa_core* pa_core_new(pa_mainloop_api *m, bool shared, size_t shm_size); /* Check whether no one is connected to this core */ void pa_core_check_idle(pa_core *c); -int pa_core_exit(pa_core *c, pa_bool_t force, int retval); +int pa_core_exit(pa_core *c, bool force, int retval); void pa_core_maybe_vacuum(pa_core *c); diff --git a/src/pulsecore/cpu-arm.c b/src/pulsecore/cpu-arm.c index 1378124ba..cce3b9177 100644 --- a/src/pulsecore/cpu-arm.c +++ b/src/pulsecore/cpu-arm.c @@ -135,7 +135,7 @@ void pa_cpu_get_arm_flags(pa_cpu_arm_flag_t *flags) { #endif } -pa_bool_t pa_cpu_init_arm(pa_cpu_arm_flag_t *flags) { +bool pa_cpu_init_arm(pa_cpu_arm_flag_t *flags) { #if defined (__arm__) #if defined (__linux__) pa_cpu_get_arm_flags(flags); @@ -149,13 +149,13 @@ pa_bool_t pa_cpu_init_arm(pa_cpu_arm_flag_t *flags) { } #endif - return TRUE; + return true; #else /* defined (__linux__) */ pa_log("Reading ARM CPU features not yet supported on this OS"); #endif /* defined (__linux__) */ #else /* defined (__arm__) */ - return FALSE; + return false; #endif /* defined (__arm__) */ } diff --git a/src/pulsecore/cpu-arm.h b/src/pulsecore/cpu-arm.h index d9dc3d5d6..5bc7d3b11 100644 --- a/src/pulsecore/cpu-arm.h +++ b/src/pulsecore/cpu-arm.h @@ -40,7 +40,7 @@ typedef enum pa_cpu_arm_flag { } pa_cpu_arm_flag_t; void pa_cpu_get_arm_flags(pa_cpu_arm_flag_t *flags); -pa_bool_t pa_cpu_init_arm(pa_cpu_arm_flag_t *flags); +bool pa_cpu_init_arm(pa_cpu_arm_flag_t *flags); /* some optimized functions */ void pa_volume_func_init_arm(pa_cpu_arm_flag_t flags); diff --git a/src/pulsecore/cpu-orc.c b/src/pulsecore/cpu-orc.c index 41ecb10ad..343e0046f 100644 --- a/src/pulsecore/cpu-orc.c +++ b/src/pulsecore/cpu-orc.c @@ -25,7 +25,7 @@ #include "cpu-orc.h" -pa_bool_t pa_cpu_init_orc(pa_cpu_info cpu_info) { +bool pa_cpu_init_orc(pa_cpu_info cpu_info) { #ifndef DISABLE_ORC /* Update these as we test on more architectures */ pa_cpu_x86_flag_t x86_want_flags = PA_CPU_X86_MMX | PA_CPU_X86_SSE | PA_CPU_X86_SSE2 | PA_CPU_X86_SSE3 | PA_CPU_X86_SSSE3 | PA_CPU_X86_SSE4_1 | PA_CPU_X86_SSE4_2; @@ -33,9 +33,9 @@ pa_bool_t pa_cpu_init_orc(pa_cpu_info cpu_info) { /* Enable Orc svolume optimizations */ if ((cpu_info.cpu_type == PA_CPU_X86) && (cpu_info.flags.x86 & x86_want_flags)) { pa_volume_func_init_orc(); - return TRUE; + return true; } #endif - return FALSE; + return false; } diff --git a/src/pulsecore/cpu-orc.h b/src/pulsecore/cpu-orc.h index 0bf81cb22..467136183 100644 --- a/src/pulsecore/cpu-orc.h +++ b/src/pulsecore/cpu-orc.h @@ -26,7 +26,7 @@ /* Orc-optimised bits */ -pa_bool_t pa_cpu_init_orc(pa_cpu_info cpu_info); +bool pa_cpu_init_orc(pa_cpu_info cpu_info); void pa_volume_func_init_orc(void); diff --git a/src/pulsecore/cpu-x86.c b/src/pulsecore/cpu-x86.c index b2a558a22..8ca6b7490 100644 --- a/src/pulsecore/cpu-x86.c +++ b/src/pulsecore/cpu-x86.c @@ -114,7 +114,7 @@ void pa_cpu_get_x86_flags(pa_cpu_x86_flag_t *flags) { #endif /* defined (__i386__) || defined (__amd64__) */ } -pa_bool_t pa_cpu_init_x86(pa_cpu_x86_flag_t *flags) { +bool pa_cpu_init_x86(pa_cpu_x86_flag_t *flags) { #if defined (__i386__) || defined (__amd64__) pa_cpu_get_x86_flags(flags); @@ -130,8 +130,8 @@ pa_bool_t pa_cpu_init_x86(pa_cpu_x86_flag_t *flags) { pa_convert_func_init_sse(*flags); } - return TRUE; + return true; #else /* defined (__i386__) || defined (__amd64__) */ - return FALSE; + return false; #endif /* defined (__i386__) || defined (__amd64__) */ } diff --git a/src/pulsecore/cpu-x86.h b/src/pulsecore/cpu-x86.h index 9a9f3a190..15726b0a4 100644 --- a/src/pulsecore/cpu-x86.h +++ b/src/pulsecore/cpu-x86.h @@ -41,7 +41,7 @@ typedef enum pa_cpu_x86_flag { } pa_cpu_x86_flag_t; void pa_cpu_get_x86_flags(pa_cpu_x86_flag_t *flags); -pa_bool_t pa_cpu_init_x86 (pa_cpu_x86_flag_t *flags); +bool pa_cpu_init_x86 (pa_cpu_x86_flag_t *flags); #if defined (__i386__) typedef int32_t pa_reg_x86; diff --git a/src/pulsecore/database-gdbm.c b/src/pulsecore/database-gdbm.c index c4a7ccb8e..183dcf1d3 100644 --- a/src/pulsecore/database-gdbm.c +++ b/src/pulsecore/database-gdbm.c @@ -61,7 +61,7 @@ void pa_datum_free(pa_datum *d) { pa_zero(d); } -pa_database* pa_database_open(const char *fn, pa_bool_t for_write) { +pa_database* pa_database_open(const char *fn, bool for_write) { GDBM_FILE f; int gdbm_cache_size; char *path; @@ -117,7 +117,7 @@ pa_datum* pa_database_get(pa_database *db, const pa_datum *key, pa_datum* data) NULL; } -int pa_database_set(pa_database *db, const pa_datum *key, const pa_datum* data, pa_bool_t overwrite) { +int pa_database_set(pa_database *db, const pa_datum *key, const pa_datum* data, bool overwrite) { datum gdbm_key, gdbm_data; pa_assert(db); diff --git a/src/pulsecore/database-simple.c b/src/pulsecore/database-simple.c index f0dbcdce4..0d22e5bc7 100644 --- a/src/pulsecore/database-simple.c +++ b/src/pulsecore/database-simple.c @@ -41,7 +41,7 @@ typedef struct simple_data { char *filename; char *tmp_filename; pa_hashmap *map; - pa_bool_t read_only; + bool read_only; } simple_data; typedef struct entry { @@ -175,7 +175,7 @@ static int fill_data(simple_data *db, FILE *f) { pa_datum data; void *d = NULL; ssize_t l = 0; - pa_bool_t append = FALSE; + bool append = false; enum { FIELD_KEY = 0, FIELD_DATA } field = FIELD_KEY; pa_assert(db); @@ -197,7 +197,7 @@ static int fill_data(simple_data *db, FILE *f) { case FIELD_DATA: data.data = d; data.size = l; - append = TRUE; + append = true; break; } @@ -208,7 +208,7 @@ static int fill_data(simple_data *db, FILE *f) { e->data.data = data.data; e->data.size = data.size; pa_hashmap_put(db->map, &e->key, e); - append = FALSE; + append = false; field = FIELD_KEY; } } @@ -224,7 +224,7 @@ static int fill_data(simple_data *db, FILE *f) { return pa_hashmap_size(db->map); } -pa_database* pa_database_open(const char *fn, pa_bool_t for_write) { +pa_database* pa_database_open(const char *fn, bool for_write) { FILE *f; char *path; simple_data *db; @@ -288,7 +288,7 @@ pa_datum* pa_database_get(pa_database *database, const pa_datum *key, pa_datum* return data; } -int pa_database_set(pa_database *database, const pa_datum *key, const pa_datum* data, pa_bool_t overwrite) { +int pa_database_set(pa_database *database, const pa_datum *key, const pa_datum* data, bool overwrite) { simple_data *db = (simple_data*)database; entry *e; int ret = 0; @@ -381,7 +381,7 @@ pa_datum* pa_database_next(pa_database *database, const pa_datum *key, pa_datum entry *e; entry *search; void *state; - pa_bool_t pick_now; + bool pick_now; pa_assert(db); pa_assert(next); @@ -392,14 +392,14 @@ pa_datum* pa_database_next(pa_database *database, const pa_datum *key, pa_datum search = pa_hashmap_get(db->map, key); state = NULL; - pick_now = FALSE; + pick_now = false; while ((e = pa_hashmap_iterate(db->map, &state, NULL))) { if (pick_now) break; if (search == e) - pick_now = TRUE; + pick_now = true; } if (!pick_now || !e) diff --git a/src/pulsecore/database-tdb.c b/src/pulsecore/database-tdb.c index 4e782d65c..3e3e85a0f 100644 --- a/src/pulsecore/database-tdb.c +++ b/src/pulsecore/database-tdb.c @@ -99,7 +99,7 @@ finish: return c; } -pa_database* pa_database_open(const char *fn, pa_bool_t for_write) { +pa_database* pa_database_open(const char *fn, bool for_write) { struct tdb_context *c; char *path; @@ -140,7 +140,7 @@ pa_datum* pa_database_get(pa_database *db, const pa_datum *key, pa_datum* data) NULL; } -int pa_database_set(pa_database *db, const pa_datum *key, const pa_datum* data, pa_bool_t overwrite) { +int pa_database_set(pa_database *db, const pa_datum *key, const pa_datum* data, bool overwrite) { TDB_DATA tdb_key, tdb_data; pa_assert(db); diff --git a/src/pulsecore/database.h b/src/pulsecore/database.h index f1a85b6cd..90d37a30b 100644 --- a/src/pulsecore/database.h +++ b/src/pulsecore/database.h @@ -41,12 +41,12 @@ typedef struct pa_datum { void pa_datum_free(pa_datum *d); /* This will append a suffix to the filename */ -pa_database* pa_database_open(const char *fn, pa_bool_t for_write); +pa_database* pa_database_open(const char *fn, bool for_write); void pa_database_close(pa_database *db); pa_datum* pa_database_get(pa_database *db, const pa_datum *key, pa_datum* data); -int pa_database_set(pa_database *db, const pa_datum *key, const pa_datum* data, pa_bool_t overwrite); +int pa_database_set(pa_database *db, const pa_datum *key, const pa_datum* data, bool overwrite); int pa_database_unset(pa_database *db, const pa_datum *key); int pa_database_clear(pa_database *db); diff --git a/src/pulsecore/dbus-shared.c b/src/pulsecore/dbus-shared.c index 963c09f25..2a5c5173c 100644 --- a/src/pulsecore/dbus-shared.c +++ b/src/pulsecore/dbus-shared.c @@ -67,7 +67,7 @@ pa_dbus_connection* pa_dbus_bus_get(pa_core *c, DBusBusType type, DBusError *err if ((pconn = pa_shared_get(c, prop_name[type]))) return pa_dbus_connection_ref(pconn); - if (!(conn = pa_dbus_wrap_connection_new(c->mainloop, TRUE, type, error))) + if (!(conn = pa_dbus_wrap_connection_new(c->mainloop, true, type, error))) return NULL; return dbus_connection_new(c, conn, prop_name[type]); diff --git a/src/pulsecore/dbus-util.c b/src/pulsecore/dbus-util.c index adffa88cb..6a69cc226 100644 --- a/src/pulsecore/dbus-util.c +++ b/src/pulsecore/dbus-util.c @@ -41,7 +41,7 @@ struct pa_dbus_wrap_connection { pa_mainloop_api *mainloop; DBusConnection *connection; pa_defer_event* dispatch_event; - pa_bool_t use_rtclock:1; + bool use_rtclock:1; }; struct timeout_data { @@ -164,7 +164,7 @@ static dbus_bool_t add_watch(DBusWatch *watch, void *data) { dbus_watch_set_data(watch, ev, NULL); - return TRUE; + return true; } /* DBusRemoveWatchFunction callback for pa mainloop */ @@ -208,7 +208,7 @@ static dbus_bool_t add_timeout(DBusTimeout *timeout, void *data) { pa_assert(c); if (!dbus_timeout_get_enabled(timeout)) - return FALSE; + return false; d = pa_xnew(struct timeout_data, 1); d->connection = c; @@ -218,7 +218,7 @@ static dbus_bool_t add_timeout(DBusTimeout *timeout, void *data) { dbus_timeout_set_data(timeout, ev, NULL); - return TRUE; + return true; } /* DBusRemoveTimeoutFunction callback for pa mainloop */ @@ -261,7 +261,7 @@ static void wakeup_main(void *userdata) { c->mainloop->defer_enable(c->dispatch_event, 1); } -pa_dbus_wrap_connection* pa_dbus_wrap_connection_new(pa_mainloop_api *m, pa_bool_t use_rtclock, DBusBusType type, DBusError *error) { +pa_dbus_wrap_connection* pa_dbus_wrap_connection_new(pa_mainloop_api *m, bool use_rtclock, DBusBusType type, DBusError *error) { DBusConnection *conn; pa_dbus_wrap_connection *pconn; char *id; @@ -276,7 +276,7 @@ pa_dbus_wrap_connection* pa_dbus_wrap_connection_new(pa_mainloop_api *m, pa_bool pconn->connection = conn; pconn->use_rtclock = use_rtclock; - dbus_connection_set_exit_on_disconnect(conn, FALSE); + dbus_connection_set_exit_on_disconnect(conn, false); dbus_connection_set_dispatch_status_function(conn, dispatch_status, pconn, NULL); dbus_connection_set_watch_functions(conn, add_watch, remove_watch, toggle_watch, pconn, NULL); dbus_connection_set_timeout_functions(conn, add_timeout, remove_timeout, toggle_timeout, pconn, NULL); @@ -296,7 +296,7 @@ pa_dbus_wrap_connection* pa_dbus_wrap_connection_new(pa_mainloop_api *m, pa_bool pa_dbus_wrap_connection* pa_dbus_wrap_connection_new_from_existing( pa_mainloop_api *m, - pa_bool_t use_rtclock, + bool use_rtclock, DBusConnection *conn) { pa_dbus_wrap_connection *pconn; @@ -308,7 +308,7 @@ pa_dbus_wrap_connection* pa_dbus_wrap_connection_new_from_existing( pconn->connection = dbus_connection_ref(conn); pconn->use_rtclock = use_rtclock; - dbus_connection_set_exit_on_disconnect(conn, FALSE); + dbus_connection_set_exit_on_disconnect(conn, false); dbus_connection_set_dispatch_status_function(conn, dispatch_status, pconn, NULL); dbus_connection_set_watch_functions(conn, add_watch, remove_watch, toggle_watch, pconn, NULL); dbus_connection_set_timeout_functions(conn, add_timeout, remove_timeout, toggle_timeout, pconn, NULL); diff --git a/src/pulsecore/dbus-util.h b/src/pulsecore/dbus-util.h index e3d6e4f37..090a73f90 100644 --- a/src/pulsecore/dbus-util.h +++ b/src/pulsecore/dbus-util.h @@ -33,10 +33,10 @@ /* A wrap connection is not shared or refcounted, it is available in client side */ typedef struct pa_dbus_wrap_connection pa_dbus_wrap_connection; -pa_dbus_wrap_connection* pa_dbus_wrap_connection_new(pa_mainloop_api *mainloop, pa_bool_t use_rtclock, DBusBusType type, DBusError *error); +pa_dbus_wrap_connection* pa_dbus_wrap_connection_new(pa_mainloop_api *mainloop, bool use_rtclock, DBusBusType type, DBusError *error); pa_dbus_wrap_connection* pa_dbus_wrap_connection_new_from_existing( pa_mainloop_api *mainloop, - pa_bool_t use_rtclock, + bool use_rtclock, DBusConnection *conn); void pa_dbus_wrap_connection_free(pa_dbus_wrap_connection* conn); diff --git a/src/pulsecore/hashmap.c b/src/pulsecore/hashmap.c index 3e1d9f147..0629164b1 100644 --- a/src/pulsecore/hashmap.c +++ b/src/pulsecore/hashmap.c @@ -311,7 +311,7 @@ unsigned pa_hashmap_size(pa_hashmap *h) { return h->n_entries; } -pa_bool_t pa_hashmap_isempty(pa_hashmap *h) { +bool pa_hashmap_isempty(pa_hashmap *h) { pa_assert(h); return h->n_entries == 0; diff --git a/src/pulsecore/hashmap.h b/src/pulsecore/hashmap.h index 59ff12ead..a57fab3c9 100644 --- a/src/pulsecore/hashmap.h +++ b/src/pulsecore/hashmap.h @@ -54,8 +54,8 @@ void pa_hashmap_remove_all(pa_hashmap *h, pa_free_cb_t free_cb); /* Return the current number of entries of the hashmap */ unsigned pa_hashmap_size(pa_hashmap *h); -/* Return TRUE if the hashmap is empty */ -pa_bool_t pa_hashmap_isempty(pa_hashmap *h); +/* Return true if the hashmap is empty */ +bool pa_hashmap_isempty(pa_hashmap *h); /* May be used to iterate through the hashmap. Initially the opaque pointer *state has to be set to NULL. The hashmap may not be diff --git a/src/pulsecore/hook-list.c b/src/pulsecore/hook-list.c index 00981be30..ed07cea48 100644 --- a/src/pulsecore/hook-list.c +++ b/src/pulsecore/hook-list.c @@ -63,7 +63,7 @@ pa_hook_slot* pa_hook_connect(pa_hook *hook, pa_hook_priority_t prio, pa_hook_cb slot = pa_xnew(pa_hook_slot, 1); slot->hook = hook; - slot->dead = FALSE; + slot->dead = false; slot->callback = cb; slot->data = data; slot->priority = prio; @@ -85,7 +85,7 @@ void pa_hook_slot_free(pa_hook_slot *slot) { pa_assert(!slot->dead); if (slot->hook->n_firing > 0) { - slot->dead = TRUE; + slot->dead = true; slot->hook->n_dead++; } else slot_free(slot->hook, slot); @@ -124,7 +124,7 @@ pa_hook_result_t pa_hook_fire(pa_hook *hook, void *data) { return result; } -pa_bool_t pa_hook_is_firing(pa_hook *hook) { +bool pa_hook_is_firing(pa_hook *hook) { pa_assert(hook); return hook->n_firing > 0; diff --git a/src/pulsecore/hook-list.h b/src/pulsecore/hook-list.h index e4b70d3cf..deaa17159 100644 --- a/src/pulsecore/hook-list.h +++ b/src/pulsecore/hook-list.h @@ -45,7 +45,7 @@ typedef pa_hook_result_t (*pa_hook_cb_t)( void *slot_data); struct pa_hook_slot { - pa_bool_t dead; + bool dead; pa_hook *hook; pa_hook_priority_t priority; pa_hook_cb_t callback; @@ -68,6 +68,6 @@ void pa_hook_slot_free(pa_hook_slot *slot); pa_hook_result_t pa_hook_fire(pa_hook *hook, void *data); -pa_bool_t pa_hook_is_firing(pa_hook *hook); +bool pa_hook_is_firing(pa_hook *hook); #endif diff --git a/src/pulsecore/idxset.c b/src/pulsecore/idxset.c index 27e4980dc..3d2dbbeff 100644 --- a/src/pulsecore/idxset.c +++ b/src/pulsecore/idxset.c @@ -452,7 +452,7 @@ unsigned pa_idxset_size(pa_idxset*s) { return s->n_entries; } -pa_bool_t pa_idxset_isempty(pa_idxset *s) { +bool pa_idxset_isempty(pa_idxset *s) { pa_assert(s); return s->n_entries == 0; diff --git a/src/pulsecore/idxset.h b/src/pulsecore/idxset.h index 039e4be13..849253c47 100644 --- a/src/pulsecore/idxset.h +++ b/src/pulsecore/idxset.h @@ -102,8 +102,8 @@ void *pa_idxset_next(pa_idxset *s, uint32_t *idx); /* Return the current number of entries in the idxset */ unsigned pa_idxset_size(pa_idxset*s); -/* Return TRUE of the idxset is empty */ -pa_bool_t pa_idxset_isempty(pa_idxset *s); +/* Return true of the idxset is empty */ +bool pa_idxset_isempty(pa_idxset *s); /* Duplicate the idxset. This will not copy the actual indexes */ pa_idxset *pa_idxset_copy(pa_idxset *s); diff --git a/src/pulsecore/iochannel.c b/src/pulsecore/iochannel.c index ed8be239d..ca0f35022 100644 --- a/src/pulsecore/iochannel.c +++ b/src/pulsecore/iochannel.c @@ -51,10 +51,10 @@ struct pa_iochannel { pa_iochannel_cb_t callback; void*userdata; - pa_bool_t readable:1; - pa_bool_t writable:1; - pa_bool_t hungup:1; - pa_bool_t no_close:1; + bool readable:1; + bool writable:1; + bool hungup:1; + bool no_close:1; pa_io_event* input_event, *output_event; }; @@ -129,7 +129,7 @@ static void enable_events(pa_iochannel *io) { static void callback(pa_mainloop_api* m, pa_io_event *e, int fd, pa_io_event_flags_t f, void *userdata) { pa_iochannel *io = userdata; - pa_bool_t changed = FALSE; + bool changed = false; pa_assert(m); pa_assert(e); @@ -137,19 +137,19 @@ static void callback(pa_mainloop_api* m, pa_io_event *e, int fd, pa_io_event_fla pa_assert(userdata); if ((f & (PA_IO_EVENT_HANGUP|PA_IO_EVENT_ERROR)) && !io->hungup) { - io->hungup = TRUE; - changed = TRUE; + io->hungup = true; + changed = true; } if ((f & PA_IO_EVENT_INPUT) && !io->readable) { - io->readable = TRUE; - changed = TRUE; + io->readable = true; + changed = true; pa_assert(e == io->input_event); } if ((f & PA_IO_EVENT_OUTPUT) && !io->writable) { - io->writable = TRUE; - changed = TRUE; + io->writable = true; + changed = true; pa_assert(e == io->output_event); } @@ -197,19 +197,19 @@ void pa_iochannel_free(pa_iochannel*io) { pa_xfree(io); } -pa_bool_t pa_iochannel_is_readable(pa_iochannel*io) { +bool pa_iochannel_is_readable(pa_iochannel*io) { pa_assert(io); return io->readable || io->hungup; } -pa_bool_t pa_iochannel_is_writable(pa_iochannel*io) { +bool pa_iochannel_is_writable(pa_iochannel*io) { pa_assert(io); return io->writable && !io->hungup; } -pa_bool_t pa_iochannel_is_hungup(pa_iochannel*io) { +bool pa_iochannel_is_hungup(pa_iochannel*io) { pa_assert(io); return io->hungup; @@ -236,7 +236,7 @@ ssize_t pa_iochannel_write(pa_iochannel*io, const void*data, size_t l) { } /* Partial write - let's get a notification when we can write more */ - io->writable = io->hungup = FALSE; + io->writable = io->hungup = false; enable_events(io); return r; @@ -254,7 +254,7 @@ ssize_t pa_iochannel_read(pa_iochannel*io, void*data, size_t l) { /* We also reset the hangup flag here to ensure that another * IO callback is triggered so that we will again call into * user code */ - io->readable = io->hungup = FALSE; + io->readable = io->hungup = false; enable_events(io); } @@ -263,7 +263,7 @@ ssize_t pa_iochannel_read(pa_iochannel*io, void*data, size_t l) { #ifdef HAVE_CREDS -pa_bool_t pa_iochannel_creds_supported(pa_iochannel *io) { +bool pa_iochannel_creds_supported(pa_iochannel *io) { struct { struct sockaddr sa; #ifdef HAVE_SYS_UN_H @@ -280,7 +280,7 @@ pa_bool_t pa_iochannel_creds_supported(pa_iochannel *io) { l = sizeof(sa); if (getsockname(io->ifd, &sa.sa, &l) < 0) - return FALSE; + return false; return sa.sa.sa_family == AF_UNIX; } @@ -341,14 +341,14 @@ ssize_t pa_iochannel_write_with_creds(pa_iochannel*io, const void*data, size_t l mh.msg_controllen = sizeof(cmsg); if ((r = sendmsg(io->ofd, &mh, MSG_NOSIGNAL)) >= 0) { - io->writable = io->hungup = FALSE; + io->writable = io->hungup = false; enable_events(io); } return r; } -ssize_t pa_iochannel_read_with_creds(pa_iochannel*io, void*data, size_t l, pa_creds *creds, pa_bool_t *creds_valid) { +ssize_t pa_iochannel_read_with_creds(pa_iochannel*io, void*data, size_t l, pa_creds *creds, bool *creds_valid) { ssize_t r; struct msghdr mh; struct iovec iov; @@ -378,7 +378,7 @@ ssize_t pa_iochannel_read_with_creds(pa_iochannel*io, void*data, size_t l, pa_cr if ((r = recvmsg(io->ifd, &mh, 0)) >= 0) { struct cmsghdr *cmh; - *creds_valid = FALSE; + *creds_valid = false; for (cmh = CMSG_FIRSTHDR(&mh); cmh; cmh = CMSG_NXTHDR(&mh, cmh)) { @@ -389,12 +389,12 @@ ssize_t pa_iochannel_read_with_creds(pa_iochannel*io, void*data, size_t l, pa_cr creds->gid = u.gid; creds->uid = u.uid; - *creds_valid = TRUE; + *creds_valid = true; break; } } - io->readable = io->hungup = FALSE; + io->readable = io->hungup = false; enable_events(io); } @@ -410,7 +410,7 @@ void pa_iochannel_set_callback(pa_iochannel*io, pa_iochannel_cb_t _callback, voi io->userdata = userdata; } -void pa_iochannel_set_noclose(pa_iochannel*io, pa_bool_t b) { +void pa_iochannel_set_noclose(pa_iochannel*io, bool b) { pa_assert(io); io->no_close = !!b; @@ -454,15 +454,15 @@ int pa_iochannel_get_send_fd(pa_iochannel *io) { return io->ofd; } -pa_bool_t pa_iochannel_socket_is_local(pa_iochannel *io) { +bool pa_iochannel_socket_is_local(pa_iochannel *io) { pa_assert(io); if (pa_socket_is_local(io->ifd)) - return TRUE; + return true; if (io->ifd != io->ofd) if (pa_socket_is_local(io->ofd)) - return TRUE; + return true; - return FALSE; + return false; } diff --git a/src/pulsecore/iochannel.h b/src/pulsecore/iochannel.h index ee3cd67d7..e95f46f78 100644 --- a/src/pulsecore/iochannel.h +++ b/src/pulsecore/iochannel.h @@ -54,20 +54,20 @@ ssize_t pa_iochannel_write(pa_iochannel*io, const void*data, size_t l); ssize_t pa_iochannel_read(pa_iochannel*io, void*data, size_t l); #ifdef HAVE_CREDS -pa_bool_t pa_iochannel_creds_supported(pa_iochannel *io); +bool pa_iochannel_creds_supported(pa_iochannel *io); int pa_iochannel_creds_enable(pa_iochannel *io); ssize_t pa_iochannel_write_with_creds(pa_iochannel*io, const void*data, size_t l, const pa_creds *ucred); -ssize_t pa_iochannel_read_with_creds(pa_iochannel*io, void*data, size_t l, pa_creds *ucred, pa_bool_t *creds_valid); +ssize_t pa_iochannel_read_with_creds(pa_iochannel*io, void*data, size_t l, pa_creds *ucred, bool *creds_valid); #endif -pa_bool_t pa_iochannel_is_readable(pa_iochannel*io); -pa_bool_t pa_iochannel_is_writable(pa_iochannel*io); -pa_bool_t pa_iochannel_is_hungup(pa_iochannel*io); +bool pa_iochannel_is_readable(pa_iochannel*io); +bool pa_iochannel_is_writable(pa_iochannel*io); +bool pa_iochannel_is_hungup(pa_iochannel*io); /* Don't close the file descriptors when the io channel is freed. By * default the file descriptors are closed. */ -void pa_iochannel_set_noclose(pa_iochannel*io, pa_bool_t b); +void pa_iochannel_set_noclose(pa_iochannel*io, bool b); /* Set the callback function that is called whenever data becomes available for read or write */ typedef void (*pa_iochannel_cb_t)(pa_iochannel*io, void *userdata); @@ -80,7 +80,7 @@ void pa_iochannel_socket_peer_to_string(pa_iochannel*io, char*s, size_t l); int pa_iochannel_socket_set_rcvbuf(pa_iochannel*io, size_t l); int pa_iochannel_socket_set_sndbuf(pa_iochannel*io, size_t l); -pa_bool_t pa_iochannel_socket_is_local(pa_iochannel *io); +bool pa_iochannel_socket_is_local(pa_iochannel *io); pa_mainloop_api* pa_iochannel_get_mainloop_api(pa_iochannel *io); diff --git a/src/pulsecore/ioline.c b/src/pulsecore/ioline.c index a5572e9f7..ead9ebdf9 100644 --- a/src/pulsecore/ioline.c +++ b/src/pulsecore/ioline.c @@ -61,8 +61,8 @@ struct pa_ioline { pa_ioline_drain_cb_t drain_callback; void *drain_userdata; - pa_bool_t dead:1; - pa_bool_t defer_close:1; + bool dead:1; + bool defer_close:1; }; static void io_callback(pa_iochannel*io, void *userdata); @@ -93,8 +93,8 @@ pa_ioline* pa_ioline_new(pa_iochannel *io) { l->defer_event = l->mainloop->defer_new(l->mainloop, defer_callback, l); l->mainloop->defer_enable(l->defer_event, 0); - l->dead = FALSE; - l->defer_close = FALSE; + l->dead = false; + l->defer_close = false; pa_iochannel_set_callback(io, io_callback, l); @@ -135,7 +135,7 @@ void pa_ioline_close(pa_ioline *l) { pa_assert(l); pa_assert(PA_REFCNT_VALUE(l) >= 1); - l->dead = TRUE; + l->dead = true; if (l->io) { pa_iochannel_free(l->io); @@ -220,7 +220,7 @@ void pa_ioline_set_drain_callback(pa_ioline*l, pa_ioline_drain_cb_t callback, vo l->drain_userdata = userdata; } -static void failure(pa_ioline *l, pa_bool_t process_leftover) { +static void failure(pa_ioline *l, bool process_leftover) { pa_assert(l); pa_assert(PA_REFCNT_VALUE(l) >= 1); pa_assert(!l->dead); @@ -326,9 +326,9 @@ static int do_read(pa_ioline *l) { if (r < 0 && errno != ECONNRESET) { pa_log("read(): %s", pa_cstrerror(errno)); - failure(l, FALSE); + failure(l, false); } else - failure(l, TRUE); + failure(l, true); return -1; } @@ -356,7 +356,7 @@ static int do_write(pa_ioline *l) { if (errno != EPIPE) pa_log("write(): %s", pa_cstrerror(errno)); - failure(l, FALSE); + failure(l, false); return -1; } @@ -391,7 +391,7 @@ static void do_work(pa_ioline *l) { do_write(l); if (l->defer_close && !l->wbuf_valid_length) - failure(l, TRUE); + failure(l, true); pa_ioline_unref(l); } @@ -421,7 +421,7 @@ void pa_ioline_defer_close(pa_ioline *l) { pa_assert(l); pa_assert(PA_REFCNT_VALUE(l) >= 1); - l->defer_close = TRUE; + l->defer_close = true; if (!l->wbuf_valid_length) l->mainloop->defer_enable(l->defer_event, 1); @@ -458,7 +458,7 @@ pa_iochannel* pa_ioline_detach_iochannel(pa_ioline *l) { return r; } -pa_bool_t pa_ioline_is_drained(pa_ioline *l) { +bool pa_ioline_is_drained(pa_ioline *l) { pa_assert(l); return l->wbuf_valid_length <= 0; diff --git a/src/pulsecore/ioline.h b/src/pulsecore/ioline.h index 120984e0f..28428eb71 100644 --- a/src/pulsecore/ioline.h +++ b/src/pulsecore/ioline.h @@ -55,8 +55,8 @@ void pa_ioline_set_drain_callback(pa_ioline*io, pa_ioline_drain_cb_t callback, v /* Make sure to close the ioline object as soon as the send buffer is emptied */ void pa_ioline_defer_close(pa_ioline *io); -/* Returns TRUE when everything was written */ -pa_bool_t pa_ioline_is_drained(pa_ioline *io); +/* Returns true when everything was written */ +bool pa_ioline_is_drained(pa_ioline *io); /* Detaches from the iochannel and returns it. Data that has already * been read will not be available in the detached iochannel */ diff --git a/src/pulsecore/lock-autospawn.c b/src/pulsecore/lock-autospawn.c index b1d414baf..72806f831 100644 --- a/src/pulsecore/lock-autospawn.c +++ b/src/pulsecore/lock-autospawn.c @@ -96,13 +96,13 @@ static int ref(void) { pa_make_fd_nonblock(pipe_fd[1]); pa_make_fd_nonblock(pipe_fd[0]); - lock_fd_mutex = pa_mutex_new(FALSE, FALSE); + lock_fd_mutex = pa_mutex_new(false, false); n_ref = 1; return 0; } -static void unref(pa_bool_t after_fork) { +static void unref(bool after_fork) { pa_assert(n_ref > 0); pa_assert(pipe_fd[0] >= 0); @@ -257,7 +257,7 @@ static int start_thread(void) { static void create_mutex(void) { PA_ONCE_BEGIN { - mutex = pa_mutex_new(FALSE, FALSE); + mutex = pa_mutex_new(false, false); } PA_ONCE_END; } @@ -282,7 +282,7 @@ int pa_autospawn_lock_init(void) { return ret; } -int pa_autospawn_lock_acquire(pa_bool_t block) { +int pa_autospawn_lock_acquire(bool block) { int ret = -1; create_mutex(); @@ -345,7 +345,7 @@ void pa_autospawn_lock_release(void) { pa_mutex_unlock(mutex); } -void pa_autospawn_lock_done(pa_bool_t after_fork) { +void pa_autospawn_lock_done(bool after_fork) { create_mutex(); pa_mutex_lock(mutex); diff --git a/src/pulsecore/lock-autospawn.h b/src/pulsecore/lock-autospawn.h index c04c4bd17..6f1855061 100644 --- a/src/pulsecore/lock-autospawn.h +++ b/src/pulsecore/lock-autospawn.h @@ -25,8 +25,8 @@ #include <pulsecore/macro.h> int pa_autospawn_lock_init(void); -int pa_autospawn_lock_acquire(pa_bool_t block); +int pa_autospawn_lock_acquire(bool block); void pa_autospawn_lock_release(void); -void pa_autospawn_lock_done(pa_bool_t after_fork); +void pa_autospawn_lock_done(bool after_fork); #endif diff --git a/src/pulsecore/log.c b/src/pulsecore/log.c index 8066ca5a1..61873fa48 100644 --- a/src/pulsecore/log.c +++ b/src/pulsecore/log.c @@ -71,11 +71,11 @@ static char *ident = NULL; /* in local charset format */ static pa_log_target target = { PA_LOG_STDERR, NULL }; static pa_log_target_type_t target_override; -static pa_bool_t target_override_set = FALSE; +static bool target_override_set = false; static pa_log_level_t maximum_level = PA_LOG_ERROR, maximum_level_override = PA_LOG_ERROR; static unsigned show_backtrace = 0, show_backtrace_override = 0, skip_backtrace = 0; static pa_log_flags_t flags = 0, flags_override = 0; -static pa_bool_t no_rate_limit = FALSE; +static bool no_rate_limit = false; static int log_fd = -1; #ifdef HAVE_SYSLOG_H @@ -280,7 +280,7 @@ static void init_defaults(void) { if (getenv(ENV_LOG_SYSLOG)) { target_override = PA_LOG_SYSLOG; - target_override_set = TRUE; + target_override_set = true; } if ((e = getenv(ENV_LOG_LEVEL))) { @@ -320,7 +320,7 @@ static void init_defaults(void) { } if (getenv(ENV_LOG_NO_RATELIMIT)) - no_rate_limit = TRUE; + no_rate_limit = true; } PA_ONCE_END; } @@ -524,14 +524,14 @@ void pa_log_level(pa_log_level_t level, const char *format, ...) { va_end(ap); } -pa_bool_t pa_log_ratelimit(pa_log_level_t level) { +bool pa_log_ratelimit(pa_log_level_t level) { /* Not more than 10 messages every 5s */ static PA_DEFINE_RATELIMIT(ratelimit, 5 * PA_USEC_PER_SEC, 10); init_defaults(); if (no_rate_limit) - return TRUE; + return true; return pa_ratelimit_test(&ratelimit, level); } diff --git a/src/pulsecore/log.h b/src/pulsecore/log.h index dd5e371c6..0cfa0ed07 100644 --- a/src/pulsecore/log.h +++ b/src/pulsecore/log.h @@ -153,6 +153,6 @@ LOG_FUNC(error, PA_LOG_ERROR) #define pa_log pa_log_error -pa_bool_t pa_log_ratelimit(pa_log_level_t level); +bool pa_log_ratelimit(pa_log_level_t level); #endif diff --git a/src/pulsecore/macro.h b/src/pulsecore/macro.h index c6d7d5660..39d6a9890 100644 --- a/src/pulsecore/macro.h +++ b/src/pulsecore/macro.h @@ -204,7 +204,7 @@ typedef int pa_bool_t; pa_log_debug("Assertion '%s' failed at %s:%u, function %s.\n", #expr , __FILE__, __LINE__, PA_PRETTY_FUNCTION); \ return; \ } \ - } while(FALSE) + } while(false) #define pa_return_val_if_fail(expr, val) \ do { \ @@ -212,7 +212,7 @@ typedef int pa_bool_t; pa_log_debug("Assertion '%s' failed at %s:%u, function %s.\n", #expr , __FILE__, __LINE__, PA_PRETTY_FUNCTION); \ return (val); \ } \ - } while(FALSE) + } while(false) #define pa_return_null_if_fail(expr) pa_return_val_if_fail(expr, NULL) @@ -224,10 +224,10 @@ typedef int pa_bool_t; pa_log_error("Assertion '%s' failed at %s:%u, function %s(). Aborting.", #expr , __FILE__, __LINE__, PA_PRETTY_FUNCTION); \ abort(); \ } \ - } while (FALSE) + } while (false) /* Does exactly nothing */ -#define pa_nop() do {} while (FALSE) +#define pa_nop() do {} while (false) /* pa_assert() is an assert that may be optimized away by defining * NDEBUG. pa_assert_fp() is an assert that may be optimized away by @@ -252,7 +252,7 @@ typedef int pa_bool_t; do { \ pa_log_error("Code should not be reached at %s:%u, function %s(). Aborting.", __FILE__, __LINE__, PA_PRETTY_FUNCTION); \ abort(); \ - } while (FALSE) + } while (false) #endif /* A compile time assertion */ @@ -263,7 +263,7 @@ typedef int pa_bool_t; case !!(expr): \ ; \ } \ - } while (FALSE) + } while (false) #define PA_PTR_TO_UINT(p) ((unsigned int) ((uintptr_t) (p))) #define PA_UINT_TO_PTR(u) ((void*) ((uintptr_t) (u))) diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c index 5b77df3b4..2d83b72c4 100644 --- a/src/pulsecore/memblock.c +++ b/src/pulsecore/memblock.c @@ -70,8 +70,8 @@ struct pa_memblock { pa_memblock_type_t type; - pa_bool_t read_only:1; - pa_bool_t is_silence:1; + bool read_only:1; + bool is_silence:1; pa_atomic_ptr_t data; size_t length; @@ -235,7 +235,7 @@ static pa_memblock *memblock_new_appended(pa_mempool *p, size_t length) { PA_REFCNT_INIT(b); b->pool = p; b->type = PA_MEMBLOCK_APPENDED; - b->read_only = b->is_silence = FALSE; + b->read_only = b->is_silence = false; pa_atomic_ptr_store(&b->data, (uint8_t*) b + PA_ALIGN(sizeof(pa_memblock))); b->length = length; pa_atomic_store(&b->n_acquired, 0); @@ -351,7 +351,7 @@ pa_memblock *pa_memblock_new_pool(pa_mempool *p, size_t length) { PA_REFCNT_INIT(b); b->pool = p; - b->read_only = b->is_silence = FALSE; + b->read_only = b->is_silence = false; b->length = length; pa_atomic_store(&b->n_acquired, 0); pa_atomic_store(&b->please_signal, 0); @@ -361,7 +361,7 @@ pa_memblock *pa_memblock_new_pool(pa_mempool *p, size_t length) { } /* No lock necessary */ -pa_memblock *pa_memblock_new_fixed(pa_mempool *p, void *d, size_t length, pa_bool_t read_only) { +pa_memblock *pa_memblock_new_fixed(pa_mempool *p, void *d, size_t length, bool read_only) { pa_memblock *b; pa_assert(p); @@ -376,7 +376,7 @@ pa_memblock *pa_memblock_new_fixed(pa_mempool *p, void *d, size_t length, pa_boo b->pool = p; b->type = PA_MEMBLOCK_FIXED; b->read_only = read_only; - b->is_silence = FALSE; + b->is_silence = false; pa_atomic_ptr_store(&b->data, d); b->length = length; pa_atomic_store(&b->n_acquired, 0); @@ -387,7 +387,7 @@ pa_memblock *pa_memblock_new_fixed(pa_mempool *p, void *d, size_t length, pa_boo } /* No lock necessary */ -pa_memblock *pa_memblock_new_user(pa_mempool *p, void *d, size_t length, pa_free_cb_t free_cb, pa_bool_t read_only) { +pa_memblock *pa_memblock_new_user(pa_mempool *p, void *d, size_t length, pa_free_cb_t free_cb, bool read_only) { pa_memblock *b; pa_assert(p); @@ -403,7 +403,7 @@ pa_memblock *pa_memblock_new_user(pa_mempool *p, void *d, size_t length, pa_free b->pool = p; b->type = PA_MEMBLOCK_USER; b->read_only = read_only; - b->is_silence = FALSE; + b->is_silence = false; pa_atomic_ptr_store(&b->data, d); b->length = length; pa_atomic_store(&b->n_acquired, 0); @@ -416,7 +416,7 @@ pa_memblock *pa_memblock_new_user(pa_mempool *p, void *d, size_t length, pa_free } /* No lock necessary */ -pa_bool_t pa_memblock_is_read_only(pa_memblock *b) { +bool pa_memblock_is_read_only(pa_memblock *b) { pa_assert(b); pa_assert(PA_REFCNT_VALUE(b) > 0); @@ -424,7 +424,7 @@ pa_bool_t pa_memblock_is_read_only(pa_memblock *b) { } /* No lock necessary */ -pa_bool_t pa_memblock_is_silence(pa_memblock *b) { +bool pa_memblock_is_silence(pa_memblock *b) { pa_assert(b); pa_assert(PA_REFCNT_VALUE(b) > 0); @@ -432,7 +432,7 @@ pa_bool_t pa_memblock_is_silence(pa_memblock *b) { } /* No lock necessary */ -void pa_memblock_set_is_silence(pa_memblock *b, pa_bool_t v) { +void pa_memblock_set_is_silence(pa_memblock *b, bool v) { pa_assert(b); pa_assert(PA_REFCNT_VALUE(b) > 0); @@ -440,7 +440,7 @@ void pa_memblock_set_is_silence(pa_memblock *b, pa_bool_t v) { } /* No lock necessary */ -pa_bool_t pa_memblock_ref_is_one(pa_memblock *b) { +bool pa_memblock_ref_is_one(pa_memblock *b) { int r; pa_assert(b); @@ -560,7 +560,7 @@ static void memblock_free(pa_memblock *b) { case PA_MEMBLOCK_POOL_EXTERNAL: case PA_MEMBLOCK_POOL: { struct mempool_slot *slot; - pa_bool_t call_free; + bool call_free; pa_assert_se(slot = mempool_slot_by_ptr(b->pool, pa_atomic_ptr_load(&b->data))); @@ -638,7 +638,7 @@ static void memblock_make_local(pa_memblock *b) { pa_atomic_ptr_store(&b->data, new_data); b->type = PA_MEMBLOCK_POOL_EXTERNAL; - b->read_only = FALSE; + b->read_only = false; goto finish; } @@ -649,7 +649,7 @@ static void memblock_make_local(pa_memblock *b) { pa_atomic_ptr_store(&b->data, pa_xmemdup(pa_atomic_ptr_load(&b->data), b->length)); b->type = PA_MEMBLOCK_USER; - b->read_only = FALSE; + b->read_only = false; finish: pa_atomic_inc(&b->pool->stat.n_allocated_by_type[b->type]); @@ -712,7 +712,7 @@ static void memblock_replace_import(pa_memblock *b) { pa_mutex_unlock(import->mutex); } -pa_mempool* pa_mempool_new(pa_bool_t shared, size_t size) { +pa_mempool* pa_mempool_new(bool shared, size_t size) { pa_mempool *p; char t1[PA_BYTES_SNPRINT_MAX], t2[PA_BYTES_SNPRINT_MAX]; @@ -749,7 +749,7 @@ pa_mempool* pa_mempool_new(pa_bool_t shared, size_t size) { PA_LLIST_HEAD_INIT(pa_memimport, p->imports); PA_LLIST_HEAD_INIT(pa_memexport, p->exports); - p->mutex = pa_mutex_new(TRUE, TRUE); + p->mutex = pa_mutex_new(true, true); p->semaphore = pa_semaphore_new(0); p->free_slots = pa_flist_new(p->n_blocks); @@ -874,7 +874,7 @@ int pa_mempool_get_shm_id(pa_mempool *p, uint32_t *id) { } /* No lock necessary */ -pa_bool_t pa_mempool_is_shared(pa_mempool *p) { +bool pa_mempool_is_shared(pa_mempool *p) { pa_assert(p); return !!p->memory.shared; @@ -888,7 +888,7 @@ pa_memimport* pa_memimport_new(pa_mempool *p, pa_memimport_release_cb_t cb, void pa_assert(cb); i = pa_xnew(pa_memimport, 1); - i->mutex = pa_mutex_new(TRUE, TRUE); + i->mutex = pa_mutex_new(true, true); i->pool = p; i->segments = pa_hashmap_new(NULL, NULL); i->blocks = pa_hashmap_new(NULL, NULL); @@ -1002,8 +1002,8 @@ pa_memblock* pa_memimport_get(pa_memimport *i, uint32_t block_id, uint32_t shm_i PA_REFCNT_INIT(b); b->pool = i->pool; b->type = PA_MEMBLOCK_IMPORTED; - b->read_only = TRUE; - b->is_silence = FALSE; + b->read_only = true; + b->is_silence = false; pa_atomic_ptr_store(&b->data, (uint8_t*) seg->memory.ptr + offset); b->length = size; pa_atomic_store(&b->n_acquired, 0); @@ -1054,7 +1054,7 @@ pa_memexport* pa_memexport_new(pa_mempool *p, pa_memexport_revoke_cb_t cb, void return NULL; e = pa_xnew(pa_memexport, 1); - e->mutex = pa_mutex_new(TRUE, TRUE); + e->mutex = pa_mutex_new(true, true); e->pool = p; PA_LLIST_HEAD_INIT(struct memexport_slot, e->free_slots); PA_LLIST_HEAD_INIT(struct memexport_slot, e->used_slots); diff --git a/src/pulsecore/memblock.h b/src/pulsecore/memblock.h index 84c5d05cb..6a3f2ed36 100644 --- a/src/pulsecore/memblock.h +++ b/src/pulsecore/memblock.h @@ -85,13 +85,13 @@ pa_memblock *pa_memblock_new(pa_mempool *, size_t length); pa_memblock *pa_memblock_new_pool(pa_mempool *, size_t length); /* Allocate a new memory block of type PA_MEMBLOCK_USER */ -pa_memblock *pa_memblock_new_user(pa_mempool *, void *data, size_t length, pa_free_cb_t free_cb, pa_bool_t read_only); +pa_memblock *pa_memblock_new_user(pa_mempool *, void *data, size_t length, pa_free_cb_t free_cb, bool read_only); /* A special case of pa_memblock_new_user: take a memory buffer previously allocated with pa_xmalloc() */ #define pa_memblock_new_malloced(p,data,length) pa_memblock_new_user(p, data, length, pa_xfree, 0) /* Allocate a new memory block of type PA_MEMBLOCK_FIXED */ -pa_memblock *pa_memblock_new_fixed(pa_mempool *, void *data, size_t length, pa_bool_t read_only); +pa_memblock *pa_memblock_new_fixed(pa_mempool *, void *data, size_t length, bool read_only); void pa_memblock_unref(pa_memblock*b); pa_memblock* pa_memblock_ref(pa_memblock*b); @@ -104,10 +104,10 @@ function is not multiple caller safe, i.e. needs to be locked manually if called from more than one thread at the same time. */ void pa_memblock_unref_fixed(pa_memblock*b); -pa_bool_t pa_memblock_is_read_only(pa_memblock *b); -pa_bool_t pa_memblock_is_silence(pa_memblock *b); -pa_bool_t pa_memblock_ref_is_one(pa_memblock *b); -void pa_memblock_set_is_silence(pa_memblock *b, pa_bool_t v); +bool pa_memblock_is_read_only(pa_memblock *b); +bool pa_memblock_is_silence(pa_memblock *b); +bool pa_memblock_ref_is_one(pa_memblock *b); +void pa_memblock_set_is_silence(pa_memblock *b, bool v); void* pa_memblock_acquire(pa_memblock *b); void *pa_memblock_acquire_chunk(const pa_memchunk *c); @@ -119,12 +119,12 @@ pa_mempool * pa_memblock_get_pool(pa_memblock *b); pa_memblock *pa_memblock_will_need(pa_memblock *b); /* The memory block manager */ -pa_mempool* pa_mempool_new(pa_bool_t shared, size_t size); +pa_mempool* pa_mempool_new(bool shared, size_t size); void pa_mempool_free(pa_mempool *p); const pa_mempool_stat* pa_mempool_get_stat(pa_mempool *p); void pa_mempool_vacuum(pa_mempool *p); int pa_mempool_get_shm_id(pa_mempool *p, uint32_t *id); -pa_bool_t pa_mempool_is_shared(pa_mempool *p); +bool pa_mempool_is_shared(pa_mempool *p); size_t pa_mempool_block_size_max(pa_mempool *p); /* For receiving blocks from other nodes */ diff --git a/src/pulsecore/memblockq.c b/src/pulsecore/memblockq.c index 5b9a44b9b..571107dac 100644 --- a/src/pulsecore/memblockq.c +++ b/src/pulsecore/memblockq.c @@ -52,7 +52,7 @@ struct pa_memblockq { unsigned n_blocks; size_t maxlength, tlength, base, prebuf, minreq, maxrewind; int64_t read_index, write_index; - pa_bool_t in_prebuf; + bool in_prebuf; pa_memchunk silence; pa_mcalign *mcalign; int64_t missing, requested; @@ -86,7 +86,7 @@ pa_memblockq* pa_memblockq_new( pa_log_debug("memblockq requested: maxlength=%lu, tlength=%lu, base=%lu, prebuf=%lu, minreq=%lu maxrewind=%lu", (unsigned long) maxlength, (unsigned long) tlength, (unsigned long) bq->base, (unsigned long) prebuf, (unsigned long) minreq, (unsigned long) maxrewind); - bq->in_prebuf = TRUE; + bq->in_prebuf = true; pa_memblockq_set_maxlength(bq, maxlength); pa_memblockq_set_tlength(bq, tlength); @@ -222,7 +222,7 @@ static void drop_backlog(pa_memblockq *bq) { drop_block(bq, bq->blocks); } -static pa_bool_t can_push(pa_memblockq *bq, size_t l) { +static bool can_push(pa_memblockq *bq, size_t l) { int64_t end; pa_assert(bq); @@ -233,7 +233,7 @@ static pa_bool_t can_push(pa_memblockq *bq, size_t l) { if ((int64_t) l > d) l -= (size_t) d; else - return TRUE; + return true; } end = bq->blocks_tail ? bq->blocks_tail->index + (int64_t) bq->blocks_tail->chunk.length : bq->write_index; @@ -241,12 +241,12 @@ static pa_bool_t can_push(pa_memblockq *bq, size_t l) { /* Make sure that the list doesn't get too long */ if (bq->write_index + (int64_t) l > end) if (bq->write_index + (int64_t) l - bq->read_index > (int64_t) bq->maxlength) - return FALSE; + return false; - return TRUE; + return true; } -static void write_index_changed(pa_memblockq *bq, int64_t old_write_index, pa_bool_t account) { +static void write_index_changed(pa_memblockq *bq, int64_t old_write_index, bool account) { int64_t delta; pa_assert(bq); @@ -438,11 +438,11 @@ int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *uchunk) { finish: - write_index_changed(bq, old, TRUE); + write_index_changed(bq, old, true); return 0; } -pa_bool_t pa_memblockq_prebuf_active(pa_memblockq *bq) { +bool pa_memblockq_prebuf_active(pa_memblockq *bq) { pa_assert(bq); if (bq->in_prebuf) @@ -451,24 +451,24 @@ pa_bool_t pa_memblockq_prebuf_active(pa_memblockq *bq) { return bq->prebuf > 0 && bq->read_index >= bq->write_index; } -static pa_bool_t update_prebuf(pa_memblockq *bq) { +static bool update_prebuf(pa_memblockq *bq) { pa_assert(bq); if (bq->in_prebuf) { if (pa_memblockq_get_length(bq) < bq->prebuf) - return TRUE; + return true; - bq->in_prebuf = FALSE; - return FALSE; + bq->in_prebuf = false; + return false; } else { if (bq->prebuf > 0 && bq->read_index >= bq->write_index) { - bq->in_prebuf = TRUE; - return TRUE; + bq->in_prebuf = true; + return true; } - return FALSE; + return false; } } @@ -657,16 +657,16 @@ void pa_memblockq_rewind(pa_memblockq *bq, size_t length) { read_index_changed(bq, old); } -pa_bool_t pa_memblockq_is_readable(pa_memblockq *bq) { +bool pa_memblockq_is_readable(pa_memblockq *bq) { pa_assert(bq); if (pa_memblockq_prebuf_active(bq)) - return FALSE; + return false; if (pa_memblockq_get_length(bq) <= 0) - return FALSE; + return false; - return TRUE; + return true; } size_t pa_memblockq_get_length(pa_memblockq *bq) { @@ -690,7 +690,7 @@ size_t pa_memblockq_missing(pa_memblockq *bq) { return l >= bq->minreq ? l : 0; } -void pa_memblockq_seek(pa_memblockq *bq, int64_t offset, pa_seek_mode_t seek, pa_bool_t account) { +void pa_memblockq_seek(pa_memblockq *bq, int64_t offset, pa_seek_mode_t seek, bool account) { int64_t old; pa_assert(bq); @@ -717,7 +717,7 @@ void pa_memblockq_seek(pa_memblockq *bq, int64_t offset, pa_seek_mode_t seek, pa write_index_changed(bq, old, account); } -void pa_memblockq_flush_write(pa_memblockq *bq, pa_bool_t account) { +void pa_memblockq_flush_write(pa_memblockq *bq, bool account) { int64_t old; pa_assert(bq); @@ -804,14 +804,14 @@ int pa_memblockq_push_align(pa_memblockq* bq, const pa_memchunk *chunk) { void pa_memblockq_prebuf_disable(pa_memblockq *bq) { pa_assert(bq); - bq->in_prebuf = FALSE; + bq->in_prebuf = false; } void pa_memblockq_prebuf_force(pa_memblockq *bq) { pa_assert(bq); if (bq->prebuf > 0) - bq->in_prebuf = TRUE; + bq->in_prebuf = true; } size_t pa_memblockq_get_maxlength(pa_memblockq *bq) { @@ -914,7 +914,7 @@ void pa_memblockq_set_prebuf(pa_memblockq *bq, size_t prebuf) { bq->prebuf = bq->tlength+bq->base-bq->minreq; if (bq->prebuf <= 0 || pa_memblockq_get_length(bq) >= bq->prebuf) - bq->in_prebuf = FALSE; + bq->in_prebuf = false; } void pa_memblockq_set_maxrewind(pa_memblockq *bq, size_t maxrewind) { @@ -967,7 +967,7 @@ int pa_memblockq_splice(pa_memblockq *bq, pa_memblockq *source) { pa_memblock_unref(chunk.memblock); } else - pa_memblockq_seek(bq, (int64_t) chunk.length, PA_SEEK_RELATIVE, TRUE); + pa_memblockq_seek(bq, (int64_t) chunk.length, PA_SEEK_RELATIVE, true); pa_memblockq_drop(bq, chunk.length); } @@ -997,7 +997,7 @@ void pa_memblockq_set_silence(pa_memblockq *bq, pa_memchunk *silence) { pa_memchunk_reset(&bq->silence); } -pa_bool_t pa_memblockq_is_empty(pa_memblockq *bq) { +bool pa_memblockq_is_empty(pa_memblockq *bq) { pa_assert(bq); return !bq->blocks; diff --git a/src/pulsecore/memblockq.h b/src/pulsecore/memblockq.h index a81ab85bd..24f4d4730 100644 --- a/src/pulsecore/memblockq.h +++ b/src/pulsecore/memblockq.h @@ -87,7 +87,7 @@ int pa_memblockq_push(pa_memblockq* bq, const pa_memchunk *chunk); int pa_memblockq_push_align(pa_memblockq* bq, const pa_memchunk *chunk); /* Manipulate the write pointer */ -void pa_memblockq_seek(pa_memblockq *bq, int64_t offset, pa_seek_mode_t seek, pa_bool_t account); +void pa_memblockq_seek(pa_memblockq *bq, int64_t offset, pa_seek_mode_t seek, bool account); /* Return a copy of the next memory chunk in the queue. It is not * removed from the queue. There are two reasons this function might @@ -109,7 +109,7 @@ void pa_memblockq_drop(pa_memblockq *bq, size_t length); void pa_memblockq_rewind(pa_memblockq *bq, size_t length); /* Test if the pa_memblockq is currently readable, that is, more data than base */ -pa_bool_t pa_memblockq_is_readable(pa_memblockq *bq); +bool pa_memblockq_is_readable(pa_memblockq *bq); /* Return the length of the queue in bytes */ size_t pa_memblockq_get_length(pa_memblockq *bq); @@ -125,7 +125,7 @@ size_t pa_memblockq_pop_missing(pa_memblockq *bq); int pa_memblockq_splice(pa_memblockq *bq, pa_memblockq *source); /* Set the queue to silence, set write index to read index */ -void pa_memblockq_flush_write(pa_memblockq *bq, pa_bool_t account); +void pa_memblockq_flush_write(pa_memblockq *bq, bool account); /* Set the queue to silence, set write read index to write index*/ void pa_memblockq_flush_read(pa_memblockq *bq); @@ -178,13 +178,13 @@ void pa_memblockq_willneed(pa_memblockq *bq); /* Check whether the memblockq is completely empty, i.e. no data * neither left nor right of the read pointer, and hence no buffered * data for the future nor data in the backlog. */ -pa_bool_t pa_memblockq_is_empty(pa_memblockq *bq); +bool pa_memblockq_is_empty(pa_memblockq *bq); /* Drop everything in the queue, but don't modify the indexes */ void pa_memblockq_silence(pa_memblockq *bq); /* Check whether we currently are in prebuf state */ -pa_bool_t pa_memblockq_prebuf_active(pa_memblockq *bq); +bool pa_memblockq_prebuf_active(pa_memblockq *bq); /* Return how many items are currently stored in the queue */ unsigned pa_memblockq_get_nblocks(pa_memblockq *bq); diff --git a/src/pulsecore/memchunk.c b/src/pulsecore/memchunk.c index 5f0359746..5f8545f8d 100644 --- a/src/pulsecore/memchunk.c +++ b/src/pulsecore/memchunk.c @@ -110,7 +110,7 @@ pa_memchunk* pa_memchunk_memcpy(pa_memchunk *dst, pa_memchunk *src) { return dst; } -pa_bool_t pa_memchunk_isset(pa_memchunk *chunk) { +bool pa_memchunk_isset(pa_memchunk *chunk) { assert(chunk); return diff --git a/src/pulsecore/memchunk.h b/src/pulsecore/memchunk.h index 922ffaa4e..6dccaed77 100644 --- a/src/pulsecore/memchunk.h +++ b/src/pulsecore/memchunk.h @@ -52,7 +52,7 @@ pa_memchunk *pa_memchunk_will_need(const pa_memchunk *c); /* Copy the data in the src memchunk to the dst memchunk */ pa_memchunk* pa_memchunk_memcpy(pa_memchunk *dst, pa_memchunk *src); -/* Return TRUE if any field is set != 0 */ -pa_bool_t pa_memchunk_isset(pa_memchunk *c); +/* Return true if any field is set != 0 */ +bool pa_memchunk_isset(pa_memchunk *c); #endif diff --git a/src/pulsecore/memtrap.c b/src/pulsecore/memtrap.c index 4236934ea..87ea4fe6c 100644 --- a/src/pulsecore/memtrap.c +++ b/src/pulsecore/memtrap.c @@ -61,7 +61,7 @@ static void allocate_aupdate(void) { } PA_ONCE_END; } -pa_bool_t pa_memtrap_is_good(pa_memtrap *m) { +bool pa_memtrap_is_good(pa_memtrap *m) { pa_assert(m); return !pa_atomic_load(&m->bad); @@ -150,7 +150,7 @@ pa_memtrap* pa_memtrap_add(const void *start, size_t size) { allocate_aupdate(); - mx = pa_static_mutex_get(&mutex, FALSE, TRUE); + mx = pa_static_mutex_get(&mutex, false, true); pa_mutex_lock(mx); j = pa_aupdate_write_begin(aupdate); @@ -172,7 +172,7 @@ void pa_memtrap_remove(pa_memtrap *m) { allocate_aupdate(); - mx = pa_static_mutex_get(&mutex, FALSE, TRUE); + mx = pa_static_mutex_get(&mutex, false, true); pa_mutex_lock(mx); j = pa_aupdate_write_begin(aupdate); @@ -200,7 +200,7 @@ pa_memtrap *pa_memtrap_update(pa_memtrap *m, const void *start, size_t size) { allocate_aupdate(); - mx = pa_static_mutex_get(&mutex, FALSE, TRUE); + mx = pa_static_mutex_get(&mutex, false, true); pa_mutex_lock(mx); j = pa_aupdate_write_begin(aupdate); diff --git a/src/pulsecore/memtrap.h b/src/pulsecore/memtrap.h index fa38da58d..9af30e917 100644 --- a/src/pulsecore/memtrap.h +++ b/src/pulsecore/memtrap.h @@ -44,7 +44,7 @@ pa_memtrap *pa_memtrap_update(pa_memtrap *m, const void *start, size_t size); void pa_memtrap_remove(pa_memtrap *m); -pa_bool_t pa_memtrap_is_good(pa_memtrap *m); +bool pa_memtrap_is_good(pa_memtrap *m); void pa_memtrap_install(void); diff --git a/src/pulsecore/mime-type.c b/src/pulsecore/mime-type.c index 09ce00b46..60e42e78d 100644 --- a/src/pulsecore/mime-type.c +++ b/src/pulsecore/mime-type.c @@ -28,7 +28,7 @@ #include "mime-type.h" -pa_bool_t pa_sample_spec_is_mime(const pa_sample_spec *ss, const pa_channel_map *cm) { +bool pa_sample_spec_is_mime(const pa_sample_spec *ss, const pa_channel_map *cm) { pa_assert(pa_channel_map_compatible(cm, ss)); @@ -45,33 +45,33 @@ pa_bool_t pa_sample_spec_is_mime(const pa_sample_spec *ss, const pa_channel_map ss->rate != 32000 && ss->rate != 44100 && ss->rate != 48000) - return FALSE; + return false; if (ss->channels != 1 && ss->channels != 2) - return FALSE; + return false; if ((cm->channels == 1 && cm->map[0] != PA_CHANNEL_POSITION_MONO) || (cm->channels == 2 && (cm->map[0] != PA_CHANNEL_POSITION_LEFT || cm->map[1] != PA_CHANNEL_POSITION_RIGHT))) - return FALSE; + return false; - return TRUE; + return true; case PA_SAMPLE_ULAW: if (ss->rate != 8000) - return FALSE; + return false; if (ss->channels != 1) - return FALSE; + return false; if (cm->map[0] != PA_CHANNEL_POSITION_MONO) - return FALSE; + return false; - return TRUE; + return true; default: - return FALSE; + return false; } } diff --git a/src/pulsecore/mime-type.h b/src/pulsecore/mime-type.h index 0a1d8925b..789d7c25b 100644 --- a/src/pulsecore/mime-type.h +++ b/src/pulsecore/mime-type.h @@ -25,7 +25,7 @@ #include <pulse/sample.h> #include <pulse/channelmap.h> -pa_bool_t pa_sample_spec_is_mime(const pa_sample_spec *ss, const pa_channel_map *cm); +bool pa_sample_spec_is_mime(const pa_sample_spec *ss, const pa_channel_map *cm); void pa_sample_spec_mimefy(pa_sample_spec *ss, pa_channel_map *cm); char *pa_sample_spec_to_mime_type(const pa_sample_spec *ss, const pa_channel_map *cm); char *pa_sample_spec_to_mime_type_mimefy(const pa_sample_spec *_ss, const pa_channel_map *_cm); diff --git a/src/pulsecore/mix.c b/src/pulsecore/mix.c index 6ff6831ac..4520d063a 100644 --- a/src/pulsecore/mix.c +++ b/src/pulsecore/mix.c @@ -616,7 +616,7 @@ size_t pa_mix( size_t length, const pa_sample_spec *spec, const pa_cvolume *volume, - pa_bool_t mute) { + bool mute) { pa_cvolume full_volume; unsigned k; diff --git a/src/pulsecore/mix.h b/src/pulsecore/mix.h index e90652a9d..a4cde01e7 100644 --- a/src/pulsecore/mix.h +++ b/src/pulsecore/mix.h @@ -49,7 +49,7 @@ size_t pa_mix( size_t length, const pa_sample_spec *spec, const pa_cvolume *volume, - pa_bool_t mute); + bool mute); typedef void (*pa_do_mix_func_t) (pa_mix_info streams[], unsigned nstreams, unsigned channels, void *data, unsigned length); diff --git a/src/pulsecore/modargs.c b/src/pulsecore/modargs.c index d48a2c8e1..09ca9fc9e 100644 --- a/src/pulsecore/modargs.c +++ b/src/pulsecore/modargs.c @@ -317,7 +317,7 @@ int pa_modargs_get_value_s32(pa_modargs *ma, const char *key, int32_t *value) { return 0; } -int pa_modargs_get_value_boolean(pa_modargs *ma, const char *key, pa_bool_t *value) { +int pa_modargs_get_value_boolean(pa_modargs *ma, const char *key, bool *value) { const char *v; int r; diff --git a/src/pulsecore/modargs.h b/src/pulsecore/modargs.h index c1345ea24..95be54d8f 100644 --- a/src/pulsecore/modargs.h +++ b/src/pulsecore/modargs.h @@ -44,7 +44,7 @@ const char *pa_modargs_get_value(pa_modargs *ma, const char *key, const char *de /* Return a module argument as unsigned 32bit value in *value */ int pa_modargs_get_value_u32(pa_modargs *ma, const char *key, uint32_t *value); int pa_modargs_get_value_s32(pa_modargs *ma, const char *key, int32_t *value); -int pa_modargs_get_value_boolean(pa_modargs *ma, const char *key, pa_bool_t *value); +int pa_modargs_get_value_boolean(pa_modargs *ma, const char *key, bool *value); /* Return a module argument as double value in *value */ int pa_modargs_get_value_double(pa_modargs *ma, const char *key, double *value); diff --git a/src/pulsecore/modinfo.c b/src/pulsecore/modinfo.c index 860b80641..73dd3b6e7 100644 --- a/src/pulsecore/modinfo.c +++ b/src/pulsecore/modinfo.c @@ -43,7 +43,7 @@ pa_modinfo *pa_modinfo_get_by_handle(lt_dlhandle dl, const char *module_name) { pa_modinfo *i; const char* (*func)(void); - pa_bool_t (*func2) (void); + bool (*func2) (void); pa_assert(dl); @@ -64,7 +64,7 @@ pa_modinfo *pa_modinfo_get_by_handle(lt_dlhandle dl, const char *module_name) { if ((func = (const char* (*)(void)) pa_load_sym(dl, module_name, PA_SYMBOL_DEPRECATED))) i->deprecated = pa_xstrdup(func()); - if ((func2 = (pa_bool_t (*)(void)) pa_load_sym(dl, module_name, PA_SYMBOL_LOAD_ONCE))) + if ((func2 = (bool (*)(void)) pa_load_sym(dl, module_name, PA_SYMBOL_LOAD_ONCE))) i->load_once = func2(); return i; diff --git a/src/pulsecore/modinfo.h b/src/pulsecore/modinfo.h index baad0de70..f02a04c36 100644 --- a/src/pulsecore/modinfo.h +++ b/src/pulsecore/modinfo.h @@ -31,7 +31,7 @@ typedef struct pa_modinfo { char *usage; char *version; char *deprecated; - pa_bool_t load_once; + bool load_once; } pa_modinfo; /* Read meta data from an libtool handle */ diff --git a/src/pulsecore/module.c b/src/pulsecore/module.c index f30a3ce93..396096942 100644 --- a/src/pulsecore/module.c +++ b/src/pulsecore/module.c @@ -49,7 +49,7 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) { pa_module *m = NULL; - pa_bool_t (*load_once)(void); + bool (*load_once)(void); const char* (*get_deprecated)(void); pa_modinfo *mi; @@ -62,7 +62,7 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) { m = pa_xnew(pa_module, 1); m->name = pa_xstrdup(name); m->argument = pa_xstrdup(argument); - m->load_once = FALSE; + m->load_once = false; m->proplist = pa_proplist_new(); m->index = PA_IDXSET_INVALID; @@ -77,7 +77,7 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) { goto fail; } - if ((load_once = (pa_bool_t (*)(void)) pa_load_sym(m->dl, name, PA_SYMBOL_LOAD_ONCE))) { + if ((load_once = (bool (*)(void)) pa_load_sym(m->dl, name, PA_SYMBOL_LOAD_ONCE))) { m->load_once = load_once(); @@ -111,7 +111,7 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) { m->get_n_used = (int (*)(pa_module*_m)) pa_load_sym(m->dl, name, PA_SYMBOL_GET_N_USED); m->userdata = NULL; m->core = c; - m->unload_requested = FALSE; + m->unload_requested = false; pa_assert_se(pa_idxset_put(c->modules, m, &m->index) >= 0); pa_assert(m->index != PA_IDXSET_INVALID); @@ -185,7 +185,7 @@ static void pa_module_free(pa_module *m) { pa_xfree(m); } -void pa_module_unload(pa_core *c, pa_module *m, pa_bool_t force) { +void pa_module_unload(pa_core *c, pa_module *m, bool force) { pa_assert(c); pa_assert(m); @@ -198,7 +198,7 @@ void pa_module_unload(pa_core *c, pa_module *m, pa_bool_t force) { pa_module_free(m); } -void pa_module_unload_by_index(pa_core *c, uint32_t idx, pa_bool_t force) { +void pa_module_unload_by_index(pa_core *c, uint32_t idx, bool force) { pa_module *m; pa_assert(c); pa_assert(idx != PA_IDXSET_INVALID); @@ -254,16 +254,16 @@ static void defer_cb(pa_mainloop_api*api, pa_defer_event *e, void *userdata) { while ((m = pa_idxset_iterate(c->modules, &state, NULL))) if (m->unload_requested) - pa_module_unload(c, m, TRUE); + pa_module_unload(c, m, true); } -void pa_module_unload_request(pa_module *m, pa_bool_t force) { +void pa_module_unload_request(pa_module *m, bool force) { pa_assert(m); if (m->core->disallow_module_loading && !force) return; - m->unload_requested = TRUE; + m->unload_requested = true; if (!m->core->module_defer_unload_event) m->core->module_defer_unload_event = m->core->mainloop->defer_new(m->core->mainloop, defer_cb, m->core); @@ -271,7 +271,7 @@ void pa_module_unload_request(pa_module *m, pa_bool_t force) { m->core->mainloop->defer_enable(m->core->module_defer_unload_event, 1); } -void pa_module_unload_request_by_index(pa_core *c, uint32_t idx, pa_bool_t force) { +void pa_module_unload_request_by_index(pa_core *c, uint32_t idx, bool force) { pa_module *m; pa_assert(c); diff --git a/src/pulsecore/module.h b/src/pulsecore/module.h index 0b6cb7c4c..ad4571e08 100644 --- a/src/pulsecore/module.h +++ b/src/pulsecore/module.h @@ -44,19 +44,19 @@ struct pa_module { void *userdata; - pa_bool_t load_once:1; - pa_bool_t unload_requested:1; + bool load_once:1; + bool unload_requested:1; pa_proplist *proplist; }; pa_module* pa_module_load(pa_core *c, const char *name, const char*argument); -void pa_module_unload(pa_core *c, pa_module *m, pa_bool_t force); -void pa_module_unload_by_index(pa_core *c, uint32_t idx, pa_bool_t force); +void pa_module_unload(pa_core *c, pa_module *m, bool force); +void pa_module_unload_by_index(pa_core *c, uint32_t idx, bool force); -void pa_module_unload_request(pa_module *m, pa_bool_t force); -void pa_module_unload_request_by_index(pa_core *c, uint32_t idx, pa_bool_t force); +void pa_module_unload_request(pa_module *m, bool force); +void pa_module_unload_request_by_index(pa_core *c, uint32_t idx, bool force); void pa_module_unload_all(pa_core *c); @@ -85,7 +85,7 @@ void pa_module_update_proplist(pa_module *m, pa_update_mode_t mode, pa_proplist struct __stupid_useless_struct_to_allow_trailing_semicolon #define PA_MODULE_LOAD_ONCE(b) \ - pa_bool_t pa__load_once(void) { return b; } \ + bool pa__load_once(void) { return b; } \ struct __stupid_useless_struct_to_allow_trailing_semicolon #endif diff --git a/src/pulsecore/msgobject.c b/src/pulsecore/msgobject.c index b55ba8bf3..d7927c82f 100644 --- a/src/pulsecore/msgobject.c +++ b/src/pulsecore/msgobject.c @@ -28,7 +28,7 @@ PA_DEFINE_PUBLIC_CLASS(pa_msgobject, pa_object); -pa_msgobject *pa_msgobject_new_internal(size_t size, const char *type_id, pa_bool_t (*check_type)(const char *type_name)) { +pa_msgobject *pa_msgobject_new_internal(size_t size, const char *type_id, bool (*check_type)(const char *type_name)) { pa_msgobject *o; pa_assert(size >= sizeof(pa_msgobject)); diff --git a/src/pulsecore/msgobject.h b/src/pulsecore/msgobject.h index 9b5712b45..163c7d71c 100644 --- a/src/pulsecore/msgobject.h +++ b/src/pulsecore/msgobject.h @@ -36,7 +36,7 @@ struct pa_msgobject { int (*process_msg)(pa_msgobject *o, int code, void *userdata, int64_t offset, pa_memchunk *chunk); }; -pa_msgobject *pa_msgobject_new_internal(size_t size, const char *type_id, pa_bool_t (*check_type)(const char *type_name)); +pa_msgobject *pa_msgobject_new_internal(size_t size, const char *type_id, bool (*check_type)(const char *type_name)); #define pa_msgobject_new(type) ((type*) pa_msgobject_new_internal(sizeof(type), type##_type_id, type##_check_type)) #define pa_msgobject_free ((void (*) (pa_msgobject* o)) pa_object_free) diff --git a/src/pulsecore/mutex-posix.c b/src/pulsecore/mutex-posix.c index d90525bf3..74c5768a8 100644 --- a/src/pulsecore/mutex-posix.c +++ b/src/pulsecore/mutex-posix.c @@ -39,7 +39,7 @@ struct pa_cond { pthread_cond_t cond; }; -pa_mutex* pa_mutex_new(pa_bool_t recursive, pa_bool_t inherit_priority) { +pa_mutex* pa_mutex_new(bool recursive, bool inherit_priority) { pa_mutex *m; pthread_mutexattr_t attr; int r; @@ -90,16 +90,16 @@ void pa_mutex_lock(pa_mutex *m) { pa_assert_se(pthread_mutex_lock(&m->mutex) == 0); } -pa_bool_t pa_mutex_try_lock(pa_mutex *m) { +bool pa_mutex_try_lock(pa_mutex *m) { int r; pa_assert(m); if ((r = pthread_mutex_trylock(&m->mutex)) != 0) { pa_assert(r == EBUSY); - return FALSE; + return false; } - return TRUE; + return true; } void pa_mutex_unlock(pa_mutex *m) { @@ -139,7 +139,7 @@ int pa_cond_wait(pa_cond *c, pa_mutex *m) { return pthread_cond_wait(&c->cond, &m->mutex); } -pa_mutex* pa_static_mutex_get(pa_static_mutex *s, pa_bool_t recursive, pa_bool_t inherit_priority) { +pa_mutex* pa_static_mutex_get(pa_static_mutex *s, bool recursive, bool inherit_priority) { pa_mutex *m; pa_assert(s); diff --git a/src/pulsecore/mutex-win32.c b/src/pulsecore/mutex-win32.c index e70f230ac..978101caf 100644 --- a/src/pulsecore/mutex-win32.c +++ b/src/pulsecore/mutex-win32.c @@ -38,7 +38,7 @@ struct pa_cond { pa_hashmap *wait_events; }; -pa_mutex* pa_mutex_new(pa_bool_t recursive, pa_bool_t inherit_priority) { +pa_mutex* pa_mutex_new(bool recursive, bool inherit_priority) { pa_mutex *m; m = pa_xnew(pa_mutex, 1); @@ -114,7 +114,7 @@ int pa_cond_wait(pa_cond *c, pa_mutex *m) { assert(c); assert(m); - event = CreateEvent(NULL, FALSE, FALSE, NULL); + event = CreateEvent(NULL, false, false, NULL); assert(event); pa_hashmap_put(c->wait_events, event, event); @@ -133,7 +133,7 @@ int pa_cond_wait(pa_cond *c, pa_mutex *m) { } /* This is a copy of the function in mutex-posix.c */ -pa_mutex* pa_static_mutex_get(pa_static_mutex *s, pa_bool_t recursive, pa_bool_t inherit_priority) { +pa_mutex* pa_static_mutex_get(pa_static_mutex *s, bool recursive, bool inherit_priority) { pa_mutex *m; pa_assert(s); diff --git a/src/pulsecore/mutex.h b/src/pulsecore/mutex.h index fd6939f4e..e3d4ec7ad 100644 --- a/src/pulsecore/mutex.h +++ b/src/pulsecore/mutex.h @@ -32,11 +32,11 @@ typedef struct pa_mutex pa_mutex; * good candidates for it. Don't use this blindly! Also, note that * only very few operating systems actually implement this, hence this * is merely a hint. */ -pa_mutex* pa_mutex_new(pa_bool_t recursive, pa_bool_t inherit_priority); +pa_mutex* pa_mutex_new(bool recursive, bool inherit_priority); void pa_mutex_free(pa_mutex *m); void pa_mutex_lock(pa_mutex *m); -pa_bool_t pa_mutex_try_lock(pa_mutex *m); +bool pa_mutex_try_lock(pa_mutex *m); void pa_mutex_unlock(pa_mutex *m); typedef struct pa_cond pa_cond; @@ -54,6 +54,6 @@ typedef struct pa_static_mutex { #define PA_STATIC_MUTEX_INIT { PA_ATOMIC_PTR_INIT(NULL) } -pa_mutex* pa_static_mutex_get(pa_static_mutex *m, pa_bool_t recursive, pa_bool_t inherit_priority); +pa_mutex* pa_static_mutex_get(pa_static_mutex *m, bool recursive, bool inherit_priority); #endif diff --git a/src/pulsecore/namereg.c b/src/pulsecore/namereg.c index 334e00d35..7704abe49 100644 --- a/src/pulsecore/namereg.c +++ b/src/pulsecore/namereg.c @@ -44,7 +44,7 @@ struct namereg_entry { void *data; }; -static pa_bool_t is_valid_char(char c) { +static bool is_valid_char(char c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || @@ -54,41 +54,41 @@ static pa_bool_t is_valid_char(char c) { c == '_'; } -pa_bool_t pa_namereg_is_valid_name(const char *name) { +bool pa_namereg_is_valid_name(const char *name) { const char *c; pa_assert(name); if (*name == 0) - return FALSE; + return false; for (c = name; *c && (c-name < PA_NAME_MAX); c++) if (!is_valid_char(*c)) - return FALSE; + return false; if (*c) - return FALSE; + return false; - return TRUE; + return true; } -pa_bool_t pa_namereg_is_valid_name_or_wildcard(const char *name, pa_namereg_type_t type) { +bool pa_namereg_is_valid_name_or_wildcard(const char *name, pa_namereg_type_t type) { pa_assert(name); if (pa_namereg_is_valid_name(name)) - return TRUE; + return true; if (type == PA_NAMEREG_SINK && pa_streq(name, "@DEFAULT_SINK@")) - return TRUE; + return true; if (type == PA_NAMEREG_SOURCE && (pa_streq(name, "@DEFAULT_SOURCE@") || pa_streq(name, "@DEFAULT_MONITOR@"))) - return TRUE; + return true; - return FALSE; + return false; } char* pa_namereg_make_valid_name(const char *name) { @@ -108,7 +108,7 @@ char* pa_namereg_make_valid_name(const char *name) { return n; } -const char *pa_namereg_register(pa_core *c, const char *name, pa_namereg_type_t type, void *data, pa_bool_t fail) { +const char *pa_namereg_register(pa_core *c, const char *name, pa_namereg_type_t type, void *data, bool fail) { struct namereg_entry *e; char *n = NULL; diff --git a/src/pulsecore/namereg.h b/src/pulsecore/namereg.h index b5a976d7c..afb3532a8 100644 --- a/src/pulsecore/namereg.h +++ b/src/pulsecore/namereg.h @@ -34,7 +34,7 @@ typedef enum pa_namereg_type { PA_NAMEREG_CARD } pa_namereg_type_t; -const char *pa_namereg_register(pa_core *c, const char *name, pa_namereg_type_t type, void *data, pa_bool_t fail); +const char *pa_namereg_register(pa_core *c, const char *name, pa_namereg_type_t type, void *data, bool fail); void pa_namereg_unregister(pa_core *c, const char *name); void* pa_namereg_get(pa_core *c, const char *name, pa_namereg_type_t type); @@ -44,8 +44,8 @@ pa_source* pa_namereg_set_default_source(pa_core*c, pa_source *s); pa_sink *pa_namereg_get_default_sink(pa_core *c); pa_source *pa_namereg_get_default_source(pa_core *c); -pa_bool_t pa_namereg_is_valid_name(const char *name); -pa_bool_t pa_namereg_is_valid_name_or_wildcard(const char *name, pa_namereg_type_t type); +bool pa_namereg_is_valid_name(const char *name); +bool pa_namereg_is_valid_name_or_wildcard(const char *name, pa_namereg_type_t type); char* pa_namereg_make_valid_name(const char *name); #endif diff --git a/src/pulsecore/object.c b/src/pulsecore/object.c index b6fbe908b..bc1aaf701 100644 --- a/src/pulsecore/object.c +++ b/src/pulsecore/object.c @@ -28,7 +28,7 @@ const char pa_object_type_id[] = "pa_object"; -pa_object *pa_object_new_internal(size_t size, const char *type_id, pa_bool_t (*check_type)(const char *type_id)) { +pa_object *pa_object_new_internal(size_t size, const char *type_id, bool (*check_type)(const char *type_id)) { pa_object *o; pa_assert(size > sizeof(pa_object)); @@ -65,7 +65,7 @@ void pa_object_unref(pa_object *o) { } } -pa_bool_t pa_object_check_type(const char *type_id) { +bool pa_object_check_type(const char *type_id) { pa_assert(type_id); return type_id == pa_object_type_id; diff --git a/src/pulsecore/object.h b/src/pulsecore/object.h index c60577140..65f5ee696 100644 --- a/src/pulsecore/object.h +++ b/src/pulsecore/object.h @@ -35,21 +35,21 @@ struct pa_object { PA_REFCNT_DECLARE; const char *type_id; void (*free)(pa_object *o); - pa_bool_t (*check_type)(const char *type_name); + bool (*check_type)(const char *type_name); }; -pa_object *pa_object_new_internal(size_t size, const char *type_id, pa_bool_t (*check_type)(const char *type_id)); +pa_object *pa_object_new_internal(size_t size, const char *type_id, bool (*check_type)(const char *type_id)); #define pa_object_new(type) ((type*) pa_object_new_internal(sizeof(type), type##_type_id, type##_check_type) #define pa_object_free ((void (*) (pa_object* _obj)) pa_xfree) -pa_bool_t pa_object_check_type(const char *type_id); +bool pa_object_check_type(const char *type_id); extern const char pa_object_type_id[]; -static inline pa_bool_t pa_object_isinstance(void *o) { +static inline bool pa_object_isinstance(void *o) { pa_object *obj = (pa_object*) o; - return obj ? obj->check_type(pa_object_type_id) : TRUE; + return obj ? obj->check_type(pa_object_type_id) : true; } pa_object *pa_object_ref(pa_object *o); @@ -70,9 +70,9 @@ static inline pa_object* pa_object_cast(void *o) { #define PA_OBJECT(o) pa_object_cast(o) #define PA_DECLARE_CLASS_COMMON(c) \ - static inline pa_bool_t c##_isinstance(void *o) { \ + static inline bool c##_isinstance(void *o) { \ pa_object *obj = (pa_object*) o; \ - return obj ? obj->check_type(c##_type_id) : TRUE; \ + return obj ? obj->check_type(c##_type_id) : true; \ } \ static inline c* c##_cast(void *o) { \ pa_assert(c##_isinstance(o)); \ @@ -95,13 +95,13 @@ static inline pa_object* pa_object_cast(void *o) { #define PA_DECLARE_PUBLIC_CLASS(c) \ extern const char c##_type_id[]; \ PA_DECLARE_CLASS_COMMON(c); \ - pa_bool_t c##_check_type(const char *type_id) + bool c##_check_type(const char *type_id) #define PA_DEFINE_PUBLIC_CLASS(c, parent) \ const char c##_type_id[] = #c; \ - pa_bool_t c##_check_type(const char *type_id) { \ + bool c##_check_type(const char *type_id) { \ if (type_id == c##_type_id) \ - return TRUE; \ + return true; \ return parent##_check_type(type_id); \ } \ struct __stupid_useless_struct_to_allow_trailing_semicolon @@ -109,9 +109,9 @@ static inline pa_object* pa_object_cast(void *o) { #define PA_DEFINE_PRIVATE_CLASS(c, parent) \ static const char c##_type_id[] = #c; \ PA_DECLARE_CLASS_COMMON(c); \ - static pa_bool_t c##_check_type(const char *type_id) { \ + static bool c##_check_type(const char *type_id) { \ if (type_id == c##_type_id) \ - return TRUE; \ + return true; \ return parent##_check_type(type_id); \ } \ struct __stupid_useless_struct_to_allow_trailing_semicolon diff --git a/src/pulsecore/once.c b/src/pulsecore/once.c index 30b35a6c3..16059c34c 100644 --- a/src/pulsecore/once.c +++ b/src/pulsecore/once.c @@ -30,27 +30,27 @@ /* See http://www.hpl.hp.com/research/linux/atomic_ops/example.php4 for the * reference algorithm used here. */ -pa_bool_t pa_once_begin(pa_once *control) { +bool pa_once_begin(pa_once *control) { pa_mutex *m; pa_assert(control); if (pa_atomic_load(&control->done)) - return FALSE; + return false; /* Caveat: We have to make sure that the once func has completed * before returning, even if the once func is not actually * executed by us. Hence the awkward locking. */ - m = pa_static_mutex_get(&control->mutex, FALSE, FALSE); + m = pa_static_mutex_get(&control->mutex, false, false); pa_mutex_lock(m); if (pa_atomic_load(&control->done)) { pa_mutex_unlock(m); - return FALSE; + return false; } - return TRUE; + return true; } void pa_once_end(pa_once *control) { @@ -61,7 +61,7 @@ void pa_once_end(pa_once *control) { pa_assert(!pa_atomic_load(&control->done)); pa_atomic_store(&control->done, 1); - m = pa_static_mutex_get(&control->mutex, FALSE, FALSE); + m = pa_static_mutex_get(&control->mutex, false, false); pa_mutex_unlock(m); } diff --git a/src/pulsecore/once.h b/src/pulsecore/once.h index a478d1ff2..460a70029 100644 --- a/src/pulsecore/once.h +++ b/src/pulsecore/once.h @@ -37,7 +37,7 @@ typedef struct pa_once { } /* Not to be called directly, use the macros defined below instead */ -pa_bool_t pa_once_begin(pa_once *o); +bool pa_once_begin(pa_once *o); void pa_once_end(pa_once *o); #define PA_ONCE_BEGIN \ diff --git a/src/pulsecore/parseaddr.c b/src/pulsecore/parseaddr.c index 7ec068a40..d31e68cbc 100644 --- a/src/pulsecore/parseaddr.c +++ b/src/pulsecore/parseaddr.c @@ -132,16 +132,16 @@ int pa_parse_address(const char *name, pa_parsed_address *ret_p) { return 0; } -pa_bool_t pa_is_ip_address(const char *a) { +bool pa_is_ip_address(const char *a) { char buf[INET6_ADDRSTRLEN]; pa_assert(a); if (inet_pton(AF_INET6, a, buf) >= 1) - return TRUE; + return true; if (inet_pton(AF_INET, a, buf) >= 1) - return TRUE; + return true; - return FALSE; + return false; } diff --git a/src/pulsecore/parseaddr.h b/src/pulsecore/parseaddr.h index a1071b0ab..9c9745bc8 100644 --- a/src/pulsecore/parseaddr.h +++ b/src/pulsecore/parseaddr.h @@ -41,6 +41,6 @@ typedef struct pa_parsed_address { int pa_parse_address(const char *a, pa_parsed_address *ret_p); -pa_bool_t pa_is_ip_address(const char *a); +bool pa_is_ip_address(const char *a); #endif diff --git a/src/pulsecore/pdispatch.c b/src/pulsecore/pdispatch.c index 9a9ef4e10..d76ba3ba7 100644 --- a/src/pulsecore/pdispatch.c +++ b/src/pulsecore/pdispatch.c @@ -215,7 +215,7 @@ struct pa_pdispatch { pa_pdispatch_drain_cb_t drain_callback; void *drain_userdata; const pa_creds *creds; - pa_bool_t use_rtclock; + bool use_rtclock; }; static void reply_info_free(struct reply_info *r) { @@ -232,7 +232,7 @@ static void reply_info_free(struct reply_info *r) { pa_xfree(r); } -pa_pdispatch* pa_pdispatch_new(pa_mainloop_api *mainloop, pa_bool_t use_rtclock, const pa_pdispatch_cb_t *table, unsigned entries) { +pa_pdispatch* pa_pdispatch_new(pa_mainloop_api *mainloop, bool use_rtclock, const pa_pdispatch_cb_t *table, unsigned entries) { pa_pdispatch *pd; pa_assert(mainloop); diff --git a/src/pulsecore/pdispatch.h b/src/pulsecore/pdispatch.h index c5431c2ec..797ddcacf 100644 --- a/src/pulsecore/pdispatch.h +++ b/src/pulsecore/pdispatch.h @@ -37,7 +37,7 @@ typedef struct pa_pdispatch pa_pdispatch; typedef void (*pa_pdispatch_cb_t)(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata); typedef void (*pa_pdispatch_drain_cb_t)(pa_pdispatch *pd, void *userdata); -pa_pdispatch* pa_pdispatch_new(pa_mainloop_api *m, pa_bool_t use_rtclock, const pa_pdispatch_cb_t *table, unsigned entries); +pa_pdispatch* pa_pdispatch_new(pa_mainloop_api *m, bool use_rtclock, const pa_pdispatch_cb_t *table, unsigned entries); void pa_pdispatch_unref(pa_pdispatch *pd); pa_pdispatch* pa_pdispatch_ref(pa_pdispatch *pd); diff --git a/src/pulsecore/pid.c b/src/pulsecore/pid.c index 588349b6f..e347884ad 100644 --- a/src/pulsecore/pid.c +++ b/src/pulsecore/pid.c @@ -147,7 +147,7 @@ static int proc_name_ours(pid_t pid, const char *procname) { return -1; } else { char *expected; - pa_bool_t good; + bool good; char stored[64]; if (!(fgets(stored, sizeof(stored), f))) { @@ -208,7 +208,7 @@ int pa_pid_file_create(const char *procname) { int ours = 1; #ifdef OS_IS_WIN32 - if ((process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid)) != NULL) { + if ((process = OpenProcess(PROCESS_QUERY_INFORMATION, false, pid)) != NULL) { CloseHandle(process); #else if (kill(pid, 0) >= 0 || errno != ESRCH) { diff --git a/src/pulsecore/play-memblockq.c b/src/pulsecore/play-memblockq.c index 2ce92e50d..ff0c52b26 100644 --- a/src/pulsecore/play-memblockq.c +++ b/src/pulsecore/play-memblockq.c @@ -105,7 +105,7 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s * we are heard right-away. */ if (PA_SINK_INPUT_IS_LINKED(state) && i->thread_info.state == PA_SINK_INPUT_INIT) - pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); + pa_sink_input_request_rewind(i, 0, false, true, true); } static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk) { @@ -199,7 +199,7 @@ pa_sink_input* pa_memblockq_sink_input_new( u->memblockq = NULL; pa_sink_input_new_data_init(&data); - pa_sink_input_new_data_set_sink(&data, sink, FALSE); + pa_sink_input_new_data_set_sink(&data, sink, false); data.driver = __FILE__; pa_sink_input_new_data_set_sample_spec(&data, ss); pa_sink_input_new_data_set_channel_map(&data, map); diff --git a/src/pulsecore/proplist-util.c b/src/pulsecore/proplist-util.c index f4474310b..473290f4f 100644 --- a/src/pulsecore/proplist-util.c +++ b/src/pulsecore/proplist-util.c @@ -121,14 +121,14 @@ void pa_init_proplist(pa_proplist *p) { if (pa_startswith(*e, "PULSE_PROP_")) { size_t kl, skip; char *k; - pa_bool_t override; + bool override; if (pa_startswith(*e, "PULSE_PROP_OVERRIDE_")) { skip = 20; - override = TRUE; + override = true; } else { skip = 11; - override = FALSE; + override = false; } kl = strcspn(*e+skip, "="); diff --git a/src/pulsecore/protocol-dbus.c b/src/pulsecore/protocol-dbus.c index 17ad902e4..0ff4d8395 100644 --- a/src/pulsecore/protocol-dbus.c +++ b/src/pulsecore/protocol-dbus.c @@ -57,15 +57,15 @@ struct connection_entry { DBusConnection *connection; pa_client *client; - pa_bool_t listening_for_all_signals; + bool listening_for_all_signals; /* Contains object paths. If this is empty, then signals from all objects - * are accepted. Only used when listening_for_all_signals == TRUE. */ + * are accepted. Only used when listening_for_all_signals == true. */ pa_idxset *all_signals_objects; /* Signal name -> signal paths entry. The entries contain object paths. If * a path set is empty, then that signal is accepted from all objects. This - * variable is only used when listening_for_all_signals == FALSE. */ + * variable is only used when listening_for_all_signals == false. */ pa_hashmap *listening_signals; }; @@ -730,7 +730,7 @@ int pa_dbus_protocol_add_interface(pa_dbus_protocol *p, void *userdata) { struct object_entry *obj_entry; struct interface_entry *iface_entry; - pa_bool_t obj_entry_created = FALSE; + bool obj_entry_created = false; pa_assert(p); pa_assert(path); @@ -748,7 +748,7 @@ int pa_dbus_protocol_add_interface(pa_dbus_protocol *p, obj_entry->introspection = NULL; pa_hashmap_put(p->objects, obj_entry->path, obj_entry); - obj_entry_created = TRUE; + obj_entry_created = true; } if (pa_hashmap_get(obj_entry->interfaces, info->name) != NULL) @@ -895,7 +895,7 @@ int pa_dbus_protocol_register_connection(pa_dbus_protocol *p, DBusConnection *co conn_entry = pa_xnew(struct connection_entry, 1); conn_entry->connection = dbus_connection_ref(conn); conn_entry->client = client; - conn_entry->listening_for_all_signals = FALSE; + conn_entry->listening_for_all_signals = false; conn_entry->all_signals_objects = pa_idxset_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); conn_entry->listening_signals = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); @@ -984,11 +984,11 @@ void pa_dbus_protocol_add_signal_listener( /* all_signals_objects will either be emptied or replaced with new objects, * so we empty it here unconditionally. If listening_for_all_signals is - * currently FALSE, the idxset is empty already so this does nothing. */ + * currently false, the idxset is empty already so this does nothing. */ pa_idxset_remove_all(conn_entry->all_signals_objects, pa_xfree); if (signal_name) { - conn_entry->listening_for_all_signals = FALSE; + conn_entry->listening_for_all_signals = false; /* Replace the old signal paths entry for this signal with a new * one. */ @@ -1002,7 +1002,7 @@ void pa_dbus_protocol_add_signal_listener( pa_hashmap_put(conn_entry->listening_signals, signal_paths_entry->signal, signal_paths_entry); } else { - conn_entry->listening_for_all_signals = TRUE; + conn_entry->listening_for_all_signals = true; /* We're not interested in individual signals anymore, so let's empty * listening_signals. */ @@ -1027,7 +1027,7 @@ void pa_dbus_protocol_remove_signal_listener(pa_dbus_protocol *p, DBusConnection signal_paths_entry_free(signal_paths_entry); } else { - conn_entry->listening_for_all_signals = FALSE; + conn_entry->listening_for_all_signals = false; pa_idxset_remove_all(conn_entry->all_signals_objects, pa_xfree); pa_hashmap_remove_all(conn_entry->listening_signals, (pa_free_cb_t) signal_paths_entry_free); } diff --git a/src/pulsecore/protocol-esound.c b/src/pulsecore/protocol-esound.c index 9509604eb..7c1b7a210 100644 --- a/src/pulsecore/protocol-esound.c +++ b/src/pulsecore/protocol-esound.c @@ -82,12 +82,12 @@ typedef struct connection { pa_msgobject parent; uint32_t index; - pa_bool_t dead; + bool dead; pa_esound_protocol *protocol; pa_esound_options *options; pa_iochannel *io; pa_client *client; - pa_bool_t authorized, swap_byte_order; + bool authorized, swap_byte_order; void *write_data; size_t write_data_alloc, write_data_index, write_data_length; void *read_data; @@ -105,7 +105,7 @@ typedef struct connection { pa_memblock *current_memblock; size_t memblock_index; pa_atomic_t missing; - pa_bool_t underrun; + bool underrun; } playback; struct { @@ -306,7 +306,7 @@ static void connection_write(connection *c, const void *data, size_t length) { memcpy((uint8_t*) c->write_data + i, data, length); } -static void format_esd2native(int format, pa_bool_t swap_bytes, pa_sample_spec *ss) { +static void format_esd2native(int format, bool swap_bytes, pa_sample_spec *ss) { pa_assert(ss); ss->channels = (uint8_t) (((format & ESD_MASK_CHAN) == ESD_STEREO) ? 2 : 1); @@ -347,7 +347,7 @@ static int esd_proto_connect(connection *c, esd_proto_t request, const void *dat if ((key = pa_auth_cookie_read(c->options->auth_cookie, ESD_KEY_LEN))) if (memcmp(data, key, ESD_KEY_LEN) == 0) - c->authorized = TRUE; + c->authorized = true; } if (!c->authorized) { @@ -364,9 +364,9 @@ static int esd_proto_connect(connection *c, esd_proto_t request, const void *dat memcpy(&ekey, data, sizeof(uint32_t)); if (ekey == ESD_ENDIAN_KEY) - c->swap_byte_order = FALSE; + c->swap_byte_order = false; else if (ekey == ESD_SWAP_ENDIAN_KEY) - c->swap_byte_order = TRUE; + c->swap_byte_order = true; else { pa_log_warn("Client sent invalid endian key"); return -1; @@ -425,7 +425,7 @@ static int esd_proto_stream_play(connection *c, esd_proto_t request, const void sdata.module = c->options->module; sdata.client = c->client; if (sink) - pa_sink_input_new_data_set_sink(&sdata, sink, FALSE); + pa_sink_input_new_data_set_sink(&sdata, sink, false); pa_sink_input_new_data_set_sample_spec(&sdata, &ss); pa_sink_input_new(&c->sink_input, c->protocol->core, &sdata); @@ -525,7 +525,7 @@ static int esd_proto_stream_record(connection *c, esd_proto_t request, const voi sdata.module = c->options->module; sdata.client = c->client; if (source) - pa_source_output_new_data_set_source(&sdata, source, FALSE); + pa_source_output_new_data_set_source(&sdata, source, false); pa_source_output_new_data_set_sample_spec(&sdata, &ss); pa_source_output_new(&c->source_output, c->protocol->core, &sdata); @@ -643,7 +643,7 @@ static int esd_proto_all_info(connection *c, esd_proto_t request, const void *da if (conn->sink_input) { pa_cvolume volume; - pa_sink_input_get_volume(conn->sink_input, &volume, TRUE); + pa_sink_input_get_volume(conn->sink_input, &volume, true); rate = (int32_t) conn->sink_input->sample_spec.rate; lvolume = (int32_t) ((volume.values[0]*ESD_VOLUME_BASE)/PA_VOLUME_NORM); rvolume = (int32_t) ((volume.values[volume.channels == 2 ? 1 : 0]*ESD_VOLUME_BASE)/PA_VOLUME_NORM); @@ -783,7 +783,7 @@ static int esd_proto_stream_pan(connection *c, esd_proto_t request, const void * volume.values[1] = (rvolume*PA_VOLUME_NORM)/ESD_VOLUME_BASE; volume.channels = conn->sink_input->sample_spec.channels; - pa_sink_input_set_volume(conn->sink_input, &volume, TRUE, TRUE); + pa_sink_input_set_volume(conn->sink_input, &volume, true, true); ok = 1; } else ok = 0; @@ -823,7 +823,7 @@ static int esd_proto_sample_pan(connection *c, esd_proto_t request, const void * pa_cvolume_remap(&volume, &stereo, &ce->channel_map); ce->volume = volume; - ce->volume_is_set = TRUE; + ce->volume_is_set = true; ok = 1; } @@ -1266,7 +1266,7 @@ static void do_work(connection *c) { fail: if (c->state == ESD_STREAMING_DATA && c->sink_input) { - c->dead = TRUE; + c->dead = true; pa_iochannel_free(c->io); c->io = NULL; @@ -1341,7 +1341,7 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int if (pa_memblockq_is_readable(c->input_memblockq) && c->playback.underrun) { pa_log_debug("Requesting rewind due to end of underrun."); - pa_sink_input_request_rewind(c->sink_input, 0, FALSE, TRUE, FALSE); + pa_sink_input_request_rewind(c->sink_input, 0, false, true, false); } /* pa_log("got data, %u", pa_memblockq_get_length(c->input_memblockq)); */ @@ -1378,7 +1378,7 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t length, pa_memchunk *chunk if (pa_memblockq_peek(c->input_memblockq, chunk) < 0) { - c->playback.underrun = TRUE; + c->playback.underrun = true; if (c->dead && pa_sink_input_safe_to_remove(i)) pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(c), CONNECTION_MESSAGE_UNLINK_CONNECTION, NULL, 0, NULL, NULL); @@ -1387,7 +1387,7 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t length, pa_memchunk *chunk } else { size_t m; - c->playback.underrun = FALSE; + c->playback.underrun = false; chunk->length = PA_MIN(length, chunk->length); pa_memblockq_drop(c->input_memblockq, chunk->length); @@ -1516,9 +1516,9 @@ void pa_esound_protocol_connect(pa_esound_protocol *p, pa_iochannel *io, pa_esou c->client->userdata = c; c->options = pa_esound_options_ref(o); - c->authorized = FALSE; - c->swap_byte_order = FALSE; - c->dead = FALSE; + c->authorized = false; + c->swap_byte_order = false; + c->dead = false; c->read_data_length = 0; c->read_data = pa_xmalloc(c->read_data_alloc = proto_map[ESD_PROTO_CONNECT].data_length); @@ -1537,7 +1537,7 @@ void pa_esound_protocol_connect(pa_esound_protocol *p, pa_iochannel *io, pa_esou c->playback.current_memblock = NULL; c->playback.memblock_index = 0; - c->playback.underrun = TRUE; + c->playback.underrun = true; pa_atomic_store(&c->playback.missing, 0); pa_memchunk_reset(&c->scache.memchunk); @@ -1547,7 +1547,7 @@ void pa_esound_protocol_connect(pa_esound_protocol *p, pa_iochannel *io, pa_esou if (o->auth_anonymous) { pa_log_info("Client authenticated anonymously."); - c->authorized = TRUE; + c->authorized = true; } if (!c->authorized && @@ -1555,7 +1555,7 @@ void pa_esound_protocol_connect(pa_esound_protocol *p, pa_iochannel *io, pa_esou pa_ip_acl_check(o->auth_ip_acl, pa_iochannel_get_recv_fd(io)) > 0) { pa_log_info("Client authenticated by IP ACL."); - c->authorized = TRUE; + c->authorized = true; } if (!c->authorized) @@ -1671,7 +1671,7 @@ void pa_esound_options_unref(pa_esound_options *o) { } int pa_esound_options_parse(pa_esound_options *o, pa_core *c, pa_modargs *ma) { - pa_bool_t enabled; + bool enabled; const char *acl; pa_assert(o); @@ -1697,7 +1697,7 @@ int pa_esound_options_parse(pa_esound_options *o, pa_core *c, pa_modargs *ma) { o->auth_ip_acl = ipa; } - enabled = TRUE; + enabled = true; if (pa_modargs_get_value_boolean(ma, "auth-cookie-enabled", &enabled) < 0) { pa_log("auth-cookie-enabled= expects a boolean argument."); return -1; @@ -1715,7 +1715,7 @@ int pa_esound_options_parse(pa_esound_options *o, pa_core *c, pa_modargs *ma) { if (!(cn = pa_modargs_get_value(ma, "cookie", NULL))) cn = DEFAULT_COOKIE_FILE; - if (!(o->auth_cookie = pa_auth_cookie_get(c, cn, TRUE, ESD_KEY_LEN))) + if (!(o->auth_cookie = pa_auth_cookie_get(c, cn, true, ESD_KEY_LEN))) return -1; } else diff --git a/src/pulsecore/protocol-esound.h b/src/pulsecore/protocol-esound.h index 63a29ce8d..e4b65e742 100644 --- a/src/pulsecore/protocol-esound.h +++ b/src/pulsecore/protocol-esound.h @@ -37,7 +37,7 @@ typedef struct pa_esound_options { pa_module *module; - pa_bool_t auth_anonymous; + bool auth_anonymous; pa_ip_acl *auth_ip_acl; pa_auth_cookie *auth_cookie; diff --git a/src/pulsecore/protocol-http.c b/src/pulsecore/protocol-http.c index 7d49bf822..ced03a107 100644 --- a/src/pulsecore/protocol-http.c +++ b/src/pulsecore/protocol-http.c @@ -561,7 +561,7 @@ static void handle_listen_prefix(struct connection *c, const char *source_name) data.driver = __FILE__; data.module = c->module; data.client = c->client; - pa_source_output_new_data_set_source(&data, source, FALSE); + pa_source_output_new_data_set_source(&data, source, false); pa_proplist_update(data.proplist, PA_UPDATE_MERGE, c->client->proplist); pa_source_output_new_data_set_sample_spec(&data, &ss); pa_source_output_new_data_set_channel_map(&data, &cm); diff --git a/src/pulsecore/protocol-native.c b/src/pulsecore/protocol-native.c index 1fa2b382e..ba5aabc1e 100644 --- a/src/pulsecore/protocol-native.c +++ b/src/pulsecore/protocol-native.c @@ -84,8 +84,8 @@ typedef struct record_stream { pa_source_output *source_output; pa_memblockq *memblockq; - pa_bool_t adjust_latency:1; - pa_bool_t early_requests:1; + bool adjust_latency:1; + bool early_requests:1; /* Requested buffer attributes */ pa_buffer_attr buffer_attr_req; @@ -121,11 +121,11 @@ typedef struct playback_stream { pa_sink_input *sink_input; pa_memblockq *memblockq; - pa_bool_t adjust_latency:1; - pa_bool_t early_requests:1; + bool adjust_latency:1; + bool early_requests:1; - pa_bool_t is_underrun:1; - pa_bool_t drain_request:1; + bool is_underrun:1; + bool drain_request:1; uint32_t drain_tag; uint32_t syncid; @@ -171,8 +171,8 @@ struct pa_native_connection { pa_msgobject parent; pa_native_protocol *protocol; pa_native_options *options; - pa_bool_t authorized:1; - pa_bool_t is_local:1; + bool authorized:1; + bool is_local:1; uint32_t version; pa_client *client; pa_pstream *pstream; @@ -234,7 +234,7 @@ enum { static bool sink_input_process_underrun_cb(pa_sink_input *i); static int sink_input_pop_cb(pa_sink_input *i, size_t length, pa_memchunk *chunk); static void sink_input_kill_cb(pa_sink_input *i); -static void sink_input_suspend_cb(pa_sink_input *i, pa_bool_t suspend); +static void sink_input_suspend_cb(pa_sink_input *i, bool suspend); static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest); static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes); static void sink_input_update_max_rewind_cb(pa_sink_input *i, size_t nbytes); @@ -246,7 +246,7 @@ static void playback_stream_request_bytes(struct playback_stream*s); static void source_output_kill_cb(pa_source_output *o); static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk); -static void source_output_suspend_cb(pa_source_output *o, pa_bool_t suspend); +static void source_output_suspend_cb(pa_source_output *o, bool suspend); static void source_output_moving_cb(pa_source_output *o, pa_source *dest); static pa_usec_t source_output_get_latency_cb(pa_source_output *o); static void source_output_send_event_cb(pa_source_output *o, const char *event, pa_proplist *pl); @@ -638,14 +638,14 @@ static record_stream* record_stream_new( pa_idxset *formats, pa_buffer_attr *attr, pa_cvolume *volume, - pa_bool_t muted, - pa_bool_t muted_set, + bool muted, + bool muted_set, pa_source_output_flags_t flags, pa_proplist *p, - pa_bool_t adjust_latency, - pa_bool_t early_requests, - pa_bool_t relative_volume, - pa_bool_t peak_detect, + bool adjust_latency, + bool early_requests, + bool relative_volume, + bool peak_detect, pa_sink_input *direct_on_input, int *ret) { @@ -666,7 +666,7 @@ static record_stream* record_stream_new( data.module = c->options->module; data.client = c->client; if (source) - pa_source_output_new_data_set_source(&data, source, FALSE); + pa_source_output_new_data_set_source(&data, source, false); if (pa_sample_spec_valid(ss)) pa_source_output_new_data_set_sample_spec(&data, ss); if (pa_channel_map_valid(map)) @@ -677,11 +677,11 @@ static record_stream* record_stream_new( if (volume) { pa_source_output_new_data_set_volume(&data, volume); data.volume_is_absolute = !relative_volume; - data.save_volume = FALSE; + data.save_volume = false; } if (muted_set) { pa_source_output_new_data_set_muted(&data, muted); - data.save_muted = FALSE; + data.save_muted = false; } if (peak_detect) data.resample_method = PA_RESAMPLER_PEAKS; @@ -1077,13 +1077,13 @@ static playback_stream* playback_stream_new( pa_idxset *formats, pa_buffer_attr *a, pa_cvolume *volume, - pa_bool_t muted, - pa_bool_t muted_set, + bool muted, + bool muted_set, pa_sink_input_flags_t flags, pa_proplist *p, - pa_bool_t adjust_latency, - pa_bool_t early_requests, - pa_bool_t relative_volume, + bool adjust_latency, + bool early_requests, + bool relative_volume, uint32_t syncid, uint32_t *missing, int *ret) { @@ -1134,7 +1134,7 @@ static playback_stream* playback_stream_new( data.module = c->options->module; data.client = c->client; if (sink) - pa_sink_input_new_data_set_sink(&data, sink, FALSE); + pa_sink_input_new_data_set_sink(&data, sink, false); if (pa_sample_spec_valid(ss)) pa_sink_input_new_data_set_sample_spec(&data, ss); if (pa_channel_map_valid(map)) @@ -1147,11 +1147,11 @@ static playback_stream* playback_stream_new( if (volume) { pa_sink_input_new_data_set_volume(&data, volume); data.volume_is_absolute = !relative_volume; - data.save_volume = FALSE; + data.save_volume = false; } if (muted_set) { pa_sink_input_new_data_set_muted(&data, muted); - data.save_muted = FALSE; + data.save_muted = false; } data.sync_base = ssync ? ssync->sink_input : NULL; data.flags = flags; @@ -1169,8 +1169,8 @@ static playback_stream* playback_stream_new( s->connection = c; s->syncid = syncid; s->sink_input = sink_input; - s->is_underrun = TRUE; - s->drain_request = FALSE; + s->is_underrun = true; + s->drain_request = false; pa_atomic_store(&s->missing, 0); s->buffer_attr_req = *a; s->adjust_latency = adjust_latency; @@ -1414,7 +1414,7 @@ static void handle_seek(playback_stream *s, int64_t indexw) { pa_sink_input_request_rewind(s->sink_input, (size_t) (s->sink_input->thread_info.underrun_for == (uint64_t) -1 ? 0 : s->sink_input->thread_info.underrun_for), - FALSE, TRUE, FALSE); + false, true, false); } } else { @@ -1427,7 +1427,7 @@ static void handle_seek(playback_stream *s, int64_t indexw) { * let's have it ask us again */ pa_log_debug("Requesting rewind due to rewrite."); - pa_sink_input_request_rewind(s->sink_input, (size_t) (indexr - indexw), TRUE, FALSE, FALSE); + pa_sink_input_request_rewind(s->sink_input, (size_t) (indexr - indexw), true, false, false); } } @@ -1435,7 +1435,7 @@ static void handle_seek(playback_stream *s, int64_t indexw) { } static void flush_write_no_account(pa_memblockq *q) { - pa_memblockq_flush_write(q, FALSE); + pa_memblockq_flush_write(q, false); } /* Called from thread context */ @@ -1466,7 +1466,7 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int if (pa_log_ratelimit(PA_LOG_WARN)) pa_log_warn("Failed to push data into queue"); pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(s), PLAYBACK_STREAM_MESSAGE_OVERFLOW, NULL, 0, NULL, NULL); - pa_memblockq_seek(s->memblockq, (int64_t) chunk->length, PA_SEEK_RELATIVE, TRUE); + pa_memblockq_seek(s->memblockq, (int64_t) chunk->length, PA_SEEK_RELATIVE, true); } /* If more data is in queue, we rewind later instead. */ @@ -1532,7 +1532,7 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(s), PLAYBACK_STREAM_MESSAGE_DRAIN_ACK, userdata, 0, NULL, NULL); else { s->drain_tag = PA_PTR_TO_UINT(userdata); - s->drain_request = TRUE; + s->drain_request = true; } } @@ -1742,7 +1742,7 @@ static void sink_input_send_event_cb(pa_sink_input *i, const char *event, pa_pro } /* Called from main context */ -static void sink_input_suspend_cb(pa_sink_input *i, pa_bool_t suspend) { +static void sink_input_suspend_cb(pa_sink_input *i, bool suspend) { playback_stream *s; pa_tagstruct *t; @@ -1880,7 +1880,7 @@ static void source_output_send_event_cb(pa_source_output *o, const char *event, } /* Called from main context */ -static void source_output_suspend_cb(pa_source_output *o, pa_bool_t suspend) { +static void source_output_suspend_cb(pa_source_output *o, bool suspend) { record_stream *s; pa_tagstruct *t; @@ -1977,24 +1977,24 @@ static void command_create_playback_stream(pa_pdispatch *pd, uint32_t command, u pa_tagstruct *reply; pa_sink *sink = NULL; pa_cvolume volume; - pa_bool_t - corked = FALSE, - no_remap = FALSE, - no_remix = FALSE, - fix_format = FALSE, - fix_rate = FALSE, - fix_channels = FALSE, - no_move = FALSE, - variable_rate = FALSE, - muted = FALSE, - adjust_latency = FALSE, - early_requests = FALSE, - dont_inhibit_auto_suspend = FALSE, - volume_set = TRUE, - muted_set = FALSE, - fail_on_suspend = FALSE, - relative_volume = FALSE, - passthrough = FALSE; + bool + corked = false, + no_remap = false, + no_remix = false, + fix_format = false, + fix_rate = false, + fix_channels = false, + no_move = false, + variable_rate = false, + muted = false, + adjust_latency = false, + early_requests = false, + dont_inhibit_auto_suspend = false, + volume_set = true, + muted_set = false, + fail_on_suspend = false, + relative_volume = false, + passthrough = false; pa_sink_input_flags_t flags = 0; pa_proplist *p = NULL; @@ -2302,25 +2302,25 @@ static void command_create_record_stream(pa_pdispatch *pd, uint32_t command, uin pa_tagstruct *reply; pa_source *source = NULL; pa_cvolume volume; - pa_bool_t - corked = FALSE, - no_remap = FALSE, - no_remix = FALSE, - fix_format = FALSE, - fix_rate = FALSE, - fix_channels = FALSE, - no_move = FALSE, - variable_rate = FALSE, - muted = FALSE, - adjust_latency = FALSE, - peak_detect = FALSE, - early_requests = FALSE, - dont_inhibit_auto_suspend = FALSE, - volume_set = FALSE, - muted_set = FALSE, - fail_on_suspend = FALSE, - relative_volume = FALSE, - passthrough = FALSE; + bool + corked = false, + no_remap = false, + no_remix = false, + fix_format = false, + fix_rate = false, + fix_channels = false, + no_move = false, + variable_rate = false, + muted = false, + adjust_latency = false, + peak_detect = false, + early_requests = false, + dont_inhibit_auto_suspend = false, + volume_set = false, + muted_set = false, + fail_on_suspend = false, + relative_volume = false, + passthrough = false; pa_source_output_flags_t flags = 0; pa_proplist *p = NULL; @@ -2409,7 +2409,7 @@ static void command_create_record_stream(pa_pdispatch *pd, uint32_t command, uin if (c->version >= 22) { /* For newer client versions (with per-source-output volumes), we try * to make the behaviour for playback and record streams the same. */ - volume_set = TRUE; + volume_set = true; if (pa_tagstruct_getu8(t, &n_formats) < 0) { protocol_error(c); @@ -2560,7 +2560,7 @@ static void command_exit(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta } CHECK_VALIDITY(c->pstream, c->authorized, tag, PA_ERR_ACCESS); - ret = pa_core_exit(c->protocol->core, FALSE, 0); + ret = pa_core_exit(c->protocol->core, false, 0); CHECK_VALIDITY(c->pstream, ret >= 0, tag, PA_ERR_ACCESS); pa_log_debug("Client %s asks us to terminate.", pa_strnull(pa_proplist_gets(c->client->proplist, PA_PROP_APPLICATION_PROCESS_BINARY))); @@ -2572,7 +2572,7 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta pa_native_connection *c = PA_NATIVE_CONNECTION(userdata); const void*cookie; pa_tagstruct *reply; - pa_bool_t shm_on_remote = FALSE, do_shm; + bool shm_on_remote = false, do_shm; pa_native_connection_assert_ref(c); pa_assert(t); @@ -2603,14 +2603,14 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta pa_proplist_setf(c->client->proplist, "native-protocol.version", "%u", c->version); if (!c->authorized) { - pa_bool_t success = FALSE; + bool success = false; #ifdef HAVE_CREDS const pa_creds *creds; if ((creds = pa_pdispatch_creds(pd))) { if (creds->uid == getuid()) - success = TRUE; + success = true; else if (c->options->auth_group) { int r; gid_t gid; @@ -2618,13 +2618,13 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta if ((gid = pa_get_gid_of_group(c->options->auth_group)) == (gid_t) -1) pa_log_warn("Failed to get GID of group '%s'", c->options->auth_group); else if (gid == creds->gid) - success = TRUE; + success = true; if (!success) { if ((r = pa_uid_in_group(creds->uid, c->options->auth_group)) < 0) pa_log_warn("Failed to check group membership."); else if (r > 0) - success = TRUE; + success = true; } } @@ -2640,7 +2640,7 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta if ((ac = pa_auth_cookie_read(c->options->auth_cookie, PA_NATIVE_COOKIE_LENGTH))) if (memcmp(ac, cookie, PA_NATIVE_COOKIE_LENGTH) == 0) - success = TRUE; + success = true; } if (!success) { @@ -2649,7 +2649,7 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta return; } - c->authorized = TRUE; + c->authorized = true; if (c->auth_timeout_event) { c->protocol->core->mainloop->time_free(c->auth_timeout_event); c->auth_timeout_event = NULL; @@ -2665,7 +2665,7 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta if (do_shm) if (c->version < 10 || (c->version >= 13 && !shm_on_remote)) - do_shm = FALSE; + do_shm = false; #ifdef HAVE_CREDS if (do_shm) { @@ -2675,7 +2675,7 @@ static void command_auth(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_ta const pa_creds *creds; if (!(creds = pa_pdispatch_creds(pd)) || getuid() != creds->uid) - do_shm = FALSE; + do_shm = false; } #endif @@ -2957,7 +2957,7 @@ static void command_create_upload_stream(pa_pdispatch *pd, uint32_t command, uin if (!name || !pa_namereg_is_valid_name(name)) { pa_proplist_free(p); - CHECK_VALIDITY(c->pstream, FALSE, tag, PA_ERR_INVALID); + CHECK_VALIDITY(c->pstream, false, tag, PA_ERR_INVALID); } s = upload_stream_new(c, &ss, &map, name, length, p); @@ -3129,8 +3129,8 @@ static void sink_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_sin PA_TAG_SAMPLE_SPEC, &fixed_ss, PA_TAG_CHANNEL_MAP, &sink->channel_map, PA_TAG_U32, sink->module ? sink->module->index : PA_INVALID_INDEX, - PA_TAG_CVOLUME, pa_sink_get_volume(sink, FALSE), - PA_TAG_BOOLEAN, pa_sink_get_mute(sink, FALSE), + PA_TAG_CVOLUME, pa_sink_get_volume(sink, false), + PA_TAG_BOOLEAN, pa_sink_get_mute(sink, false), PA_TAG_U32, sink->monitor_source ? sink->monitor_source->index : PA_INVALID_INDEX, PA_TAG_STRING, sink->monitor_source ? sink->monitor_source->name : NULL, PA_TAG_USEC, pa_sink_get_latency(sink), @@ -3199,8 +3199,8 @@ static void source_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_s PA_TAG_SAMPLE_SPEC, &fixed_ss, PA_TAG_CHANNEL_MAP, &source->channel_map, PA_TAG_U32, source->module ? source->module->index : PA_INVALID_INDEX, - PA_TAG_CVOLUME, pa_source_get_volume(source, FALSE), - PA_TAG_BOOLEAN, pa_source_get_mute(source, FALSE), + PA_TAG_CVOLUME, pa_source_get_volume(source, false), + PA_TAG_BOOLEAN, pa_source_get_mute(source, false), PA_TAG_U32, source->monitor_of ? source->monitor_of->index : PA_INVALID_INDEX, PA_TAG_STRING, source->monitor_of ? source->monitor_of->name : NULL, PA_TAG_USEC, pa_source_get_latency(source), @@ -3327,7 +3327,7 @@ static void module_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_m pa_tagstruct_putu32(t, (uint32_t) pa_module_get_n_used(module)); if (c->version < 15) - pa_tagstruct_put_boolean(t, FALSE); /* autoload is obsolete */ + pa_tagstruct_put_boolean(t, false); /* autoload is obsolete */ if (c->version >= 15) pa_tagstruct_put_proplist(t, module->proplist); @@ -3337,7 +3337,7 @@ static void sink_input_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, pa_sample_spec fixed_ss; pa_usec_t sink_latency; pa_cvolume v; - pa_bool_t has_volume = FALSE; + bool has_volume = false; pa_assert(t); pa_sink_input_assert_ref(s); @@ -3346,7 +3346,7 @@ static void sink_input_fill_tagstruct(pa_native_connection *c, pa_tagstruct *t, has_volume = pa_sink_input_is_volume_readable(s); if (has_volume) - pa_sink_input_get_volume(s, &v, TRUE); + pa_sink_input_get_volume(s, &v, true); else pa_cvolume_reset(&v, fixed_ss.channels); @@ -3380,7 +3380,7 @@ static void source_output_fill_tagstruct(pa_native_connection *c, pa_tagstruct * pa_sample_spec fixed_ss; pa_usec_t source_latency; pa_cvolume v; - pa_bool_t has_volume = FALSE; + bool has_volume = false; pa_assert(t); pa_source_output_assert_ref(s); @@ -3389,7 +3389,7 @@ static void source_output_fill_tagstruct(pa_native_connection *c, pa_tagstruct * has_volume = pa_source_output_is_volume_readable(s); if (has_volume) - pa_source_output_get_volume(s, &v, TRUE); + pa_source_output_get_volume(s, &v, true); else pa_cvolume_reset(&v, fixed_ss.channels); @@ -3770,12 +3770,12 @@ static void command_set_volume( CHECK_VALIDITY(c->pstream, volume.channels == 1 || pa_cvolume_compatible(&volume, &sink->sample_spec), tag, PA_ERR_INVALID); pa_log_debug("Client %s changes volume of sink %s.", client_name, sink->name); - pa_sink_set_volume(sink, &volume, TRUE, TRUE); + pa_sink_set_volume(sink, &volume, true, true); } else if (source) { CHECK_VALIDITY(c->pstream, volume.channels == 1 || pa_cvolume_compatible(&volume, &source->sample_spec), tag, PA_ERR_INVALID); pa_log_debug("Client %s changes volume of source %s.", client_name, source->name); - pa_source_set_volume(source, &volume, TRUE, TRUE); + pa_source_set_volume(source, &volume, true, true); } else if (si) { CHECK_VALIDITY(c->pstream, si->volume_writable, tag, PA_ERR_BADSTATE); CHECK_VALIDITY(c->pstream, volume.channels == 1 || pa_cvolume_compatible(&volume, &si->sample_spec), tag, PA_ERR_INVALID); @@ -3783,14 +3783,14 @@ static void command_set_volume( pa_log_debug("Client %s changes volume of sink input %s.", client_name, pa_strnull(pa_proplist_gets(si->proplist, PA_PROP_MEDIA_NAME))); - pa_sink_input_set_volume(si, &volume, TRUE, TRUE); + pa_sink_input_set_volume(si, &volume, true, true); } else if (so) { CHECK_VALIDITY(c->pstream, volume.channels == 1 || pa_cvolume_compatible(&volume, &so->sample_spec), tag, PA_ERR_INVALID); pa_log_debug("Client %s changes volume of source output %s.", client_name, pa_strnull(pa_proplist_gets(so->proplist, PA_PROP_MEDIA_NAME))); - pa_source_output_set_volume(so, &volume, TRUE, TRUE); + pa_source_output_set_volume(so, &volume, true, true); } pa_pstream_send_simple_ack(c->pstream, tag); @@ -3805,7 +3805,7 @@ static void command_set_mute( pa_native_connection *c = PA_NATIVE_CONNECTION(userdata); uint32_t idx; - pa_bool_t mute; + bool mute; pa_sink *sink = NULL; pa_source *source = NULL; pa_sink_input *si = NULL; @@ -3866,20 +3866,20 @@ static void command_set_mute( if (sink) { pa_log_debug("Client %s changes mute of sink %s.", client_name, sink->name); - pa_sink_set_mute(sink, mute, TRUE); + pa_sink_set_mute(sink, mute, true); } else if (source) { pa_log_debug("Client %s changes mute of source %s.", client_name, source->name); - pa_source_set_mute(source, mute, TRUE); + pa_source_set_mute(source, mute, true); } else if (si) { pa_log_debug("Client %s changes mute of sink input %s.", client_name, pa_strnull(pa_proplist_gets(si->proplist, PA_PROP_MEDIA_NAME))); - pa_sink_input_set_mute(si, mute, TRUE); + pa_sink_input_set_mute(si, mute, true); } else if (so) { pa_log_debug("Client %s changes mute of source output %s.", client_name, pa_strnull(pa_proplist_gets(so->proplist, PA_PROP_MEDIA_NAME))); - pa_source_output_set_mute(so, mute, TRUE); + pa_source_output_set_mute(so, mute, true); } pa_pstream_send_simple_ack(c->pstream, tag); @@ -3888,7 +3888,7 @@ static void command_set_mute( static void command_cork_playback_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) { pa_native_connection *c = PA_NATIVE_CONNECTION(userdata); uint32_t idx; - pa_bool_t b; + bool b; playback_stream *s; pa_native_connection_assert_ref(c); @@ -3910,7 +3910,7 @@ static void command_cork_playback_stream(pa_pdispatch *pd, uint32_t command, uin pa_sink_input_cork(s->sink_input, b); if (b) - s->is_underrun = TRUE; + s->is_underrun = true; pa_pstream_send_simple_ack(c->pstream, tag); } @@ -3959,7 +3959,7 @@ static void command_cork_record_stream(pa_pdispatch *pd, uint32_t command, uint3 pa_native_connection *c = PA_NATIVE_CONNECTION(userdata); uint32_t idx; record_stream *s; - pa_bool_t b; + bool b; pa_native_connection_assert_ref(c); pa_assert(t); @@ -4022,7 +4022,7 @@ static void command_set_stream_buffer_attr(pa_pdispatch *pd, uint32_t command, u if (command == PA_COMMAND_SET_PLAYBACK_STREAM_BUFFER_ATTR) { playback_stream *s; - pa_bool_t adjust_latency = FALSE, early_requests = FALSE; + bool adjust_latency = false, early_requests = false; s = pa_idxset_get_by_index(c->output_streams, idx); CHECK_VALIDITY(c->pstream, s, tag, PA_ERR_NOENTITY); @@ -4060,7 +4060,7 @@ static void command_set_stream_buffer_attr(pa_pdispatch *pd, uint32_t command, u } else { record_stream *s; - pa_bool_t adjust_latency = FALSE, early_requests = FALSE; + bool adjust_latency = false, early_requests = false; pa_assert(command == PA_COMMAND_SET_RECORD_STREAM_BUFFER_ATTR); s = pa_idxset_get_by_index(c->record_streams, idx); @@ -4175,7 +4175,7 @@ static void command_update_proplist(pa_pdispatch *pd, uint32_t command, uint32_t if (!(mode == PA_UPDATE_SET || mode == PA_UPDATE_MERGE || mode == PA_UPDATE_REPLACE)) { pa_proplist_free(p); - CHECK_VALIDITY(c->pstream, FALSE, tag, PA_ERR_INVALID); + CHECK_VALIDITY(c->pstream, false, tag, PA_ERR_INVALID); } if (command == PA_COMMAND_UPDATE_PLAYBACK_STREAM_PROPLIST) { @@ -4184,7 +4184,7 @@ static void command_update_proplist(pa_pdispatch *pd, uint32_t command, uint32_t s = pa_idxset_get_by_index(c->output_streams, idx); if (!s || !playback_stream_isinstance(s)) { pa_proplist_free(p); - CHECK_VALIDITY(c->pstream, FALSE, tag, PA_ERR_NOENTITY); + CHECK_VALIDITY(c->pstream, false, tag, PA_ERR_NOENTITY); } pa_sink_input_update_proplist(s->sink_input, mode, p); @@ -4193,7 +4193,7 @@ static void command_update_proplist(pa_pdispatch *pd, uint32_t command, uint32_t if (!(s = pa_idxset_get_by_index(c->record_streams, idx))) { pa_proplist_free(p); - CHECK_VALIDITY(c->pstream, FALSE, tag, PA_ERR_NOENTITY); + CHECK_VALIDITY(c->pstream, false, tag, PA_ERR_NOENTITY); } pa_source_output_update_proplist(s->source_output, mode, p); @@ -4476,7 +4476,7 @@ static void command_unload_module(pa_pdispatch *pd, uint32_t command, uint32_t t m = pa_idxset_get_by_index(c->protocol->core->modules, idx); CHECK_VALIDITY(c->pstream, m, tag, PA_ERR_NOENTITY); - pa_module_unload_request(m, FALSE); + pa_module_unload_request(m, false); pa_pstream_send_simple_ack(c->pstream, tag); } @@ -4517,7 +4517,7 @@ static void command_move_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag CHECK_VALIDITY(c->pstream, si && sink, tag, PA_ERR_NOENTITY); - if (pa_sink_input_move_to(si, sink, TRUE) < 0) { + if (pa_sink_input_move_to(si, sink, true) < 0) { pa_pstream_send_error(c->pstream, tag, PA_ERR_INVALID); return; } @@ -4536,7 +4536,7 @@ static void command_move_stream(pa_pdispatch *pd, uint32_t command, uint32_t tag CHECK_VALIDITY(c->pstream, so && source, tag, PA_ERR_NOENTITY); - if (pa_source_output_move_to(so, source, TRUE) < 0) { + if (pa_source_output_move_to(so, source, true) < 0) { pa_pstream_send_error(c->pstream, tag, PA_ERR_INVALID); return; } @@ -4549,7 +4549,7 @@ static void command_suspend(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa pa_native_connection *c = PA_NATIVE_CONNECTION(userdata); uint32_t idx = PA_INVALID_INDEX; const char *name = NULL; - pa_bool_t b; + bool b; pa_native_connection_assert_ref(c); pa_assert(t); @@ -4702,7 +4702,7 @@ static void command_set_card_profile(pa_pdispatch *pd, uint32_t command, uint32_ CHECK_VALIDITY(c->pstream, card, tag, PA_ERR_NOENTITY); - if ((ret = pa_card_set_profile(card, profile, TRUE)) < 0) { + if ((ret = pa_card_set_profile(card, profile, true)) < 0) { pa_pstream_send_error(c->pstream, tag, -ret); return; } @@ -4742,7 +4742,7 @@ static void command_set_sink_or_source_port(pa_pdispatch *pd, uint32_t command, CHECK_VALIDITY(c->pstream, sink, tag, PA_ERR_NOENTITY); - if ((ret = pa_sink_set_port(sink, port, TRUE)) < 0) { + if ((ret = pa_sink_set_port(sink, port, true)) < 0) { pa_pstream_send_error(c->pstream, tag, -ret); return; } @@ -4758,7 +4758,7 @@ static void command_set_sink_or_source_port(pa_pdispatch *pd, uint32_t command, CHECK_VALIDITY(c->pstream, source, tag, PA_ERR_NOENTITY); - if ((ret = pa_source_set_port(source, port, TRUE)) < 0) { + if ((ret = pa_source_set_port(source, port, true)) < 0) { pa_pstream_send_error(c->pstream, tag, -ret); return; } @@ -5009,11 +5009,11 @@ void pa_native_protocol_connect(pa_native_protocol *p, pa_iochannel *io, pa_nati c->parent.process_msg = native_connection_process_msg; c->protocol = p; c->options = pa_native_options_ref(o); - c->authorized = FALSE; + c->authorized = false; if (o->auth_anonymous) { pa_log_info("Client authenticated anonymously."); - c->authorized = TRUE; + c->authorized = true; } if (!c->authorized && @@ -5021,7 +5021,7 @@ void pa_native_protocol_connect(pa_native_protocol *p, pa_iochannel *io, pa_nati pa_ip_acl_check(o->auth_ip_acl, pa_iochannel_get_recv_fd(io)) > 0) { pa_log_info("Client authenticated by IP ACL."); - c->authorized = TRUE; + c->authorized = true; } if (!c->authorized) @@ -5045,7 +5045,7 @@ void pa_native_protocol_connect(pa_native_protocol *p, pa_iochannel *io, pa_nati pa_pstream_set_revoke_callback(c->pstream, pstream_revoke_callback, c); pa_pstream_set_release_callback(c->pstream, pstream_release_callback, c); - c->pdispatch = pa_pdispatch_new(p->core->mainloop, TRUE, command_table, PA_COMMAND_MAX); + c->pdispatch = pa_pdispatch_new(p->core->mainloop, true, command_table, PA_COMMAND_MAX); c->record_streams = pa_idxset_new(NULL, NULL); c->output_streams = pa_idxset_new(NULL, NULL); @@ -5233,7 +5233,7 @@ void pa_native_options_unref(pa_native_options *o) { } int pa_native_options_parse(pa_native_options *o, pa_core *c, pa_modargs *ma) { - pa_bool_t enabled; + bool enabled; const char *acl; pa_assert(o); @@ -5245,7 +5245,7 @@ int pa_native_options_parse(pa_native_options *o, pa_core *c, pa_modargs *ma) { return -1; } - enabled = TRUE; + enabled = true; if (pa_modargs_get_value_boolean(ma, "auth-group-enable", &enabled) < 0) { pa_log("auth-group-enable= expects a boolean argument."); return -1; @@ -5273,7 +5273,7 @@ int pa_native_options_parse(pa_native_options *o, pa_core *c, pa_modargs *ma) { o->auth_ip_acl = ipa; } - enabled = TRUE; + enabled = true; if (pa_modargs_get_value_boolean(ma, "auth-cookie-enabled", &enabled) < 0) { pa_log("auth-cookie-enabled= expects a boolean argument."); return -1; @@ -5292,14 +5292,14 @@ int pa_native_options_parse(pa_native_options *o, pa_core *c, pa_modargs *ma) { cn = pa_modargs_get_value(ma, "cookie", NULL); if (cn) - o->auth_cookie = pa_auth_cookie_get(c, cn, TRUE, PA_NATIVE_COOKIE_LENGTH); + o->auth_cookie = pa_auth_cookie_get(c, cn, true, PA_NATIVE_COOKIE_LENGTH); else { - o->auth_cookie = pa_auth_cookie_get(c, PA_NATIVE_COOKIE_FILE, FALSE, PA_NATIVE_COOKIE_LENGTH); + o->auth_cookie = pa_auth_cookie_get(c, PA_NATIVE_COOKIE_FILE, false, PA_NATIVE_COOKIE_LENGTH); if (!o->auth_cookie) { - o->auth_cookie = pa_auth_cookie_get(c, PA_NATIVE_COOKIE_FILE_FALLBACK, FALSE, PA_NATIVE_COOKIE_LENGTH); + o->auth_cookie = pa_auth_cookie_get(c, PA_NATIVE_COOKIE_FILE_FALLBACK, false, PA_NATIVE_COOKIE_LENGTH); if (!o->auth_cookie) - o->auth_cookie = pa_auth_cookie_get(c, PA_NATIVE_COOKIE_FILE, TRUE, PA_NATIVE_COOKIE_LENGTH); + o->auth_cookie = pa_auth_cookie_get(c, PA_NATIVE_COOKIE_FILE, true, PA_NATIVE_COOKIE_LENGTH); } } diff --git a/src/pulsecore/protocol-native.h b/src/pulsecore/protocol-native.h index 971262742..30b99f918 100644 --- a/src/pulsecore/protocol-native.h +++ b/src/pulsecore/protocol-native.h @@ -43,7 +43,7 @@ typedef struct pa_native_options { pa_module *module; - pa_bool_t auth_anonymous; + bool auth_anonymous; char *auth_group; pa_ip_acl *auth_ip_acl; pa_auth_cookie *auth_cookie; diff --git a/src/pulsecore/protocol-simple.c b/src/pulsecore/protocol-simple.c index 14eb5663f..fc36880e1 100644 --- a/src/pulsecore/protocol-simple.c +++ b/src/pulsecore/protocol-simple.c @@ -57,13 +57,13 @@ typedef struct connection { pa_client *client; pa_memblockq *input_memblockq, *output_memblockq; - pa_bool_t dead; + bool dead; struct { pa_memblock *current_memblock; size_t memblock_index; pa_atomic_t missing; - pa_bool_t underrun; + bool underrun; } playback; } connection; @@ -266,7 +266,7 @@ fail: if (c->sink_input) { /* If there is a sink input, we first drain what we already have read before shutting down the connection */ - c->dead = TRUE; + c->dead = true; pa_iochannel_free(c->io); c->io = NULL; @@ -323,7 +323,7 @@ static int sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int if (pa_memblockq_is_readable(c->input_memblockq) && c->playback.underrun) { pa_log_debug("Requesting rewind due to end of underrun."); - pa_sink_input_request_rewind(c->sink_input, 0, FALSE, TRUE, FALSE); + pa_sink_input_request_rewind(c->sink_input, 0, false, true, false); } /* pa_log("got data, %u", pa_memblockq_get_length(c->input_memblockq)); */ @@ -360,7 +360,7 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t length, pa_memchunk *chunk if (pa_memblockq_peek(c->input_memblockq, chunk) < 0) { - c->playback.underrun = TRUE; + c->playback.underrun = true; if (c->dead && pa_sink_input_safe_to_remove(i)) pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(c), CONNECTION_MESSAGE_UNLINK_CONNECTION, NULL, 0, NULL, NULL); @@ -371,7 +371,7 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t length, pa_memchunk *chunk chunk->length = PA_MIN(length, chunk->length); - c->playback.underrun = FALSE; + c->playback.underrun = false; pa_memblockq_drop(c->input_memblockq, chunk->length); m = pa_memblockq_pop_missing(c->input_memblockq); @@ -502,8 +502,8 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp c->options = pa_simple_options_ref(o); c->playback.current_memblock = NULL; c->playback.memblock_index = 0; - c->dead = FALSE; - c->playback.underrun = TRUE; + c->dead = false; + c->playback.underrun = true; pa_atomic_store(&c->playback.missing, 0); pa_client_new_data_init(&client_data); @@ -536,7 +536,7 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp data.driver = __FILE__; data.module = o->module; data.client = c->client; - pa_sink_input_new_data_set_sink(&data, sink, FALSE); + pa_sink_input_new_data_set_sink(&data, sink, false); pa_proplist_update(data.proplist, PA_UPDATE_MERGE, c->client->proplist); pa_sink_input_new_data_set_sample_spec(&data, &o->sample_spec); @@ -592,7 +592,7 @@ void pa_simple_protocol_connect(pa_simple_protocol *p, pa_iochannel *io, pa_simp data.driver = __FILE__; data.module = o->module; data.client = c->client; - pa_source_output_new_data_set_source(&data, source, FALSE); + pa_source_output_new_data_set_source(&data, source, false); pa_proplist_update(data.proplist, PA_UPDATE_MERGE, c->client->proplist); pa_source_output_new_data_set_sample_spec(&data, &o->sample_spec); @@ -703,8 +703,8 @@ pa_simple_options* pa_simple_options_new(void) { o = pa_xnew0(pa_simple_options, 1); PA_REFCNT_INIT(o); - o->record = FALSE; - o->playback = TRUE; + o->record = false; + o->playback = true; return o; } @@ -732,7 +732,7 @@ void pa_simple_options_unref(pa_simple_options *o) { } int pa_simple_options_parse(pa_simple_options *o, pa_core *c, pa_modargs *ma) { - pa_bool_t enabled; + bool enabled; pa_assert(o); pa_assert(PA_REFCNT_VALUE(o) >= 1); diff --git a/src/pulsecore/protocol-simple.h b/src/pulsecore/protocol-simple.h index a25ab80a9..f0723db99 100644 --- a/src/pulsecore/protocol-simple.h +++ b/src/pulsecore/protocol-simple.h @@ -39,8 +39,8 @@ typedef struct pa_simple_options { pa_sample_spec sample_spec; pa_channel_map channel_map; - pa_bool_t record:1; - pa_bool_t playback:1; + bool record:1; + bool playback:1; } pa_simple_options; pa_simple_protocol* pa_simple_protocol_get(pa_core*core); diff --git a/src/pulsecore/pstream.c b/src/pulsecore/pstream.c index 6cf4394c3..190fc9a33 100644 --- a/src/pulsecore/pstream.c +++ b/src/pulsecore/pstream.c @@ -94,7 +94,7 @@ struct item_info { /* packet info */ pa_packet *packet; #ifdef HAVE_CREDS - pa_bool_t with_creds; + bool with_creds; pa_creds creds; #endif @@ -117,7 +117,7 @@ struct pa_pstream { pa_queue *send_queue; - pa_bool_t dead; + bool dead; struct { union { @@ -140,7 +140,7 @@ struct pa_pstream { size_t index; } read; - pa_bool_t use_shm; + bool use_shm; pa_memimport *import; pa_memexport *export; @@ -166,7 +166,7 @@ struct pa_pstream { #ifdef HAVE_CREDS pa_creds read_creds, write_creds; - pa_bool_t read_creds_valid, send_creds_now; + bool read_creds_valid, send_creds_now; #endif }; @@ -241,7 +241,7 @@ pa_pstream *pa_pstream_new(pa_mainloop_api *m, pa_iochannel *io, pa_mempool *poo PA_REFCNT_INIT(p); p->io = io; pa_iochannel_set_callback(io, io_callback, p); - p->dead = FALSE; + p->dead = false; p->mainloop = m; p->defer_event = m->defer_new(m, defer_callback, p); @@ -271,7 +271,7 @@ pa_pstream *pa_pstream_new(pa_mainloop_api *m, pa_iochannel *io, pa_mempool *poo p->mempool = pool; - p->use_shm = FALSE; + p->use_shm = false; p->export = NULL; /* We do importing unconditionally */ @@ -281,8 +281,8 @@ pa_pstream *pa_pstream_new(pa_mainloop_api *m, pa_iochannel *io, pa_mempool *poo pa_iochannel_socket_set_sndbuf(io, pa_mempool_block_size_max(p->mempool)); #ifdef HAVE_CREDS - p->send_creds_now = FALSE; - p->read_creds_valid = FALSE; + p->send_creds_now = false; + p->read_creds_valid = false; #endif return p; } @@ -385,7 +385,7 @@ void pa_pstream_send_memblock(pa_pstream*p, uint32_t channel, int64_t offset, pa i->offset = offset; i->seek_mode = seek_mode; #ifdef HAVE_CREDS - i->with_creds = FALSE; + i->with_creds = false; #endif pa_queue_push(p->send_queue, i); @@ -412,7 +412,7 @@ void pa_pstream_send_release(pa_pstream *p, uint32_t block_id) { item->type = PA_PSTREAM_ITEM_SHMRELEASE; item->block_id = block_id; #ifdef HAVE_CREDS - item->with_creds = FALSE; + item->with_creds = false; #endif pa_queue_push(p->send_queue, item); @@ -449,7 +449,7 @@ void pa_pstream_send_revoke(pa_pstream *p, uint32_t block_id) { item->type = PA_PSTREAM_ITEM_SHMREVOKE; item->block_id = block_id; #ifdef HAVE_CREDS - item->with_creds = FALSE; + item->with_creds = false; #endif pa_queue_push(p->send_queue, item); @@ -511,7 +511,7 @@ static void prepare_next_write_item(pa_pstream *p) { } else { uint32_t flags; - pa_bool_t send_payload = TRUE; + bool send_payload = true; pa_assert(p->write.current->type == PA_PSTREAM_ITEM_MEMBLOCK); pa_assert(p->write.current->chunk.memblock); @@ -538,7 +538,7 @@ static void prepare_next_write_item(pa_pstream *p) { &length) >= 0) { flags |= PA_FLAG_SHMDATA; - send_payload = FALSE; + send_payload = false; shm_info[PA_PSTREAM_SHM_BLOCKID] = htonl(block_id); shm_info[PA_PSTREAM_SHM_SHMID] = htonl(shm_id); @@ -611,7 +611,7 @@ static int do_write(pa_pstream *p) { if ((r = pa_iochannel_write_with_creds(p->io, d, l, &p->write_creds)) < 0) goto fail; - p->send_creds_now = FALSE; + p->send_creds_now = false; } else #endif @@ -674,7 +674,7 @@ static int do_read(pa_pstream *p) { #ifdef HAVE_CREDS { - pa_bool_t b = 0; + bool b = 0; if ((r = pa_iochannel_read_with_creds(p->io, d, l, &p->read_creds, &b)) <= 0) goto fail; @@ -888,7 +888,7 @@ frame_done: p->read.data = NULL; #ifdef HAVE_CREDS - p->read_creds_valid = FALSE; + p->read_creds_valid = false; #endif return 0; @@ -948,14 +948,14 @@ void pa_pstream_set_revoke_callback(pa_pstream *p, pa_pstream_block_id_cb_t cb, p->release_callback_userdata = userdata; } -pa_bool_t pa_pstream_is_pending(pa_pstream *p) { - pa_bool_t b; +bool pa_pstream_is_pending(pa_pstream *p) { + bool b; pa_assert(p); pa_assert(PA_REFCNT_VALUE(p) > 0); if (p->dead) - b = FALSE; + b = false; else b = p->write.current || !pa_queue_isempty(p->send_queue); @@ -984,7 +984,7 @@ void pa_pstream_unlink(pa_pstream *p) { if (p->dead) return; - p->dead = TRUE; + p->dead = true; if (p->import) { pa_memimport_free(p->import); @@ -1012,7 +1012,7 @@ void pa_pstream_unlink(pa_pstream *p) { p->receive_memblock_callback = NULL; } -void pa_pstream_enable_shm(pa_pstream *p, pa_bool_t enable) { +void pa_pstream_enable_shm(pa_pstream *p, bool enable) { pa_assert(p); pa_assert(PA_REFCNT_VALUE(p) > 0); @@ -1032,7 +1032,7 @@ void pa_pstream_enable_shm(pa_pstream *p, pa_bool_t enable) { } } -pa_bool_t pa_pstream_get_shm(pa_pstream *p) { +bool pa_pstream_get_shm(pa_pstream *p) { pa_assert(p); pa_assert(PA_REFCNT_VALUE(p) > 0); diff --git a/src/pulsecore/pstream.h b/src/pulsecore/pstream.h index 6bb47fb45..deb2bc3d1 100644 --- a/src/pulsecore/pstream.h +++ b/src/pulsecore/pstream.h @@ -61,9 +61,9 @@ void pa_pstream_set_die_callback(pa_pstream *p, pa_pstream_notify_cb_t cb, void void pa_pstream_set_release_callback(pa_pstream *p, pa_pstream_block_id_cb_t cb, void *userdata); void pa_pstream_set_revoke_callback(pa_pstream *p, pa_pstream_block_id_cb_t cb, void *userdata); -pa_bool_t pa_pstream_is_pending(pa_pstream *p); +bool pa_pstream_is_pending(pa_pstream *p); -void pa_pstream_enable_shm(pa_pstream *p, pa_bool_t enable); -pa_bool_t pa_pstream_get_shm(pa_pstream *p); +void pa_pstream_enable_shm(pa_pstream *p, bool enable); +bool pa_pstream_get_shm(pa_pstream *p); #endif diff --git a/src/pulsecore/random.c b/src/pulsecore/random.c index e83af059f..acfbc3123 100644 --- a/src/pulsecore/random.c +++ b/src/pulsecore/random.c @@ -41,7 +41,7 @@ #include "random.h" -static pa_bool_t has_whined = FALSE; +static bool has_whined = false; static const char * const devices[] = { "/dev/urandom", "/dev/random", NULL }; @@ -102,7 +102,7 @@ void pa_random_seed(void) { if (!has_whined) { pa_log_warn("Failed to get proper entropy. Falling back to seeding with current time."); - has_whined = TRUE; + has_whined = true; } seed = (unsigned int) time(NULL); @@ -123,7 +123,7 @@ void pa_random(void *ret_data, size_t length) { if (!has_whined) { pa_log_warn("Failed to get proper entropy. Falling back to unsecure pseudo RNG."); - has_whined = TRUE; + has_whined = true; } for (p = ret_data, l = length; l > 0; p++, l--) diff --git a/src/pulsecore/ratelimit.c b/src/pulsecore/ratelimit.c index a274d2cc1..37e46c821 100644 --- a/src/pulsecore/ratelimit.c +++ b/src/pulsecore/ratelimit.c @@ -35,13 +35,13 @@ static pa_static_mutex mutex = PA_STATIC_MUTEX_INIT; /* Modelled after Linux' lib/ratelimit.c by Dave Young * <hidave.darkstar@gmail.com>, which is licensed GPLv2. */ -pa_bool_t pa_ratelimit_test(pa_ratelimit *r, pa_log_level_t t) { +bool pa_ratelimit_test(pa_ratelimit *r, pa_log_level_t t) { pa_usec_t now; pa_mutex *m; now = pa_rtclock_now(); - m = pa_static_mutex_get(&mutex, FALSE, FALSE); + m = pa_static_mutex_get(&mutex, false, false); pa_mutex_lock(m); pa_assert(r); @@ -67,10 +67,10 @@ pa_bool_t pa_ratelimit_test(pa_ratelimit *r, pa_log_level_t t) { r->n_missed++; pa_mutex_unlock(m); - return FALSE; + return false; good: r->n_printed++; pa_mutex_unlock(m); - return TRUE; + return true; } diff --git a/src/pulsecore/ratelimit.h b/src/pulsecore/ratelimit.h index 9a36195d1..036646230 100644 --- a/src/pulsecore/ratelimit.h +++ b/src/pulsecore/ratelimit.h @@ -50,8 +50,8 @@ typedef struct pa_ratelimit { r->n_printed = 0; \ r->n_missed = 0; \ r->begin = 0; \ - } while (FALSE); + } while (false); -pa_bool_t pa_ratelimit_test(pa_ratelimit *r, pa_log_level_t t); +bool pa_ratelimit_test(pa_ratelimit *r, pa_log_level_t t); #endif diff --git a/src/pulsecore/refcnt.h b/src/pulsecore/refcnt.h index 782436b5c..d52cac831 100644 --- a/src/pulsecore/refcnt.h +++ b/src/pulsecore/refcnt.h @@ -58,13 +58,13 @@ do { \ pa_atomic_store(&(p)->_ref, 1); \ pa_log("REF: Init %p", p); \ - } while (FALSE) + } while (false) #define PA_REFCNT_INC(p) \ do { \ pa_atomic_inc(&(p)->_ref); \ pa_log("REF: Inc %p", p); \ - } while (FALSE) \ + } while (false) \ #define PA_REFCNT_DEC(p) \ ({ \ diff --git a/src/pulsecore/rtpoll.c b/src/pulsecore/rtpoll.c index d90c996c1..09e5e8a34 100644 --- a/src/pulsecore/rtpoll.c +++ b/src/pulsecore/rtpoll.c @@ -51,13 +51,13 @@ struct pa_rtpoll { unsigned n_pollfd_alloc, n_pollfd_used; struct timeval next_elapse; - pa_bool_t timer_enabled:1; + bool timer_enabled:1; - pa_bool_t scan_for_dead:1; - pa_bool_t running:1; - pa_bool_t rebuild_needed:1; - pa_bool_t quit:1; - pa_bool_t timer_elapsed:1; + bool scan_for_dead:1; + bool running:1; + bool rebuild_needed:1; + bool quit:1; + bool timer_elapsed:1; #ifdef DEBUG_TIMING pa_usec_t timestamp; @@ -69,7 +69,7 @@ struct pa_rtpoll { struct pa_rtpoll_item { pa_rtpoll *rtpoll; - pa_bool_t dead; + bool dead; pa_rtpoll_priority_t priority; @@ -110,7 +110,7 @@ static void rtpoll_rebuild(pa_rtpoll *p) { pa_assert(p); - p->rebuild_needed = FALSE; + p->rebuild_needed = false; if (p->n_pollfd_used > p->n_pollfd_alloc) { /* Hmm, we have to allocate some more space */ @@ -161,7 +161,7 @@ static void rtpoll_item_destroy(pa_rtpoll_item *i) { if (pa_flist_push(PA_STATIC_FLIST_GET(items), i) < 0) pa_xfree(i); - p->rebuild_needed = TRUE; + p->rebuild_needed = true; } void pa_rtpoll_free(pa_rtpoll *p) { @@ -203,7 +203,7 @@ static void reset_all_revents(pa_rtpoll *p) { } } -int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait_op) { +int pa_rtpoll_run(pa_rtpoll *p, bool wait_op) { pa_rtpoll_item *i; int r = 0; struct timeval timeout; @@ -215,8 +215,8 @@ int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait_op) { pa_log("rtpoll_run"); #endif - p->running = TRUE; - p->timer_elapsed = FALSE; + p->running = true; + p->timer_elapsed = false; /* First, let's do some work */ for (i = p->items; i && i->priority < PA_RTPOLL_NEVER; i = i->next) { @@ -354,12 +354,12 @@ int pa_rtpoll_run(pa_rtpoll *p, pa_bool_t wait_op) { finish: - p->running = FALSE; + p->running = false; if (p->scan_for_dead) { pa_rtpoll_item *n; - p->scan_for_dead = FALSE; + p->scan_for_dead = false; for (i = p->items; i; i = n) { n = i->next; @@ -376,7 +376,7 @@ void pa_rtpoll_set_timer_absolute(pa_rtpoll *p, pa_usec_t usec) { pa_assert(p); pa_timeval_store(&p->next_elapse, usec); - p->timer_enabled = TRUE; + p->timer_enabled = true; } void pa_rtpoll_set_timer_relative(pa_rtpoll *p, pa_usec_t usec) { @@ -387,14 +387,14 @@ void pa_rtpoll_set_timer_relative(pa_rtpoll *p, pa_usec_t usec) { pa_rtclock_get(&p->next_elapse); pa_timeval_add(&p->next_elapse, usec); - p->timer_enabled = TRUE; + p->timer_enabled = true; } void pa_rtpoll_set_timer_disabled(pa_rtpoll *p) { pa_assert(p); memset(&p->next_elapse, 0, sizeof(p->next_elapse)); - p->timer_enabled = FALSE; + p->timer_enabled = false; } pa_rtpoll_item *pa_rtpoll_item_new(pa_rtpoll *p, pa_rtpoll_priority_t prio, unsigned n_fds) { @@ -406,7 +406,7 @@ pa_rtpoll_item *pa_rtpoll_item_new(pa_rtpoll *p, pa_rtpoll_priority_t prio, unsi i = pa_xnew(pa_rtpoll_item, 1); i->rtpoll = p; - i->dead = FALSE; + i->dead = false; i->n_pollfd = n_fds; i->pollfd = NULL; i->priority = prio; @@ -437,8 +437,8 @@ void pa_rtpoll_item_free(pa_rtpoll_item *i) { pa_assert(i); if (i->rtpoll->running) { - i->dead = TRUE; - i->rtpoll->scan_for_dead = TRUE; + i->dead = true; + i->rtpoll->scan_for_dead = true; return; } @@ -628,10 +628,10 @@ pa_rtpoll_item *pa_rtpoll_item_new_asyncmsgq_write(pa_rtpoll *p, pa_rtpoll_prior void pa_rtpoll_quit(pa_rtpoll *p) { pa_assert(p); - p->quit = TRUE; + p->quit = true; } -pa_bool_t pa_rtpoll_timer_elapsed(pa_rtpoll *p) { +bool pa_rtpoll_timer_elapsed(pa_rtpoll *p) { pa_assert(p); return p->timer_elapsed; diff --git a/src/pulsecore/rtpoll.h b/src/pulsecore/rtpoll.h index 1c8f8b0ee..43ff5e639 100644 --- a/src/pulsecore/rtpoll.h +++ b/src/pulsecore/rtpoll.h @@ -61,15 +61,15 @@ void pa_rtpoll_free(pa_rtpoll *p); * struct pollfd. Returns negative on error, positive if the loop * should continue to run, 0 when the loop should be terminated * cleanly. */ -int pa_rtpoll_run(pa_rtpoll *f, pa_bool_t wait); +int pa_rtpoll_run(pa_rtpoll *f, bool wait); void pa_rtpoll_set_timer_absolute(pa_rtpoll *p, pa_usec_t usec); void pa_rtpoll_set_timer_relative(pa_rtpoll *p, pa_usec_t usec); void pa_rtpoll_set_timer_disabled(pa_rtpoll *p); -/* Return TRUE when the elapsed timer was the reason for +/* Return true when the elapsed timer was the reason for * the last pa_rtpoll_run() invocation to finish */ -pa_bool_t pa_rtpoll_timer_elapsed(pa_rtpoll *p); +bool pa_rtpoll_timer_elapsed(pa_rtpoll *p); /* A new fd wakeup item for pa_rtpoll */ pa_rtpoll_item *pa_rtpoll_item_new(pa_rtpoll *p, pa_rtpoll_priority_t prio, unsigned n_fds); diff --git a/src/pulsecore/sample-util.c b/src/pulsecore/sample-util.c index bda5a5e90..dc5c1fd23 100644 --- a/src/pulsecore/sample-util.c +++ b/src/pulsecore/sample-util.c @@ -113,7 +113,7 @@ size_t pa_frame_align(size_t l, const pa_sample_spec *ss) { return (l/fs) * fs; } -pa_bool_t pa_frame_aligned(size_t l, const pa_sample_spec *ss) { +bool pa_frame_aligned(size_t l, const pa_sample_spec *ss) { size_t fs; pa_assert(ss); @@ -194,7 +194,7 @@ static pa_memblock *silence_memblock_new(pa_mempool *pool, uint8_t c) { memset(data, c, length); pa_memblock_release(b); - pa_memblock_set_is_silence(b, TRUE); + pa_memblock_set_is_silence(b, true); return b; } diff --git a/src/pulsecore/sample-util.h b/src/pulsecore/sample-util.h index dda1be5e5..7e7fb9282 100644 --- a/src/pulsecore/sample-util.h +++ b/src/pulsecore/sample-util.h @@ -49,7 +49,7 @@ pa_memchunk* pa_silence_memchunk_get(pa_silence_cache *cache, pa_mempool *pool, size_t pa_frame_align(size_t l, const pa_sample_spec *ss) PA_GCC_PURE; -pa_bool_t pa_frame_aligned(size_t l, const pa_sample_spec *ss) PA_GCC_PURE; +bool pa_frame_aligned(size_t l, const pa_sample_spec *ss) PA_GCC_PURE; void pa_interleave(const void *src[], unsigned channels, void *dst, size_t ss, unsigned n); void pa_deinterleave(const void *src, void *dst[], unsigned channels, size_t ss, unsigned n); diff --git a/src/pulsecore/shm.c b/src/pulsecore/shm.c index 8aa34faf3..efaee5796 100644 --- a/src/pulsecore/shm.c +++ b/src/pulsecore/shm.c @@ -102,7 +102,7 @@ static char *segment_name(char *fn, size_t l, unsigned id) { } #endif -int pa_shm_create_rw(pa_shm *m, size_t size, pa_bool_t shared, mode_t mode) { +int pa_shm_create_rw(pa_shm *m, size_t size, bool shared, mode_t mode) { #ifdef HAVE_SHM_OPEN char fn[32]; int fd = -1; @@ -143,7 +143,7 @@ int pa_shm_create_rw(pa_shm *m, size_t size, pa_bool_t shared, mode_t mode) { m->ptr = pa_xmalloc(m->size); #endif - m->do_unlink = FALSE; + m->do_unlink = false; } else { #ifdef HAVE_SHM_OPEN @@ -180,7 +180,7 @@ int pa_shm_create_rw(pa_shm *m, size_t size, pa_bool_t shared, mode_t mode) { pa_atomic_store(&marker->marker, SHM_MARKER); pa_assert_se(pa_close(fd) == 0); - m->do_unlink = TRUE; + m->do_unlink = true; #else goto fail; #endif @@ -324,8 +324,8 @@ int pa_shm_attach_ro(pa_shm *m, unsigned id) { goto fail; } - m->do_unlink = FALSE; - m->shared = TRUE; + m->do_unlink = false; + m->shared = true; pa_assert_se(pa_close(fd) == 0); diff --git a/src/pulsecore/shm.h b/src/pulsecore/shm.h index c2adbd075..9d615518c 100644 --- a/src/pulsecore/shm.h +++ b/src/pulsecore/shm.h @@ -30,11 +30,11 @@ typedef struct pa_shm { unsigned id; void *ptr; size_t size; - pa_bool_t do_unlink:1; - pa_bool_t shared:1; + bool do_unlink:1; + bool shared:1; } pa_shm; -int pa_shm_create_rw(pa_shm *m, size_t size, pa_bool_t shared, mode_t mode); +int pa_shm_create_rw(pa_shm *m, size_t size, bool shared, mode_t mode); int pa_shm_attach_ro(pa_shm *m, unsigned id); void pa_shm_punch(pa_shm *m, size_t offset, size_t size); diff --git a/src/pulsecore/shmasyncq.h b/src/pulsecore/shmasyncq.h index 67ce6071e..f9ae0c6e9 100644 --- a/src/pulsecore/shmasyncq.h +++ b/src/pulsecore/shmasyncq.h @@ -45,10 +45,10 @@ typedef struct pa_shmasyncq pa_shmasyncq; pa_shmasyncq *pa_shmasyncq_new(unsigned n_elements, size_t element_size, void *data, int fd[2]); void pa_shmasyncq_free(pa_shmasyncq* q, pa_free_cb_t free_cb); -void* pa_shmasyncq_pop_begin(pa_shmasyncq *q, pa_bool_t wait); +void* pa_shmasyncq_pop_begin(pa_shmasyncq *q, bool wait); void pa_shmasyncq_pop_commit(pa_shmasyncq *q); -int* pa_shmasyncq_push_begin(pa_shmasyncq *q, pa_bool_t wait); +int* pa_shmasyncq_push_begin(pa_shmasyncq *q, bool wait); void pa_shmasyncq_push_commit(pa_shmasyncq *q); int pa_shmasyncq_get_fd(pa_shmasyncq *q); diff --git a/src/pulsecore/sink-input.c b/src/pulsecore/sink-input.c index 2cc0738d8..ffea078a5 100644 --- a/src/pulsecore/sink-input.c +++ b/src/pulsecore/sink-input.c @@ -86,7 +86,7 @@ static void volume_factor_from_hashmap(pa_cvolume *v, pa_hashmap *items, uint8_t static void sink_input_free(pa_object *o); static void set_real_ratio(pa_sink_input *i, const pa_cvolume *v); -static int check_passthrough_connection(pa_bool_t passthrough, pa_sink *dest) { +static int check_passthrough_connection(bool passthrough, pa_sink *dest) { if (pa_sink_is_passthrough(dest)) { pa_log_warn("Sink is already connected to PASSTHROUGH input"); return -PA_ERR_BUSY; @@ -107,7 +107,7 @@ pa_sink_input_new_data* pa_sink_input_new_data_init(pa_sink_input_new_data *data pa_zero(*data); data->resample_method = PA_RESAMPLER_INVALID; data->proplist = pa_proplist_new(); - data->volume_writable = TRUE; + data->volume_writable = true; data->volume_factor_items = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); data->volume_factor_sink_items = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func); @@ -129,16 +129,16 @@ void pa_sink_input_new_data_set_channel_map(pa_sink_input_new_data *data, const data->channel_map = *map; } -pa_bool_t pa_sink_input_new_data_is_passthrough(pa_sink_input_new_data *data) { +bool pa_sink_input_new_data_is_passthrough(pa_sink_input_new_data *data) { pa_assert(data); if (PA_LIKELY(data->format) && PA_UNLIKELY(!pa_format_info_is_pcm(data->format))) - return TRUE; + return true; if (PA_UNLIKELY(data->flags & PA_SINK_INPUT_PASSTHROUGH)) - return TRUE; + return true; - return FALSE; + return false; } void pa_sink_input_new_data_set_volume(pa_sink_input_new_data *data, const pa_cvolume *volume) { @@ -171,15 +171,15 @@ void pa_sink_input_new_data_add_volume_factor_sink(pa_sink_input_new_data *data, pa_assert_se(pa_hashmap_put(data->volume_factor_sink_items, v->key, v) >= 0); } -void pa_sink_input_new_data_set_muted(pa_sink_input_new_data *data, pa_bool_t mute) { +void pa_sink_input_new_data_set_muted(pa_sink_input_new_data *data, bool mute) { pa_assert(data); - data->muted_is_set = TRUE; + data->muted_is_set = true; data->muted = !!mute; } -pa_bool_t pa_sink_input_new_data_set_sink(pa_sink_input_new_data *data, pa_sink *s, pa_bool_t save) { - pa_bool_t ret = TRUE; +bool pa_sink_input_new_data_set_sink(pa_sink_input_new_data *data, pa_sink *s, bool save) { + bool ret = true; pa_idxset *formats = NULL; pa_assert(data); @@ -204,14 +204,14 @@ pa_bool_t pa_sink_input_new_data_set_sink(pa_sink_input_new_data *data, pa_sink /* Sink doesn't support any of the formats requested by the client */ if (formats) pa_idxset_free(formats, (pa_free_cb_t) pa_format_info_free); - ret = FALSE; + ret = false; } } return ret; } -pa_bool_t pa_sink_input_new_data_set_formats(pa_sink_input_new_data *data, pa_idxset *formats) { +bool pa_sink_input_new_data_set_formats(pa_sink_input_new_data *data, pa_idxset *formats) { pa_assert(data); pa_assert(formats); @@ -225,7 +225,7 @@ pa_bool_t pa_sink_input_new_data_set_formats(pa_sink_input_new_data *data, pa_id return pa_sink_input_new_data_set_sink(data, data->sink, data->save_sink); } - return TRUE; + return true; } void pa_sink_input_new_data_done(pa_sink_input_new_data *data) { @@ -300,7 +300,7 @@ int pa_sink_input_new( pa_proplist_update(data->proplist, PA_UPDATE_MERGE, data->client->proplist); if (data->origin_sink && (data->origin_sink->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER)) - data->volume_writable = FALSE; + data->volume_writable = false; if (!data->req_formats) { /* From this point on, we want to work only with formats, and get back @@ -321,7 +321,7 @@ int pa_sink_input_new( if (!data->sink) { pa_sink *sink = pa_namereg_get(core, NULL, PA_NAMEREG_SINK); pa_return_val_if_fail(sink, -PA_ERR_NOENTITY); - pa_sink_input_new_data_set_sink(data, sink, FALSE); + pa_sink_input_new_data_set_sink(data, sink, false); } /* Routing's done, we have a sink. Now let's fix the format and set up the * sample spec */ @@ -375,16 +375,16 @@ int pa_sink_input_new( /* Don't restore (or save) stream volume for passthrough streams and * prevent attenuation/gain */ if (pa_sink_input_new_data_is_passthrough(data)) { - data->volume_is_set = TRUE; + data->volume_is_set = true; pa_cvolume_reset(&data->volume, data->sample_spec.channels); - data->volume_is_absolute = TRUE; - data->save_volume = FALSE; + data->volume_is_absolute = true; + data->save_volume = false; } if (!data->volume_is_set) { pa_cvolume_reset(&data->volume, data->sample_spec.channels); - data->volume_is_absolute = FALSE; - data->save_volume = FALSE; + data->volume_is_absolute = false; + data->save_volume = false; } if (!data->volume_writable) @@ -393,7 +393,7 @@ int pa_sink_input_new( pa_return_val_if_fail(pa_cvolume_compatible(&data->volume, &data->sample_spec), -PA_ERR_INVALID); if (!data->muted_is_set) - data->muted = FALSE; + data->muted = false; if (data->flags & PA_SINK_INPUT_FIX_FORMAT) { pa_return_val_if_fail(pa_format_info_is_pcm(data->format), -PA_ERR_INVALID); @@ -426,7 +426,7 @@ int pa_sink_input_new( module-suspend-on-idle can resume a sink */ pa_log_info("Trying to change sample rate"); - if (pa_sink_update_rate(data->sink, data->sample_spec.rate, pa_sink_input_new_data_is_passthrough(data)) == TRUE) + if (pa_sink_update_rate(data->sink, data->sample_spec.rate, pa_sink_input_new_data_is_passthrough(data)) == true) pa_log_info("Rate changed to %u Hz", data->sink->sample_spec.rate); } @@ -545,7 +545,7 @@ int pa_sink_input_new( i->userdata = NULL; i->thread_info.state = i->state; - i->thread_info.attached = FALSE; + i->thread_info.attached = false; pa_atomic_store(&i->thread_info.drained, 1); i->thread_info.sample_spec = i->sample_spec; i->thread_info.resampler = resampler; @@ -553,8 +553,8 @@ int pa_sink_input_new( i->thread_info.muted = i->muted; i->thread_info.requested_sink_latency = (pa_usec_t) -1; i->thread_info.rewrite_nbytes = 0; - i->thread_info.rewrite_flush = FALSE; - i->thread_info.dont_rewind_render = FALSE; + i->thread_info.rewrite_flush = false; + i->thread_info.dont_rewind_render = false; i->thread_info.underrun_for = (uint64_t) -1; i->thread_info.underrun_for_sink = 0; i->thread_info.playing_for = 0; @@ -660,7 +660,7 @@ static void sink_input_set_state(pa_sink_input *i, pa_sink_input_state_t state) /* Called from main context */ void pa_sink_input_unlink(pa_sink_input *i) { - pa_bool_t linked; + bool linked; pa_source_output *o, *p = NULL; pa_assert(i); @@ -707,7 +707,7 @@ void pa_sink_input_unlink(pa_sink_input *i) { /* We might need to update the sink's volume if we are in flat volume mode. */ if (pa_sink_flat_volume_enabled(i->sink)) - pa_sink_set_volume(i->sink, NULL, FALSE, FALSE); + pa_sink_set_volume(i->sink, NULL, false, false); if (i->sink->asyncmsgq) pa_assert_se(pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i->sink), PA_SINK_MESSAGE_REMOVE_INPUT, i, 0, NULL) == 0); @@ -799,7 +799,7 @@ void pa_sink_input_put(pa_sink_input *i) { /* We might need to update the sink's volume if we are in flat volume mode. */ if (pa_sink_flat_volume_enabled(i->sink)) - pa_sink_set_volume(i->sink, NULL, FALSE, i->save_volume); + pa_sink_set_volume(i->sink, NULL, false, i->save_volume); else { if (i->origin_sink && (i->origin_sink->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER)) { pa_assert(pa_cvolume_is_norm(&i->volume)); @@ -853,8 +853,8 @@ pa_usec_t pa_sink_input_get_latency(pa_sink_input *i, pa_usec_t *sink_latency) { /* Called from thread context */ void pa_sink_input_peek(pa_sink_input *i, size_t slength /* in sink bytes */, pa_memchunk *chunk, pa_cvolume *volume) { - pa_bool_t do_volume_adj_here, need_volume_factor_sink; - pa_bool_t volume_is_norm; + bool do_volume_adj_here, need_volume_factor_sink; + bool volume_is_norm; size_t block_size_max_sink, block_size_max_sink_input; size_t ilength; size_t ilength_full; @@ -919,7 +919,7 @@ void pa_sink_input_peek(pa_sink_input *i, size_t slength /* in sink bytes */, pa * data, so let's just hand out silence */ pa_atomic_store(&i->thread_info.drained, 1); - pa_memblockq_seek(i->thread_info.render_memblockq, (int64_t) slength, PA_SEEK_RELATIVE, TRUE); + pa_memblockq_seek(i->thread_info.render_memblockq, (int64_t) slength, PA_SEEK_RELATIVE, true); i->thread_info.playing_for = 0; if (i->thread_info.underrun_for != (uint64_t) -1) { i->thread_info.underrun_for += ilength_full; @@ -939,7 +939,7 @@ void pa_sink_input_peek(pa_sink_input *i, size_t slength /* in sink bytes */, pa while (tchunk.length > 0) { pa_memchunk wchunk; - pa_bool_t nvfs = need_volume_factor_sink; + bool nvfs = need_volume_factor_sink; wchunk = tchunk; pa_memblock_ref(wchunk.memblock); @@ -953,7 +953,7 @@ void pa_sink_input_peek(pa_sink_input *i, size_t slength /* in sink bytes */, pa if (i->thread_info.muted) { pa_silence_memchunk(&wchunk, &i->thread_info.sample_spec); - nvfs = FALSE; + nvfs = false; } else if (!i->thread_info.resampler && nvfs) { pa_cvolume v; @@ -963,7 +963,7 @@ void pa_sink_input_peek(pa_sink_input *i, size_t slength /* in sink bytes */, pa pa_sw_cvolume_multiply(&v, &i->thread_info.soft_volume, &i->volume_factor_sink); pa_volume_memchunk(&wchunk, &i->thread_info.sample_spec, &v); - nvfs = FALSE; + nvfs = false; } else pa_volume_memchunk(&wchunk, &i->thread_info.sample_spec, &i->thread_info.soft_volume); @@ -1066,7 +1066,7 @@ bool pa_sink_input_process_underrun(pa_sink_input *i) { /* Called from thread context */ void pa_sink_input_process_rewind(pa_sink_input *i, size_t nbytes /* in sink sample spec */) { size_t lbq; - pa_bool_t called = FALSE; + bool called = false; pa_sink_input_assert_ref(i); pa_sink_input_assert_io_context(i); @@ -1089,7 +1089,7 @@ void pa_sink_input_process_rewind(pa_sink_input *i, size_t nbytes /* in sink sam /* We were asked to drop all buffered data, and rerequest new * data from implementor the next time peek() is called */ - pa_memblockq_flush_write(i->thread_info.render_memblockq, TRUE); + pa_memblockq_flush_write(i->thread_info.render_memblockq, true); } else if (i->thread_info.rewrite_nbytes > 0) { size_t max_rewrite, amount; @@ -1110,7 +1110,7 @@ void pa_sink_input_process_rewind(pa_sink_input *i, size_t nbytes /* in sink sam /* Tell the implementor */ if (i->process_rewind) i->process_rewind(i, amount); - called = TRUE; + called = true; /* Convert back to to sink domain */ if (i->thread_info.resampler) @@ -1118,7 +1118,7 @@ void pa_sink_input_process_rewind(pa_sink_input *i, size_t nbytes /* in sink sam if (amount > 0) /* Ok, now update the write pointer */ - pa_memblockq_seek(i->thread_info.render_memblockq, - ((int64_t) amount), PA_SEEK_RELATIVE, TRUE); + pa_memblockq_seek(i->thread_info.render_memblockq, - ((int64_t) amount), PA_SEEK_RELATIVE, true); if (i->thread_info.rewrite_flush) pa_memblockq_silence(i->thread_info.render_memblockq); @@ -1134,8 +1134,8 @@ void pa_sink_input_process_rewind(pa_sink_input *i, size_t nbytes /* in sink sam i->process_rewind(i, 0); i->thread_info.rewrite_nbytes = 0; - i->thread_info.rewrite_flush = FALSE; - i->thread_info.dont_rewind_render = FALSE; + i->thread_info.rewrite_flush = false; + i->thread_info.dont_rewind_render = false; } /* Called from thread context */ @@ -1193,7 +1193,7 @@ pa_usec_t pa_sink_input_set_requested_latency_within_thread(pa_sink_input *i, pa usec = PA_CLAMP(usec, i->sink->thread_info.min_latency, i->sink->thread_info.max_latency); i->thread_info.requested_sink_latency = usec; - pa_sink_invalidate_requested_latency(i->sink, TRUE); + pa_sink_invalidate_requested_latency(i->sink, true); return usec; } @@ -1245,7 +1245,7 @@ pa_usec_t pa_sink_input_get_requested_latency(pa_sink_input *i) { } /* Called from main context */ -void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume, pa_bool_t save, pa_bool_t absolute) { +void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume, bool save, bool absolute) { pa_cvolume v; pa_sink_input_assert_ref(i); @@ -1283,7 +1283,7 @@ void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume, pa_boo /* We are in flat volume mode, so let's update all sink input * volumes and update the flat volume of the sink */ - pa_sink_set_volume(i->sink, NULL, TRUE, save); + pa_sink_set_volume(i->sink, NULL, true, save); } else { /* OK, we are in normal volume mode. The volume only affects @@ -1380,20 +1380,20 @@ static void set_real_ratio(pa_sink_input *i, const pa_cvolume *v) { } /* Called from main or I/O context */ -pa_bool_t pa_sink_input_is_passthrough(pa_sink_input *i) { +bool pa_sink_input_is_passthrough(pa_sink_input *i) { pa_sink_input_assert_ref(i); if (PA_UNLIKELY(!pa_format_info_is_pcm(i->format))) - return TRUE; + return true; if (PA_UNLIKELY(i->flags & PA_SINK_INPUT_PASSTHROUGH)) - return TRUE; + return true; - return FALSE; + return false; } /* Called from main context */ -pa_bool_t pa_sink_input_is_volume_readable(pa_sink_input *i) { +bool pa_sink_input_is_volume_readable(pa_sink_input *i) { pa_sink_input_assert_ref(i); pa_assert_ctl_context(); @@ -1401,7 +1401,7 @@ pa_bool_t pa_sink_input_is_volume_readable(pa_sink_input *i) { } /* Called from main context */ -pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i, pa_cvolume *volume, pa_bool_t absolute) { +pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i, pa_cvolume *volume, bool absolute) { pa_sink_input_assert_ref(i); pa_assert_ctl_context(); pa_assert(PA_SINK_INPUT_IS_LINKED(i->state)); @@ -1416,7 +1416,7 @@ pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i, pa_cvolume *volume, pa_bo } /* Called from main context */ -void pa_sink_input_set_mute(pa_sink_input *i, pa_bool_t mute, pa_bool_t save) { +void pa_sink_input_set_mute(pa_sink_input *i, bool mute, bool save) { pa_sink_input_assert_ref(i); pa_assert_ctl_context(); pa_assert(PA_SINK_INPUT_IS_LINKED(i->state)); @@ -1439,7 +1439,7 @@ void pa_sink_input_set_mute(pa_sink_input *i, pa_bool_t mute, pa_bool_t save) { } /* Called from main context */ -pa_bool_t pa_sink_input_get_mute(pa_sink_input *i) { +bool pa_sink_input_get_mute(pa_sink_input *i) { pa_sink_input_assert_ref(i); pa_assert_ctl_context(); pa_assert(PA_SINK_INPUT_IS_LINKED(i->state)); @@ -1462,7 +1462,7 @@ void pa_sink_input_update_proplist(pa_sink_input *i, pa_update_mode_t mode, pa_p } /* Called from main context */ -void pa_sink_input_cork(pa_sink_input *i, pa_bool_t b) { +void pa_sink_input_cork(pa_sink_input *i, bool b) { pa_sink_input_assert_ref(i); pa_assert_ctl_context(); pa_assert(PA_SINK_INPUT_IS_LINKED(i->state)); @@ -1522,65 +1522,65 @@ pa_resample_method_t pa_sink_input_get_resample_method(pa_sink_input *i) { } /* Called from main context */ -pa_bool_t pa_sink_input_may_move(pa_sink_input *i) { +bool pa_sink_input_may_move(pa_sink_input *i) { pa_sink_input_assert_ref(i); pa_assert_ctl_context(); pa_assert(PA_SINK_INPUT_IS_LINKED(i->state)); if (i->flags & PA_SINK_INPUT_DONT_MOVE) - return FALSE; + return false; if (i->sync_next || i->sync_prev) { pa_log_warn("Moving synchronized streams not supported."); - return FALSE; + return false; } - return TRUE; + return true; } -static pa_bool_t find_filter_sink_input(pa_sink_input *target, pa_sink *s) { +static bool find_filter_sink_input(pa_sink_input *target, pa_sink *s) { int i = 0; while (s && s->input_to_master) { if (s->input_to_master == target) - return TRUE; + return true; s = s->input_to_master->sink; pa_assert(i++ < 100); } - return FALSE; + return false; } /* Called from main context */ -pa_bool_t pa_sink_input_may_move_to(pa_sink_input *i, pa_sink *dest) { +bool pa_sink_input_may_move_to(pa_sink_input *i, pa_sink *dest) { pa_sink_input_assert_ref(i); pa_assert_ctl_context(); pa_assert(PA_SINK_INPUT_IS_LINKED(i->state)); pa_sink_assert_ref(dest); if (dest == i->sink) - return TRUE; + return true; if (!pa_sink_input_may_move(i)) - return FALSE; + return false; /* Make sure we're not creating a filter sink cycle */ if (find_filter_sink_input(i, dest)) { pa_log_debug("Can't connect input to %s, as that would create a cycle.", dest->name); - return FALSE; + return false; } if (pa_idxset_size(dest->inputs) >= PA_MAX_INPUTS_PER_SINK) { pa_log_warn("Failed to move sink input: too many inputs per sink."); - return FALSE; + return false; } if (check_passthrough_connection(pa_sink_input_is_passthrough(i), dest) < 0) - return FALSE; + return false; if (i->may_move_to) if (!i->may_move_to(i, dest)) - return FALSE; + return false; - return TRUE; + return true; } /* Called from main context */ @@ -1620,7 +1620,7 @@ int pa_sink_input_start_move(pa_sink_input *i) { if (pa_sink_flat_volume_enabled(i->sink)) /* We might need to update the sink's volume if we are in flat * volume mode. */ - pa_sink_set_volume(i->sink, NULL, FALSE, FALSE); + pa_sink_set_volume(i->sink, NULL, false, false); pa_assert_se(pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i->sink), PA_SINK_MESSAGE_START_MOVE, i, 0, NULL) == 0); @@ -1785,11 +1785,11 @@ static void update_volume_due_to_moving(pa_sink_input *i, pa_sink *dest) { /* If i->sink == dest, then recursion has finished, and we can finally call * pa_sink_set_volume(), which will do the rest of the updates. */ if ((i->sink == dest) && pa_sink_flat_volume_enabled(i->sink)) - pa_sink_set_volume(i->sink, NULL, FALSE, i->save_volume); + pa_sink_set_volume(i->sink, NULL, false, i->save_volume); } /* Called from main context */ -int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, pa_bool_t save) { +int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, bool save) { struct volume_factor_entry *v; void *state = NULL; @@ -1820,7 +1820,7 @@ int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, pa_bool_t save) { SINK_INPUT_MOVE_FINISH hook */ pa_log_info("Trying to change sample rate"); - if (pa_sink_update_rate(dest, i->sample_spec.rate, pa_sink_input_is_passthrough(i)) == TRUE) + if (pa_sink_update_rate(dest, i->sample_spec.rate, pa_sink_input_is_passthrough(i)) == true) pa_log_info("Rate changed to %u Hz", dest->sample_spec.rate); } @@ -1878,7 +1878,7 @@ void pa_sink_input_fail_move(pa_sink_input *i) { } /* Called from main context */ -int pa_sink_input_move_to(pa_sink_input *i, pa_sink *dest, pa_bool_t save) { +int pa_sink_input_move_to(pa_sink_input *i, pa_sink *dest, bool save) { int r; pa_sink_input_assert_ref(i); @@ -1913,7 +1913,7 @@ int pa_sink_input_move_to(pa_sink_input *i, pa_sink *dest, pa_bool_t save) { /* Called from IO thread context */ void pa_sink_input_set_state_within_thread(pa_sink_input *i, pa_sink_input_state_t state) { - pa_bool_t corking, uncorking; + bool corking, uncorking; pa_sink_input_assert_ref(i); pa_sink_input_assert_io_context(i); @@ -1937,7 +1937,7 @@ void pa_sink_input_set_state_within_thread(pa_sink_input *i, pa_sink_input_state /* This will tell the implementing sink input driver to rewind * so that the unplayed already mixed data is not lost */ - pa_sink_input_request_rewind(i, 0, TRUE, TRUE, FALSE); + pa_sink_input_request_rewind(i, 0, true, true, false); /* Set the corked state *after* requesting rewind */ i->thread_info.state = state; @@ -1955,7 +1955,7 @@ void pa_sink_input_set_state_within_thread(pa_sink_input *i, pa_sink_input_state /* OK, we're being uncorked. Make sure we're not rewound when * the hw buffer is remixed and request a remix. */ - pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); + pa_sink_input_request_rewind(i, 0, false, true, true); } else /* We may not be corking or uncorking, but we still need to set the state. */ i->thread_info.state = state; @@ -1971,14 +1971,14 @@ int pa_sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int64_t case PA_SINK_INPUT_MESSAGE_SET_SOFT_VOLUME: if (!pa_cvolume_equal(&i->thread_info.soft_volume, &i->soft_volume)) { i->thread_info.soft_volume = i->soft_volume; - pa_sink_input_request_rewind(i, 0, TRUE, FALSE, FALSE); + pa_sink_input_request_rewind(i, 0, true, false, false); } return 0; case PA_SINK_INPUT_MESSAGE_SET_SOFT_MUTE: if (i->thread_info.muted != i->muted) { i->thread_info.muted = i->muted; - pa_sink_input_request_rewind(i, 0, TRUE, FALSE, FALSE); + pa_sink_input_request_rewind(i, 0, true, false, false); } return 0; @@ -2042,36 +2042,36 @@ pa_sink_input_state_t pa_sink_input_get_state(pa_sink_input *i) { } /* Called from IO context */ -pa_bool_t pa_sink_input_safe_to_remove(pa_sink_input *i) { +bool pa_sink_input_safe_to_remove(pa_sink_input *i) { pa_sink_input_assert_ref(i); pa_sink_input_assert_io_context(i); if (PA_SINK_INPUT_IS_LINKED(i->thread_info.state)) return pa_memblockq_is_empty(i->thread_info.render_memblockq); - return TRUE; + return true; } /* Called from IO context */ void pa_sink_input_request_rewind( pa_sink_input *i, size_t nbytes /* in our sample spec */, - pa_bool_t rewrite, - pa_bool_t flush, - pa_bool_t dont_rewind_render) { + bool rewrite, + bool flush, + bool dont_rewind_render) { size_t lbq; - /* If 'rewrite' is TRUE the sink is rewound as far as requested + /* If 'rewrite' is true the sink is rewound as far as requested * and possible and the exact value of this is passed back the - * implementor via process_rewind(). If 'flush' is also TRUE all + * implementor via process_rewind(). If 'flush' is also true all * already rendered data is also dropped. * - * If 'rewrite' is FALSE the sink is rewound as far as requested + * If 'rewrite' is false the sink is rewound as far as requested * and possible and the already rendered data is dropped so that * in the next iteration we read new data from the - * implementor. This implies 'flush' is TRUE. If - * dont_rewind_render is TRUE then the render memblockq is not + * implementor. This implies 'flush' is true. If + * dont_rewind_render is true then the render memblockq is not * rewound. */ /* nbytes = 0 means maximum rewind request */ diff --git a/src/pulsecore/sink-input.h b/src/pulsecore/sink-input.h index fcd154519..4cf8614e4 100644 --- a/src/pulsecore/sink-input.h +++ b/src/pulsecore/sink-input.h @@ -45,7 +45,7 @@ typedef enum pa_sink_input_state { /* FIXME: we need a state for MOVING here */ } pa_sink_input_state_t; -static inline pa_bool_t PA_SINK_INPUT_IS_LINKED(pa_sink_input_state_t x) { +static inline bool PA_SINK_INPUT_IS_LINKED(pa_sink_input_state_t x) { return x == PA_SINK_INPUT_DRAINED || x == PA_SINK_INPUT_RUNNING || x == PA_SINK_INPUT_CORKED; } @@ -114,15 +114,15 @@ struct pa_sink_input { pa_cvolume volume_factor_sink; /* A second volume factor in format of the sink this stream is connected to. */ pa_hashmap *volume_factor_sink_items; - pa_bool_t volume_writable:1; + bool volume_writable:1; - pa_bool_t muted:1; + bool muted:1; - /* if TRUE then the sink we are connected to and/or the volume + /* if true then the sink we are connected to and/or the volume * set is worth remembering, i.e. was explicitly chosen by the * user and not automatically. module-stream-restore looks for * this.*/ - pa_bool_t save_sink:1, save_volume:1, save_muted:1; + bool save_sink:1, save_volume:1, save_muted:1; pa_resample_method_t requested_resample_method, actual_resample_method; @@ -179,11 +179,11 @@ struct pa_sink_input { /* If non-NULL called whenever the sink this input is attached * to suspends or resumes. Called from main context */ - void (*suspend) (pa_sink_input *i, pa_bool_t b); /* may be NULL */ + void (*suspend) (pa_sink_input *i, bool b); /* may be NULL */ /* If non-NULL called whenever the sink this input is attached * to suspends or resumes. Called from IO context */ - void (*suspend_within_thread) (pa_sink_input *i, pa_bool_t b); /* may be NULL */ + void (*suspend_within_thread) (pa_sink_input *i, bool b); /* may be NULL */ /* If non-NULL called whenever the sink input is moved to a new * sink. Called from main context after the sink input has been @@ -208,9 +208,9 @@ struct pa_sink_input { void (*state_change) (pa_sink_input *i, pa_sink_input_state_t state); /* may be NULL */ /* If non-NULL this function is called before this sink input is - * move to a sink and if it returns FALSE the move will not + * move to a sink and if it returns false the move will not * be allowed */ - pa_bool_t (*may_move_to) (pa_sink_input *i, pa_sink *s); /* may be NULL */ + bool (*may_move_to) (pa_sink_input *i, pa_sink *s); /* may be NULL */ /* If non-NULL this function is used to dispatch asynchronous * control events. Called from main context. */ @@ -229,12 +229,12 @@ struct pa_sink_input { pa_atomic_t drained; pa_cvolume soft_volume; - pa_bool_t muted:1; + bool muted:1; - pa_bool_t attached:1; /* True only between ->attach() and ->detach() calls */ + bool attached:1; /* True only between ->attach() and ->detach() calls */ /* rewrite_nbytes: 0: rewrite nothing, (size_t) -1: rewrite everything, otherwise how many bytes to rewrite */ - pa_bool_t rewrite_flush:1, dont_rewind_render:1; + bool rewrite_flush:1, dont_rewind_render:1; size_t rewrite_nbytes; uint64_t underrun_for, playing_for; uint64_t underrun_for_sink; /* Like underrun_for, but in sink sample spec */ @@ -300,32 +300,32 @@ typedef struct pa_sink_input_new_data { pa_idxset *nego_formats; pa_cvolume volume; - pa_bool_t muted:1; + bool muted:1; pa_hashmap *volume_factor_items, *volume_factor_sink_items; - pa_bool_t sample_spec_is_set:1; - pa_bool_t channel_map_is_set:1; + bool sample_spec_is_set:1; + bool channel_map_is_set:1; - pa_bool_t volume_is_set:1; - pa_bool_t muted_is_set:1; + bool volume_is_set:1; + bool muted_is_set:1; - pa_bool_t volume_is_absolute:1; + bool volume_is_absolute:1; - pa_bool_t volume_writable:1; + bool volume_writable:1; - pa_bool_t save_sink:1, save_volume:1, save_muted:1; + bool save_sink:1, save_volume:1, save_muted:1; } pa_sink_input_new_data; pa_sink_input_new_data* pa_sink_input_new_data_init(pa_sink_input_new_data *data); void pa_sink_input_new_data_set_sample_spec(pa_sink_input_new_data *data, const pa_sample_spec *spec); void pa_sink_input_new_data_set_channel_map(pa_sink_input_new_data *data, const pa_channel_map *map); -pa_bool_t pa_sink_input_new_data_is_passthrough(pa_sink_input_new_data *data); +bool pa_sink_input_new_data_is_passthrough(pa_sink_input_new_data *data); void pa_sink_input_new_data_set_volume(pa_sink_input_new_data *data, const pa_cvolume *volume); void pa_sink_input_new_data_add_volume_factor(pa_sink_input_new_data *data, const char *key, const pa_cvolume *volume_factor); void pa_sink_input_new_data_add_volume_factor_sink(pa_sink_input_new_data *data, const char *key, const pa_cvolume *volume_factor); -void pa_sink_input_new_data_set_muted(pa_sink_input_new_data *data, pa_bool_t mute); -pa_bool_t pa_sink_input_new_data_set_sink(pa_sink_input_new_data *data, pa_sink *s, pa_bool_t save); -pa_bool_t pa_sink_input_new_data_set_formats(pa_sink_input_new_data *data, pa_idxset *formats); +void pa_sink_input_new_data_set_muted(pa_sink_input_new_data *data, bool mute); +bool pa_sink_input_new_data_set_sink(pa_sink_input_new_data *data, pa_sink *s, bool save); +bool pa_sink_input_new_data_set_formats(pa_sink_input_new_data *data, pa_idxset *formats); void pa_sink_input_new_data_done(pa_sink_input_new_data *data); /* To be called by the implementing module only */ @@ -349,9 +349,9 @@ fully -- or at all. If the request for a rewrite was successful, the sink driver will call ->rewind() and pass the number of bytes that could be rewound in the HW device. This functionality is required for implementing the "zero latency" write-through functionality. */ -void pa_sink_input_request_rewind(pa_sink_input *i, size_t nbytes, pa_bool_t rewrite, pa_bool_t flush, pa_bool_t dont_rewind_render); +void pa_sink_input_request_rewind(pa_sink_input *i, size_t nbytes, bool rewrite, bool flush, bool dont_rewind_render); -void pa_sink_input_cork(pa_sink_input *i, pa_bool_t b); +void pa_sink_input_cork(pa_sink_input *i, bool b); int pa_sink_input_set_rate(pa_sink_input *i, uint32_t rate); int pa_sink_input_update_rate(pa_sink_input *i); @@ -367,15 +367,15 @@ void pa_sink_input_kill(pa_sink_input*i); pa_usec_t pa_sink_input_get_latency(pa_sink_input *i, pa_usec_t *sink_latency); -pa_bool_t pa_sink_input_is_passthrough(pa_sink_input *i); -pa_bool_t pa_sink_input_is_volume_readable(pa_sink_input *i); -void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume, pa_bool_t save, pa_bool_t absolute); +bool pa_sink_input_is_passthrough(pa_sink_input *i); +bool pa_sink_input_is_volume_readable(pa_sink_input *i); +void pa_sink_input_set_volume(pa_sink_input *i, const pa_cvolume *volume, bool save, bool absolute); void pa_sink_input_add_volume_factor(pa_sink_input *i, const char *key, const pa_cvolume *volume_factor); void pa_sink_input_remove_volume_factor(pa_sink_input *i, const char *key); -pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i, pa_cvolume *volume, pa_bool_t absolute); +pa_cvolume *pa_sink_input_get_volume(pa_sink_input *i, pa_cvolume *volume, bool absolute); -void pa_sink_input_set_mute(pa_sink_input *i, pa_bool_t mute, pa_bool_t save); -pa_bool_t pa_sink_input_get_mute(pa_sink_input *i); +void pa_sink_input_set_mute(pa_sink_input *i, bool mute, bool save); +bool pa_sink_input_get_mute(pa_sink_input *i); void pa_sink_input_update_proplist(pa_sink_input *i, pa_update_mode_t mode, pa_proplist *p); @@ -383,15 +383,15 @@ pa_resample_method_t pa_sink_input_get_resample_method(pa_sink_input *i); void pa_sink_input_send_event(pa_sink_input *i, const char *name, pa_proplist *data); -int pa_sink_input_move_to(pa_sink_input *i, pa_sink *dest, pa_bool_t save); -pa_bool_t pa_sink_input_may_move(pa_sink_input *i); /* may this sink input move at all? */ -pa_bool_t pa_sink_input_may_move_to(pa_sink_input *i, pa_sink *dest); /* may this sink input move to this sink? */ +int pa_sink_input_move_to(pa_sink_input *i, pa_sink *dest, bool save); +bool pa_sink_input_may_move(pa_sink_input *i); /* may this sink input move at all? */ +bool pa_sink_input_may_move_to(pa_sink_input *i, pa_sink *dest); /* may this sink input move to this sink? */ /* The same as pa_sink_input_move_to() but in two separate steps, * first the detaching from the old sink, then the attaching to the * new sink */ int pa_sink_input_start_move(pa_sink_input *i); -int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, pa_bool_t save); +int pa_sink_input_finish_move(pa_sink_input *i, pa_sink *dest, bool save); void pa_sink_input_fail_move(pa_sink_input *i); pa_sink_input_state_t pa_sink_input_get_state(pa_sink_input *i); @@ -412,7 +412,7 @@ int pa_sink_input_process_msg(pa_msgobject *o, int code, void *userdata, int64_t pa_usec_t pa_sink_input_set_requested_latency_within_thread(pa_sink_input *i, pa_usec_t usec); -pa_bool_t pa_sink_input_safe_to_remove(pa_sink_input *i); +bool pa_sink_input_safe_to_remove(pa_sink_input *i); bool pa_sink_input_process_underrun(pa_sink_input *i); pa_memchunk* pa_sink_input_get_silence(pa_sink_input *i, pa_memchunk *ret); diff --git a/src/pulsecore/sink.c b/src/pulsecore/sink.c index cf3a90eb3..902a53717 100644 --- a/src/pulsecore/sink.c +++ b/src/pulsecore/sink.c @@ -111,7 +111,7 @@ void pa_sink_new_data_set_channel_map(pa_sink_new_data *data, const pa_channel_m void pa_sink_new_data_set_alternate_sample_rate(pa_sink_new_data *data, const uint32_t alternate_sample_rate) { pa_assert(data); - data->alternate_sample_rate_is_set = TRUE; + data->alternate_sample_rate_is_set = true; data->alternate_sample_rate = alternate_sample_rate; } @@ -122,10 +122,10 @@ void pa_sink_new_data_set_volume(pa_sink_new_data *data, const pa_cvolume *volum data->volume = *volume; } -void pa_sink_new_data_set_muted(pa_sink_new_data *data, pa_bool_t mute) { +void pa_sink_new_data_set_muted(pa_sink_new_data *data, bool mute) { pa_assert(data); - data->muted_is_set = TRUE; + data->muted_is_set = true; data->muted = !!mute; } @@ -219,20 +219,20 @@ pa_sink* pa_sink_new( if (!data->volume_is_set) { pa_cvolume_reset(&data->volume, data->sample_spec.channels); - data->save_volume = FALSE; + data->save_volume = false; } pa_return_null_if_fail(pa_cvolume_valid(&data->volume)); pa_return_null_if_fail(pa_cvolume_compatible(&data->volume, &data->sample_spec)); if (!data->muted_is_set) - data->muted = FALSE; + data->muted = false; if (data->card) pa_proplist_update(data->proplist, PA_UPDATE_MERGE, data->card->proplist); pa_device_init_description(data->proplist); - pa_device_init_icon(data->proplist, TRUE); + pa_device_init_icon(data->proplist, true); pa_device_init_intended_roles(data->proplist); if (pa_hook_fire(&core->hooks[PA_CORE_HOOK_SINK_FIXATE], data) < 0) { @@ -249,7 +249,7 @@ pa_sink* pa_sink_new( s->flags = flags; s->priority = 0; s->suspend_cause = data->suspend_cause; - pa_sink_set_mixer_dirty(s, FALSE); + pa_sink_set_mixer_dirty(s, false); s->name = pa_xstrdup(name); s->proplist = pa_proplist_copy(data->proplist); s->driver = pa_xstrdup(pa_path_get_filename(data->driver)); @@ -281,7 +281,7 @@ pa_sink* pa_sink_new( s->base_volume = PA_VOLUME_NORM; s->n_volume_steps = PA_VOLUME_NORM+1; s->muted = data->muted; - s->refresh_volume = s->refresh_muted = FALSE; + s->refresh_volume = s->refresh_muted = false; reset_callbacks(s); s->userdata = NULL; @@ -294,7 +294,7 @@ pa_sink* pa_sink_new( data->ports = NULL; s->active_port = NULL; - s->save_port = FALSE; + s->save_port = false; if (data->active_port) if ((s->active_port = pa_hashmap_get(s->ports, data->active_port))) @@ -330,10 +330,10 @@ pa_sink* pa_sink_new( s->thread_info.soft_muted = s->muted; s->thread_info.state = s->state; s->thread_info.rewind_nbytes = 0; - s->thread_info.rewind_requested = FALSE; + s->thread_info.rewind_requested = false; s->thread_info.max_rewind = 0; s->thread_info.max_request = 0; - s->thread_info.requested_latency_valid = FALSE; + s->thread_info.requested_latency_valid = false; s->thread_info.requested_latency = 0; s->thread_info.min_latency = ABSOLUTE_MIN_LATENCY; s->thread_info.max_latency = ABSOLUTE_MAX_LATENCY; @@ -398,7 +398,7 @@ pa_sink* pa_sink_new( /* Called from main context */ static int sink_set_state(pa_sink *s, pa_sink_state_t state) { int ret; - pa_bool_t suspend_change; + bool suspend_change; pa_sink_state_t original_state; pa_assert(s); @@ -531,7 +531,7 @@ void pa_sink_set_set_mute_callback(pa_sink *s, pa_sink_cb_t cb) { pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index); } -static void enable_flat_volume(pa_sink *s, pa_bool_t enable) { +static void enable_flat_volume(pa_sink *s, bool enable) { pa_sink_flags_t flags; pa_assert(s); @@ -552,7 +552,7 @@ static void enable_flat_volume(pa_sink *s, pa_bool_t enable) { pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index); } -void pa_sink_enable_decibel_volume(pa_sink *s, pa_bool_t enable) { +void pa_sink_enable_decibel_volume(pa_sink *s, bool enable) { pa_sink_flags_t flags; pa_assert(s); @@ -562,10 +562,10 @@ void pa_sink_enable_decibel_volume(pa_sink *s, pa_bool_t enable) { if (enable) { s->flags |= PA_SINK_DECIBEL_VOLUME; - enable_flat_volume(s, TRUE); + enable_flat_volume(s, true); } else { s->flags &= ~PA_SINK_DECIBEL_VOLUME; - enable_flat_volume(s, FALSE); + enable_flat_volume(s, false); } /* If the flags have changed after init, let any clients know via a change event */ @@ -611,12 +611,12 @@ void pa_sink_put(pa_sink* s) { * * Note: This flag can also change over the life time of the sink. */ if (!(s->flags & PA_SINK_HW_VOLUME_CTRL) && !(s->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER)) - pa_sink_enable_decibel_volume(s, TRUE); + pa_sink_enable_decibel_volume(s, true); /* If the sink implementor support DB volumes by itself, we should always * try and enable flat volumes too */ if ((s->flags & PA_SINK_DECIBEL_VOLUME)) - enable_flat_volume(s, TRUE); + enable_flat_volume(s, true); if (s->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER) { pa_sink *root_sink = pa_sink_get_master(s); @@ -663,7 +663,7 @@ void pa_sink_put(pa_sink* s) { /* Called from main context */ void pa_sink_unlink(pa_sink* s) { - pa_bool_t linked; + bool linked; pa_sink_input *i, *j = NULL; pa_assert(s); @@ -823,12 +823,12 @@ int pa_sink_update_status(pa_sink*s) { } /* Called from any context - must be threadsafe */ -void pa_sink_set_mixer_dirty(pa_sink *s, pa_bool_t is_dirty) { +void pa_sink_set_mixer_dirty(pa_sink *s, bool is_dirty) { pa_atomic_store(&s->mixer_dirty, is_dirty ? 1 : 0); } /* Called from main context */ -int pa_sink_suspend(pa_sink *s, pa_bool_t suspend, pa_suspend_cause_t cause) { +int pa_sink_suspend(pa_sink *s, bool suspend, pa_suspend_cause_t cause) { pa_sink_assert_ref(s); pa_assert_ctl_context(); pa_assert(PA_SINK_IS_LINKED(s->state)); @@ -845,7 +845,7 @@ int pa_sink_suspend(pa_sink *s, pa_bool_t suspend, pa_suspend_cause_t cause) { if (!(s->suspend_cause & PA_SUSPEND_SESSION) && (pa_atomic_load(&s->mixer_dirty) != 0)) { /* This might look racy but isn't: If somebody sets mixer_dirty exactly here, it'll be handled just fine. */ - pa_sink_set_mixer_dirty(s, FALSE); + pa_sink_set_mixer_dirty(s, false); pa_log_debug("Mixer is now accessible. Updating alsa mixer settings."); if (s->active_port && s->set_port) { if (s->flags & PA_SINK_DEFERRED_VOLUME) { @@ -901,7 +901,7 @@ pa_queue *pa_sink_move_all_start(pa_sink *s, pa_queue *q) { } /* Called from main context */ -void pa_sink_move_all_finish(pa_sink *s, pa_queue *q, pa_bool_t save) { +void pa_sink_move_all_finish(pa_sink *s, pa_queue *q, bool save) { pa_sink_input *i; pa_sink_assert_ref(s); @@ -977,7 +977,7 @@ void pa_sink_process_rewind(pa_sink *s, size_t nbytes) { return; s->thread_info.rewind_nbytes = 0; - s->thread_info.rewind_requested = FALSE; + s->thread_info.rewind_requested = false; if (nbytes > 0) { pa_log_debug("Processing rewind..."); @@ -1376,8 +1376,8 @@ void pa_sink_render_full(pa_sink *s, size_t length, pa_memchunk *result) { } /* Called from main thread */ -pa_bool_t pa_sink_update_rate(pa_sink *s, uint32_t rate, pa_bool_t passthrough) { - pa_bool_t ret = FALSE; +bool pa_sink_update_rate(pa_sink *s, uint32_t rate, bool passthrough) { + bool ret = false; if (s->update_rate) { uint32_t desired_rate = rate; @@ -1385,29 +1385,29 @@ pa_bool_t pa_sink_update_rate(pa_sink *s, uint32_t rate, pa_bool_t passthrough) uint32_t alternate_rate = s->alternate_sample_rate; uint32_t idx; pa_sink_input *i; - pa_bool_t use_alternate = FALSE; + bool use_alternate = false; if (PA_UNLIKELY(default_rate == alternate_rate)) { pa_log_warn("Default and alternate sample rates are the same."); - return FALSE; + return false; } if (PA_SINK_IS_RUNNING(s->state)) { pa_log_info("Cannot update rate, SINK_IS_RUNNING, will keep using %u Hz", s->sample_spec.rate); - return FALSE; + return false; } if (s->monitor_source) { - if (PA_SOURCE_IS_RUNNING(s->monitor_source->state) == TRUE) { + if (PA_SOURCE_IS_RUNNING(s->monitor_source->state) == true) { pa_log_info("Cannot update rate, monitor source is RUNNING"); - return FALSE; + return false; } } if (PA_UNLIKELY (desired_rate < 8000 || desired_rate > PA_RATE_MAX)) - return FALSE; + return false; if (!passthrough) { pa_assert(default_rate % 4000 || default_rate % 11025); @@ -1416,11 +1416,11 @@ pa_bool_t pa_sink_update_rate(pa_sink *s, uint32_t rate, pa_bool_t passthrough) if (default_rate % 4000) { /* default is a 11025 multiple */ if ((alternate_rate % 4000 == 0) && (desired_rate % 4000 == 0)) - use_alternate=TRUE; + use_alternate=true; } else { /* default is 4000 multiple */ if ((alternate_rate % 11025 == 0) && (desired_rate % 11025 == 0)) - use_alternate=TRUE; + use_alternate=true; } if (use_alternate) @@ -1432,18 +1432,18 @@ pa_bool_t pa_sink_update_rate(pa_sink *s, uint32_t rate, pa_bool_t passthrough) } if (desired_rate == s->sample_spec.rate) - return FALSE; + return false; if (!passthrough && pa_sink_used_by(s) > 0) - return FALSE; + return false; pa_log_debug("Suspending sink %s due to changing the sample rate.", s->name); - pa_sink_suspend(s, TRUE, PA_SUSPEND_INTERNAL); + pa_sink_suspend(s, true, PA_SUSPEND_INTERNAL); - if (s->update_rate(s, desired_rate) == TRUE) { + if (s->update_rate(s, desired_rate) == true) { /* update monitor source as well */ if (s->monitor_source && !passthrough) - pa_source_update_rate(s->monitor_source, desired_rate, FALSE); + pa_source_update_rate(s->monitor_source, desired_rate, false); pa_log_info("Changed sampling rate successfully"); PA_IDXSET_FOREACH(i, s->inputs, idx) { @@ -1451,10 +1451,10 @@ pa_bool_t pa_sink_update_rate(pa_sink *s, uint32_t rate, pa_bool_t passthrough) pa_sink_input_update_rate(i); } - ret = TRUE; + ret = true; } - pa_sink_suspend(s, FALSE, PA_SUSPEND_INTERNAL); + pa_sink_suspend(s, false, PA_SUSPEND_INTERNAL); } return ret ; @@ -1528,7 +1528,7 @@ pa_usec_t pa_sink_get_latency_within_thread(pa_sink *s) { * When a sink uses volume sharing, it never has the PA_SINK_FLAT_VOLUME flag * set. Instead, flat volume mode is detected by checking whether the root sink * has the flag set. */ -pa_bool_t pa_sink_flat_volume_enabled(pa_sink *s) { +bool pa_sink_flat_volume_enabled(pa_sink *s) { pa_sink_assert_ref(s); s = pa_sink_get_master(s); @@ -1536,7 +1536,7 @@ pa_bool_t pa_sink_flat_volume_enabled(pa_sink *s) { if (PA_LIKELY(s)) return (s->flags & PA_SINK_FLAT_VOLUME); else - return FALSE; + return false; } /* Called from the main thread (and also from the IO thread while the main @@ -1555,7 +1555,7 @@ pa_sink *pa_sink_get_master(pa_sink *s) { } /* Called from main context */ -pa_bool_t pa_sink_is_passthrough(pa_sink *s) { +bool pa_sink_is_passthrough(pa_sink *s) { pa_sink_input *alt_i; uint32_t idx; @@ -1566,10 +1566,10 @@ pa_bool_t pa_sink_is_passthrough(pa_sink *s) { alt_i = pa_idxset_first(s->inputs, &idx); if (pa_sink_input_is_passthrough(alt_i)) - return TRUE; + return true; } - return FALSE; + return false; } /* Called from main context */ @@ -1579,15 +1579,15 @@ void pa_sink_enter_passthrough(pa_sink *s) { /* disable the monitor in passthrough mode */ if (s->monitor_source) { pa_log_debug("Suspending monitor source %s, because the sink is entering the passthrough mode.", s->monitor_source->name); - pa_source_suspend(s->monitor_source, TRUE, PA_SUSPEND_PASSTHROUGH); + pa_source_suspend(s->monitor_source, true, PA_SUSPEND_PASSTHROUGH); } /* set the volume to NORM */ - s->saved_volume = *pa_sink_get_volume(s, TRUE); + s->saved_volume = *pa_sink_get_volume(s, true); s->saved_save_volume = s->save_volume; pa_cvolume_set(&volume, s->sample_spec.channels, PA_MIN(s->base_volume, PA_VOLUME_NORM)); - pa_sink_set_volume(s, &volume, TRUE, FALSE); + pa_sink_set_volume(s, &volume, true, false); } /* Called from main context */ @@ -1595,14 +1595,14 @@ void pa_sink_leave_passthrough(pa_sink *s) { /* Unsuspend monitor */ if (s->monitor_source) { pa_log_debug("Resuming monitor source %s, because the sink is leaving the passthrough mode.", s->monitor_source->name); - pa_source_suspend(s->monitor_source, FALSE, PA_SUSPEND_PASSTHROUGH); + pa_source_suspend(s->monitor_source, false, PA_SUSPEND_PASSTHROUGH); } /* Restore sink volume to what it was before we entered passthrough mode */ - pa_sink_set_volume(s, &s->saved_volume, TRUE, s->saved_save_volume); + pa_sink_set_volume(s, &s->saved_volume, true, s->saved_save_volume); pa_cvolume_init(&s->saved_volume); - s->saved_save_volume = FALSE; + s->saved_save_volume = false; } /* Called from main context. */ @@ -1800,7 +1800,7 @@ static void get_maximum_input_volume(pa_sink *s, pa_cvolume *max_volume, const p /* Called from main thread. Only called for the root sink in volume sharing * cases, except for internal recursive calls. */ -static pa_bool_t has_inputs(pa_sink *s) { +static bool has_inputs(pa_sink *s) { pa_sink_input *i; uint32_t idx; @@ -1808,10 +1808,10 @@ static pa_bool_t has_inputs(pa_sink *s) { PA_IDXSET_FOREACH(i, s->inputs, idx) { if (!i->origin_sink || !(i->origin_sink->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER) || has_inputs(i->origin_sink)) - return TRUE; + return true; } - return FALSE; + return false; } /* Called from main thread. Only called for the root sink in volume sharing @@ -1933,9 +1933,9 @@ static void propagate_reference_volume(pa_sink *s) { /* Called from main thread. Only called for the root sink in volume sharing * cases, except for internal recursive calls. The return value indicates * whether any reference volume actually changed. */ -static pa_bool_t update_reference_volume(pa_sink *s, const pa_cvolume *v, const pa_channel_map *channel_map, pa_bool_t save) { +static bool update_reference_volume(pa_sink *s, const pa_cvolume *v, const pa_channel_map *channel_map, bool save) { pa_cvolume volume; - pa_bool_t reference_volume_changed; + bool reference_volume_changed; pa_sink_input *i; uint32_t idx; @@ -1966,24 +1966,24 @@ static pa_bool_t update_reference_volume(pa_sink *s, const pa_cvolume *v, const * intermediate sink that didn't change its volume. This theoretical * possibility is the reason why we have that !(s->flags & * PA_SINK_SHARE_VOLUME_WITH_MASTER) condition. Probably nobody would - * notice even if we returned here FALSE always if - * reference_volume_changed is FALSE. */ - return FALSE; + * notice even if we returned here false always if + * reference_volume_changed is false. */ + return false; PA_IDXSET_FOREACH(i, s->inputs, idx) { if (i->origin_sink && (i->origin_sink->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER)) - update_reference_volume(i->origin_sink, v, channel_map, FALSE); + update_reference_volume(i->origin_sink, v, channel_map, false); } - return TRUE; + return true; } /* Called from main thread */ void pa_sink_set_volume( pa_sink *s, const pa_cvolume *volume, - pa_bool_t send_msg, - pa_bool_t save) { + bool send_msg, + bool save) { pa_cvolume new_reference_volume; pa_sink *root_sink; @@ -2117,7 +2117,7 @@ static void propagate_real_volume(pa_sink *s, const pa_cvolume *old_real_volume) return; /* 1. Make the real volume the reference volume */ - update_reference_volume(s, &s->real_volume, &s->channel_map, TRUE); + update_reference_volume(s, &s->real_volume, &s->channel_map, true); } if (pa_sink_flat_volume_enabled(s)) { @@ -2159,7 +2159,7 @@ static void propagate_real_volume(pa_sink *s, const pa_cvolume *old_real_volume) * to save changed hw settings given that hw volume changes not * triggered by PA are almost certainly done by the user. */ if (!(s->flags & PA_SINK_SHARE_VOLUME_WITH_MASTER)) - s->save_volume = TRUE; + s->save_volume = true; } /* Called from io thread */ @@ -2171,7 +2171,7 @@ void pa_sink_update_volume_and_mute(pa_sink *s) { } /* Called from main thread */ -const pa_cvolume *pa_sink_get_volume(pa_sink *s, pa_bool_t force_refresh) { +const pa_cvolume *pa_sink_get_volume(pa_sink *s, bool force_refresh) { pa_sink_assert_ref(s); pa_assert_ctl_context(); pa_assert(PA_SINK_IS_LINKED(s->state)); @@ -2213,8 +2213,8 @@ void pa_sink_volume_changed(pa_sink *s, const pa_cvolume *new_real_volume) { } /* Called from main thread */ -void pa_sink_set_mute(pa_sink *s, pa_bool_t mute, pa_bool_t save) { - pa_bool_t old_muted; +void pa_sink_set_mute(pa_sink *s, bool mute, bool save) { + bool old_muted; pa_sink_assert_ref(s); pa_assert_ctl_context(); @@ -2234,14 +2234,14 @@ void pa_sink_set_mute(pa_sink *s, pa_bool_t mute, pa_bool_t save) { } /* Called from main thread */ -pa_bool_t pa_sink_get_mute(pa_sink *s, pa_bool_t force_refresh) { +bool pa_sink_get_mute(pa_sink *s, bool force_refresh) { pa_sink_assert_ref(s); pa_assert_ctl_context(); pa_assert(PA_SINK_IS_LINKED(s->state)); if (s->refresh_muted || force_refresh) { - pa_bool_t old_muted = s->muted; + bool old_muted = s->muted; if (!(s->flags & PA_SINK_DEFERRED_VOLUME) && s->get_mute) s->get_mute(s); @@ -2249,7 +2249,7 @@ pa_bool_t pa_sink_get_mute(pa_sink *s, pa_bool_t force_refresh) { pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SINK_MESSAGE_GET_MUTE, NULL, 0, NULL) == 0); if (old_muted != s->muted) { - s->save_muted = TRUE; + s->save_muted = true; pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index); @@ -2262,7 +2262,7 @@ pa_bool_t pa_sink_get_mute(pa_sink *s, pa_bool_t force_refresh) { } /* Called from main thread */ -void pa_sink_mute_changed(pa_sink *s, pa_bool_t new_muted) { +void pa_sink_mute_changed(pa_sink *s, bool new_muted) { pa_sink_assert_ref(s); pa_assert_ctl_context(); pa_assert(PA_SINK_IS_LINKED(s->state)); @@ -2273,13 +2273,13 @@ void pa_sink_mute_changed(pa_sink *s, pa_bool_t new_muted) { return; s->muted = new_muted; - s->save_muted = TRUE; + s->save_muted = true; pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index); } /* Called from main thread */ -pa_bool_t pa_sink_update_proplist(pa_sink *s, pa_update_mode_t mode, pa_proplist *p) { +bool pa_sink_update_proplist(pa_sink *s, pa_update_mode_t mode, pa_proplist *p) { pa_sink_assert_ref(s); pa_assert_ctl_context(); @@ -2291,7 +2291,7 @@ pa_bool_t pa_sink_update_proplist(pa_sink *s, pa_update_mode_t mode, pa_proplist pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK|PA_SUBSCRIPTION_EVENT_CHANGE, s->index); } - return TRUE; + return true; } /* Called from main thread */ @@ -2419,7 +2419,7 @@ static void sync_input_volumes_within_thread(pa_sink *s) { continue; i->thread_info.soft_volume = i->soft_volume; - pa_sink_input_request_rewind(i, 0, TRUE, FALSE, FALSE); + pa_sink_input_request_rewind(i, 0, true, false, false); } } @@ -2472,7 +2472,7 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse } pa_assert(!i->thread_info.attached); - i->thread_info.attached = TRUE; + i->thread_info.attached = true; if (i->attach) i->attach(i); @@ -2523,7 +2523,7 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse pa_sink_input_set_state_within_thread(i, i->state); pa_assert(i->thread_info.attached); - i->thread_info.attached = FALSE; + i->thread_info.attached = false; /* Since the caller sleeps in pa_sink_input_unlink(), * we can safely access data outside of thread_info even @@ -2545,7 +2545,7 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse if (pa_hashmap_remove(s->thread_info.inputs, PA_UINT32_TO_PTR(i->index))) pa_sink_input_unref(i); - pa_sink_invalidate_requested_latency(s, TRUE); + pa_sink_invalidate_requested_latency(s, true); pa_sink_request_rewind(s, (size_t) -1); /* In flat volume mode we need to update the volume as @@ -2613,7 +2613,7 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse if (total_nbytes > 0) { i->thread_info.rewrite_nbytes = i->thread_info.resampler ? pa_resampler_request(i->thread_info.resampler, total_nbytes) : total_nbytes; - i->thread_info.rewrite_flush = TRUE; + i->thread_info.rewrite_flush = true; pa_sink_input_process_rewind(i, sink_nbytes); } } @@ -2622,13 +2622,13 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse i->detach(i); pa_assert(i->thread_info.attached); - i->thread_info.attached = FALSE; + i->thread_info.attached = false; /* Let's remove the sink input ...*/ if (pa_hashmap_remove(s->thread_info.inputs, PA_UINT32_TO_PTR(i->index))) pa_sink_input_unref(i); - pa_sink_invalidate_requested_latency(s, TRUE); + pa_sink_invalidate_requested_latency(s, true); pa_log_debug("Requesting rewind due to started move"); pa_sink_request_rewind(s, (size_t) -1); @@ -2650,7 +2650,7 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse pa_hashmap_put(s->thread_info.inputs, PA_UINT32_TO_PTR(i->index), pa_sink_input_ref(i)); pa_assert(!i->thread_info.attached); - i->thread_info.attached = TRUE; + i->thread_info.attached = true; if (i->attach) i->attach(i); @@ -2769,7 +2769,7 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse case PA_SINK_MESSAGE_SET_STATE: { - pa_bool_t suspend_change = + bool suspend_change = (s->thread_info.state == PA_SINK_SUSPENDED && PA_SINK_IS_OPENED(PA_PTR_TO_UINT(userdata))) || (PA_SINK_IS_OPENED(s->thread_info.state) && PA_PTR_TO_UINT(userdata) == PA_SINK_SUSPENDED); @@ -2777,7 +2777,7 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse if (s->thread_info.state == PA_SINK_SUSPENDED) { s->thread_info.rewind_nbytes = 0; - s->thread_info.rewind_requested = FALSE; + s->thread_info.rewind_requested = false; } if (suspend_change) { @@ -2882,8 +2882,8 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse if (!PA_SINK_IS_LINKED(s->state)) return 0; - pa_sink_get_volume(s, TRUE); - pa_sink_get_mute(s, TRUE); + pa_sink_get_volume(s, true); + pa_sink_get_mute(s, true); return 0; case PA_SINK_MESSAGE_SET_LATENCY_OFFSET: @@ -2899,7 +2899,7 @@ int pa_sink_process_msg(pa_msgobject *o, int code, void *userdata, int64_t offse } /* Called from main thread */ -int pa_sink_suspend_all(pa_core *c, pa_bool_t suspend, pa_suspend_cause_t cause) { +int pa_sink_suspend_all(pa_core *c, bool suspend, pa_suspend_cause_t cause) { pa_sink *sink; uint32_t idx; int ret = 0; @@ -2986,7 +2986,7 @@ void pa_sink_request_rewind(pa_sink*s, size_t nbytes) { return; s->thread_info.rewind_nbytes = nbytes; - s->thread_info.rewind_requested = TRUE; + s->thread_info.rewind_requested = true; if (s->request_rewind) s->request_rewind(s); @@ -3025,7 +3025,7 @@ pa_usec_t pa_sink_get_requested_latency_within_thread(pa_sink *s) { if (PA_SINK_IS_LINKED(s->thread_info.state)) { /* Only cache if properly initialized */ s->thread_info.requested_latency = result; - s->thread_info.requested_latency_valid = TRUE; + s->thread_info.requested_latency_valid = true; } return result; @@ -3111,7 +3111,7 @@ void pa_sink_set_max_request(pa_sink *s, size_t max_request) { } /* Called from IO thread */ -void pa_sink_invalidate_requested_latency(pa_sink *s, pa_bool_t dynamic) { +void pa_sink_invalidate_requested_latency(pa_sink *s, bool dynamic) { pa_sink_input *i; void *state = NULL; @@ -3119,7 +3119,7 @@ void pa_sink_invalidate_requested_latency(pa_sink *s, pa_bool_t dynamic) { pa_sink_assert_io_context(s); if ((s->flags & PA_SINK_DYNAMIC_LATENCY)) - s->thread_info.requested_latency_valid = FALSE; + s->thread_info.requested_latency_valid = false; else if (dynamic) return; @@ -3219,7 +3219,7 @@ void pa_sink_set_latency_range_within_thread(pa_sink *s, pa_usec_t min_latency, i->update_sink_latency_range(i); } - pa_sink_invalidate_requested_latency(s, FALSE); + pa_sink_invalidate_requested_latency(s, false); pa_source_set_latency_range_within_thread(s->monitor_source, min_latency, max_latency); } @@ -3298,7 +3298,7 @@ void pa_sink_set_fixed_latency_within_thread(pa_sink *s, pa_usec_t latency) { i->update_sink_fixed_latency(i); } - pa_sink_invalidate_requested_latency(s, FALSE); + pa_sink_invalidate_requested_latency(s, false); pa_source_set_fixed_latency_within_thread(s->monitor_source, latency); } @@ -3344,7 +3344,7 @@ size_t pa_sink_get_max_request(pa_sink *s) { } /* Called from main context */ -int pa_sink_set_port(pa_sink *s, const char *name, pa_bool_t save) { +int pa_sink_set_port(pa_sink *s, const char *name, bool save) { pa_device_port *port; int ret; @@ -3392,13 +3392,13 @@ int pa_sink_set_port(pa_sink *s, const char *name, pa_bool_t save) { return 0; } -pa_bool_t pa_device_init_icon(pa_proplist *p, pa_bool_t is_sink) { +bool pa_device_init_icon(pa_proplist *p, bool is_sink) { const char *ff, *c, *t = NULL, *s = "", *profile, *bus; pa_assert(p); if (pa_proplist_contains(p, PA_PROP_DEVICE_ICON_NAME)) - return TRUE; + return true; if ((ff = pa_proplist_gets(p, PA_PROP_DEVICE_FORM_FACTOR))) { @@ -3456,15 +3456,15 @@ pa_bool_t pa_device_init_icon(pa_proplist *p, pa_bool_t is_sink) { pa_proplist_setf(p, PA_PROP_DEVICE_ICON_NAME, "%s%s%s%s", t, pa_strempty(s), bus ? "-" : "", pa_strempty(bus)); - return TRUE; + return true; } -pa_bool_t pa_device_init_description(pa_proplist *p) { +bool pa_device_init_description(pa_proplist *p) { const char *s, *d = NULL, *k; pa_assert(p); if (pa_proplist_contains(p, PA_PROP_DEVICE_DESCRIPTION)) - return TRUE; + return true; if ((s = pa_proplist_gets(p, PA_PROP_DEVICE_FORM_FACTOR))) if (pa_streq(s, "internal")) @@ -3479,7 +3479,7 @@ pa_bool_t pa_device_init_description(pa_proplist *p) { d = pa_proplist_gets(p, PA_PROP_DEVICE_PRODUCT_NAME); if (!d) - return FALSE; + return false; k = pa_proplist_gets(p, PA_PROP_DEVICE_PROFILE_DESCRIPTION); @@ -3488,24 +3488,24 @@ pa_bool_t pa_device_init_description(pa_proplist *p) { else if (d) pa_proplist_sets(p, PA_PROP_DEVICE_DESCRIPTION, d); - return TRUE; + return true; } -pa_bool_t pa_device_init_intended_roles(pa_proplist *p) { +bool pa_device_init_intended_roles(pa_proplist *p) { const char *s; pa_assert(p); if (pa_proplist_contains(p, PA_PROP_DEVICE_INTENDED_ROLES)) - return TRUE; + return true; if ((s = pa_proplist_gets(p, PA_PROP_DEVICE_FORM_FACTOR))) if (pa_streq(s, "handset") || pa_streq(s, "hands-free") || pa_streq(s, "headset")) { pa_proplist_sets(p, PA_PROP_DEVICE_INTENDED_ROLES, "phone"); - return TRUE; + return true; } - return FALSE; + return false; } unsigned pa_device_init_priority(pa_proplist *p) { @@ -3657,9 +3657,9 @@ static void pa_sink_volume_change_flush(pa_sink *s) { } /* Called from the IO thread. */ -pa_bool_t pa_sink_volume_change_apply(pa_sink *s, pa_usec_t *usec_to_next) { +bool pa_sink_volume_change_apply(pa_sink *s, pa_usec_t *usec_to_next) { pa_usec_t now; - pa_bool_t ret = FALSE; + bool ret = false; pa_assert(s); @@ -3678,7 +3678,7 @@ pa_bool_t pa_sink_volume_change_apply(pa_sink *s, pa_usec_t *usec_to_next) { PA_LLIST_REMOVE(pa_sink_volume_change, s->thread_info.volume_changes, c); pa_log_debug("Volume change to %d at %llu was written %llu usec late", pa_cvolume_avg(&c->hw_volume), (long long unsigned) c->at, (long long unsigned) (now - c->at)); - ret = TRUE; + ret = true; s->thread_info.current_hw_volume = c->hw_volume; pa_sink_volume_change_free(c); } @@ -3753,7 +3753,7 @@ pa_idxset* pa_sink_get_formats(pa_sink *s) { /* Called from the main thread */ /* Allows an external source to set what formats a sink supports if the sink * permits this. The function makes a copy of the formats on success. */ -pa_bool_t pa_sink_set_formats(pa_sink *s, pa_idxset *formats) { +bool pa_sink_set_formats(pa_sink *s, pa_idxset *formats) { pa_assert(s); pa_assert(formats); @@ -3762,14 +3762,14 @@ pa_bool_t pa_sink_set_formats(pa_sink *s, pa_idxset *formats) { return s->set_formats(s, formats); else /* Sink doesn't support setting this -- bail out */ - return FALSE; + return false; } /* Called from the main thread */ /* Checks if the sink can accept this format */ -pa_bool_t pa_sink_check_format(pa_sink *s, pa_format_info *f) { +bool pa_sink_check_format(pa_sink *s, pa_format_info *f) { pa_idxset *formats = NULL; - pa_bool_t ret = FALSE; + bool ret = false; pa_assert(s); pa_assert(f); @@ -3782,7 +3782,7 @@ pa_bool_t pa_sink_check_format(pa_sink *s, pa_format_info *f) { PA_IDXSET_FOREACH(finfo_device, formats, i) { if (pa_format_info_is_compatible(finfo_device, f)) { - ret = TRUE; + ret = true; break; } } diff --git a/src/pulsecore/sink.h b/src/pulsecore/sink.h index 3c0fc39b9..54056a7a6 100644 --- a/src/pulsecore/sink.h +++ b/src/pulsecore/sink.h @@ -51,7 +51,7 @@ typedef struct pa_sink_volume_change pa_sink_volume_change; #define PA_MAX_INPUTS_PER_SINK 32 /* Returns true if sink is linked: registered and accessible from client side. */ -static inline pa_bool_t PA_SINK_IS_LINKED(pa_sink_state_t x) { +static inline bool PA_SINK_IS_LINKED(pa_sink_state_t x) { return x == PA_SINK_RUNNING || x == PA_SINK_IDLE || x == PA_SINK_SUSPENDED; } @@ -93,17 +93,17 @@ struct pa_sink { pa_cvolume real_volume; /* The volume that the hardware is configured to */ pa_cvolume soft_volume; /* The internal software volume we apply to all PCM data while it passes through */ - pa_bool_t muted:1; + bool muted:1; - pa_bool_t refresh_volume:1; - pa_bool_t refresh_muted:1; - pa_bool_t save_port:1; - pa_bool_t save_volume:1; - pa_bool_t save_muted:1; + bool refresh_volume:1; + bool refresh_muted:1; + bool save_port:1; + bool save_volume:1; + bool save_muted:1; /* Saved volume state while we're in passthrough mode */ pa_cvolume saved_volume; - pa_bool_t saved_save_volume:1; + bool saved_save_volume:1; pa_asyncmsgq *asyncmsgq; @@ -191,7 +191,7 @@ struct pa_sink { /* Called when the mute setting is queried. A PA_SINK_MESSAGE_GET_MUTE * message will also be sent. Called from IO thread if PA_SINK_DEFERRED_VOLUME - * flag is set otherwise from main loop context. If refresh_mute is FALSE + * flag is set otherwise from main loop context. If refresh_mute is false * neither this function is called nor a message is sent. * * You must use the function pa_sink_set_get_mute_callback() to @@ -223,14 +223,14 @@ struct pa_sink { pa_idxset* (*get_formats)(pa_sink *s); /* may be NULL */ /* Called to set the list of formats supported by the sink. Can be - * NULL if the sink does not support this. Returns TRUE on success, - * FALSE otherwise (for example when an unsupportable format is + * NULL if the sink does not support this. Returns true on success, + * false otherwise (for example when an unsupportable format is * set). Makes a copy of the formats passed in. */ - pa_bool_t (*set_formats)(pa_sink *s, pa_idxset *formats); /* may be NULL */ + bool (*set_formats)(pa_sink *s, pa_idxset *formats); /* may be NULL */ /* Called whenever the sampling frequency shall be changed. Called from * main thread. */ - pa_bool_t (*update_rate)(pa_sink *s, uint32_t rate); + bool (*update_rate)(pa_sink *s, uint32_t rate); /* Contains copies of the above data so that the real-time worker * thread can work without access locking */ @@ -241,12 +241,12 @@ struct pa_sink { pa_rtpoll *rtpoll; pa_cvolume soft_volume; - pa_bool_t soft_muted:1; + bool soft_muted:1; /* The requested latency is used for dynamic latency * sinks. For fixed latency sinks it is always identical to * the fixed_latency. See below. */ - pa_bool_t requested_latency_valid:1; + bool requested_latency_valid:1; pa_usec_t requested_latency; /* The number of bytes streams need to keep around as history to @@ -259,7 +259,7 @@ struct pa_sink { /* Maximum of what clients requested to rewind in this cycle */ size_t rewind_nbytes; - pa_bool_t rewind_requested; + bool rewind_requested; /* Both dynamic and fixed latencies will be clamped to this * range. */ @@ -344,19 +344,19 @@ typedef struct pa_sink_new_data { pa_channel_map channel_map; uint32_t alternate_sample_rate; pa_cvolume volume; - pa_bool_t muted :1; + bool muted :1; - pa_bool_t sample_spec_is_set:1; - pa_bool_t channel_map_is_set:1; - pa_bool_t alternate_sample_rate_is_set:1; - pa_bool_t volume_is_set:1; - pa_bool_t muted_is_set:1; + bool sample_spec_is_set:1; + bool channel_map_is_set:1; + bool alternate_sample_rate_is_set:1; + bool volume_is_set:1; + bool muted_is_set:1; - pa_bool_t namereg_fail:1; + bool namereg_fail:1; - pa_bool_t save_port:1; - pa_bool_t save_volume:1; - pa_bool_t save_muted:1; + bool save_port:1; + bool save_volume:1; + bool save_muted:1; } pa_sink_new_data; pa_sink_new_data* pa_sink_new_data_init(pa_sink_new_data *data); @@ -365,7 +365,7 @@ void pa_sink_new_data_set_sample_spec(pa_sink_new_data *data, const pa_sample_sp void pa_sink_new_data_set_channel_map(pa_sink_new_data *data, const pa_channel_map *map); void pa_sink_new_data_set_alternate_sample_rate(pa_sink_new_data *data, const uint32_t alternate_sample_rate); void pa_sink_new_data_set_volume(pa_sink_new_data *data, const pa_cvolume *volume); -void pa_sink_new_data_set_muted(pa_sink_new_data *data, pa_bool_t mute); +void pa_sink_new_data_set_muted(pa_sink_new_data *data, bool mute); void pa_sink_new_data_set_port(pa_sink_new_data *data, const char *port); void pa_sink_new_data_done(pa_sink_new_data *data); @@ -381,7 +381,7 @@ void pa_sink_set_set_volume_callback(pa_sink *s, pa_sink_cb_t cb); void pa_sink_set_write_volume_callback(pa_sink *s, pa_sink_cb_t cb); void pa_sink_set_get_mute_callback(pa_sink *s, pa_sink_cb_t cb); void pa_sink_set_set_mute_callback(pa_sink *s, pa_sink_cb_t cb); -void pa_sink_enable_decibel_volume(pa_sink *s, pa_bool_t enable); +void pa_sink_enable_decibel_volume(pa_sink *s, bool enable); void pa_sink_put(pa_sink *s); void pa_sink_unlink(pa_sink* s); @@ -400,18 +400,18 @@ void pa_sink_attach(pa_sink *s); void pa_sink_set_soft_volume(pa_sink *s, const pa_cvolume *volume); void pa_sink_volume_changed(pa_sink *s, const pa_cvolume *new_volume); -void pa_sink_mute_changed(pa_sink *s, pa_bool_t new_muted); +void pa_sink_mute_changed(pa_sink *s, bool new_muted); void pa_sink_update_flags(pa_sink *s, pa_sink_flags_t mask, pa_sink_flags_t value); -pa_bool_t pa_device_init_description(pa_proplist *p); -pa_bool_t pa_device_init_icon(pa_proplist *p, pa_bool_t is_sink); -pa_bool_t pa_device_init_intended_roles(pa_proplist *p); +bool pa_device_init_description(pa_proplist *p); +bool pa_device_init_icon(pa_proplist *p, bool is_sink); +bool pa_device_init_intended_roles(pa_proplist *p); unsigned pa_device_init_priority(pa_proplist *p); /**** May be called by everyone, from main context */ -pa_bool_t pa_sink_update_rate(pa_sink *s, uint32_t rate, pa_bool_t passthrough); +bool pa_sink_update_rate(pa_sink *s, uint32_t rate, bool passthrough); void pa_sink_set_latency_offset(pa_sink *s, int64_t offset); /* The returned value is supposed to be in the time domain of the sound card! */ @@ -424,32 +424,32 @@ size_t pa_sink_get_max_rewind(pa_sink *s); size_t pa_sink_get_max_request(pa_sink *s); int pa_sink_update_status(pa_sink*s); -int pa_sink_suspend(pa_sink *s, pa_bool_t suspend, pa_suspend_cause_t cause); -int pa_sink_suspend_all(pa_core *c, pa_bool_t suspend, pa_suspend_cause_t cause); +int pa_sink_suspend(pa_sink *s, bool suspend, pa_suspend_cause_t cause); +int pa_sink_suspend_all(pa_core *c, bool suspend, pa_suspend_cause_t cause); /* Use this instead of checking s->flags & PA_SINK_FLAT_VOLUME directly. */ -pa_bool_t pa_sink_flat_volume_enabled(pa_sink *s); +bool pa_sink_flat_volume_enabled(pa_sink *s); /* Get the master sink when sharing volumes */ pa_sink *pa_sink_get_master(pa_sink *s); /* Is the sink in passthrough mode? (that is, is there a passthrough sink input * connected to this sink? */ -pa_bool_t pa_sink_is_passthrough(pa_sink *s); +bool pa_sink_is_passthrough(pa_sink *s); /* These should be called when a sink enters/leaves passthrough mode */ void pa_sink_enter_passthrough(pa_sink *s); void pa_sink_leave_passthrough(pa_sink *s); -void pa_sink_set_volume(pa_sink *sink, const pa_cvolume *volume, pa_bool_t sendmsg, pa_bool_t save); -const pa_cvolume *pa_sink_get_volume(pa_sink *sink, pa_bool_t force_refresh); +void pa_sink_set_volume(pa_sink *sink, const pa_cvolume *volume, bool sendmsg, bool save); +const pa_cvolume *pa_sink_get_volume(pa_sink *sink, bool force_refresh); -void pa_sink_set_mute(pa_sink *sink, pa_bool_t mute, pa_bool_t save); -pa_bool_t pa_sink_get_mute(pa_sink *sink, pa_bool_t force_refresh); +void pa_sink_set_mute(pa_sink *sink, bool mute, bool save); +bool pa_sink_get_mute(pa_sink *sink, bool force_refresh); -pa_bool_t pa_sink_update_proplist(pa_sink *s, pa_update_mode_t mode, pa_proplist *p); +bool pa_sink_update_proplist(pa_sink *s, pa_update_mode_t mode, pa_proplist *p); -int pa_sink_set_port(pa_sink *s, const char *name, pa_bool_t save); -void pa_sink_set_mixer_dirty(pa_sink *s, pa_bool_t is_dirty); +int pa_sink_set_port(pa_sink *s, const char *name, bool save); +void pa_sink_set_mixer_dirty(pa_sink *s, bool is_dirty); unsigned pa_sink_linked_by(pa_sink *s); /* Number of connected streams */ unsigned pa_sink_used_by(pa_sink *s); /* Number of connected streams which are not corked */ @@ -458,12 +458,12 @@ unsigned pa_sink_check_suspend(pa_sink *s); /* Returns how many streams are acti /* Moves all inputs away, and stores them in pa_queue */ pa_queue *pa_sink_move_all_start(pa_sink *s, pa_queue *q); -void pa_sink_move_all_finish(pa_sink *s, pa_queue *q, pa_bool_t save); +void pa_sink_move_all_finish(pa_sink *s, pa_queue *q, bool save); void pa_sink_move_all_fail(pa_queue *q); pa_idxset* pa_sink_get_formats(pa_sink *s); -pa_bool_t pa_sink_set_formats(pa_sink *s, pa_idxset *formats); -pa_bool_t pa_sink_check_format(pa_sink *s, pa_format_info *f); +bool pa_sink_set_formats(pa_sink *s, pa_idxset *formats); +bool pa_sink_check_format(pa_sink *s, pa_format_info *f); pa_idxset* pa_sink_check_formats(pa_sink *s, pa_idxset *in_formats); /*** To be called exclusively by the sink driver, from IO context */ @@ -490,7 +490,7 @@ void pa_sink_set_fixed_latency_within_thread(pa_sink *s, pa_usec_t latency); void pa_sink_update_volume_and_mute(pa_sink *s); -pa_bool_t pa_sink_volume_change_apply(pa_sink *s, pa_usec_t *usec_to_next); +bool pa_sink_volume_change_apply(pa_sink *s, pa_usec_t *usec_to_next); size_t pa_sink_process_input_underruns(pa_sink *s, size_t left_to_play); @@ -498,7 +498,7 @@ size_t pa_sink_process_input_underruns(pa_sink *s, size_t left_to_play); void pa_sink_request_rewind(pa_sink*s, size_t nbytes); -void pa_sink_invalidate_requested_latency(pa_sink *s, pa_bool_t dynamic); +void pa_sink_invalidate_requested_latency(pa_sink *s, bool dynamic); pa_usec_t pa_sink_get_latency_within_thread(pa_sink *s); diff --git a/src/pulsecore/socket-client.c b/src/pulsecore/socket-client.c index a12757a8d..564a36688 100644 --- a/src/pulsecore/socket-client.c +++ b/src/pulsecore/socket-client.c @@ -78,7 +78,7 @@ struct pa_socket_client { pa_socket_client_cb_t callback; void *userdata; - pa_bool_t local; + bool local; #ifdef HAVE_LIBASYNCNS asyncns_t *asyncns; @@ -418,7 +418,7 @@ static void timeout_cb(pa_mainloop_api *m, pa_time_event *e, const struct timeva do_call(c); } -static void start_timeout(pa_socket_client *c, pa_bool_t use_rtclock) { +static void start_timeout(pa_socket_client *c, bool use_rtclock) { struct timeval tv; pa_assert(c); @@ -427,7 +427,7 @@ static void start_timeout(pa_socket_client *c, pa_bool_t use_rtclock) { c->timeout_event = c->mainloop->time_new(c->mainloop, pa_timeval_rtstore(&tv, pa_rtclock_now() + CONNECT_TIMEOUT * PA_USEC_PER_SEC, use_rtclock), timeout_cb, c); } -pa_socket_client* pa_socket_client_new_string(pa_mainloop_api *m, pa_bool_t use_rtclock, const char*name, uint16_t default_port) { +pa_socket_client* pa_socket_client_new_string(pa_mainloop_api *m, bool use_rtclock, const char*name, uint16_t default_port) { pa_socket_client *c = NULL; pa_parsed_address a; @@ -540,7 +540,7 @@ finish: /* Return non-zero when the target sockaddr is considered local. "local" means UNIX socket or TCP socket on localhost. Other local IP addresses are not considered local. */ -pa_bool_t pa_socket_client_is_local(pa_socket_client *c) { +bool pa_socket_client_is_local(pa_socket_client *c) { pa_assert(c); pa_assert(PA_REFCNT_VALUE(c) >= 1); diff --git a/src/pulsecore/socket-client.h b/src/pulsecore/socket-client.h index 138f658cc..235d4498e 100644 --- a/src/pulsecore/socket-client.h +++ b/src/pulsecore/socket-client.h @@ -38,13 +38,13 @@ pa_socket_client* pa_socket_client_new_ipv4(pa_mainloop_api *m, uint32_t address pa_socket_client* pa_socket_client_new_ipv6(pa_mainloop_api *m, uint8_t address[16], uint16_t port); pa_socket_client* pa_socket_client_new_unix(pa_mainloop_api *m, const char *filename); pa_socket_client* pa_socket_client_new_sockaddr(pa_mainloop_api *m, const struct sockaddr *sa, size_t salen); -pa_socket_client* pa_socket_client_new_string(pa_mainloop_api *m, pa_bool_t use_rtclock, const char *a, uint16_t default_port); +pa_socket_client* pa_socket_client_new_string(pa_mainloop_api *m, bool use_rtclock, const char *a, uint16_t default_port); pa_socket_client* pa_socket_client_ref(pa_socket_client *c); void pa_socket_client_unref(pa_socket_client *c); void pa_socket_client_set_callback(pa_socket_client *c, pa_socket_client_cb_t on_connection, void *userdata); -pa_bool_t pa_socket_client_is_local(pa_socket_client *c); +bool pa_socket_client_is_local(pa_socket_client *c); #endif diff --git a/src/pulsecore/socket-server.c b/src/pulsecore/socket-server.c index 74db9e324..ef77563d4 100644 --- a/src/pulsecore/socket-server.c +++ b/src/pulsecore/socket-server.c @@ -229,7 +229,7 @@ pa_socket_server* pa_socket_server_new_unix(pa_mainloop_api *m, const char *file #endif /* HAVE_SYS_UN_H */ -pa_socket_server* pa_socket_server_new_ipv4(pa_mainloop_api *m, uint32_t address, uint16_t port, pa_bool_t fallback, const char *tcpwrap_service) { +pa_socket_server* pa_socket_server_new_ipv4(pa_mainloop_api *m, uint32_t address, uint16_t port, bool fallback, const char *tcpwrap_service) { pa_socket_server *ss; int fd = -1; struct sockaddr_in sa; @@ -291,7 +291,7 @@ fail: } #ifdef HAVE_IPV6 -pa_socket_server* pa_socket_server_new_ipv6(pa_mainloop_api *m, const uint8_t address[16], uint16_t port, pa_bool_t fallback, const char *tcpwrap_service) { +pa_socket_server* pa_socket_server_new_ipv6(pa_mainloop_api *m, const uint8_t address[16], uint16_t port, bool fallback, const char *tcpwrap_service) { pa_socket_server *ss; int fd = -1; struct sockaddr_in6 sa; @@ -360,7 +360,7 @@ fail: } #endif -pa_socket_server* pa_socket_server_new_ipv4_loopback(pa_mainloop_api *m, uint16_t port, pa_bool_t fallback, const char *tcpwrap_service) { +pa_socket_server* pa_socket_server_new_ipv4_loopback(pa_mainloop_api *m, uint16_t port, bool fallback, const char *tcpwrap_service) { pa_assert(m); pa_assert(port > 0); @@ -368,7 +368,7 @@ pa_socket_server* pa_socket_server_new_ipv4_loopback(pa_mainloop_api *m, uint16_ } #ifdef HAVE_IPV6 -pa_socket_server* pa_socket_server_new_ipv6_loopback(pa_mainloop_api *m, uint16_t port, pa_bool_t fallback, const char *tcpwrap_service) { +pa_socket_server* pa_socket_server_new_ipv6_loopback(pa_mainloop_api *m, uint16_t port, bool fallback, const char *tcpwrap_service) { pa_assert(m); pa_assert(port > 0); @@ -376,7 +376,7 @@ pa_socket_server* pa_socket_server_new_ipv6_loopback(pa_mainloop_api *m, uint16_ } #endif -pa_socket_server* pa_socket_server_new_ipv4_any(pa_mainloop_api *m, uint16_t port, pa_bool_t fallback, const char *tcpwrap_service) { +pa_socket_server* pa_socket_server_new_ipv4_any(pa_mainloop_api *m, uint16_t port, bool fallback, const char *tcpwrap_service) { pa_assert(m); pa_assert(port > 0); @@ -384,7 +384,7 @@ pa_socket_server* pa_socket_server_new_ipv4_any(pa_mainloop_api *m, uint16_t por } #ifdef HAVE_IPV6 -pa_socket_server* pa_socket_server_new_ipv6_any(pa_mainloop_api *m, uint16_t port, pa_bool_t fallback, const char *tcpwrap_service) { +pa_socket_server* pa_socket_server_new_ipv6_any(pa_mainloop_api *m, uint16_t port, bool fallback, const char *tcpwrap_service) { pa_assert(m); pa_assert(port > 0); @@ -392,7 +392,7 @@ pa_socket_server* pa_socket_server_new_ipv6_any(pa_mainloop_api *m, uint16_t por } #endif -pa_socket_server* pa_socket_server_new_ipv4_string(pa_mainloop_api *m, const char *name, uint16_t port, pa_bool_t fallback, const char *tcpwrap_service) { +pa_socket_server* pa_socket_server_new_ipv4_string(pa_mainloop_api *m, const char *name, uint16_t port, bool fallback, const char *tcpwrap_service) { struct in_addr ipv4; pa_assert(m); @@ -406,7 +406,7 @@ pa_socket_server* pa_socket_server_new_ipv4_string(pa_mainloop_api *m, const cha } #ifdef HAVE_IPV6 -pa_socket_server* pa_socket_server_new_ipv6_string(pa_mainloop_api *m, const char *name, uint16_t port, pa_bool_t fallback, const char *tcpwrap_service) { +pa_socket_server* pa_socket_server_new_ipv6_string(pa_mainloop_api *m, const char *name, uint16_t port, bool fallback, const char *tcpwrap_service) { struct in6_addr ipv6; pa_assert(m); diff --git a/src/pulsecore/socket-server.h b/src/pulsecore/socket-server.h index 16da07b81..a72bd9ec1 100644 --- a/src/pulsecore/socket-server.h +++ b/src/pulsecore/socket-server.h @@ -33,15 +33,15 @@ typedef struct pa_socket_server pa_socket_server; pa_socket_server* pa_socket_server_new(pa_mainloop_api *m, int fd); pa_socket_server* pa_socket_server_new_unix(pa_mainloop_api *m, const char *filename); -pa_socket_server* pa_socket_server_new_ipv4(pa_mainloop_api *m, uint32_t address, uint16_t port, pa_bool_t fallback, const char *tcpwrap_service); -pa_socket_server* pa_socket_server_new_ipv4_loopback(pa_mainloop_api *m, uint16_t port, pa_bool_t fallback, const char *tcpwrap_service); -pa_socket_server* pa_socket_server_new_ipv4_any(pa_mainloop_api *m, uint16_t port, pa_bool_t fallback, const char *tcpwrap_service); -pa_socket_server* pa_socket_server_new_ipv4_string(pa_mainloop_api *m, const char *name, uint16_t port, pa_bool_t fallback, const char *tcpwrap_service); +pa_socket_server* pa_socket_server_new_ipv4(pa_mainloop_api *m, uint32_t address, uint16_t port, bool fallback, const char *tcpwrap_service); +pa_socket_server* pa_socket_server_new_ipv4_loopback(pa_mainloop_api *m, uint16_t port, bool fallback, const char *tcpwrap_service); +pa_socket_server* pa_socket_server_new_ipv4_any(pa_mainloop_api *m, uint16_t port, bool fallback, const char *tcpwrap_service); +pa_socket_server* pa_socket_server_new_ipv4_string(pa_mainloop_api *m, const char *name, uint16_t port, bool fallback, const char *tcpwrap_service); #ifdef HAVE_IPV6 -pa_socket_server* pa_socket_server_new_ipv6(pa_mainloop_api *m, const uint8_t address[16], uint16_t port, pa_bool_t fallback, const char *tcpwrap_service); -pa_socket_server* pa_socket_server_new_ipv6_loopback(pa_mainloop_api *m, uint16_t port, pa_bool_t fallback, const char *tcpwrap_service); -pa_socket_server* pa_socket_server_new_ipv6_any(pa_mainloop_api *m, uint16_t port, pa_bool_t fallback, const char *tcpwrap_service); -pa_socket_server* pa_socket_server_new_ipv6_string(pa_mainloop_api *m, const char *name, uint16_t port, pa_bool_t fallback, const char *tcpwrap_service); +pa_socket_server* pa_socket_server_new_ipv6(pa_mainloop_api *m, const uint8_t address[16], uint16_t port, bool fallback, const char *tcpwrap_service); +pa_socket_server* pa_socket_server_new_ipv6_loopback(pa_mainloop_api *m, uint16_t port, bool fallback, const char *tcpwrap_service); +pa_socket_server* pa_socket_server_new_ipv6_any(pa_mainloop_api *m, uint16_t port, bool fallback, const char *tcpwrap_service); +pa_socket_server* pa_socket_server_new_ipv6_string(pa_mainloop_api *m, const char *name, uint16_t port, bool fallback, const char *tcpwrap_service); #endif void pa_socket_server_unref(pa_socket_server*s); diff --git a/src/pulsecore/socket-util.c b/src/pulsecore/socket-util.c index 68119d179..e1c0b5589 100644 --- a/src/pulsecore/socket-util.c +++ b/src/pulsecore/socket-util.c @@ -280,12 +280,12 @@ int pa_unix_socket_remove_stale(const char *fn) { #endif /* HAVE_SYS_UN_H */ -pa_bool_t pa_socket_address_is_local(const struct sockaddr *sa) { +bool pa_socket_address_is_local(const struct sockaddr *sa) { pa_assert(sa); switch (sa->sa_family) { case AF_UNIX: - return TRUE; + return true; case AF_INET: return ((const struct sockaddr_in*) sa)->sin_addr.s_addr == INADDR_LOOPBACK; @@ -296,11 +296,11 @@ pa_bool_t pa_socket_address_is_local(const struct sockaddr *sa) { #endif default: - return FALSE; + return false; } } -pa_bool_t pa_socket_is_local(int fd) { +bool pa_socket_is_local(int fd) { union { struct sockaddr_storage storage; @@ -316,7 +316,7 @@ pa_bool_t pa_socket_is_local(int fd) { socklen_t sa_len = sizeof(sa); if (getpeername(fd, &sa.sa, &sa_len) < 0) - return FALSE; + return false; return pa_socket_address_is_local(&sa.sa); } diff --git a/src/pulsecore/socket-util.h b/src/pulsecore/socket-util.h index 154afd4a2..93c28b283 100644 --- a/src/pulsecore/socket-util.h +++ b/src/pulsecore/socket-util.h @@ -40,7 +40,7 @@ int pa_socket_set_rcvbuf(int fd, size_t l); int pa_unix_socket_is_stale(const char *fn); int pa_unix_socket_remove_stale(const char *fn); -pa_bool_t pa_socket_address_is_local(const struct sockaddr *sa); -pa_bool_t pa_socket_is_local(int fd); +bool pa_socket_address_is_local(const struct sockaddr *sa); +bool pa_socket_is_local(int fd); #endif diff --git a/src/pulsecore/sound-file-stream.c b/src/pulsecore/sound-file-stream.c index 4101dea2b..33f7337fd 100644 --- a/src/pulsecore/sound-file-stream.c +++ b/src/pulsecore/sound-file-stream.c @@ -132,7 +132,7 @@ static void sink_input_state_change_cb(pa_sink_input *i, pa_sink_input_state_t s * we are heard right-away. */ if (PA_SINK_INPUT_IS_LINKED(state) && i->thread_info.state == PA_SINK_INPUT_INIT) - pa_sink_input_request_rewind(i, 0, FALSE, TRUE, TRUE); + pa_sink_input_request_rewind(i, 0, false, true, true); } /* Called from IO thread context */ @@ -298,7 +298,7 @@ int pa_play_file( u->readf_function = pa_sndfile_readf_function(&ss); pa_sink_input_new_data_init(&data); - pa_sink_input_new_data_set_sink(&data, sink, FALSE); + pa_sink_input_new_data_set_sink(&data, sink, false); data.driver = __FILE__; pa_sink_input_new_data_set_sample_spec(&data, &ss); pa_sink_input_new_data_set_channel_map(&data, &cm); diff --git a/src/pulsecore/source-output.c b/src/pulsecore/source-output.c index f60b614c3..66a33bd53 100644 --- a/src/pulsecore/source-output.c +++ b/src/pulsecore/source-output.c @@ -53,7 +53,7 @@ pa_source_output_new_data* pa_source_output_new_data_init(pa_source_output_new_d pa_zero(*data); data->resample_method = PA_RESAMPLER_INVALID; data->proplist = pa_proplist_new(); - data->volume_writable = TRUE; + data->volume_writable = true; return data; } @@ -72,16 +72,16 @@ void pa_source_output_new_data_set_channel_map(pa_source_output_new_data *data, data->channel_map = *map; } -pa_bool_t pa_source_output_new_data_is_passthrough(pa_source_output_new_data *data) { +bool pa_source_output_new_data_is_passthrough(pa_source_output_new_data *data) { pa_assert(data); if (PA_LIKELY(data->format) && PA_UNLIKELY(!pa_format_info_is_pcm(data->format))) - return TRUE; + return true; if (PA_UNLIKELY(data->flags & PA_SOURCE_OUTPUT_PASSTHROUGH)) - return TRUE; + return true; - return FALSE; + return false; } void pa_source_output_new_data_set_volume(pa_source_output_new_data *data, const pa_cvolume *volume) { @@ -99,7 +99,7 @@ void pa_source_output_new_data_apply_volume_factor(pa_source_output_new_data *da if (data->volume_factor_is_set) pa_sw_cvolume_multiply(&data->volume_factor, &data->volume_factor, volume_factor); else { - data->volume_factor_is_set = TRUE; + data->volume_factor_is_set = true; data->volume_factor = *volume_factor; } } @@ -111,20 +111,20 @@ void pa_source_output_new_data_apply_volume_factor_source(pa_source_output_new_d if (data->volume_factor_source_is_set) pa_sw_cvolume_multiply(&data->volume_factor_source, &data->volume_factor_source, volume_factor); else { - data->volume_factor_source_is_set = TRUE; + data->volume_factor_source_is_set = true; data->volume_factor_source = *volume_factor; } } -void pa_source_output_new_data_set_muted(pa_source_output_new_data *data, pa_bool_t mute) { +void pa_source_output_new_data_set_muted(pa_source_output_new_data *data, bool mute) { pa_assert(data); - data->muted_is_set = TRUE; + data->muted_is_set = true; data->muted = !!mute; } -pa_bool_t pa_source_output_new_data_set_source(pa_source_output_new_data *data, pa_source *s, pa_bool_t save) { - pa_bool_t ret = TRUE; +bool pa_source_output_new_data_set_source(pa_source_output_new_data *data, pa_source *s, bool save) { + bool ret = true; pa_idxset *formats = NULL; pa_assert(data); @@ -149,14 +149,14 @@ pa_bool_t pa_source_output_new_data_set_source(pa_source_output_new_data *data, /* Source doesn't support any of the formats requested by the client */ if (formats) pa_idxset_free(formats, (pa_free_cb_t) pa_format_info_free); - ret = FALSE; + ret = false; } } return ret; } -pa_bool_t pa_source_output_new_data_set_formats(pa_source_output_new_data *data, pa_idxset *formats) { +bool pa_source_output_new_data_set_formats(pa_source_output_new_data *data, pa_idxset *formats) { pa_assert(data); pa_assert(formats); @@ -170,7 +170,7 @@ pa_bool_t pa_source_output_new_data_set_formats(pa_source_output_new_data *data, return pa_source_output_new_data_set_source(data, data->source, data->save_source); } - return TRUE; + return true; } void pa_source_output_new_data_done(pa_source_output_new_data *data) { @@ -236,7 +236,7 @@ int pa_source_output_new( pa_proplist_update(data->proplist, PA_UPDATE_MERGE, data->client->proplist); if (data->destination_source && (data->destination_source->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER)) - data->volume_writable = FALSE; + data->volume_writable = false; if (!data->req_formats) { /* From this point on, we want to work only with formats, and get back @@ -257,7 +257,7 @@ int pa_source_output_new( if (!data->source) { pa_source *source = pa_namereg_get(core, NULL, PA_NAMEREG_SOURCE); pa_return_val_if_fail(source, -PA_ERR_NOENTITY); - pa_source_output_new_data_set_source(data, source, FALSE); + pa_source_output_new_data_set_source(data, source, false); } /* Routing's done, we have a source. Now let's fix the format and set up the @@ -297,16 +297,16 @@ int pa_source_output_new( /* Don't restore (or save) stream volume for passthrough streams and * prevent attenuation/gain */ if (pa_source_output_new_data_is_passthrough(data)) { - data->volume_is_set = TRUE; + data->volume_is_set = true; pa_cvolume_reset(&data->volume, data->sample_spec.channels); - data->volume_is_absolute = TRUE; - data->save_volume = FALSE; + data->volume_is_absolute = true; + data->save_volume = false; } if (!data->volume_is_set) { pa_cvolume_reset(&data->volume, data->sample_spec.channels); - data->volume_is_absolute = FALSE; - data->save_volume = FALSE; + data->volume_is_absolute = false; + data->save_volume = false; } if (!data->volume_writable) @@ -325,7 +325,7 @@ int pa_source_output_new( pa_return_val_if_fail(pa_cvolume_compatible(&data->volume_factor_source, &data->source->sample_spec), -PA_ERR_INVALID); if (!data->muted_is_set) - data->muted = FALSE; + data->muted = false; if (data->flags & PA_SOURCE_OUTPUT_FIX_FORMAT) { pa_return_val_if_fail(pa_format_info_is_pcm(data->format), -PA_ERR_INVALID); @@ -358,7 +358,7 @@ int pa_source_output_new( module-suspend-on-idle can resume a source */ pa_log_info("Trying to change sample rate"); - if (pa_source_update_rate(data->source, data->sample_spec.rate, pa_source_output_new_data_is_passthrough(data)) == TRUE) + if (pa_source_update_rate(data->source, data->sample_spec.rate, pa_source_output_new_data_is_passthrough(data)) == true) pa_log_info("Rate changed to %u Hz", data->source->sample_spec.rate); } @@ -460,7 +460,7 @@ int pa_source_output_new( o->userdata = NULL; o->thread_info.state = o->state; - o->thread_info.attached = FALSE; + o->thread_info.attached = false; o->thread_info.sample_spec = o->sample_spec; o->thread_info.resampler = resampler; o->thread_info.soft_volume = o->soft_volume; @@ -551,7 +551,7 @@ static void source_output_set_state(pa_source_output *o, pa_source_output_state_ /* Called from main context */ void pa_source_output_unlink(pa_source_output*o) { - pa_bool_t linked; + bool linked; pa_assert(o); pa_assert_ctl_context(); @@ -586,7 +586,7 @@ void pa_source_output_unlink(pa_source_output*o) { /* We might need to update the source's volume if we are in flat volume mode. */ if (pa_source_flat_volume_enabled(o->source)) - pa_source_set_volume(o->source, NULL, FALSE, FALSE); + pa_source_set_volume(o->source, NULL, false, false); if (o->source->asyncmsgq) pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SOURCE_MESSAGE_REMOVE_OUTPUT, o, 0, NULL) == 0); @@ -660,7 +660,7 @@ void pa_source_output_put(pa_source_output *o) { /* We might need to update the source's volume if we are in flat volume mode. */ if (pa_source_flat_volume_enabled(o->source)) - pa_source_set_volume(o->source, NULL, FALSE, o->save_volume); + pa_source_set_volume(o->source, NULL, false, o->save_volume); else { if (o->destination_source && (o->destination_source->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER)) { pa_assert(pa_cvolume_is_norm(&o->volume)); @@ -714,8 +714,8 @@ pa_usec_t pa_source_output_get_latency(pa_source_output *o, pa_usec_t *source_la /* Called from thread context */ void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) { - pa_bool_t need_volume_factor_source; - pa_bool_t volume_is_norm; + bool need_volume_factor_source; + bool volume_is_norm; size_t length; size_t limit, mbs = 0; @@ -732,7 +732,7 @@ void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) { if (pa_memblockq_push(o->thread_info.delay_memblockq, chunk) < 0) { pa_log_debug("Delay queue overflow!"); - pa_memblockq_seek(o->thread_info.delay_memblockq, (int64_t) chunk->length, PA_SEEK_RELATIVE, TRUE); + pa_memblockq_seek(o->thread_info.delay_memblockq, (int64_t) chunk->length, PA_SEEK_RELATIVE, true); } limit = o->process_rewind ? 0 : o->source->thread_info.max_rewind; @@ -762,7 +762,7 @@ void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) { /* Implement the delay queue */ while ((length = pa_memblockq_get_length(o->thread_info.delay_memblockq)) > limit) { pa_memchunk qchunk; - pa_bool_t nvfs = need_volume_factor_source; + bool nvfs = need_volume_factor_source; length -= limit; @@ -779,7 +779,7 @@ void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) { if (o->thread_info.muted) { pa_silence_memchunk(&qchunk, &o->source->sample_spec); - nvfs = FALSE; + nvfs = false; } else if (!o->thread_info.resampler && nvfs) { pa_cvolume v; @@ -789,7 +789,7 @@ void pa_source_output_push(pa_source_output *o, const pa_memchunk *chunk) { pa_sw_cvolume_multiply(&v, &o->thread_info.soft_volume, &o->volume_factor_source); pa_volume_memchunk(&qchunk, &o->source->sample_spec, &v); - nvfs = FALSE; + nvfs = false; } else pa_volume_memchunk(&qchunk, &o->source->sample_spec, &o->thread_info.soft_volume); @@ -891,7 +891,7 @@ pa_usec_t pa_source_output_set_requested_latency_within_thread(pa_source_output usec = PA_CLAMP(usec, o->source->thread_info.min_latency, o->source->thread_info.max_latency); o->thread_info.requested_source_latency = usec; - pa_source_invalidate_requested_latency(o->source, TRUE); + pa_source_invalidate_requested_latency(o->source, true); return usec; } @@ -943,7 +943,7 @@ pa_usec_t pa_source_output_get_requested_latency(pa_source_output *o) { } /* Called from main context */ -void pa_source_output_set_volume(pa_source_output *o, const pa_cvolume *volume, pa_bool_t save, pa_bool_t absolute) { +void pa_source_output_set_volume(pa_source_output *o, const pa_cvolume *volume, bool save, bool absolute) { pa_cvolume v; pa_source_output_assert_ref(o); @@ -981,7 +981,7 @@ void pa_source_output_set_volume(pa_source_output *o, const pa_cvolume *volume, /* We are in flat volume mode, so let's update all source input * volumes and update the flat volume of the source */ - pa_source_set_volume(o->source, NULL, TRUE, save); + pa_source_set_volume(o->source, NULL, true, save); } else { /* OK, we are in normal volume mode. The volume only affects @@ -1022,20 +1022,20 @@ static void set_real_ratio(pa_source_output *o, const pa_cvolume *v) { } /* Called from main or I/O context */ -pa_bool_t pa_source_output_is_passthrough(pa_source_output *o) { +bool pa_source_output_is_passthrough(pa_source_output *o) { pa_source_output_assert_ref(o); if (PA_UNLIKELY(!pa_format_info_is_pcm(o->format))) - return TRUE; + return true; if (PA_UNLIKELY(o->flags & PA_SOURCE_OUTPUT_PASSTHROUGH)) - return TRUE; + return true; - return FALSE; + return false; } /* Called from main context */ -pa_bool_t pa_source_output_is_volume_readable(pa_source_output *o) { +bool pa_source_output_is_volume_readable(pa_source_output *o) { pa_source_output_assert_ref(o); pa_assert_ctl_context(); @@ -1043,7 +1043,7 @@ pa_bool_t pa_source_output_is_volume_readable(pa_source_output *o) { } /* Called from main context */ -pa_cvolume *pa_source_output_get_volume(pa_source_output *o, pa_cvolume *volume, pa_bool_t absolute) { +pa_cvolume *pa_source_output_get_volume(pa_source_output *o, pa_cvolume *volume, bool absolute) { pa_source_output_assert_ref(o); pa_assert_ctl_context(); pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); @@ -1058,7 +1058,7 @@ pa_cvolume *pa_source_output_get_volume(pa_source_output *o, pa_cvolume *volume, } /* Called from main context */ -void pa_source_output_set_mute(pa_source_output *o, pa_bool_t mute, pa_bool_t save) { +void pa_source_output_set_mute(pa_source_output *o, bool mute, bool save) { pa_source_output_assert_ref(o); pa_assert_ctl_context(); pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); @@ -1081,7 +1081,7 @@ void pa_source_output_set_mute(pa_source_output *o, pa_bool_t mute, pa_bool_t sa } /* Called from main context */ -pa_bool_t pa_source_output_get_mute(pa_source_output *o) { +bool pa_source_output_get_mute(pa_source_output *o) { pa_source_output_assert_ref(o); pa_assert_ctl_context(); pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); @@ -1104,7 +1104,7 @@ void pa_source_output_update_proplist(pa_source_output *o, pa_update_mode_t mode } /* Called from main context */ -void pa_source_output_cork(pa_source_output *o, pa_bool_t b) { +void pa_source_output_cork(pa_source_output *o, bool b) { pa_source_output_assert_ref(o); pa_assert_ctl_context(); pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); @@ -1164,59 +1164,59 @@ pa_resample_method_t pa_source_output_get_resample_method(pa_source_output *o) { } /* Called from main context */ -pa_bool_t pa_source_output_may_move(pa_source_output *o) { +bool pa_source_output_may_move(pa_source_output *o) { pa_source_output_assert_ref(o); pa_assert_ctl_context(); pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); if (o->flags & PA_SOURCE_OUTPUT_DONT_MOVE) - return FALSE; + return false; if (o->direct_on_input) - return FALSE; + return false; - return TRUE; + return true; } -static pa_bool_t find_filter_source_output(pa_source_output *target, pa_source *s) { +static bool find_filter_source_output(pa_source_output *target, pa_source *s) { int i = 0; while (s && s->output_from_master) { if (s->output_from_master == target) - return TRUE; + return true; s = s->output_from_master->source; pa_assert(i++ < 100); } - return FALSE; + return false; } /* Called from main context */ -pa_bool_t pa_source_output_may_move_to(pa_source_output *o, pa_source *dest) { +bool pa_source_output_may_move_to(pa_source_output *o, pa_source *dest) { pa_source_output_assert_ref(o); pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); pa_source_assert_ref(dest); if (dest == o->source) - return TRUE; + return true; if (!pa_source_output_may_move(o)) - return FALSE; + return false; /* Make sure we're not creating a filter source cycle */ if (find_filter_source_output(o, dest)) { pa_log_debug("Can't connect output to %s, as that would create a cycle.", dest->name); - return FALSE; + return false; } if (pa_idxset_size(dest->outputs) >= PA_MAX_OUTPUTS_PER_SOURCE) { pa_log_warn("Failed to move source output: too many outputs per source."); - return FALSE; + return false; } if (o->may_move_to) if (!o->may_move_to(o, dest)) - return FALSE; + return false; - return TRUE; + return true; } /* Called from main context */ @@ -1248,7 +1248,7 @@ int pa_source_output_start_move(pa_source_output *o) { if (pa_source_flat_volume_enabled(o->source)) /* We might need to update the source's volume if we are in flat * volume mode. */ - pa_source_set_volume(o->source, NULL, FALSE, FALSE); + pa_source_set_volume(o->source, NULL, false, false); pa_assert_se(pa_asyncmsgq_send(o->source->asyncmsgq, PA_MSGOBJECT(o->source), PA_SOURCE_MESSAGE_REMOVE_OUTPUT, o, 0, NULL) == 0); @@ -1409,11 +1409,11 @@ static void update_volume_due_to_moving(pa_source_output *o, pa_source *dest) { /* If o->source == dest, then recursion has finished, and we can finally call * pa_source_set_volume(), which will do the rest of the updates. */ if ((o->source == dest) && pa_source_flat_volume_enabled(o->source)) - pa_source_set_volume(o->source, NULL, FALSE, o->save_volume); + pa_source_set_volume(o->source, NULL, false, o->save_volume); } /* Called from main context */ -int pa_source_output_finish_move(pa_source_output *o, pa_source *dest, pa_bool_t save) { +int pa_source_output_finish_move(pa_source_output *o, pa_source *dest, bool save) { pa_source_output_assert_ref(o); pa_assert_ctl_context(); pa_assert(PA_SOURCE_OUTPUT_IS_LINKED(o->state)); @@ -1441,7 +1441,7 @@ int pa_source_output_finish_move(pa_source_output *o, pa_source *dest, pa_bool_t SOURCE_OUTPUT_MOVE_FINISH hook */ pa_log_info("Trying to change sample rate"); - if (pa_source_update_rate(dest, o->sample_spec.rate, pa_source_output_is_passthrough(o)) == TRUE) + if (pa_source_update_rate(dest, o->sample_spec.rate, pa_source_output_is_passthrough(o)) == true) pa_log_info("Rate changed to %u Hz", dest->sample_spec.rate); } @@ -1496,7 +1496,7 @@ void pa_source_output_fail_move(pa_source_output *o) { } /* Called from main context */ -int pa_source_output_move_to(pa_source_output *o, pa_source *dest, pa_bool_t save) { +int pa_source_output_move_to(pa_source_output *o, pa_source *dest, bool save) { int r; pa_source_output_assert_ref(o); diff --git a/src/pulsecore/source-output.h b/src/pulsecore/source-output.h index e60430f6d..102fb8b85 100644 --- a/src/pulsecore/source-output.h +++ b/src/pulsecore/source-output.h @@ -43,7 +43,7 @@ typedef enum pa_source_output_state { PA_SOURCE_OUTPUT_UNLINKED } pa_source_output_state_t; -static inline pa_bool_t PA_SOURCE_OUTPUT_IS_LINKED(pa_source_output_state_t x) { +static inline bool PA_SOURCE_OUTPUT_IS_LINKED(pa_source_output_state_t x) { return x == PA_SOURCE_OUTPUT_RUNNING || x == PA_SOURCE_OUTPUT_CORKED; } @@ -96,15 +96,15 @@ struct pa_source_output { pa_cvolume volume_factor_source; /* A second volume factor in format of the source this stream is connected to */ - pa_bool_t volume_writable:1; + bool volume_writable:1; - pa_bool_t muted:1; + bool muted:1; - /* if TRUE then the source we are connected to and/or the volume + /* if true then the source we are connected to and/or the volume * set is worth remembering, i.e. was explicitly chosen by the * user and not automatically. module-stream-restore looks for * this.*/ - pa_bool_t save_source:1, save_volume:1, save_muted:1; + bool save_source:1, save_volume:1, save_muted:1; pa_resample_method_t requested_resample_method, actual_resample_method; @@ -145,11 +145,11 @@ struct pa_source_output { /* If non-NULL called whenever the source this output is attached * to suspends or resumes. Called from main context */ - void (*suspend) (pa_source_output *o, pa_bool_t b); /* may be NULL */ + void (*suspend) (pa_source_output *o, bool b); /* may be NULL */ /* If non-NULL called whenever the source this output is attached * to suspends or resumes. Called from IO context */ - void (*suspend_within_thread) (pa_source_output *o, pa_bool_t b); /* may be NULL */ + void (*suspend_within_thread) (pa_source_output *o, bool b); /* may be NULL */ /* If non-NULL called whenever the source output is moved to a new * source. Called from main context after the source output has been @@ -174,9 +174,9 @@ struct pa_source_output { void (*state_change) (pa_source_output *o, pa_source_output_state_t state); /* may be NULL */ /* If non-NULL this function is called before this source output - * is moved to a source and if it returns FALSE the move + * is moved to a source and if it returns false the move * will not be allowed */ - pa_bool_t (*may_move_to) (pa_source_output *o, pa_source *s); /* may be NULL */ + bool (*may_move_to) (pa_source_output *o, pa_source *s); /* may be NULL */ /* If non-NULL this function is used to dispatch asynchronous * control events. */ @@ -194,9 +194,9 @@ struct pa_source_output { pa_source_output_state_t state; pa_cvolume soft_volume; - pa_bool_t muted:1; + bool muted:1; - pa_bool_t attached:1; /* True only between ->attach() and ->detach() calls */ + bool attached:1; /* True only between ->attach() and ->detach() calls */ pa_sample_spec sample_spec; @@ -257,31 +257,31 @@ typedef struct pa_source_output_new_data { pa_idxset *nego_formats; pa_cvolume volume, volume_factor, volume_factor_source; - pa_bool_t muted:1; + bool muted:1; - pa_bool_t sample_spec_is_set:1; - pa_bool_t channel_map_is_set:1; + bool sample_spec_is_set:1; + bool channel_map_is_set:1; - pa_bool_t volume_is_set:1, volume_factor_is_set:1, volume_factor_source_is_set:1; - pa_bool_t muted_is_set:1; + bool volume_is_set:1, volume_factor_is_set:1, volume_factor_source_is_set:1; + bool muted_is_set:1; - pa_bool_t volume_is_absolute:1; + bool volume_is_absolute:1; - pa_bool_t volume_writable:1; + bool volume_writable:1; - pa_bool_t save_source:1, save_volume:1, save_muted:1; + bool save_source:1, save_volume:1, save_muted:1; } pa_source_output_new_data; pa_source_output_new_data* pa_source_output_new_data_init(pa_source_output_new_data *data); void pa_source_output_new_data_set_sample_spec(pa_source_output_new_data *data, const pa_sample_spec *spec); void pa_source_output_new_data_set_channel_map(pa_source_output_new_data *data, const pa_channel_map *map); -pa_bool_t pa_source_output_new_data_is_passthrough(pa_source_output_new_data *data); +bool pa_source_output_new_data_is_passthrough(pa_source_output_new_data *data); void pa_source_output_new_data_set_volume(pa_source_output_new_data *data, const pa_cvolume *volume); void pa_source_output_new_data_apply_volume_factor(pa_source_output_new_data *data, const pa_cvolume *volume_factor); void pa_source_output_new_data_apply_volume_factor_source(pa_source_output_new_data *data, const pa_cvolume *volume_factor); -void pa_source_output_new_data_set_muted(pa_source_output_new_data *data, pa_bool_t mute); -pa_bool_t pa_source_output_new_data_set_source(pa_source_output_new_data *data, pa_source *s, pa_bool_t save); -pa_bool_t pa_source_output_new_data_set_formats(pa_source_output_new_data *data, pa_idxset *formats); +void pa_source_output_new_data_set_muted(pa_source_output_new_data *data, bool mute); +bool pa_source_output_new_data_set_source(pa_source_output_new_data *data, pa_source *s, bool save); +bool pa_source_output_new_data_set_formats(pa_source_output_new_data *data, pa_idxset *formats); void pa_source_output_new_data_done(pa_source_output_new_data *data); /* To be called by the implementing module only */ @@ -298,7 +298,7 @@ void pa_source_output_set_name(pa_source_output *o, const char *name); pa_usec_t pa_source_output_set_requested_latency(pa_source_output *o, pa_usec_t usec); -void pa_source_output_cork(pa_source_output *o, pa_bool_t b); +void pa_source_output_cork(pa_source_output *o, bool b); int pa_source_output_set_rate(pa_source_output *o, uint32_t rate); int pa_source_output_update_rate(pa_source_output *o); @@ -312,13 +312,13 @@ void pa_source_output_kill(pa_source_output*o); pa_usec_t pa_source_output_get_latency(pa_source_output *o, pa_usec_t *source_latency); -pa_bool_t pa_source_output_is_volume_readable(pa_source_output *o); -pa_bool_t pa_source_output_is_passthrough(pa_source_output *o); -void pa_source_output_set_volume(pa_source_output *o, const pa_cvolume *volume, pa_bool_t save, pa_bool_t absolute); -pa_cvolume *pa_source_output_get_volume(pa_source_output *o, pa_cvolume *volume, pa_bool_t absolute); +bool pa_source_output_is_volume_readable(pa_source_output *o); +bool pa_source_output_is_passthrough(pa_source_output *o); +void pa_source_output_set_volume(pa_source_output *o, const pa_cvolume *volume, bool save, bool absolute); +pa_cvolume *pa_source_output_get_volume(pa_source_output *o, pa_cvolume *volume, bool absolute); -void pa_source_output_set_mute(pa_source_output *o, pa_bool_t mute, pa_bool_t save); -pa_bool_t pa_source_output_get_mute(pa_source_output *o); +void pa_source_output_set_mute(pa_source_output *o, bool mute, bool save); +bool pa_source_output_get_mute(pa_source_output *o); void pa_source_output_update_proplist(pa_source_output *o, pa_update_mode_t mode, pa_proplist *p); @@ -326,15 +326,15 @@ pa_resample_method_t pa_source_output_get_resample_method(pa_source_output *o); void pa_source_output_send_event(pa_source_output *o, const char *name, pa_proplist *data); -pa_bool_t pa_source_output_may_move(pa_source_output *o); -pa_bool_t pa_source_output_may_move_to(pa_source_output *o, pa_source *dest); -int pa_source_output_move_to(pa_source_output *o, pa_source *dest, pa_bool_t save); +bool pa_source_output_may_move(pa_source_output *o); +bool pa_source_output_may_move_to(pa_source_output *o, pa_source *dest); +int pa_source_output_move_to(pa_source_output *o, pa_source *dest, bool save); /* The same as pa_source_output_move_to() but in two separate steps, * first the detaching from the old source, then the attaching to the * new source */ int pa_source_output_start_move(pa_source_output *o); -int pa_source_output_finish_move(pa_source_output *o, pa_source *dest, pa_bool_t save); +int pa_source_output_finish_move(pa_source_output *o, pa_source *dest, bool save); void pa_source_output_fail_move(pa_source_output *o); #define pa_source_output_get_state(o) ((o)->state) diff --git a/src/pulsecore/source.c b/src/pulsecore/source.c index 98a8bcc3d..9c492c16d 100644 --- a/src/pulsecore/source.c +++ b/src/pulsecore/source.c @@ -102,7 +102,7 @@ void pa_source_new_data_set_channel_map(pa_source_new_data *data, const pa_chann void pa_source_new_data_set_alternate_sample_rate(pa_source_new_data *data, const uint32_t alternate_sample_rate) { pa_assert(data); - data->alternate_sample_rate_is_set = TRUE; + data->alternate_sample_rate_is_set = true; data->alternate_sample_rate = alternate_sample_rate; } @@ -113,10 +113,10 @@ void pa_source_new_data_set_volume(pa_source_new_data *data, const pa_cvolume *v data->volume = *volume; } -void pa_source_new_data_set_muted(pa_source_new_data *data, pa_bool_t mute) { +void pa_source_new_data_set_muted(pa_source_new_data *data, bool mute) { pa_assert(data); - data->muted_is_set = TRUE; + data->muted_is_set = true; data->muted = !!mute; } @@ -206,20 +206,20 @@ pa_source* pa_source_new( if (!data->volume_is_set) { pa_cvolume_reset(&data->volume, data->sample_spec.channels); - data->save_volume = FALSE; + data->save_volume = false; } pa_return_null_if_fail(pa_cvolume_valid(&data->volume)); pa_return_null_if_fail(pa_cvolume_compatible(&data->volume, &data->sample_spec)); if (!data->muted_is_set) - data->muted = FALSE; + data->muted = false; if (data->card) pa_proplist_update(data->proplist, PA_UPDATE_MERGE, data->card->proplist); pa_device_init_description(data->proplist); - pa_device_init_icon(data->proplist, FALSE); + pa_device_init_icon(data->proplist, false); pa_device_init_intended_roles(data->proplist); if (pa_hook_fire(&core->hooks[PA_CORE_HOOK_SOURCE_FIXATE], data) < 0) { @@ -236,7 +236,7 @@ pa_source* pa_source_new( s->flags = flags; s->priority = 0; s->suspend_cause = data->suspend_cause; - pa_source_set_mixer_dirty(s, FALSE); + pa_source_set_mixer_dirty(s, false); s->name = pa_xstrdup(name); s->proplist = pa_proplist_copy(data->proplist); s->driver = pa_xstrdup(pa_path_get_filename(data->driver)); @@ -269,7 +269,7 @@ pa_source* pa_source_new( s->base_volume = PA_VOLUME_NORM; s->n_volume_steps = PA_VOLUME_NORM+1; s->muted = data->muted; - s->refresh_volume = s->refresh_muted = FALSE; + s->refresh_volume = s->refresh_muted = false; reset_callbacks(s); s->userdata = NULL; @@ -282,7 +282,7 @@ pa_source* pa_source_new( data->ports = NULL; s->active_port = NULL; - s->save_port = FALSE; + s->save_port = false; if (data->active_port) if ((s->active_port = pa_hashmap_get(s->ports, data->active_port))) @@ -318,7 +318,7 @@ pa_source* pa_source_new( s->thread_info.soft_muted = s->muted; s->thread_info.state = s->state; s->thread_info.max_rewind = 0; - s->thread_info.requested_latency_valid = FALSE; + s->thread_info.requested_latency_valid = false; s->thread_info.requested_latency = 0; s->thread_info.min_latency = ABSOLUTE_MIN_LATENCY; s->thread_info.max_latency = ABSOLUTE_MAX_LATENCY; @@ -352,7 +352,7 @@ pa_source* pa_source_new( /* Called from main context */ static int source_set_state(pa_source *s, pa_source_state_t state) { int ret; - pa_bool_t suspend_change; + bool suspend_change; pa_source_state_t original_state; pa_assert(s); @@ -482,7 +482,7 @@ void pa_source_set_set_mute_callback(pa_source *s, pa_source_cb_t cb) { pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index); } -static void enable_flat_volume(pa_source *s, pa_bool_t enable) { +static void enable_flat_volume(pa_source *s, bool enable) { pa_source_flags_t flags; pa_assert(s); @@ -503,7 +503,7 @@ static void enable_flat_volume(pa_source *s, pa_bool_t enable) { pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index); } -void pa_source_enable_decibel_volume(pa_source *s, pa_bool_t enable) { +void pa_source_enable_decibel_volume(pa_source *s, bool enable) { pa_source_flags_t flags; pa_assert(s); @@ -513,10 +513,10 @@ void pa_source_enable_decibel_volume(pa_source *s, pa_bool_t enable) { if (enable) { s->flags |= PA_SOURCE_DECIBEL_VOLUME; - enable_flat_volume(s, TRUE); + enable_flat_volume(s, true); } else { s->flags &= ~PA_SOURCE_DECIBEL_VOLUME; - enable_flat_volume(s, FALSE); + enable_flat_volume(s, false); } /* If the flags have changed after init, let any clients know via a change event */ @@ -562,12 +562,12 @@ void pa_source_put(pa_source *s) { * * Note: This flag can also change over the life time of the source. */ if (!(s->flags & PA_SOURCE_HW_VOLUME_CTRL) && !(s->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER)) - pa_source_enable_decibel_volume(s, TRUE); + pa_source_enable_decibel_volume(s, true); /* If the source implementor support DB volumes by itself, we should always * try and enable flat volumes too */ if ((s->flags & PA_SOURCE_DECIBEL_VOLUME)) - enable_flat_volume(s, TRUE); + enable_flat_volume(s, true); if (s->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER) { pa_source *root_source = pa_source_get_master(s); @@ -606,7 +606,7 @@ void pa_source_put(pa_source *s) { /* Called from main context */ void pa_source_unlink(pa_source *s) { - pa_bool_t linked; + bool linked; pa_source_output *o, *j = NULL; pa_assert(s); @@ -740,12 +740,12 @@ int pa_source_update_status(pa_source*s) { } /* Called from any context - must be threadsafe */ -void pa_source_set_mixer_dirty(pa_source *s, pa_bool_t is_dirty) { +void pa_source_set_mixer_dirty(pa_source *s, bool is_dirty) { pa_atomic_store(&s->mixer_dirty, is_dirty ? 1 : 0); } /* Called from main context */ -int pa_source_suspend(pa_source *s, pa_bool_t suspend, pa_suspend_cause_t cause) { +int pa_source_suspend(pa_source *s, bool suspend, pa_suspend_cause_t cause) { pa_source_assert_ref(s); pa_assert_ctl_context(); pa_assert(PA_SOURCE_IS_LINKED(s->state)); @@ -762,7 +762,7 @@ int pa_source_suspend(pa_source *s, pa_bool_t suspend, pa_suspend_cause_t cause) if (!(s->suspend_cause & PA_SUSPEND_SESSION) && (pa_atomic_load(&s->mixer_dirty) != 0)) { /* This might look racy but isn't: If somebody sets mixer_dirty exactly here, it'll be handled just fine. */ - pa_source_set_mixer_dirty(s, FALSE); + pa_source_set_mixer_dirty(s, false); pa_log_debug("Mixer is now accessible. Updating alsa mixer settings."); if (s->active_port && s->set_port) { if (s->flags & PA_SOURCE_DEFERRED_VOLUME) { @@ -837,7 +837,7 @@ pa_queue *pa_source_move_all_start(pa_source *s, pa_queue *q) { } /* Called from main context */ -void pa_source_move_all_finish(pa_source *s, pa_queue *q, pa_bool_t save) { +void pa_source_move_all_finish(pa_source *s, pa_queue *q, bool save) { pa_source_output *o; pa_source_assert_ref(s); @@ -967,8 +967,8 @@ void pa_source_post_direct(pa_source*s, pa_source_output *o, const pa_memchunk * } /* Called from main thread */ -pa_bool_t pa_source_update_rate(pa_source *s, uint32_t rate, pa_bool_t passthrough) { - pa_bool_t ret = FALSE; +bool pa_source_update_rate(pa_source *s, uint32_t rate, bool passthrough) { + bool ret = false; if (s->update_rate) { uint32_t desired_rate = rate; @@ -976,22 +976,22 @@ pa_bool_t pa_source_update_rate(pa_source *s, uint32_t rate, pa_bool_t passthrou uint32_t alternate_rate = s->alternate_sample_rate; uint32_t idx; pa_source_output *o; - pa_bool_t use_alternate = FALSE; + bool use_alternate = false; if (PA_UNLIKELY(default_rate == alternate_rate)) { pa_log_warn("Default and alternate sample rates are the same."); - return FALSE; + return false; } if (PA_SOURCE_IS_RUNNING(s->state)) { pa_log_info("Cannot update rate, SOURCE_IS_RUNNING, will keep using %u Hz", s->sample_spec.rate); - return FALSE; + return false; } if (PA_UNLIKELY (desired_rate < 8000 || desired_rate > PA_RATE_MAX)) - return FALSE; + return false; if (!passthrough) { pa_assert(default_rate % 4000 || default_rate % 11025); @@ -1000,11 +1000,11 @@ pa_bool_t pa_source_update_rate(pa_source *s, uint32_t rate, pa_bool_t passthrou if (default_rate % 4000) { /* default is a 11025 multiple */ if ((alternate_rate % 4000 == 0) && (desired_rate % 4000 == 0)) - use_alternate=TRUE; + use_alternate=true; } else { /* default is 4000 multiple */ if ((alternate_rate % 11025 == 0) && (desired_rate % 11025 == 0)) - use_alternate=TRUE; + use_alternate=true; } if (use_alternate) @@ -1016,25 +1016,25 @@ pa_bool_t pa_source_update_rate(pa_source *s, uint32_t rate, pa_bool_t passthrou } if (desired_rate == s->sample_spec.rate) - return FALSE; + return false; if (!passthrough && pa_source_used_by(s) > 0) - return FALSE; + return false; pa_log_debug("Suspending source %s due to changing the sample rate.", s->name); - pa_source_suspend(s, TRUE, PA_SUSPEND_INTERNAL); + pa_source_suspend(s, true, PA_SUSPEND_INTERNAL); - if (s->update_rate(s, desired_rate) == TRUE) { + if (s->update_rate(s, desired_rate) == true) { pa_log_info("Changed sampling rate successfully "); PA_IDXSET_FOREACH(o, s->outputs, idx) { if (o->state == PA_SOURCE_OUTPUT_CORKED) pa_source_output_update_rate(o); } - ret = TRUE; + ret = true; } - pa_source_suspend(s, FALSE, PA_SUSPEND_INTERNAL); + pa_source_suspend(s, false, PA_SUSPEND_INTERNAL); } return ret; @@ -1106,7 +1106,7 @@ pa_usec_t pa_source_get_latency_within_thread(pa_source *s) { * When a source uses volume sharing, it never has the PA_SOURCE_FLAT_VOLUME flag * set. Instead, flat volume mode is detected by checking whether the root source * has the flag set. */ -pa_bool_t pa_source_flat_volume_enabled(pa_source *s) { +bool pa_source_flat_volume_enabled(pa_source *s) { pa_source_assert_ref(s); s = pa_source_get_master(s); @@ -1114,7 +1114,7 @@ pa_bool_t pa_source_flat_volume_enabled(pa_source *s) { if (PA_LIKELY(s)) return (s->flags & PA_SOURCE_FLAT_VOLUME); else - return FALSE; + return false; } /* Called from the main thread (and also from the IO thread while the main @@ -1133,7 +1133,7 @@ pa_source *pa_source_get_master(pa_source *s) { } /* Called from main context */ -pa_bool_t pa_source_is_passthrough(pa_source *s) { +bool pa_source_is_passthrough(pa_source *s) { pa_source_assert_ref(s); @@ -1146,20 +1146,20 @@ void pa_source_enter_passthrough(pa_source *s) { pa_cvolume volume; /* set the volume to NORM */ - s->saved_volume = *pa_source_get_volume(s, TRUE); + s->saved_volume = *pa_source_get_volume(s, true); s->saved_save_volume = s->save_volume; pa_cvolume_set(&volume, s->sample_spec.channels, PA_MIN(s->base_volume, PA_VOLUME_NORM)); - pa_source_set_volume(s, &volume, TRUE, FALSE); + pa_source_set_volume(s, &volume, true, false); } /* Called from main context */ void pa_source_leave_passthrough(pa_source *s) { /* Restore source volume to what it was before we entered passthrough mode */ - pa_source_set_volume(s, &s->saved_volume, TRUE, s->saved_save_volume); + pa_source_set_volume(s, &s->saved_volume, true, s->saved_save_volume); pa_cvolume_init(&s->saved_volume); - s->saved_save_volume = FALSE; + s->saved_save_volume = false; } /* Called from main context. */ @@ -1357,7 +1357,7 @@ static void get_maximum_output_volume(pa_source *s, pa_cvolume *max_volume, cons /* Called from main thread. Only called for the root source in volume sharing * cases, except for internal recursive calls. */ -static pa_bool_t has_outputs(pa_source *s) { +static bool has_outputs(pa_source *s) { pa_source_output *o; uint32_t idx; @@ -1365,10 +1365,10 @@ static pa_bool_t has_outputs(pa_source *s) { PA_IDXSET_FOREACH(o, s->outputs, idx) { if (!o->destination_source || !(o->destination_source->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER) || has_outputs(o->destination_source)) - return TRUE; + return true; } - return FALSE; + return false; } /* Called from main thread. Only called for the root source in volume sharing @@ -1490,9 +1490,9 @@ static void propagate_reference_volume(pa_source *s) { /* Called from main thread. Only called for the root source in volume sharing * cases, except for internal recursive calls. The return value indicates * whether any reference volume actually changed. */ -static pa_bool_t update_reference_volume(pa_source *s, const pa_cvolume *v, const pa_channel_map *channel_map, pa_bool_t save) { +static bool update_reference_volume(pa_source *s, const pa_cvolume *v, const pa_channel_map *channel_map, bool save) { pa_cvolume volume; - pa_bool_t reference_volume_changed; + bool reference_volume_changed; pa_source_output *o; uint32_t idx; @@ -1523,24 +1523,24 @@ static pa_bool_t update_reference_volume(pa_source *s, const pa_cvolume *v, cons * intermediate source that didn't change its volume. This theoretical * possibility is the reason why we have that !(s->flags & * PA_SOURCE_SHARE_VOLUME_WITH_MASTER) condition. Probably nobody would - * notice even if we returned here FALSE always if - * reference_volume_changed is FALSE. */ - return FALSE; + * notice even if we returned here false always if + * reference_volume_changed is false. */ + return false; PA_IDXSET_FOREACH(o, s->outputs, idx) { if (o->destination_source && (o->destination_source->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER)) - update_reference_volume(o->destination_source, v, channel_map, FALSE); + update_reference_volume(o->destination_source, v, channel_map, false); } - return TRUE; + return true; } /* Called from main thread */ void pa_source_set_volume( pa_source *s, const pa_cvolume *volume, - pa_bool_t send_msg, - pa_bool_t save) { + bool send_msg, + bool save) { pa_cvolume new_reference_volume; pa_source *root_source; @@ -1674,7 +1674,7 @@ static void propagate_real_volume(pa_source *s, const pa_cvolume *old_real_volum return; /* 1. Make the real volume the reference volume */ - update_reference_volume(s, &s->real_volume, &s->channel_map, TRUE); + update_reference_volume(s, &s->real_volume, &s->channel_map, true); } if (pa_source_flat_volume_enabled(s)) { @@ -1716,7 +1716,7 @@ static void propagate_real_volume(pa_source *s, const pa_cvolume *old_real_volum * to save changed hw settings given that hw volume changes not * triggered by PA are almost certainly done by the user. */ if (!(s->flags & PA_SOURCE_SHARE_VOLUME_WITH_MASTER)) - s->save_volume = TRUE; + s->save_volume = true; } /* Called from io thread */ @@ -1728,7 +1728,7 @@ void pa_source_update_volume_and_mute(pa_source *s) { } /* Called from main thread */ -const pa_cvolume *pa_source_get_volume(pa_source *s, pa_bool_t force_refresh) { +const pa_cvolume *pa_source_get_volume(pa_source *s, bool force_refresh) { pa_source_assert_ref(s); pa_assert_ctl_context(); pa_assert(PA_SOURCE_IS_LINKED(s->state)); @@ -1770,8 +1770,8 @@ void pa_source_volume_changed(pa_source *s, const pa_cvolume *new_real_volume) { } /* Called from main thread */ -void pa_source_set_mute(pa_source *s, pa_bool_t mute, pa_bool_t save) { - pa_bool_t old_muted; +void pa_source_set_mute(pa_source *s, bool mute, bool save) { + bool old_muted; pa_source_assert_ref(s); pa_assert_ctl_context(); @@ -1791,14 +1791,14 @@ void pa_source_set_mute(pa_source *s, pa_bool_t mute, pa_bool_t save) { } /* Called from main thread */ -pa_bool_t pa_source_get_mute(pa_source *s, pa_bool_t force_refresh) { +bool pa_source_get_mute(pa_source *s, bool force_refresh) { pa_source_assert_ref(s); pa_assert_ctl_context(); pa_assert(PA_SOURCE_IS_LINKED(s->state)); if (s->refresh_muted || force_refresh) { - pa_bool_t old_muted = s->muted; + bool old_muted = s->muted; if (!(s->flags & PA_SOURCE_DEFERRED_VOLUME) && s->get_mute) s->get_mute(s); @@ -1806,7 +1806,7 @@ pa_bool_t pa_source_get_mute(pa_source *s, pa_bool_t force_refresh) { pa_assert_se(pa_asyncmsgq_send(s->asyncmsgq, PA_MSGOBJECT(s), PA_SOURCE_MESSAGE_GET_MUTE, NULL, 0, NULL) == 0); if (old_muted != s->muted) { - s->save_muted = TRUE; + s->save_muted = true; pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index); @@ -1819,7 +1819,7 @@ pa_bool_t pa_source_get_mute(pa_source *s, pa_bool_t force_refresh) { } /* Called from main thread */ -void pa_source_mute_changed(pa_source *s, pa_bool_t new_muted) { +void pa_source_mute_changed(pa_source *s, bool new_muted) { pa_source_assert_ref(s); pa_assert_ctl_context(); pa_assert(PA_SOURCE_IS_LINKED(s->state)); @@ -1830,13 +1830,13 @@ void pa_source_mute_changed(pa_source *s, pa_bool_t new_muted) { return; s->muted = new_muted; - s->save_muted = TRUE; + s->save_muted = true; pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index); } /* Called from main thread */ -pa_bool_t pa_source_update_proplist(pa_source *s, pa_update_mode_t mode, pa_proplist *p) { +bool pa_source_update_proplist(pa_source *s, pa_update_mode_t mode, pa_proplist *p) { pa_source_assert_ref(s); pa_assert_ctl_context(); @@ -1848,7 +1848,7 @@ pa_bool_t pa_source_update_proplist(pa_source *s, pa_update_mode_t mode, pa_prop pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE|PA_SUBSCRIPTION_EVENT_CHANGE, s->index); } - return TRUE; + return true; } /* Called from main thread */ @@ -1952,7 +1952,7 @@ static void sync_output_volumes_within_thread(pa_source *s) { continue; o->thread_info.soft_volume = o->soft_volume; - //pa_source_output_request_rewind(o, 0, TRUE, FALSE, FALSE); + //pa_source_output_request_rewind(o, 0, true, false, false); } } @@ -1990,7 +1990,7 @@ int pa_source_process_msg(pa_msgobject *object, int code, void *userdata, int64_ } pa_assert(!o->thread_info.attached); - o->thread_info.attached = TRUE; + o->thread_info.attached = true; if (o->attach) o->attach(o); @@ -2021,7 +2021,7 @@ int pa_source_process_msg(pa_msgobject *object, int code, void *userdata, int64_ o->detach(o); pa_assert(o->thread_info.attached); - o->thread_info.attached = FALSE; + o->thread_info.attached = false; if (o->thread_info.direct_on_input) { pa_hashmap_remove(o->thread_info.direct_on_input->thread_info.direct_outputs, PA_UINT32_TO_PTR(o->index)); @@ -2031,7 +2031,7 @@ int pa_source_process_msg(pa_msgobject *object, int code, void *userdata, int64_ if (pa_hashmap_remove(s->thread_info.outputs, PA_UINT32_TO_PTR(o->index))) pa_source_output_unref(o); - pa_source_invalidate_requested_latency(s, TRUE); + pa_source_invalidate_requested_latency(s, true); /* In flat volume mode we need to update the volume as * well */ @@ -2102,7 +2102,7 @@ int pa_source_process_msg(pa_msgobject *object, int code, void *userdata, int64_ case PA_SOURCE_MESSAGE_SET_STATE: { - pa_bool_t suspend_change = + bool suspend_change = (s->thread_info.state == PA_SOURCE_SUSPENDED && PA_SOURCE_IS_OPENED(PA_PTR_TO_UINT(userdata))) || (PA_SOURCE_IS_OPENED(s->thread_info.state) && PA_PTR_TO_UINT(userdata) == PA_SOURCE_SUSPENDED); @@ -2210,8 +2210,8 @@ int pa_source_process_msg(pa_msgobject *object, int code, void *userdata, int64_ if (!PA_SOURCE_IS_LINKED(s->state)) return 0; - pa_source_get_volume(s, TRUE); - pa_source_get_mute(s, TRUE); + pa_source_get_volume(s, true); + pa_source_get_mute(s, true); return 0; case PA_SOURCE_MESSAGE_SET_LATENCY_OFFSET: @@ -2226,7 +2226,7 @@ int pa_source_process_msg(pa_msgobject *object, int code, void *userdata, int64_ } /* Called from main thread */ -int pa_source_suspend_all(pa_core *c, pa_bool_t suspend, pa_suspend_cause_t cause) { +int pa_source_suspend_all(pa_core *c, bool suspend, pa_suspend_cause_t cause) { pa_source *source; uint32_t idx; int ret = 0; @@ -2320,7 +2320,7 @@ pa_usec_t pa_source_get_requested_latency_within_thread(pa_source *s) { if (PA_SOURCE_IS_LINKED(s->thread_info.state)) { /* Only cache this if we are fully set up */ s->thread_info.requested_latency = result; - s->thread_info.requested_latency_valid = TRUE; + s->thread_info.requested_latency_valid = true; } return result; @@ -2372,7 +2372,7 @@ void pa_source_set_max_rewind(pa_source *s, size_t max_rewind) { } /* Called from IO thread */ -void pa_source_invalidate_requested_latency(pa_source *s, pa_bool_t dynamic) { +void pa_source_invalidate_requested_latency(pa_source *s, bool dynamic) { pa_source_output *o; void *state = NULL; @@ -2380,7 +2380,7 @@ void pa_source_invalidate_requested_latency(pa_source *s, pa_bool_t dynamic) { pa_source_assert_io_context(s); if ((s->flags & PA_SOURCE_DYNAMIC_LATENCY)) - s->thread_info.requested_latency_valid = FALSE; + s->thread_info.requested_latency_valid = false; else if (dynamic) return; @@ -2484,7 +2484,7 @@ void pa_source_set_latency_range_within_thread(pa_source *s, pa_usec_t min_laten o->update_source_latency_range(o); } - pa_source_invalidate_requested_latency(s, FALSE); + pa_source_invalidate_requested_latency(s, false); } /* Called from main thread, before the source is put */ @@ -2556,7 +2556,7 @@ void pa_source_set_fixed_latency_within_thread(pa_source *s, pa_usec_t latency) o->update_source_fixed_latency(o); } - pa_source_invalidate_requested_latency(s, FALSE); + pa_source_invalidate_requested_latency(s, false); } /* Called from main thread */ @@ -2586,7 +2586,7 @@ size_t pa_source_get_max_rewind(pa_source *s) { } /* Called from main context */ -int pa_source_set_port(pa_source *s, const char *name, pa_bool_t save) { +int pa_source_set_port(pa_source *s, const char *name, bool save) { pa_device_port *port; int ret; @@ -2736,9 +2736,9 @@ static void pa_source_volume_change_flush(pa_source *s) { } /* Called from the IO thread. */ -pa_bool_t pa_source_volume_change_apply(pa_source *s, pa_usec_t *usec_to_next) { +bool pa_source_volume_change_apply(pa_source *s, pa_usec_t *usec_to_next) { pa_usec_t now; - pa_bool_t ret = FALSE; + bool ret = false; pa_assert(s); @@ -2757,7 +2757,7 @@ pa_bool_t pa_source_volume_change_apply(pa_source *s, pa_usec_t *usec_to_next) { PA_LLIST_REMOVE(pa_source_volume_change, s->thread_info.volume_changes, c); pa_log_debug("Volume change to %d at %llu was written %llu usec late", pa_cvolume_avg(&c->hw_volume), (long long unsigned) c->at, (long long unsigned) (now - c->at)); - ret = TRUE; + ret = true; s->thread_info.current_hw_volume = c->hw_volume; pa_source_volume_change_free(c); } @@ -2804,9 +2804,9 @@ pa_idxset* pa_source_get_formats(pa_source *s) { /* Called from the main thread */ /* Checks if the source can accept this format */ -pa_bool_t pa_source_check_format(pa_source *s, pa_format_info *f) { +bool pa_source_check_format(pa_source *s, pa_format_info *f) { pa_idxset *formats = NULL; - pa_bool_t ret = FALSE; + bool ret = false; pa_assert(s); pa_assert(f); @@ -2819,7 +2819,7 @@ pa_bool_t pa_source_check_format(pa_source *s, pa_format_info *f) { PA_IDXSET_FOREACH(finfo_device, formats, i) { if (pa_format_info_is_compatible(finfo_device, f)) { - ret = TRUE; + ret = true; break; } } diff --git a/src/pulsecore/source.h b/src/pulsecore/source.h index ef26dd939..6bdd47293 100644 --- a/src/pulsecore/source.h +++ b/src/pulsecore/source.h @@ -51,7 +51,7 @@ typedef struct pa_source_volume_change pa_source_volume_change; #define PA_MAX_OUTPUTS_PER_SOURCE 32 /* Returns true if source is linked: registered and accessible from client side. */ -static inline pa_bool_t PA_SOURCE_IS_LINKED(pa_source_state_t x) { +static inline bool PA_SOURCE_IS_LINKED(pa_source_state_t x) { return x == PA_SOURCE_RUNNING || x == PA_SOURCE_IDLE || x == PA_SOURCE_SUSPENDED; } @@ -93,17 +93,17 @@ struct pa_source { pa_cvolume real_volume; /* The volume that the hardware is configured to */ pa_cvolume soft_volume; /* The internal software volume we apply to all PCM data while it passes through */ - pa_bool_t muted:1; + bool muted:1; - pa_bool_t refresh_volume:1; - pa_bool_t refresh_muted:1; - pa_bool_t save_port:1; - pa_bool_t save_volume:1; - pa_bool_t save_muted:1; + bool refresh_volume:1; + bool refresh_muted:1; + bool save_port:1; + bool save_volume:1; + bool save_muted:1; /* Saved volume state while we're in passthrough mode */ pa_cvolume saved_volume; - pa_bool_t saved_save_volume:1; + bool saved_save_volume:1; pa_asyncmsgq *asyncmsgq; @@ -126,7 +126,7 @@ struct pa_source { /* Called when the volume is queried. Called from main loop * context. If this is NULL a PA_SOURCE_MESSAGE_GET_VOLUME message * will be sent to the IO thread instead. If refresh_volume is - * FALSE neither this function is called nor a message is sent. + * false neither this function is called nor a message is sent. * * You must use the function pa_source_set_get_volume_callback() to * set this callback. */ @@ -159,7 +159,7 @@ struct pa_source { /* Called when the mute setting is queried. Called from main loop * context. If this is NULL a PA_SOURCE_MESSAGE_GET_MUTE message * will be sent to the IO thread instead. If refresh_mute is - * FALSE neither this function is called nor a message is sent. + * false neither this function is called nor a message is sent. * * You must use the function pa_source_set_get_mute_callback() to * set this callback. */ @@ -187,7 +187,7 @@ struct pa_source { /* Called whenever the sampling frequency shall be changed. Called from * main thread. */ - pa_bool_t (*update_rate)(pa_source *s, uint32_t rate); + bool (*update_rate)(pa_source *s, uint32_t rate); /* Contains copies of the above data so that the real-time worker * thread can work without access locking */ @@ -198,9 +198,9 @@ struct pa_source { pa_rtpoll *rtpoll; pa_cvolume soft_volume; - pa_bool_t soft_muted:1; + bool soft_muted:1; - pa_bool_t requested_latency_valid:1; + bool requested_latency_valid:1; pa_usec_t requested_latency; /* Then number of bytes this source will be rewound for at @@ -281,19 +281,19 @@ typedef struct pa_source_new_data { pa_channel_map channel_map; uint32_t alternate_sample_rate; pa_cvolume volume; - pa_bool_t muted:1; + bool muted:1; - pa_bool_t volume_is_set:1; - pa_bool_t muted_is_set:1; - pa_bool_t sample_spec_is_set:1; - pa_bool_t channel_map_is_set:1; - pa_bool_t alternate_sample_rate_is_set:1; + bool volume_is_set:1; + bool muted_is_set:1; + bool sample_spec_is_set:1; + bool channel_map_is_set:1; + bool alternate_sample_rate_is_set:1; - pa_bool_t namereg_fail:1; + bool namereg_fail:1; - pa_bool_t save_port:1; - pa_bool_t save_volume:1; - pa_bool_t save_muted:1; + bool save_port:1; + bool save_volume:1; + bool save_muted:1; } pa_source_new_data; pa_source_new_data* pa_source_new_data_init(pa_source_new_data *data); @@ -302,7 +302,7 @@ void pa_source_new_data_set_sample_spec(pa_source_new_data *data, const pa_sampl void pa_source_new_data_set_channel_map(pa_source_new_data *data, const pa_channel_map *map); void pa_source_new_data_set_alternate_sample_rate(pa_source_new_data *data, const uint32_t alternate_sample_rate); void pa_source_new_data_set_volume(pa_source_new_data *data, const pa_cvolume *volume); -void pa_source_new_data_set_muted(pa_source_new_data *data, pa_bool_t mute); +void pa_source_new_data_set_muted(pa_source_new_data *data, bool mute); void pa_source_new_data_set_port(pa_source_new_data *data, const char *port); void pa_source_new_data_done(pa_source_new_data *data); @@ -318,7 +318,7 @@ void pa_source_set_set_volume_callback(pa_source *s, pa_source_cb_t cb); void pa_source_set_write_volume_callback(pa_source *s, pa_source_cb_t cb); void pa_source_set_get_mute_callback(pa_source *s, pa_source_cb_t cb); void pa_source_set_set_mute_callback(pa_source *s, pa_source_cb_t cb); -void pa_source_enable_decibel_volume(pa_source *s, pa_bool_t enable); +void pa_source_enable_decibel_volume(pa_source *s, bool enable); void pa_source_put(pa_source *s); void pa_source_unlink(pa_source *s); @@ -336,7 +336,7 @@ void pa_source_attach(pa_source *s); void pa_source_set_soft_volume(pa_source *s, const pa_cvolume *volume); void pa_source_volume_changed(pa_source *s, const pa_cvolume *new_volume); -void pa_source_mute_changed(pa_source *s, pa_bool_t new_muted); +void pa_source_mute_changed(pa_source *s, bool new_muted); int pa_source_sync_suspend(pa_source *s); @@ -355,34 +355,34 @@ pa_usec_t pa_source_get_fixed_latency(pa_source *s); size_t pa_source_get_max_rewind(pa_source *s); int pa_source_update_status(pa_source*s); -int pa_source_suspend(pa_source *s, pa_bool_t suspend, pa_suspend_cause_t cause); -int pa_source_suspend_all(pa_core *c, pa_bool_t suspend, pa_suspend_cause_t cause); +int pa_source_suspend(pa_source *s, bool suspend, pa_suspend_cause_t cause); +int pa_source_suspend_all(pa_core *c, bool suspend, pa_suspend_cause_t cause); /* Use this instead of checking s->flags & PA_SOURCE_FLAT_VOLUME directly. */ -pa_bool_t pa_source_flat_volume_enabled(pa_source *s); +bool pa_source_flat_volume_enabled(pa_source *s); /* Get the master source when sharing volumes */ pa_source *pa_source_get_master(pa_source *s); /* Is the source in passthrough mode? (that is, is this a monitor source for a sink * that has a passthrough sink input connected to it. */ -pa_bool_t pa_source_is_passthrough(pa_source *s); +bool pa_source_is_passthrough(pa_source *s); /* These should be called when a source enters/leaves passthrough mode */ void pa_source_enter_passthrough(pa_source *s); void pa_source_leave_passthrough(pa_source *s); -void pa_source_set_volume(pa_source *source, const pa_cvolume *volume, pa_bool_t sendmsg, pa_bool_t save); -const pa_cvolume *pa_source_get_volume(pa_source *source, pa_bool_t force_refresh); +void pa_source_set_volume(pa_source *source, const pa_cvolume *volume, bool sendmsg, bool save); +const pa_cvolume *pa_source_get_volume(pa_source *source, bool force_refresh); -void pa_source_set_mute(pa_source *source, pa_bool_t mute, pa_bool_t save); -pa_bool_t pa_source_get_mute(pa_source *source, pa_bool_t force_refresh); +void pa_source_set_mute(pa_source *source, bool mute, bool save); +bool pa_source_get_mute(pa_source *source, bool force_refresh); -pa_bool_t pa_source_update_proplist(pa_source *s, pa_update_mode_t mode, pa_proplist *p); +bool pa_source_update_proplist(pa_source *s, pa_update_mode_t mode, pa_proplist *p); -int pa_source_set_port(pa_source *s, const char *name, pa_bool_t save); -void pa_source_set_mixer_dirty(pa_source *s, pa_bool_t is_dirty); +int pa_source_set_port(pa_source *s, const char *name, bool save); +void pa_source_set_mixer_dirty(pa_source *s, bool is_dirty); -pa_bool_t pa_source_update_rate(pa_source *s, uint32_t rate, pa_bool_t passthrough); +bool pa_source_update_rate(pa_source *s, uint32_t rate, bool passthrough); unsigned pa_source_linked_by(pa_source *s); /* Number of connected streams */ unsigned pa_source_used_by(pa_source *s); /* Number of connected streams that are not corked */ @@ -391,11 +391,11 @@ unsigned pa_source_check_suspend(pa_source *s); /* Returns how many streams are /* Moves all inputs away, and stores them in pa_queue */ pa_queue *pa_source_move_all_start(pa_source *s, pa_queue *q); -void pa_source_move_all_finish(pa_source *s, pa_queue *q, pa_bool_t save); +void pa_source_move_all_finish(pa_source *s, pa_queue *q, bool save); void pa_source_move_all_fail(pa_queue *q); pa_idxset* pa_source_get_formats(pa_source *s); -pa_bool_t pa_source_check_format(pa_source *s, pa_format_info *f); +bool pa_source_check_format(pa_source *s, pa_format_info *f); pa_idxset* pa_source_check_formats(pa_source *s, pa_idxset *in_formats); /*** To be called exclusively by the source driver, from IO context */ @@ -418,11 +418,11 @@ void pa_source_set_fixed_latency_within_thread(pa_source *s, pa_usec_t latency); void pa_source_update_volume_and_mute(pa_source *s); -pa_bool_t pa_source_volume_change_apply(pa_source *s, pa_usec_t *usec_to_next); +bool pa_source_volume_change_apply(pa_source *s, pa_usec_t *usec_to_next); /*** To be called exclusively by source output drivers, from IO context */ -void pa_source_invalidate_requested_latency(pa_source *s, pa_bool_t dynamic); +void pa_source_invalidate_requested_latency(pa_source *s, bool dynamic); pa_usec_t pa_source_get_latency_within_thread(pa_source *s); #define pa_source_assert_io_context(s) \ diff --git a/src/pulsecore/strbuf.c b/src/pulsecore/strbuf.c index f131d5cdb..7c15fa7e9 100644 --- a/src/pulsecore/strbuf.c +++ b/src/pulsecore/strbuf.c @@ -188,7 +188,7 @@ size_t pa_strbuf_printf(pa_strbuf *sb, const char *format, ...) { } } -pa_bool_t pa_strbuf_isempty(pa_strbuf *sb) { +bool pa_strbuf_isempty(pa_strbuf *sb) { pa_assert(sb); return sb->length <= 0; diff --git a/src/pulsecore/strbuf.h b/src/pulsecore/strbuf.h index d71ecb984..6e525765e 100644 --- a/src/pulsecore/strbuf.h +++ b/src/pulsecore/strbuf.h @@ -37,6 +37,6 @@ void pa_strbuf_puts(pa_strbuf *sb, const char *t); void pa_strbuf_putsn(pa_strbuf *sb, const char *t, size_t m); void pa_strbuf_putc(pa_strbuf *sb, char c); -pa_bool_t pa_strbuf_isempty(pa_strbuf *sb); +bool pa_strbuf_isempty(pa_strbuf *sb); #endif diff --git a/src/pulsecore/tagstruct.c b/src/pulsecore/tagstruct.c index 762947a09..e51fcf284 100644 --- a/src/pulsecore/tagstruct.c +++ b/src/pulsecore/tagstruct.c @@ -47,7 +47,7 @@ struct pa_tagstruct { size_t length, allocated; size_t rindex; - pa_bool_t dynamic; + bool dynamic; }; pa_tagstruct *pa_tagstruct_new(const uint8_t* data, size_t length) { @@ -161,7 +161,7 @@ void pa_tagstruct_put_arbitrary(pa_tagstruct *t, const void *p, size_t length) { t->length += 5+length; } -void pa_tagstruct_put_boolean(pa_tagstruct*t, pa_bool_t b) { +void pa_tagstruct_put_boolean(pa_tagstruct*t, bool b) { pa_assert(t); extend(t, 1); @@ -429,7 +429,7 @@ const uint8_t* pa_tagstruct_data(pa_tagstruct*t, size_t *l) { return t->data; } -int pa_tagstruct_get_boolean(pa_tagstruct*t, pa_bool_t *b) { +int pa_tagstruct_get_boolean(pa_tagstruct*t, bool *b) { pa_assert(t); pa_assert(b); @@ -437,9 +437,9 @@ int pa_tagstruct_get_boolean(pa_tagstruct*t, pa_bool_t *b) { return -1; if (t->data[t->rindex] == PA_TAG_BOOLEAN_TRUE) - *b = TRUE; + *b = true; else if (t->data[t->rindex] == PA_TAG_BOOLEAN_FALSE) - *b = FALSE; + *b = false; else return -1; @@ -799,7 +799,7 @@ int pa_tagstruct_get(pa_tagstruct *t, ...) { case PA_TAG_BOOLEAN_TRUE: case PA_TAG_BOOLEAN_FALSE: - ret = pa_tagstruct_get_boolean(t, va_arg(va, pa_bool_t*)); + ret = pa_tagstruct_get_boolean(t, va_arg(va, bool*)); break; case PA_TAG_TIMEVAL: diff --git a/src/pulsecore/tagstruct.h b/src/pulsecore/tagstruct.h index 5f729bc6a..9fef25574 100644 --- a/src/pulsecore/tagstruct.h +++ b/src/pulsecore/tagstruct.h @@ -78,7 +78,7 @@ void pa_tagstruct_putu64(pa_tagstruct*t, uint64_t i); void pa_tagstruct_puts64(pa_tagstruct*t, int64_t i); void pa_tagstruct_put_sample_spec(pa_tagstruct *t, const pa_sample_spec *ss); void pa_tagstruct_put_arbitrary(pa_tagstruct*t, const void *p, size_t length); -void pa_tagstruct_put_boolean(pa_tagstruct*t, pa_bool_t b); +void pa_tagstruct_put_boolean(pa_tagstruct*t, bool b); void pa_tagstruct_put_timeval(pa_tagstruct*t, const struct timeval *tv); void pa_tagstruct_put_usec(pa_tagstruct*t, pa_usec_t u); void pa_tagstruct_put_channel_map(pa_tagstruct *t, const pa_channel_map *map); @@ -96,7 +96,7 @@ int pa_tagstruct_getu64(pa_tagstruct*t, uint64_t *i); int pa_tagstruct_gets64(pa_tagstruct*t, int64_t *i); int pa_tagstruct_get_sample_spec(pa_tagstruct *t, pa_sample_spec *ss); int pa_tagstruct_get_arbitrary(pa_tagstruct *t, const void **p, size_t length); -int pa_tagstruct_get_boolean(pa_tagstruct *t, pa_bool_t *b); +int pa_tagstruct_get_boolean(pa_tagstruct *t, bool *b); int pa_tagstruct_get_timeval(pa_tagstruct*t, struct timeval *tv); int pa_tagstruct_get_usec(pa_tagstruct*t, pa_usec_t *u); int pa_tagstruct_get_channel_map(pa_tagstruct *t, pa_channel_map *map); diff --git a/src/pulsecore/thread-mq.c b/src/pulsecore/thread-mq.c index b492793ee..dd84c9af9 100644 --- a/src/pulsecore/thread-mq.c +++ b/src/pulsecore/thread-mq.c @@ -104,7 +104,7 @@ void pa_thread_mq_done(pa_thread_mq *q) { * dispatching anyway. */ if (!pa_asyncmsgq_dispatching(q->outq)) - pa_asyncmsgq_flush(q->outq, TRUE); + pa_asyncmsgq_flush(q->outq, true); q->mainloop->io_free(q->read_event); q->mainloop->io_free(q->write_event); diff --git a/src/pulsecore/thread-posix.c b/src/pulsecore/thread-posix.c index 3f4ae5c69..b422ab098 100644 --- a/src/pulsecore/thread-posix.c +++ b/src/pulsecore/thread-posix.c @@ -43,7 +43,7 @@ struct pa_thread { pa_thread_func_t thread_func; void *userdata; pa_atomic_t running; - pa_bool_t joined; + bool joined; char *name; }; @@ -134,7 +134,7 @@ int pa_thread_join(pa_thread *t) { if (t->joined) return -1; - t->joined = TRUE; + t->joined = true; return pthread_join(t->id, NULL); } @@ -149,7 +149,7 @@ pa_thread* pa_thread_self(void) { t = pa_xnew0(pa_thread, 1); t->id = pthread_self(); - t->joined = TRUE; + t->joined = true; pa_atomic_store(&t->running, 2); PA_STATIC_TLS_SET(current_thread, t); diff --git a/src/pulsecore/time-smoother.c b/src/pulsecore/time-smoother.c index 9b4a9505d..0bae4def9 100644 --- a/src/pulsecore/time-smoother.c +++ b/src/pulsecore/time-smoother.c @@ -54,7 +54,7 @@ * The larger 'adjust_time' is chosen the smoother our estimation * function will be -- but we'll adjust to clock skew slower, too. * - * If 'monotonic' is TRUE the resulting estimation function is + * If 'monotonic' is true the resulting estimation function is * guaranteed to be monotonic. */ @@ -79,11 +79,11 @@ struct pa_smoother { /* Cached parameters for our interpolation polynomial y=ax^3+b^2+cx */ double a, b, c; - pa_bool_t abc_valid:1; + bool abc_valid:1; - pa_bool_t monotonic:1; - pa_bool_t paused:1; - pa_bool_t smoothing:1; /* If FALSE we skip the polynomial interpolation step */ + bool monotonic:1; + bool paused:1; + bool smoothing:1; /* If false we skip the polynomial interpolation step */ pa_usec_t pause_time; @@ -93,11 +93,11 @@ struct pa_smoother { pa_smoother* pa_smoother_new( pa_usec_t adjust_time, pa_usec_t history_time, - pa_bool_t monotonic, - pa_bool_t smoothing, + bool monotonic, + bool smoothing, unsigned min_history, pa_usec_t time_offset, - pa_bool_t paused) { + bool paused) { pa_smoother *s; @@ -127,12 +127,12 @@ void pa_smoother_free(pa_smoother* s) { #define REDUCE(x) \ do { \ x = (x) % HISTORY_MAX; \ - } while(FALSE) + } while(false) #define REDUCE_INC(x) \ do { \ x = ((x)+1) % HISTORY_MAX; \ - } while(FALSE) + } while(false) static void drop_old(pa_smoother *s, pa_usec_t x) { @@ -273,7 +273,7 @@ static void calc_abc(pa_smoother *s) { s->b = (((double) (3*ky)/ (double) kx - dp - (double) (2*de))) / (double) kx; s->a = (dp/(double) kx - 2*s->b - de/(double) kx) / (double) (3*kx); - s->abc_valid = TRUE; + s->abc_valid = true; } static void estimate(pa_smoother *s, pa_usec_t x, pa_usec_t *y, double *deriv) { @@ -347,7 +347,7 @@ static void estimate(pa_smoother *s, pa_usec_t x, pa_usec_t *y, double *deriv) { void pa_smoother_put(pa_smoother *s, pa_usec_t x, pa_usec_t y) { pa_usec_t ney; double nde; - pa_bool_t is_new; + bool is_new; pa_assert(s); @@ -382,7 +382,7 @@ void pa_smoother_put(pa_smoother *s, pa_usec_t x, pa_usec_t y) { s->py = s->ry; } - s->abc_valid = FALSE; + s->abc_valid = false; #ifdef DEBUG_DATA pa_log_debug("%p, put(%llu | %llu) = %llu", s, (unsigned long long) (x + s->time_offset), (unsigned long long) x, (unsigned long long) y); @@ -444,11 +444,11 @@ void pa_smoother_pause(pa_smoother *s, pa_usec_t x) { pa_log_debug("pause(%llu)", (unsigned long long) x); #endif - s->paused = TRUE; + s->paused = true; s->pause_time = x; } -void pa_smoother_resume(pa_smoother *s, pa_usec_t x, pa_bool_t fix_now) { +void pa_smoother_resume(pa_smoother *s, pa_usec_t x, bool fix_now) { pa_assert(s); if (!s->paused) @@ -461,7 +461,7 @@ void pa_smoother_resume(pa_smoother *s, pa_usec_t x, pa_bool_t fix_now) { pa_log_debug("resume(%llu)", (unsigned long long) x); #endif - s->paused = FALSE; + s->paused = false; s->time_offset += x - s->pause_time; if (fix_now) @@ -501,7 +501,7 @@ pa_usec_t pa_smoother_translate(pa_smoother *s, pa_usec_t x, pa_usec_t y_delay) return (pa_usec_t) llrint((double) y_delay / nde); } -void pa_smoother_reset(pa_smoother *s, pa_usec_t time_offset, pa_bool_t paused) { +void pa_smoother_reset(pa_smoother *s, pa_usec_t time_offset, bool paused) { pa_assert(s); s->px = s->py = 0; @@ -515,7 +515,7 @@ void pa_smoother_reset(pa_smoother *s, pa_usec_t time_offset, pa_bool_t paused) s->last_y = s->last_x = 0; - s->abc_valid = FALSE; + s->abc_valid = false; s->paused = paused; s->time_offset = s->pause_time = time_offset; diff --git a/src/pulsecore/time-smoother.h b/src/pulsecore/time-smoother.h index 63d33e48f..3cb56612f 100644 --- a/src/pulsecore/time-smoother.h +++ b/src/pulsecore/time-smoother.h @@ -30,11 +30,11 @@ typedef struct pa_smoother pa_smoother; pa_smoother* pa_smoother_new( pa_usec_t x_adjust_time, pa_usec_t x_history_time, - pa_bool_t monotonic, - pa_bool_t smoothing, + bool monotonic, + bool smoothing, unsigned min_history, pa_usec_t x_offset, - pa_bool_t paused); + bool paused); void pa_smoother_free(pa_smoother* s); @@ -50,9 +50,9 @@ pa_usec_t pa_smoother_translate(pa_smoother *s, pa_usec_t x, pa_usec_t y_delay); void pa_smoother_set_time_offset(pa_smoother *s, pa_usec_t x_offset); void pa_smoother_pause(pa_smoother *s, pa_usec_t x); -void pa_smoother_resume(pa_smoother *s, pa_usec_t x, pa_bool_t abrupt); +void pa_smoother_resume(pa_smoother *s, pa_usec_t x, bool abrupt); -void pa_smoother_reset(pa_smoother *s, pa_usec_t time_offset, pa_bool_t paused); +void pa_smoother_reset(pa_smoother *s, pa_usec_t time_offset, bool paused); void pa_smoother_fix_now(pa_smoother *s); diff --git a/src/tests/asyncq-test.c b/src/tests/asyncq-test.c index 7abfb8973..22738e1c8 100644 --- a/src/tests/asyncq-test.c +++ b/src/tests/asyncq-test.c @@ -42,7 +42,7 @@ static void producer(void *_q) { pa_asyncq_push(q, PA_UINT_TO_PTR(i+1), 1); } - pa_asyncq_push(q, PA_UINT_TO_PTR(-1), TRUE); + pa_asyncq_push(q, PA_UINT_TO_PTR(-1), true); pa_log_debug("pushed end"); } @@ -54,7 +54,7 @@ static void consumer(void *_q) { pa_msleep(1000); for (i = 0;; i++) { - p = pa_asyncq_pop(q, TRUE); + p = pa_asyncq_pop(q, true); if (p == PA_UINT_TO_PTR(-1)) break; diff --git a/src/tests/cpu-test.c b/src/tests/cpu-test.c index aa4527aa5..a81e454bd 100644 --- a/src/tests/cpu-test.c +++ b/src/tests/cpu-test.c @@ -76,8 +76,8 @@ static void run_volume_test( pa_do_volume_func_t orig_func, int align, int channels, - pa_bool_t correct, - pa_bool_t perf) { + bool correct, + bool perf) { PA_DECLARE_ALIGNED(8, int16_t, s[SAMPLES]) = { 0 }; PA_DECLARE_ALIGNED(8, int16_t, s_ref[SAMPLES]) = { 0 }; @@ -155,11 +155,11 @@ START_TEST (svolume_mmx_test) { pa_log_debug("Checking MMX svolume"); for (i = 1; i <= 3; i++) { for (j = 0; j < 7; j++) - run_volume_test(mmx_func, orig_func, j, i, TRUE, FALSE); + run_volume_test(mmx_func, orig_func, j, i, true, false); } - run_volume_test(mmx_func, orig_func, 7, 1, TRUE, TRUE); - run_volume_test(mmx_func, orig_func, 7, 2, TRUE, TRUE); - run_volume_test(mmx_func, orig_func, 7, 3, TRUE, TRUE); + run_volume_test(mmx_func, orig_func, 7, 1, true, true); + run_volume_test(mmx_func, orig_func, 7, 2, true, true); + run_volume_test(mmx_func, orig_func, 7, 3, true, true); } END_TEST @@ -182,11 +182,11 @@ START_TEST (svolume_sse_test) { pa_log_debug("Checking SSE2 svolume"); for (i = 1; i <= 3; i++) { for (j = 0; j < 7; j++) - run_volume_test(sse_func, orig_func, j, i, TRUE, FALSE); + run_volume_test(sse_func, orig_func, j, i, true, false); } - run_volume_test(sse_func, orig_func, 7, 1, TRUE, TRUE); - run_volume_test(sse_func, orig_func, 7, 2, TRUE, TRUE); - run_volume_test(sse_func, orig_func, 7, 3, TRUE, TRUE); + run_volume_test(sse_func, orig_func, 7, 1, true, true); + run_volume_test(sse_func, orig_func, 7, 2, true, true); + run_volume_test(sse_func, orig_func, 7, 3, true, true); } END_TEST #endif /* defined (__i386__) || defined (__amd64__) */ @@ -211,11 +211,11 @@ START_TEST (svolume_arm_test) { pa_log_debug("Checking ARM svolume"); for (i = 1; i <= 3; i++) { for (j = 0; j < 7; j++) - run_volume_test(arm_func, orig_func, j, i, TRUE, FALSE); + run_volume_test(arm_func, orig_func, j, i, true, false); } - run_volume_test(arm_func, orig_func, 7, 1, TRUE, TRUE); - run_volume_test(arm_func, orig_func, 7, 2, TRUE, TRUE); - run_volume_test(arm_func, orig_func, 7, 3, TRUE, TRUE); + run_volume_test(arm_func, orig_func, 7, 1, true, true); + run_volume_test(arm_func, orig_func, 7, 2, true, true); + run_volume_test(arm_func, orig_func, 7, 3, true, true); } END_TEST #endif /* defined (__arm__) && defined (__linux__) */ @@ -243,10 +243,10 @@ START_TEST (svolume_orc_test) { pa_log_debug("Checking Orc svolume"); for (i = 1; i <= 2; i++) { for (j = 0; j < 7; j++) - run_volume_test(orc_func, orig_func, j, i, TRUE, FALSE); + run_volume_test(orc_func, orig_func, j, i, true, false); } - run_volume_test(orc_func, orig_func, 7, 1, TRUE, TRUE); - run_volume_test(orc_func, orig_func, 7, 2, TRUE, TRUE); + run_volume_test(orc_func, orig_func, 7, 1, true, true); + run_volume_test(orc_func, orig_func, 7, 2, true, true); } END_TEST @@ -265,8 +265,8 @@ static void run_conv_test_float_to_s16( pa_convert_func_t func, pa_convert_func_t orig_func, int align, - pa_bool_t correct, - pa_bool_t perf) { + bool correct, + bool perf) { PA_DECLARE_ALIGNED(8, int16_t, s[SAMPLES]) = { 0 }; PA_DECLARE_ALIGNED(8, int16_t, s_ref[SAMPLES]) = { 0 }; @@ -318,8 +318,8 @@ static void run_conv_test_s16_to_float( pa_convert_func_t func, pa_convert_func_t orig_func, int align, - pa_bool_t correct, - pa_bool_t perf) { + bool correct, + bool perf) { PA_DECLARE_ALIGNED(8, float, f[SAMPLES]) = { 0 }; PA_DECLARE_ALIGNED(8, float, f_ref[SAMPLES]) = { 0 }; @@ -381,14 +381,14 @@ START_TEST (sconv_sse2_test) { sse2_func = pa_get_convert_from_float32ne_function(PA_SAMPLE_S16LE); pa_log_debug("Checking SSE2 sconv (float -> s16)"); - run_conv_test_float_to_s16(sse2_func, orig_func, 0, TRUE, FALSE); - run_conv_test_float_to_s16(sse2_func, orig_func, 1, TRUE, FALSE); - run_conv_test_float_to_s16(sse2_func, orig_func, 2, TRUE, FALSE); - run_conv_test_float_to_s16(sse2_func, orig_func, 3, TRUE, FALSE); - run_conv_test_float_to_s16(sse2_func, orig_func, 4, TRUE, FALSE); - run_conv_test_float_to_s16(sse2_func, orig_func, 5, TRUE, FALSE); - run_conv_test_float_to_s16(sse2_func, orig_func, 6, TRUE, FALSE); - run_conv_test_float_to_s16(sse2_func, orig_func, 7, TRUE, TRUE); + run_conv_test_float_to_s16(sse2_func, orig_func, 0, true, false); + run_conv_test_float_to_s16(sse2_func, orig_func, 1, true, false); + run_conv_test_float_to_s16(sse2_func, orig_func, 2, true, false); + run_conv_test_float_to_s16(sse2_func, orig_func, 3, true, false); + run_conv_test_float_to_s16(sse2_func, orig_func, 4, true, false); + run_conv_test_float_to_s16(sse2_func, orig_func, 5, true, false); + run_conv_test_float_to_s16(sse2_func, orig_func, 6, true, false); + run_conv_test_float_to_s16(sse2_func, orig_func, 7, true, true); } END_TEST @@ -408,14 +408,14 @@ START_TEST (sconv_sse_test) { sse_func = pa_get_convert_from_float32ne_function(PA_SAMPLE_S16LE); pa_log_debug("Checking SSE sconv (float -> s16)"); - run_conv_test_float_to_s16(sse_func, orig_func, 0, TRUE, FALSE); - run_conv_test_float_to_s16(sse_func, orig_func, 1, TRUE, FALSE); - run_conv_test_float_to_s16(sse_func, orig_func, 2, TRUE, FALSE); - run_conv_test_float_to_s16(sse_func, orig_func, 3, TRUE, FALSE); - run_conv_test_float_to_s16(sse_func, orig_func, 4, TRUE, FALSE); - run_conv_test_float_to_s16(sse_func, orig_func, 5, TRUE, FALSE); - run_conv_test_float_to_s16(sse_func, orig_func, 6, TRUE, FALSE); - run_conv_test_float_to_s16(sse_func, orig_func, 7, TRUE, TRUE); + run_conv_test_float_to_s16(sse_func, orig_func, 0, true, false); + run_conv_test_float_to_s16(sse_func, orig_func, 1, true, false); + run_conv_test_float_to_s16(sse_func, orig_func, 2, true, false); + run_conv_test_float_to_s16(sse_func, orig_func, 3, true, false); + run_conv_test_float_to_s16(sse_func, orig_func, 4, true, false); + run_conv_test_float_to_s16(sse_func, orig_func, 5, true, false); + run_conv_test_float_to_s16(sse_func, orig_func, 6, true, false); + run_conv_test_float_to_s16(sse_func, orig_func, 7, true, true); } END_TEST #endif /* defined (__i386__) || defined (__amd64__) */ @@ -441,24 +441,24 @@ START_TEST (sconv_neon_test) { neon_to_func = pa_get_convert_to_float32ne_function(PA_SAMPLE_S16LE); pa_log_debug("Checking NEON sconv (float -> s16)"); - run_conv_test_float_to_s16(neon_from_func, orig_from_func, 0, TRUE, FALSE); - run_conv_test_float_to_s16(neon_from_func, orig_from_func, 1, TRUE, FALSE); - run_conv_test_float_to_s16(neon_from_func, orig_from_func, 2, TRUE, FALSE); - run_conv_test_float_to_s16(neon_from_func, orig_from_func, 3, TRUE, FALSE); - run_conv_test_float_to_s16(neon_from_func, orig_from_func, 4, TRUE, FALSE); - run_conv_test_float_to_s16(neon_from_func, orig_from_func, 5, TRUE, FALSE); - run_conv_test_float_to_s16(neon_from_func, orig_from_func, 6, TRUE, FALSE); - run_conv_test_float_to_s16(neon_from_func, orig_from_func, 7, TRUE, TRUE); + run_conv_test_float_to_s16(neon_from_func, orig_from_func, 0, true, false); + run_conv_test_float_to_s16(neon_from_func, orig_from_func, 1, true, false); + run_conv_test_float_to_s16(neon_from_func, orig_from_func, 2, true, false); + run_conv_test_float_to_s16(neon_from_func, orig_from_func, 3, true, false); + run_conv_test_float_to_s16(neon_from_func, orig_from_func, 4, true, false); + run_conv_test_float_to_s16(neon_from_func, orig_from_func, 5, true, false); + run_conv_test_float_to_s16(neon_from_func, orig_from_func, 6, true, false); + run_conv_test_float_to_s16(neon_from_func, orig_from_func, 7, true, true); pa_log_debug("Checking NEON sconv (s16 -> float)"); - run_conv_test_s16_to_float(neon_to_func, orig_to_func, 0, TRUE, FALSE); - run_conv_test_s16_to_float(neon_to_func, orig_to_func, 1, TRUE, FALSE); - run_conv_test_s16_to_float(neon_to_func, orig_to_func, 2, TRUE, FALSE); - run_conv_test_s16_to_float(neon_to_func, orig_to_func, 3, TRUE, FALSE); - run_conv_test_s16_to_float(neon_to_func, orig_to_func, 4, TRUE, FALSE); - run_conv_test_s16_to_float(neon_to_func, orig_to_func, 5, TRUE, FALSE); - run_conv_test_s16_to_float(neon_to_func, orig_to_func, 6, TRUE, FALSE); - run_conv_test_s16_to_float(neon_to_func, orig_to_func, 7, TRUE, TRUE); + run_conv_test_s16_to_float(neon_to_func, orig_to_func, 0, true, false); + run_conv_test_s16_to_float(neon_to_func, orig_to_func, 1, true, false); + run_conv_test_s16_to_float(neon_to_func, orig_to_func, 2, true, false); + run_conv_test_s16_to_float(neon_to_func, orig_to_func, 3, true, false); + run_conv_test_s16_to_float(neon_to_func, orig_to_func, 4, true, false); + run_conv_test_s16_to_float(neon_to_func, orig_to_func, 5, true, false); + run_conv_test_s16_to_float(neon_to_func, orig_to_func, 6, true, false); + run_conv_test_s16_to_float(neon_to_func, orig_to_func, 7, true, true); } END_TEST #endif /* HAVE_NEON */ @@ -478,8 +478,8 @@ static void run_remap_test_mono_stereo_float( pa_do_remap_func_t func, pa_do_remap_func_t orig_func, int align, - pa_bool_t correct, - pa_bool_t perf) { + bool correct, + bool perf) { PA_DECLARE_ALIGNED(8, float, s_ref[SAMPLES*2]) = { 0 }; PA_DECLARE_ALIGNED(8, float, s[SAMPLES*2]) = { 0 }; @@ -528,8 +528,8 @@ static void run_remap_test_mono_stereo_s16( pa_do_remap_func_t func, pa_do_remap_func_t orig_func, int align, - pa_bool_t correct, - pa_bool_t perf) { + bool correct, + bool perf) { PA_DECLARE_ALIGNED(8, int16_t, s_ref[SAMPLES*2]) = { 0 }; PA_DECLARE_ALIGNED(8, int16_t, s[SAMPLES*2]) = { 0 }; @@ -605,10 +605,10 @@ static void remap_test_mono_stereo_float( return; } - run_remap_test_mono_stereo_float(&remap, func, orig_func, 0, TRUE, FALSE); - run_remap_test_mono_stereo_float(&remap, func, orig_func, 1, TRUE, FALSE); - run_remap_test_mono_stereo_float(&remap, func, orig_func, 2, TRUE, FALSE); - run_remap_test_mono_stereo_float(&remap, func, orig_func, 3, TRUE, TRUE); + run_remap_test_mono_stereo_float(&remap, func, orig_func, 0, true, false); + run_remap_test_mono_stereo_float(&remap, func, orig_func, 1, true, false); + run_remap_test_mono_stereo_float(&remap, func, orig_func, 2, true, false); + run_remap_test_mono_stereo_float(&remap, func, orig_func, 3, true, true); } static void remap_test_mono_stereo_s16( @@ -644,10 +644,10 @@ static void remap_test_mono_stereo_s16( return; } - run_remap_test_mono_stereo_s16(&remap, func, orig_func, 0, TRUE, FALSE); - run_remap_test_mono_stereo_s16(&remap, func, orig_func, 1, TRUE, FALSE); - run_remap_test_mono_stereo_s16(&remap, func, orig_func, 2, TRUE, FALSE); - run_remap_test_mono_stereo_s16(&remap, func, orig_func, 3, TRUE, TRUE); + run_remap_test_mono_stereo_s16(&remap, func, orig_func, 0, true, false); + run_remap_test_mono_stereo_s16(&remap, func, orig_func, 1, true, false); + run_remap_test_mono_stereo_s16(&remap, func, orig_func, 2, true, false); + run_remap_test_mono_stereo_s16(&remap, func, orig_func, 3, true, true); } #if defined (__i386__) || defined (__amd64__) @@ -729,8 +729,8 @@ static void run_mix_test( pa_do_mix_func_t orig_func, int align, int channels, - pa_bool_t correct, - pa_bool_t perf) { + bool correct, + bool perf) { PA_DECLARE_ALIGNED(8, int16_t, in0[SAMPLES * 4]) = { 0 }; PA_DECLARE_ALIGNED(8, int16_t, in1[SAMPLES * 4]) = { 0 }; @@ -753,15 +753,15 @@ static void run_mix_test( samples_ref = out_ref + (8 - align); nsamples = channels * (SAMPLES - (8 - align)); - fail_unless((pool = pa_mempool_new(FALSE, 0)) != NULL, NULL); + fail_unless((pool = pa_mempool_new(false, 0)) != NULL, NULL); pa_random(samples0, nsamples * sizeof(int16_t)); - c0.memblock = pa_memblock_new_fixed(pool, samples0, nsamples * sizeof(int16_t), FALSE); + c0.memblock = pa_memblock_new_fixed(pool, samples0, nsamples * sizeof(int16_t), false); c0.length = pa_memblock_get_length(c0.memblock); c0.index = 0; pa_random(samples1, nsamples * sizeof(int16_t)); - c1.memblock = pa_memblock_new_fixed(pool, samples1, nsamples * sizeof(int16_t), FALSE); + c1.memblock = pa_memblock_new_fixed(pool, samples1, nsamples * sizeof(int16_t), false); c1.length = pa_memblock_get_length(c1.memblock); c1.index = 0; @@ -842,7 +842,7 @@ START_TEST (mix_neon_test) { neon_func = pa_get_mix_func(PA_SAMPLE_S16NE); pa_log_debug("Checking NEON mix"); - run_mix_test(neon_func, orig_func, 7, 2, TRUE, TRUE); + run_mix_test(neon_func, orig_func, 7, 2, true, true); } END_TEST #endif /* HAVE_NEON */ diff --git a/src/tests/interpol-test.c b/src/tests/interpol-test.c index 6303c5e81..1d1e52afd 100644 --- a/src/tests/interpol-test.c +++ b/src/tests/interpol-test.c @@ -43,7 +43,7 @@ static pa_context *context = NULL; static pa_stream *stream = NULL; static pa_mainloop_api *mainloop_api = NULL; -static pa_bool_t playback = TRUE; +static bool playback = true; static pa_usec_t latency = 0; static const char *bname = NULL; @@ -156,7 +156,7 @@ START_TEST (interpol_test) { struct timeval start, last_info = { 0, 0 }; pa_usec_t old_t = 0, old_rtc = 0; #ifdef CORK - pa_bool_t corked = FALSE; + bool corked = false; #endif /* Set up a new main loop */ @@ -181,10 +181,10 @@ START_TEST (interpol_test) { /* for (k = 0; k < 2000; k++) */ /* #endif */ { - pa_bool_t success = FALSE, changed = FALSE; + bool success = false, changed = false; pa_usec_t t, rtc, d; struct timeval now, tv; - pa_bool_t playing = FALSE; + bool playing = false; pa_threaded_mainloop_lock(m); @@ -193,15 +193,15 @@ START_TEST (interpol_test) { if (pa_stream_get_time(stream, &t) >= 0 && pa_stream_get_latency(stream, &d, NULL) >= 0) - success = TRUE; + success = true; if ((info = pa_stream_get_timing_info(stream))) { if (memcmp(&last_info, &info->timestamp, sizeof(struct timeval))) { - changed = TRUE; + changed = true; last_info = info->timestamp; } if (info->playing) - playing = TRUE; + playing = true; } } @@ -211,7 +211,7 @@ START_TEST (interpol_test) { if (success) { #ifdef CORK - pa_bool_t cork_now; + bool cork_now; #endif rtc = pa_timeval_diff(&now, &start); pa_log_info("%i\t%llu\t%llu\t%llu\t%llu\t%lli\t%u\t%u\t%llu\t%llu\n", k, diff --git a/src/tests/lock-autospawn-test.c b/src/tests/lock-autospawn-test.c index 1aa3bcae2..89d402e7e 100644 --- a/src/tests/lock-autospawn-test.c +++ b/src/tests/lock-autospawn-test.c @@ -38,7 +38,7 @@ static void thread_func(void*k) { pa_log("%i, Trying to acquire lock.", PA_PTR_TO_INT(k)); - fail_unless(pa_autospawn_lock_acquire(TRUE) > 0); + fail_unless(pa_autospawn_lock_acquire(true) > 0); pa_log("%i, Got the lock!, Sleeping for 5s", PA_PTR_TO_INT(k)); @@ -48,7 +48,7 @@ static void thread_func(void*k) { pa_autospawn_lock_release(); - pa_autospawn_lock_done(FALSE); + pa_autospawn_lock_done(false); } static void thread_func2(void *k) { @@ -62,7 +62,7 @@ static void thread_func2(void *k) { struct pollfd pollfd; int j; - if ((j = pa_autospawn_lock_acquire(FALSE)) > 0) + if ((j = pa_autospawn_lock_acquire(false)) > 0) break; fail_unless(j == 0); @@ -84,7 +84,7 @@ static void thread_func2(void *k) { pa_autospawn_lock_release(); - pa_autospawn_lock_done(FALSE); + pa_autospawn_lock_done(false); } START_TEST (lockautospawn_test) { diff --git a/src/tests/mainloop-test.c b/src/tests/mainloop-test.c index 3b062f8c5..d6732002e 100644 --- a/src/tests/mainloop-test.c +++ b/src/tests/mainloop-test.c @@ -77,7 +77,7 @@ START_TEST (mainloop_test) { #ifdef GLIB_MAIN_LOOP pa_glib_mainloop *g; - glib_main_loop = g_main_loop_new(NULL, FALSE); + glib_main_loop = g_main_loop_new(NULL, false); fail_if(!glib_main_loop); g = pa_glib_mainloop_new(NULL); @@ -101,7 +101,7 @@ START_TEST (mainloop_test) { de = a->defer_new(a, dcb, NULL); fail_if(!de); - te = a->time_new(a, pa_timeval_rtstore(&tv, pa_rtclock_now() + 2 * PA_USEC_PER_SEC, TRUE), tcb, NULL); + te = a->time_new(a, pa_timeval_rtstore(&tv, pa_rtclock_now() + 2 * PA_USEC_PER_SEC, true), tcb, NULL); #if defined(GLIB_MAIN_LOOP) g_main_loop_run(glib_main_loop); diff --git a/src/tests/mcalign-test.c b/src/tests/mcalign-test.c index 75a71dd1a..bd192b5ba 100644 --- a/src/tests/mcalign-test.c +++ b/src/tests/mcalign-test.c @@ -39,7 +39,7 @@ int main(int argc, char *argv[]) { pa_mcalign *a; pa_memchunk c; - p = pa_mempool_new(FALSE, 0); + p = pa_mempool_new(false, 0); a = pa_mcalign_new(11); diff --git a/src/tests/memblock-test.c b/src/tests/memblock-test.c index a48daf7ed..d46da6ca0 100644 --- a/src/tests/memblock-test.c +++ b/src/tests/memblock-test.c @@ -82,11 +82,11 @@ START_TEST (memblock_test) { const char txt[] = "This is a test!"; - pool_a = pa_mempool_new(TRUE, 0); + pool_a = pa_mempool_new(true, 0); fail_unless(pool_a != NULL); - pool_b = pa_mempool_new(TRUE, 0); + pool_b = pa_mempool_new(true, 0); fail_unless(pool_b != NULL); - pool_c = pa_mempool_new(TRUE, 0); + pool_c = pa_mempool_new(true, 0); fail_unless(pool_c != NULL); pa_mempool_get_shm_id(pool_a, &id_a); diff --git a/src/tests/memblockq-test.c b/src/tests/memblockq-test.c index 11ac90532..a00182ad5 100644 --- a/src/tests/memblockq-test.c +++ b/src/tests/memblockq-test.c @@ -110,7 +110,7 @@ START_TEST (memblockq_test) { pa_log_set_level(PA_LOG_DEBUG); - p = pa_mempool_new(FALSE, 0); + p = pa_mempool_new(false, 0); silence.memblock = pa_memblock_new_fixed(p, (char*) "__", 2, 1); fail_unless(silence.memblock != NULL); @@ -157,45 +157,45 @@ START_TEST (memblockq_test) { ret = pa_memblockq_push(bq, &chunk4); fail_unless(ret == 0); - pa_memblockq_seek(bq, -6, 0, TRUE); + pa_memblockq_seek(bq, -6, 0, true); ret = pa_memblockq_push(bq, &chunk3); fail_unless(ret == 0); - pa_memblockq_seek(bq, -2, 0, TRUE); + pa_memblockq_seek(bq, -2, 0, true); ret = pa_memblockq_push(bq, &chunk1); fail_unless(ret == 0); - pa_memblockq_seek(bq, -10, 0, TRUE); + pa_memblockq_seek(bq, -10, 0, true); ret = pa_memblockq_push(bq, &chunk4); fail_unless(ret == 0); - pa_memblockq_seek(bq, 10, 0, TRUE); + pa_memblockq_seek(bq, 10, 0, true); ret = pa_memblockq_push(bq, &chunk1); fail_unless(ret == 0); - pa_memblockq_seek(bq, -6, 0, TRUE); + pa_memblockq_seek(bq, -6, 0, true); ret = pa_memblockq_push(bq, &chunk2); fail_unless(ret == 0); /* Test splitting */ - pa_memblockq_seek(bq, -12, 0, TRUE); + pa_memblockq_seek(bq, -12, 0, true); ret = pa_memblockq_push(bq, &chunk1); fail_unless(ret == 0); - pa_memblockq_seek(bq, 20, 0, TRUE); + pa_memblockq_seek(bq, 20, 0, true); /* Test merging */ ret = pa_memblockq_push(bq, &chunk3); fail_unless(ret == 0); - pa_memblockq_seek(bq, -2, 0, TRUE); + pa_memblockq_seek(bq, -2, 0, true); chunk3.index += 2; chunk3.length -= 2; ret = pa_memblockq_push(bq, &chunk3); fail_unless(ret == 0); - pa_memblockq_seek(bq, 30, PA_SEEK_RELATIVE, TRUE); + pa_memblockq_seek(bq, 30, PA_SEEK_RELATIVE, true); dump(bq, 0); diff --git a/src/tests/mix-special-test.c b/src/tests/mix-special-test.c index 3d36116a5..8cf893a0c 100644 --- a/src/tests/mix-special-test.c +++ b/src/tests/mix-special-test.c @@ -208,15 +208,15 @@ START_TEST (mix_special_1ch_test) { pa_mix_info m[2]; unsigned nsamples = SAMPLES; - fail_unless((pool = pa_mempool_new(FALSE, 0)) != NULL, NULL); + fail_unless((pool = pa_mempool_new(false, 0)) != NULL, NULL); pa_random(samples0, nsamples * sizeof(int16_t)); - c0.memblock = pa_memblock_new_fixed(pool, samples0, nsamples * sizeof(int16_t), FALSE); + c0.memblock = pa_memblock_new_fixed(pool, samples0, nsamples * sizeof(int16_t), false); c0.length = pa_memblock_get_length(c0.memblock); c0.index = 0; pa_random(samples1, nsamples * sizeof(int16_t)); - c1.memblock = pa_memblock_new_fixed(pool, samples1, nsamples * sizeof(int16_t), FALSE); + c1.memblock = pa_memblock_new_fixed(pool, samples1, nsamples * sizeof(int16_t), false); c1.length = pa_memblock_get_length(c1.memblock); c1.index = 0; @@ -262,15 +262,15 @@ START_TEST (mix_special_2ch_test) { pa_mix_info m[2]; unsigned nsamples = SAMPLES * 2; - fail_unless((pool = pa_mempool_new(FALSE, 0)) != NULL, NULL); + fail_unless((pool = pa_mempool_new(false, 0)) != NULL, NULL); pa_random(samples0, nsamples * sizeof(int16_t)); - c0.memblock = pa_memblock_new_fixed(pool, samples0, nsamples * sizeof(int16_t), FALSE); + c0.memblock = pa_memblock_new_fixed(pool, samples0, nsamples * sizeof(int16_t), false); c0.length = pa_memblock_get_length(c0.memblock); c0.index = 0; pa_random(samples1, nsamples * sizeof(int16_t)); - c1.memblock = pa_memblock_new_fixed(pool, samples1, nsamples * sizeof(int16_t), FALSE); + c1.memblock = pa_memblock_new_fixed(pool, samples1, nsamples * sizeof(int16_t), false); c1.length = pa_memblock_get_length(c1.memblock); c1.index = 0; diff --git a/src/tests/mix-test.c b/src/tests/mix-test.c index e2ef49065..ae6520970 100644 --- a/src/tests/mix-test.c +++ b/src/tests/mix-test.c @@ -407,7 +407,7 @@ START_TEST (mix_test) { if (!getenv("MAKE_CHECK")) pa_log_set_level(PA_LOG_DEBUG); - fail_unless((pool = pa_mempool_new(FALSE, 0)) != NULL, NULL); + fail_unless((pool = pa_mempool_new(false, 0)) != NULL, NULL); a.channels = 1; a.rate = 44100; @@ -451,7 +451,7 @@ START_TEST (mix_test) { k.index = 0; ptr = pa_memblock_acquire_chunk(&k); - pa_mix(m, 2, ptr, k.length, &a, NULL, FALSE); + pa_mix(m, 2, ptr, k.length, &a, NULL, false); pa_memblock_release(k.memblock); compare_block(&a, &k, 2); diff --git a/src/tests/remix-test.c b/src/tests/remix-test.c index 9d169bea2..b62801135 100644 --- a/src/tests/remix-test.c +++ b/src/tests/remix-test.c @@ -52,7 +52,7 @@ int main(int argc, char *argv[]) { pa_log_set_level(PA_LOG_DEBUG); - pa_assert_se(pool = pa_mempool_new(FALSE, 0)); + pa_assert_se(pool = pa_mempool_new(false, 0)); for (i = 0; maps[i].channels > 0; i++) for (j = 0; maps[j].channels > 0; j++) { diff --git a/src/tests/resampler-test.c b/src/tests/resampler-test.c index e07a3d636..fdd263b0c 100644 --- a/src/tests/resampler-test.c +++ b/src/tests/resampler-test.c @@ -302,7 +302,7 @@ int main(int argc, char *argv[]) { pa_mempool *pool = NULL; pa_sample_spec a, b; int ret = 1, c; - pa_bool_t all_formats = TRUE; + bool all_formats = true; pa_resample_method_t method; int seconds; @@ -331,7 +331,7 @@ int main(int argc, char *argv[]) { if (!getenv("MAKE_CHECK")) pa_log_set_level(PA_LOG_INFO); - pa_assert_se(pool = pa_mempool_new(FALSE, 0)); + pa_assert_se(pool = pa_mempool_new(false, 0)); a.channels = b.channels = 1; a.rate = b.rate = 44100; @@ -368,7 +368,7 @@ int main(int argc, char *argv[]) { case ARG_FROM_SAMPLEFORMAT: a.format = pa_parse_sample_format(optarg); - all_formats = FALSE; + all_formats = false; break; case ARG_FROM_SAMPLERATE: @@ -381,7 +381,7 @@ int main(int argc, char *argv[]) { case ARG_TO_SAMPLEFORMAT: b.format = pa_parse_sample_format(optarg); - all_formats = FALSE; + all_formats = false; break; case ARG_TO_SAMPLERATE: @@ -407,7 +407,7 @@ int main(int argc, char *argv[]) { } ret = 0; - pa_assert_se(pool = pa_mempool_new(FALSE, 0)); + pa_assert_se(pool = pa_mempool_new(false, 0)); if (!all_formats) { diff --git a/src/tests/smoother-test.c b/src/tests/smoother-test.c index eac824e80..85d9d89fc 100644 --- a/src/tests/smoother-test.c +++ b/src/tests/smoother-test.c @@ -66,7 +66,7 @@ START_TEST (smoother_test) { msec[u+1] = 0; } - s = pa_smoother_new(700*PA_USEC_PER_MSEC, 2000*PA_USEC_PER_MSEC, FALSE, TRUE, 6, 0, TRUE); + s = pa_smoother_new(700*PA_USEC_PER_MSEC, 2000*PA_USEC_PER_MSEC, false, true, 6, 0, true); for (x = 0, u = 0; x < PA_USEC_PER_SEC * 10; x += PA_USEC_PER_MSEC) { @@ -76,7 +76,7 @@ START_TEST (smoother_test) { u += 2; if (u < PA_ELEMENTSOF(msec)) - pa_smoother_resume(s, (pa_usec_t) msec[u] * PA_USEC_PER_MSEC, TRUE); + pa_smoother_resume(s, (pa_usec_t) msec[u] * PA_USEC_PER_MSEC, true); } pa_log_debug("%llu\t%llu", (unsigned long long) (x/PA_USEC_PER_MSEC), (unsigned long long) (pa_smoother_get(s, x)/PA_USEC_PER_MSEC)); diff --git a/src/tests/stripnul.c b/src/tests/stripnul.c index d677ad202..e68c7bb26 100644 --- a/src/tests/stripnul.c +++ b/src/tests/stripnul.c @@ -31,7 +31,7 @@ int main(int argc, char *argv[]) { FILE *i, *o; size_t granularity; - pa_bool_t found = FALSE; + bool found = false; uint8_t *zero; pa_assert_se(argc >= 2); @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) { for (p = buffer; ((size_t) (p-buffer)/granularity) < k; p += granularity) if (memcmp(p, zero, granularity)) { size_t left; - found = TRUE; + found = true; left = (size_t) (k - (size_t) (p-buffer)/granularity); pa_assert_se(fwrite(p, granularity, left, o) == left); break; diff --git a/src/tests/thread-mainloop-test.c b/src/tests/thread-mainloop-test.c index d2f6152bf..e62f66bd3 100644 --- a/src/tests/thread-mainloop-test.c +++ b/src/tests/thread-mainloop-test.c @@ -58,7 +58,7 @@ START_TEST (thread_mainloop_test) { fail_unless(!pa_threaded_mainloop_in_thread(m)); - a->time_new(a, pa_timeval_rtstore(&tv, pa_rtclock_now() + 5 * PA_USEC_PER_SEC, TRUE), tcb, m); + a->time_new(a, pa_timeval_rtstore(&tv, pa_rtclock_now() + 5 * PA_USEC_PER_SEC, true), tcb, m); fprintf(stderr, "waiting 5s (signal)\n"); pa_threaded_mainloop_wait(m); diff --git a/src/tests/thread-test.c b/src/tests/thread-test.c index de4813c96..330181d4a 100644 --- a/src/tests/thread-test.c +++ b/src/tests/thread-test.c @@ -100,7 +100,7 @@ START_TEST (thread_test) { if (!getenv("MAKE_CHECK")) pa_log_set_level(PA_LOG_DEBUG); - mutex = pa_mutex_new(FALSE, FALSE); + mutex = pa_mutex_new(false, false); cond1 = pa_cond_new(); cond2 = pa_cond_new(); tls = pa_tls_new(pa_xfree); diff --git a/src/utils/pacat.c b/src/utils/pacat.c index aa24bd3cf..a712ccf6e 100644 --- a/src/utils/pacat.c +++ b/src/utils/pacat.c @@ -70,19 +70,19 @@ static char *device = NULL; static SNDFILE* sndfile = NULL; -static pa_bool_t verbose = FALSE; +static bool verbose = false; static pa_volume_t volume = PA_VOLUME_NORM; -static pa_bool_t volume_is_set = FALSE; +static bool volume_is_set = false; static pa_sample_spec sample_spec = { .format = PA_SAMPLE_S16LE, .rate = 44100, .channels = 2 }; -static pa_bool_t sample_spec_set = FALSE; +static bool sample_spec_set = false; static pa_channel_map channel_map; -static pa_bool_t channel_map_set = FALSE; +static bool channel_map_set = false; static sf_count_t (*readf_function)(SNDFILE *_sndfile, void *ptr, sf_count_t frames) = NULL; static sf_count_t (*writef_function)(SNDFILE *_sndfile, const void *ptr, sf_count_t frames) = NULL; @@ -92,7 +92,7 @@ static pa_stream_flags_t flags = 0; static size_t latency = 0, process_time = 0; static int32_t latency_msec = 0, process_time_msec = 0; -static pa_bool_t raw = TRUE; +static bool raw = true; static int file_format = -1; static uint32_t cork_requests = 0; @@ -776,16 +776,16 @@ int main(int argc, char *argv[]) { if (strstr(bn, "play")) { mode = PLAYBACK; - raw = FALSE; + raw = false; } else if (strstr(bn, "record")) { mode = RECORD; - raw = FALSE; + raw = false; } else if (strstr(bn, "cat")) { mode = PLAYBACK; - raw = TRUE; + raw = true; } else if (strstr(bn, "rec") || strstr(bn, "mon")) { mode = RECORD; - raw = TRUE; + raw = true; } proplist = pa_proplist_new(); @@ -863,23 +863,23 @@ int main(int argc, char *argv[]) { case ARG_VOLUME: { int v = atoi(optarg); volume = v < 0 ? 0U : (pa_volume_t) v; - volume_is_set = TRUE; + volume_is_set = true; break; } case ARG_CHANNELS: sample_spec.channels = (uint8_t) atoi(optarg); - sample_spec_set = TRUE; + sample_spec_set = true; break; case ARG_SAMPLEFORMAT: sample_spec.format = pa_parse_sample_format(optarg); - sample_spec_set = TRUE; + sample_spec_set = true; break; case ARG_SAMPLERATE: sample_spec.rate = (uint32_t) atoi(optarg); - sample_spec_set = TRUE; + sample_spec_set = true; break; case ARG_CHANNELMAP: @@ -888,7 +888,7 @@ int main(int argc, char *argv[]) { goto quit; } - channel_map_set = TRUE; + channel_map_set = true; break; case ARG_FIX_CHANNELS: @@ -955,7 +955,7 @@ int main(int argc, char *argv[]) { } case ARG_RAW: - raw = TRUE; + raw = true; break; case ARG_PASSTHROUGH: @@ -970,7 +970,7 @@ int main(int argc, char *argv[]) { } } - raw = FALSE; + raw = false; break; case ARG_LIST_FILE_FORMATS: @@ -1055,7 +1055,7 @@ int main(int argc, char *argv[]) { pa_log(_("Failed to determine sample specification from file.")); goto quit; } - sample_spec_set = TRUE; + sample_spec_set = true; if (!channel_map_set) { /* Allow the user to overwrite the channel map on the command line */ @@ -1063,7 +1063,7 @@ int main(int argc, char *argv[]) { if (sample_spec.channels > 2) pa_log(_("Warning: Failed to determine channel map from file.")); } else - channel_map_set = TRUE; + channel_map_set = true; } } } diff --git a/src/utils/pacmd.c b/src/utils/pacmd.c index 352a9d855..cf0eb4456 100644 --- a/src/utils/pacmd.c +++ b/src/utils/pacmd.c @@ -99,7 +99,7 @@ int main(int argc, char*argv[]) { char *obuf = NULL; size_t buf_size, ibuf_size, ibuf_index, ibuf_length, obuf_size, obuf_index, obuf_length; char *cli; - pa_bool_t ibuf_eof, obuf_eof, ibuf_closed, obuf_closed; + bool ibuf_eof, obuf_eof, ibuf_closed, obuf_closed; struct pollfd pollfd[3]; struct pollfd *watch_socket, *watch_stdin, *watch_stdout; @@ -190,7 +190,7 @@ int main(int argc, char*argv[]) { obuf_size = PA_MIN(buf_size, pa_pipe_buf(STDOUT_FILENO)); obuf = pa_xmalloc(obuf_size); ibuf_index = ibuf_length = obuf_index = obuf_length = 0; - ibuf_eof = obuf_eof = ibuf_closed = obuf_closed = FALSE; + ibuf_eof = obuf_eof = ibuf_closed = obuf_closed = false; if (argc > 1) { for (i = 1; i < argc; i++) { @@ -206,7 +206,7 @@ int main(int argc, char*argv[]) { } } - ibuf_eof = TRUE; + ibuf_eof = true; } for (;;) { @@ -220,12 +220,12 @@ int main(int argc, char*argv[]) { if (ibuf_length <= 0 && ibuf_eof && !ibuf_closed) { shutdown(fd, SHUT_WR); - ibuf_closed = TRUE; + ibuf_closed = true; } if (obuf_length <= 0 && obuf_eof && !obuf_closed) { shutdown(fd, SHUT_RD); - obuf_closed = TRUE; + obuf_closed = true; } pa_zero(pollfd); @@ -275,13 +275,13 @@ int main(int argc, char*argv[]) { goto quit; } - ibuf_eof = TRUE; + ibuf_eof = true; } else { ibuf_length = (size_t) r; ibuf_index = 0; } } else if (watch_stdin->revents & POLLHUP) - ibuf_eof = TRUE; + ibuf_eof = true; } if (watch_socket) { @@ -295,18 +295,18 @@ int main(int argc, char*argv[]) { goto quit; } - obuf_eof = TRUE; + obuf_eof = true; } else { obuf_length = (size_t) r; obuf_index = 0; } } else if (watch_socket->revents & POLLHUP) - obuf_eof = TRUE; + obuf_eof = true; } if (watch_stdout) { if (watch_stdout->revents & POLLHUP) { - obuf_eof = TRUE; + obuf_eof = true; obuf_length = 0; } else if (watch_stdout->revents & POLLOUT) { ssize_t r; @@ -324,7 +324,7 @@ int main(int argc, char*argv[]) { if (watch_socket) { if (watch_socket->revents & POLLHUP) { - ibuf_eof = TRUE; + ibuf_eof = true; ibuf_length = 0; } if (watch_socket->revents & POLLOUT) { ssize_t r; diff --git a/src/utils/pactl.c b/src/utils/pactl.c index b3dca7814..8849b40b3 100644 --- a/src/utils/pactl.c +++ b/src/utils/pactl.c @@ -65,10 +65,10 @@ static uint32_t source_output_idx = PA_INVALID_INDEX, sink_idx = PA_INVALID_INDEX; -static pa_bool_t short_list_format = FALSE; +static bool short_list_format = false; static uint32_t module_index; static int32_t latency_offset; -static pa_bool_t suspend; +static bool suspend; static pa_volume_t volume; static enum volume_flags { VOL_UINT = 0, @@ -95,7 +95,7 @@ static pa_channel_map channel_map; static size_t sample_length = 0; static int actions = 1; -static pa_bool_t nl = FALSE; +static bool nl = false; static enum { NONE, @@ -265,7 +265,7 @@ static void get_sink_info_callback(pa_context *c, const pa_sink_info *i, int is_ if (nl && !short_list_format) printf("\n"); - nl = TRUE; + nl = true; if (short_list_format) { printf("%u\t%s\t%s\t%s\t%s\n", @@ -378,7 +378,7 @@ static void get_source_info_callback(pa_context *c, const pa_source_info *i, int if (nl && !short_list_format) printf("\n"); - nl = TRUE; + nl = true; if (short_list_format) { printf("%u\t%s\t%s\t%s\t%s\n", @@ -475,7 +475,7 @@ static void get_module_info_callback(pa_context *c, const pa_module_info *i, int if (nl && !short_list_format) printf("\n"); - nl = TRUE; + nl = true; pa_snprintf(t, sizeof(t), "%u", i->n_used); @@ -517,7 +517,7 @@ static void get_client_info_callback(pa_context *c, const pa_client_info *i, int if (nl && !short_list_format) printf("\n"); - nl = TRUE; + nl = true; pa_snprintf(t, sizeof(t), "%u", i->owner_module); @@ -560,7 +560,7 @@ static void get_card_info_callback(pa_context *c, const pa_card_info *i, int is_ if (nl && !short_list_format) printf("\n"); - nl = TRUE; + nl = true; pa_snprintf(t, sizeof(t), "%u", i->owner_module); @@ -641,7 +641,7 @@ static void get_sink_input_info_callback(pa_context *c, const pa_sink_input_info if (nl && !short_list_format) printf("\n"); - nl = TRUE; + nl = true; pa_snprintf(t, sizeof(t), "%u", i->owner_module); pa_snprintf(k, sizeof(k), "%u", i->client); @@ -713,7 +713,7 @@ static void get_source_output_info_callback(pa_context *c, const pa_source_outpu if (nl && !short_list_format) printf("\n"); - nl = TRUE; + nl = true; pa_snprintf(t, sizeof(t), "%u", i->owner_module); pa_snprintf(k, sizeof(k), "%u", i->client); @@ -785,7 +785,7 @@ static void get_sample_info_callback(pa_context *c, const pa_sample_info *i, int if (nl && !short_list_format) printf("\n"); - nl = TRUE; + nl = true; pa_bytes_snprint(t, sizeof(t), i->bytes); @@ -864,7 +864,7 @@ static void volume_relative_adjust(pa_cvolume *cv) { } static void unload_module_by_name_callback(pa_context *c, const pa_module_info *i, int is_last, void *userdata) { - static pa_bool_t unloaded = FALSE; + static bool unloaded = false; if (is_last < 0) { pa_log(_("Failed to get module information: %s"), pa_strerror(pa_context_errno(c))); @@ -873,7 +873,7 @@ static void unload_module_by_name_callback(pa_context *c, const pa_module_info * } if (is_last) { - if (unloaded == FALSE) + if (unloaded == false) pa_log(_("Failed to unload module: Module %s not loaded"), module_name); complete_action(); return; @@ -882,7 +882,7 @@ static void unload_module_by_name_callback(pa_context *c, const pa_module_info * pa_assert(i); if (pa_streq(module_name, i->name)) { - unloaded = TRUE; + unloaded = true; actions++; pa_operation_unref(pa_context_unload_module(c, i->index, simple_callback, NULL)); } @@ -1590,9 +1590,9 @@ int main(int argc, char *argv[]) { if (optind < argc) { if (pa_streq(argv[optind], "stat")) { action = STAT; - short_list_format = FALSE; + short_list_format = false; if (optind+1 < argc && pa_streq(argv[optind+1], "short")) - short_list_format = TRUE; + short_list_format = true; } else if (pa_streq(argv[optind], "info")) action = INFO; @@ -1610,7 +1610,7 @@ int main(int argc, char *argv[]) { pa_streq(argv[i], "samples") || pa_streq(argv[i], "cards")) { list_type = pa_xstrdup(argv[i]); } else if (pa_streq(argv[i], "short")) { - short_list_format = TRUE; + short_list_format = true; } else { pa_log(_("Specify nothing, or one of: %s"), "modules, sinks, sources, sink-inputs, source-outputs, clients, samples, cards"); goto quit; diff --git a/src/utils/padsp.c b/src/utils/padsp.c index 858cec85f..b5250b3cb 100644 --- a/src/utils/padsp.c +++ b/src/utils/padsp.c @@ -1526,7 +1526,7 @@ int open(const char *filename, int flags, ...) { return real_open(filename, flags, mode); } -static pa_bool_t is_audio_device_node(const char *path) { +static bool is_audio_device_node(const char *path) { return pa_streq(path, "/dev/dsp") || pa_streq(path, "/dev/adsp") || diff --git a/src/utils/pax11publish.c b/src/utils/pax11publish.c index c5e6cfbb5..abb23120d 100644 --- a/src/utils/pax11publish.c +++ b/src/utils/pax11publish.c @@ -194,7 +194,7 @@ int main(int argc, char *argv[]) { pa_client_conf_free(conf); - if (pa_authkey_load_auto(cookie_file, TRUE, cookie, sizeof(cookie)) < 0) { + if (pa_authkey_load_auto(cookie_file, true, cookie, sizeof(cookie)) < 0) { fprintf(stderr, _("Failed to load cookie data\n")); goto finish; } |