From 4a64b0d1167e980d81b798d813f35209895f0674 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 23 Feb 2006 02:27:19 +0000 Subject: change pa_log() and friends to not require a trailing \n on all logged strings git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@574 fefdeb5f-60dc-0310-8127-8f9354f1896f --- src/daemon/caps.c | 6 +-- src/daemon/cmdline.c | 16 +++---- src/daemon/cpulimit.c | 2 +- src/daemon/daemon-conf.c | 8 ++-- src/daemon/main.c | 45 ++++++++++---------- src/modules/alsa-util.c | 2 +- src/modules/howl-wrap.c | 5 +-- src/modules/module-alsa-sink.c | 22 +++++----- src/modules/module-alsa-source.c | 22 +++++----- src/modules/module-cli.c | 6 +-- src/modules/module-combine.c | 26 ++++++------ src/modules/module-detect.c | 14 +++--- src/modules/module-esound-compat-spawnfd.c | 4 +- src/modules/module-esound-compat-spawnpid.c | 4 +- src/modules/module-esound-sink.c | 24 +++++------ src/modules/module-lirc.c | 20 ++++----- src/modules/module-match.c | 12 +++--- src/modules/module-mmkbd-evdev.c | 28 ++++++------ src/modules/module-native-protocol-fd.c | 4 +- src/modules/module-null-sink.c | 6 +-- src/modules/module-oss-mmap.c | 44 +++++++++---------- src/modules/module-oss.c | 30 ++++++------- src/modules/module-pipe-sink.c | 14 +++--- src/modules/module-pipe-source.c | 14 +++--- src/modules/module-protocol-stub.c | 14 +++--- src/modules/module-sine.c | 6 +-- src/modules/module-solaris.c | 30 ++++++------- src/modules/module-tunnel.c | 48 ++++++++++----------- src/modules/module-waveout.c | 28 ++++++------ src/modules/module-x11-bell.c | 10 ++--- src/modules/module-x11-publish.c | 8 ++-- src/modules/module-zeroconf-publish.c | 14 +++--- src/modules/oss-util.c | 22 +++++----- src/polyp/browser.c | 10 ++--- src/polyp/client-conf-x11.c | 4 +- src/polyp/client-conf.c | 2 +- src/polyp/context.c | 12 +++--- src/polyp/mainloop-signal.c | 10 ++--- src/polyp/mainloop.c | 14 +++--- src/polyp/stream.c | 4 +- src/polypcore/authkey.c | 14 +++--- src/polypcore/cli.c | 4 +- src/polypcore/client.c | 6 +-- src/polypcore/conf-parser.c | 12 +++--- src/polypcore/core-scache.c | 4 +- src/polypcore/core-subscribe.c | 2 +- src/polypcore/ioline.c | 4 +- src/polypcore/log.c | 66 ++++++++++++++++++++--------- src/polypcore/memblockq.c | 4 +- src/polypcore/modinfo.c | 2 +- src/polypcore/module.c | 14 +++--- src/polypcore/pdispatch.c | 4 +- src/polypcore/pid.c | 28 ++++++------ src/polypcore/protocol-cli.c | 2 +- src/polypcore/protocol-esound.c | 54 +++++++++++------------ src/polypcore/protocol-http.c | 4 +- src/polypcore/protocol-native.c | 38 ++++++++--------- src/polypcore/protocol-simple.c | 22 +++++----- src/polypcore/pstream.c | 10 ++--- src/polypcore/random.c | 2 +- src/polypcore/sample-util.c | 2 +- src/polypcore/sink-input.c | 6 +-- src/polypcore/sink.c | 6 +-- src/polypcore/socket-client.c | 10 ++--- src/polypcore/socket-server.c | 38 ++++++++--------- src/polypcore/socket-util.c | 6 +-- src/polypcore/sound-file-stream.c | 4 +- src/polypcore/sound-file.c | 12 +++--- src/polypcore/source-output.c | 6 +-- src/polypcore/source.c | 4 +- src/polypcore/util.c | 58 ++++++++++++------------- src/polypcore/x11wrap.c | 2 +- src/utils/pacmd.c | 20 ++++----- src/utils/pax11publish.c | 2 +- 74 files changed, 556 insertions(+), 530 deletions(-) diff --git a/src/daemon/caps.c b/src/daemon/caps.c index e12d33fb..5c52b77a 100644 --- a/src/daemon/caps.c +++ b/src/daemon/caps.c @@ -45,7 +45,7 @@ void pa_drop_root(void) { if (uid == 0 || geteuid() != 0) return; - pa_log_info(__FILE__": dropping root rights.\n"); + pa_log_info(__FILE__": dropping root rights."); #if defined(HAVE_SETRESUID) setresuid(uid, uid, uid); @@ -83,7 +83,7 @@ int pa_limit_caps(void) { if (cap_set_proc(caps) < 0) goto fail; - pa_log_info(__FILE__": dropped capabilities successfully.\n"); + pa_log_info(__FILE__": dropped capabilities successfully."); r = 0; @@ -104,7 +104,7 @@ int pa_drop_caps(void) { cap_clear(caps); if (cap_set_proc(caps) < 0) { - pa_log(__FILE__": failed to drop capabilities: %s\n", strerror(errno)); + pa_log(__FILE__": failed to drop capabilities: %s", strerror(errno)); goto fail; } diff --git a/src/daemon/cmdline.c b/src/daemon/cmdline.c index b6ab1283..a6b95a81 100644 --- a/src/daemon/cmdline.c +++ b/src/daemon/cmdline.c @@ -191,14 +191,14 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d case ARG_DAEMONIZE: case 'D': if ((conf->daemonize = optarg ? pa_parse_boolean(optarg) : 1) < 0) { - pa_log(__FILE__": --daemonize expects boolean argument\n"); + pa_log(__FILE__": --daemonize expects boolean argument"); goto fail; } break; case ARG_FAIL: if ((conf->fail = optarg ? pa_parse_boolean(optarg) : 1) < 0) { - pa_log(__FILE__": --fail expects boolean argument\n"); + pa_log(__FILE__": --fail expects boolean argument"); goto fail; } break; @@ -208,7 +208,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d if (optarg) { if (pa_daemon_conf_set_log_level(conf, optarg) < 0) { - pa_log(__FILE__": --log-level expects log level argument (either numeric in range 0..4 or one of debug, info, notice, warn, error).\n"); + pa_log(__FILE__": --log-level expects log level argument (either numeric in range 0..4 or one of debug, info, notice, warn, error)."); goto fail; } } else { @@ -220,21 +220,21 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d case ARG_HIGH_PRIORITY: if ((conf->high_priority = optarg ? pa_parse_boolean(optarg) : 1) < 0) { - pa_log(__FILE__": --high-priority expects boolean argument\n"); + pa_log(__FILE__": --high-priority expects boolean argument"); goto fail; } break; case ARG_DISALLOW_MODULE_LOADING: if ((conf->disallow_module_loading = optarg ? pa_parse_boolean(optarg) : 1) < 0) { - pa_log(__FILE__": --disallow-module-loading expects boolean argument\n"); + pa_log(__FILE__": --disallow-module-loading expects boolean argument"); goto fail; } break; case ARG_USE_PID_FILE: if ((conf->use_pid_file = optarg ? pa_parse_boolean(optarg) : 1) < 0) { - pa_log(__FILE__": --use-pid-file expects boolean argument\n"); + pa_log(__FILE__": --use-pid-file expects boolean argument"); goto fail; } break; @@ -252,7 +252,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d case ARG_LOG_TARGET: if (pa_daemon_conf_set_log_target(conf, optarg) < 0) { - pa_log(__FILE__": Invalid log target: use either 'syslog', 'stderr' or 'auto'.\n"); + pa_log(__FILE__": Invalid log target: use either 'syslog', 'stderr' or 'auto'."); goto fail; } break; @@ -271,7 +271,7 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d case ARG_RESAMPLE_METHOD: if (pa_daemon_conf_set_resample_method(conf, optarg) < 0) { - pa_log(__FILE__": Invalid resample method '%s'.\n", optarg); + pa_log(__FILE__": Invalid resample method '%s'.", optarg); goto fail; } break; diff --git a/src/daemon/cpulimit.c b/src/daemon/cpulimit.c index d7a24b8e..54f111da 100644 --- a/src/daemon/cpulimit.c +++ b/src/daemon/cpulimit.c @@ -169,7 +169,7 @@ int pa_cpu_limit_init(pa_mainloop_api *m) { /* Prepare the main loop pipe */ if (pipe(the_pipe) < 0) { - pa_log(__FILE__": pipe() failed: %s\n", strerror(errno)); + pa_log(__FILE__": pipe() failed: %s", strerror(errno)); return -1; } diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c index ecabce40..ac5fbb16 100644 --- a/src/daemon/daemon-conf.c +++ b/src/daemon/daemon-conf.c @@ -160,7 +160,7 @@ static int parse_log_target(const char *filename, unsigned line, const char *lva assert(filename && lvalue && rvalue && data); if (pa_daemon_conf_set_log_target(c, rvalue) < 0) { - pa_log(__FILE__": [%s:%u] Invalid log target '%s'.\n", filename, line, rvalue); + pa_log(__FILE__": [%s:%u] Invalid log target '%s'.", filename, line, rvalue); return -1; } @@ -172,7 +172,7 @@ static int parse_log_level(const char *filename, unsigned line, const char *lval assert(filename && lvalue && rvalue && data); if (pa_daemon_conf_set_log_level(c, rvalue) < 0) { - pa_log(__FILE__": [%s:%u] Invalid log level '%s'.\n", filename, line, rvalue); + pa_log(__FILE__": [%s:%u] Invalid log level '%s'.", filename, line, rvalue); return -1; } @@ -184,7 +184,7 @@ static int parse_resample_method(const char *filename, unsigned line, const char assert(filename && lvalue && rvalue && data); if (pa_daemon_conf_set_resample_method(c, rvalue) < 0) { - pa_log(__FILE__": [%s:%u] Inavalid resample method '%s'.\n", filename, line, rvalue); + pa_log(__FILE__": [%s:%u] Inavalid resample method '%s'.", filename, line, rvalue); return -1; } @@ -236,7 +236,7 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) { pa_open_config_file(DEFAULT_CONFIG_FILE, DEFAULT_CONFIG_FILE_USER, ENV_CONFIG_FILE, &c->config_file); if (!f && errno != ENOENT) { - pa_log(__FILE__": WARNING: failed to open configuration file '%s': %s\n", filename, strerror(errno)); + pa_log(__FILE__": WARNING: failed to open configuration file '%s': %s", filename, strerror(errno)); goto finish; } diff --git a/src/daemon/main.c b/src/daemon/main.c index 3124ad1d..4b972fe2 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -94,7 +94,7 @@ static void message_cb(pa_mainloop_api*a, pa_defer_event *e, void *userdata) { #endif static void signal_callback(pa_mainloop_api*m, PA_GCC_UNUSED pa_signal_event *e, int sig, void *userdata) { - pa_log_info(__FILE__": Got signal %s.\n", pa_strsignal(sig)); + pa_log_info(__FILE__": Got signal %s.", pa_strsignal(sig)); switch (sig) { #ifdef SIGUSR1 @@ -112,7 +112,7 @@ static void signal_callback(pa_mainloop_api*m, PA_GCC_UNUSED pa_signal_event *e, #ifdef SIGHUP case SIGHUP: { char *c = pa_full_status_string(userdata); - pa_log_notice(c); + pa_log_notice("%s", c); pa_xfree(c); return; } @@ -121,7 +121,7 @@ static void signal_callback(pa_mainloop_api*m, PA_GCC_UNUSED pa_signal_event *e, case SIGINT: case SIGTERM: default: - pa_log_info(__FILE__": Exiting.\n"); + pa_log_info(__FILE__": Exiting."); m->quit(m, 1); break; } @@ -161,7 +161,7 @@ int main(int argc, char *argv[]) { suid_root = getuid() != 0 && geteuid() == 0; if (suid_root && (pa_uid_in_group("realtime", &gid) <= 0 || gid >= 1000)) { - pa_log_warn(__FILE__": WARNING: called SUID root, but not in group 'realtime'.\n"); + pa_log_warn(__FILE__": WARNING: called SUID root, but not in group 'realtime'."); pa_drop_root(); } #else @@ -191,7 +191,7 @@ int main(int argc, char *argv[]) { goto finish; if (pa_cmdline_parse(conf, argc, argv, &d) < 0) { - pa_log(__FILE__": failed to parse command line.\n"); + pa_log(__FILE__": failed to parse command line."); goto finish; } @@ -237,9 +237,9 @@ int main(int argc, char *argv[]) { pid_t pid; if (pa_pid_file_check_running(&pid) < 0) { - pa_log_info(__FILE__": daemon not running\n"); + pa_log_info(__FILE__": daemon not running"); } else { - pa_log_info(__FILE__": daemon running as PID %u\n", pid); + pa_log_info(__FILE__": daemon running as PID %u", pid); retval = 0; } @@ -249,7 +249,7 @@ int main(int argc, char *argv[]) { case PA_CMD_KILL: if (pa_pid_file_kill(SIGINT, NULL) < 0) - pa_log(__FILE__": failed to kill daemon.\n"); + pa_log(__FILE__": failed to kill daemon."); else retval = 0; @@ -264,18 +264,18 @@ int main(int argc, char *argv[]) { int tty_fd; if (pa_stdio_acquire() < 0) { - pa_log(__FILE__": failed to acquire stdio.\n"); + pa_log(__FILE__": failed to acquire stdio."); goto finish; } #ifdef HAVE_FORK if (pipe(daemon_pipe) < 0) { - pa_log(__FILE__": failed to create pipe.\n"); + pa_log(__FILE__": failed to create pipe."); goto finish; } if ((child = fork()) < 0) { - pa_log(__FILE__": fork() failed: %s\n", strerror(errno)); + pa_log(__FILE__": fork() failed: %s", strerror(errno)); goto finish; } @@ -286,14 +286,14 @@ int main(int argc, char *argv[]) { daemon_pipe[1] = -1; if (pa_loop_read(daemon_pipe[0], &retval, sizeof(retval)) != sizeof(retval)) { - pa_log(__FILE__": read() failed: %s\n", strerror(errno)); + pa_log(__FILE__": read() failed: %s", strerror(errno)); retval = 1; } if (retval) - pa_log(__FILE__": daemon startup failed.\n"); + pa_log(__FILE__": daemon startup failed."); else - pa_log_info(__FILE__": daemon startup successful.\n"); + pa_log_info(__FILE__": daemon startup successful."); goto finish; } @@ -346,7 +346,7 @@ int main(int argc, char *argv[]) { if (conf->use_pid_file) { if (pa_pid_file_create() < 0) { - pa_log(__FILE__": pa_pid_file_create() failed.\n"); + pa_log(__FILE__": pa_pid_file_create() failed."); #ifdef HAVE_FORK if (conf->daemonize) pa_loop_write(daemon_pipe[1], &retval, sizeof(retval)); @@ -396,23 +396,22 @@ int main(int argc, char *argv[]) { assert(r == 0); buf = pa_strbuf_new(); - assert(buf); if (conf->default_script_file) r = pa_cli_command_execute_file(c, conf->default_script_file, buf, &conf->fail); if (r >= 0) r = pa_cli_command_execute(c, conf->script_commands, buf, &conf->fail); - pa_log(s = pa_strbuf_tostring_free(buf)); + pa_log_error("%s", s = pa_strbuf_tostring_free(buf)); pa_xfree(s); if (r < 0 && conf->fail) { - pa_log(__FILE__": failed to initialize daemon.\n"); + pa_log(__FILE__": failed to initialize daemon."); #ifdef HAVE_FORK if (conf->daemonize) pa_loop_write(daemon_pipe[1], &retval, sizeof(retval)); #endif } else if (!c->modules || pa_idxset_size(c->modules) == 0) { - pa_log(__FILE__": daemon startup without any loaded modules, refusing to work.\n"); + pa_log(__FILE__": daemon startup without any loaded modules, refusing to work."); #ifdef HAVE_FORK if (conf->daemonize) pa_loop_write(daemon_pipe[1], &retval, sizeof(retval)); @@ -433,13 +432,13 @@ int main(int argc, char *argv[]) { if (c->default_sink_name && pa_namereg_get(c, c->default_sink_name, PA_NAMEREG_SINK, 1) == NULL) { - pa_log_error("%s : Fatal error. Default sink name (%s) does not exist in name register.\n", __FILE__, c->default_sink_name); + pa_log_error("%s : Fatal error. Default sink name (%s) does not exist in name register.", __FILE__, c->default_sink_name); retval = 1; } else { - pa_log_info(__FILE__": Daemon startup complete.\n"); + pa_log_info(__FILE__": Daemon startup complete."); if (pa_mainloop_run(mainloop, &retval) < 0) retval = 1; - pa_log_info(__FILE__": Daemon shutdown initiated.\n"); + pa_log_info(__FILE__": Daemon shutdown initiated."); } } @@ -453,7 +452,7 @@ int main(int argc, char *argv[]) { pa_signal_done(); pa_mainloop_free(mainloop); - pa_log_info(__FILE__": Daemon terminated.\n"); + pa_log_info(__FILE__": Daemon terminated."); finish: diff --git a/src/modules/alsa-util.c b/src/modules/alsa-util.c index 68e9f975..1b254f51 100644 --- a/src/modules/alsa-util.c +++ b/src/modules/alsa-util.c @@ -63,7 +63,7 @@ int pa_alsa_set_hw_params(snd_pcm_t *pcm_handle, const pa_sample_spec *ss, uint3 goto finish; if (ss->rate != r) - pa_log_info(__FILE__": device doesn't support %u Hz, changed to %u Hz.\n", ss->rate, r); + pa_log_info(__FILE__": device doesn't support %u Hz, changed to %u Hz.", ss->rate, r); if (snd_pcm_prepare(pcm_handle) < 0) goto finish; diff --git a/src/modules/howl-wrap.c b/src/modules/howl-wrap.c index b3fe8166..f4605fb2 100644 --- a/src/modules/howl-wrap.c +++ b/src/modules/howl-wrap.c @@ -35,7 +35,6 @@ struct pa_howl_wrapper { pa_io_event *io_event; sw_discovery discovery; - }; static void howl_io_event(pa_mainloop_api*m, pa_io_event *e, int fd, pa_io_event_flags_t f, void *userdata) { @@ -51,7 +50,7 @@ static void howl_io_event(pa_mainloop_api*m, pa_io_event *e, int fd, pa_io_event return; fail: - pa_log(__FILE__": howl connection died.\n"); + pa_log_error(__FILE__": howl connection died."); w->core->mainloop->io_free(w->io_event); w->io_event = NULL; } @@ -62,7 +61,7 @@ static pa_howl_wrapper* howl_wrapper_new(pa_core *c) { assert(c); if (sw_discovery_init(&session) != SW_OKAY) { - pa_log("sw_discovery_init() failed.\n"); + pa_log_error(__FILE__": sw_discovery_init() failed."); return NULL; } diff --git a/src/modules/module-alsa-sink.c b/src/modules/module-alsa-sink.c index 6ea1e137..e37367c8 100644 --- a/src/modules/module-alsa-sink.c +++ b/src/modules/module-alsa-sink.c @@ -86,10 +86,10 @@ static void update_usage(struct userdata *u) { static void xrun_recovery(struct userdata *u) { assert(u); - pa_log(__FILE__": *** ALSA-XRUN (playback) ***\n"); + pa_log(__FILE__": *** ALSA-XRUN (playback) ***"); if (snd_pcm_prepare(u->pcm_handle) < 0) - pa_log(__FILE__": snd_pcm_prepare() failed\n"); + pa_log(__FILE__": snd_pcm_prepare() failed"); } static void do_write(struct userdata *u) { @@ -121,7 +121,7 @@ static void do_write(struct userdata *u) { continue; } - pa_log(__FILE__": snd_pcm_writei() failed\n"); + pa_log(__FILE__": snd_pcm_writei() failed"); return; } @@ -158,7 +158,7 @@ static pa_usec_t sink_get_latency_cb(pa_sink *s) { assert(s && u && u->sink); if (snd_pcm_delay(u->pcm_handle, &frames) < 0) { - pa_log(__FILE__": failed to get delay\n"); + pa_log(__FILE__": failed to get delay"); s->get_latency = NULL; return 0; } @@ -186,13 +186,13 @@ int pa__init(pa_core *c, pa_module*m) { int err; if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": failed to parse module arguments\n"); + pa_log(__FILE__": failed to parse module arguments"); goto fail; } ss = c->default_sample_spec; if (pa_modargs_get_sample_spec(ma, &ss) < 0) { - pa_log(__FILE__": failed to parse sample specification\n"); + pa_log(__FILE__": failed to parse sample specification"); goto fail; } frame_size = pa_frame_size(&ss); @@ -200,7 +200,7 @@ int pa__init(pa_core *c, pa_module*m) { periods = 8; fragsize = 1024; if (pa_modargs_get_value_u32(ma, "fragments", &periods) < 0 || pa_modargs_get_value_u32(ma, "fragment_size", &fragsize) < 0) { - pa_log(__FILE__": failed to parse buffer metrics\n"); + pa_log(__FILE__": failed to parse buffer metrics"); goto fail; } period_size = fragsize; @@ -211,12 +211,12 @@ int pa__init(pa_core *c, pa_module*m) { snd_config_update_free_global(); if ((err = snd_pcm_open(&u->pcm_handle, dev = pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)) < 0) { - pa_log(__FILE__": Error opening PCM device %s: %s\n", dev, snd_strerror(err)); + pa_log(__FILE__": Error opening PCM device %s: %s", dev, snd_strerror(err)); goto fail; } if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &periods, &period_size)) < 0) { - pa_log(__FILE__": Failed to set hardware parameters: %s\n", snd_strerror(err)); + pa_log(__FILE__": Failed to set hardware parameters: %s", snd_strerror(err)); goto fail; } @@ -229,14 +229,14 @@ int pa__init(pa_core *c, pa_module*m) { u->sink->description = pa_sprintf_malloc("Advanced Linux Sound Architecture PCM on '%s'", dev); if (pa_create_io_events(u->pcm_handle, c->mainloop, &u->io_events, &u->n_io_events, io_callback, u) < 0) { - pa_log(__FILE__": failed to obtain file descriptors\n"); + pa_log(__FILE__": failed to obtain file descriptors"); goto fail; } u->frame_size = frame_size; u->fragment_size = period_size; - pa_log_info(__FILE__": using %u fragments of size %u bytes.\n", periods, u->fragment_size); + pa_log_info(__FILE__": using %u fragments of size %u bytes.", periods, u->fragment_size); u->silence.memblock = pa_memblock_new(u->silence.length = u->fragment_size, c->memblock_stat); assert(u->silence.memblock); diff --git a/src/modules/module-alsa-source.c b/src/modules/module-alsa-source.c index 4f281aa7..bf031350 100644 --- a/src/modules/module-alsa-source.c +++ b/src/modules/module-alsa-source.c @@ -85,10 +85,10 @@ static void update_usage(struct userdata *u) { static void xrun_recovery(struct userdata *u) { assert(u); - pa_log(__FILE__": *** ALSA-XRUN (capture) ***\n"); + pa_log(__FILE__": *** ALSA-XRUN (capture) ***"); if (snd_pcm_prepare(u->pcm_handle) < 0) - pa_log(__FILE__": snd_pcm_prepare() failed\n"); + pa_log(__FILE__": snd_pcm_prepare() failed"); } static void do_read(struct userdata *u) { @@ -117,7 +117,7 @@ static void do_read(struct userdata *u) { continue; } - pa_log(__FILE__": snd_pcm_readi() failed: %s\n", strerror(-frames)); + pa_log(__FILE__": snd_pcm_readi() failed: %s", strerror(-frames)); return; } @@ -157,7 +157,7 @@ static pa_usec_t source_get_latency_cb(pa_source *s) { assert(s && u && u->source); if (snd_pcm_delay(u->pcm_handle, &frames) < 0) { - pa_log(__FILE__": failed to get delay\n"); + pa_log(__FILE__": failed to get delay"); s->get_latency = NULL; return 0; } @@ -177,13 +177,13 @@ int pa__init(pa_core *c, pa_module*m) { int err; if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": failed to parse module arguments\n"); + pa_log(__FILE__": failed to parse module arguments"); goto fail; } ss = c->default_sample_spec; if (pa_modargs_get_sample_spec(ma, &ss) < 0) { - pa_log(__FILE__": failed to parse sample specification\n"); + pa_log(__FILE__": failed to parse sample specification"); goto fail; } frame_size = pa_frame_size(&ss); @@ -191,7 +191,7 @@ int pa__init(pa_core *c, pa_module*m) { periods = 12; fragsize = 1024; if (pa_modargs_get_value_u32(ma, "fragments", &periods) < 0 || pa_modargs_get_value_u32(ma, "fragment_size", &fragsize) < 0) { - pa_log(__FILE__": failed to parse buffer metrics\n"); + pa_log(__FILE__": failed to parse buffer metrics"); goto fail; } period_size = fragsize; @@ -202,12 +202,12 @@ int pa__init(pa_core *c, pa_module*m) { snd_config_update_free_global(); if ((err = snd_pcm_open(&u->pcm_handle, dev = pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), SND_PCM_STREAM_CAPTURE, SND_PCM_NONBLOCK)) < 0) { - pa_log(__FILE__": Error opening PCM device %s: %s\n", dev, snd_strerror(err)); + pa_log(__FILE__": Error opening PCM device %s: %s", dev, snd_strerror(err)); goto fail; } if ((err = pa_alsa_set_hw_params(u->pcm_handle, &ss, &periods, &period_size)) < 0) { - pa_log(__FILE__": Failed to set hardware parameters: %s\n", snd_strerror(err)); + pa_log(__FILE__": Failed to set hardware parameters: %s", snd_strerror(err)); goto fail; } @@ -220,14 +220,14 @@ int pa__init(pa_core *c, pa_module*m) { u->source->description = pa_sprintf_malloc("Advanced Linux Sound Architecture PCM on '%s'", dev); if (pa_create_io_events(u->pcm_handle, c->mainloop, &u->io_events, &u->n_io_events, io_callback, u) < 0) { - pa_log(__FILE__": failed to obtain file descriptors\n"); + pa_log(__FILE__": failed to obtain file descriptors"); goto fail; } u->frame_size = frame_size; u->fragment_size = period_size; - pa_log(__FILE__": using %u fragments of size %u bytes.\n", periods, u->fragment_size); + pa_log(__FILE__": using %u fragments of size %u bytes.", periods, u->fragment_size); u->memchunk.memblock = NULL; u->memchunk.index = u->memchunk.length = 0; diff --git a/src/modules/module-cli.c b/src/modules/module-cli.c index c782ff8d..41e33c7f 100644 --- a/src/modules/module-cli.c +++ b/src/modules/module-cli.c @@ -52,17 +52,17 @@ int pa__init(pa_core *c, pa_module*m) { assert(c && m); if (c->running_as_daemon) { - pa_log_info(__FILE__": Running as daemon so won't load this module.\n"); + pa_log_info(__FILE__": Running as daemon so won't load this module."); return 0; } if (m->argument) { - pa_log(__FILE__": module doesn't accept arguments.\n"); + pa_log(__FILE__": module doesn't accept arguments."); return -1; } if (pa_stdio_acquire() < 0) { - pa_log(__FILE__": STDIN/STDUSE already in use.\n"); + pa_log(__FILE__": STDIN/STDUSE already in use."); return -1; } diff --git a/src/modules/module-combine.c b/src/modules/module-combine.c index 750eca67..28e85427 100644 --- a/src/modules/module-combine.c +++ b/src/modules/module-combine.c @@ -112,7 +112,7 @@ static void adjust_rates(struct userdata *u) { target_latency = max_sink_latency > min_total_latency ? max_sink_latency : min_total_latency; - pa_log_info(__FILE__": [%s] target latency is %0.0f usec.\n", u->sink->name, (float) target_latency); + pa_log_info(__FILE__": [%s] target latency is %0.0f usec.", u->sink->name, (float) target_latency); base_rate = u->sink->sample_spec.rate; @@ -125,9 +125,9 @@ static void adjust_rates(struct userdata *u) { r += (uint32_t) (((((double) o->total_latency - target_latency))/u->adjust_time)*r/ 1000000); if (r < (uint32_t) (base_rate*0.9) || r > (uint32_t) (base_rate*1.1)) - pa_log_warn(__FILE__": [%s] sample rates too different, not adjusting (%u vs. %u).\n", o->sink_input->name, base_rate, r); + pa_log_warn(__FILE__": [%s] sample rates too different, not adjusting (%u vs. %u).", o->sink_input->name, base_rate, r); else { - pa_log_info(__FILE__": [%s] new rate is %u Hz; ratio is %0.3f; latency is %0.0f usec.\n", o->sink_input->name, r, (double) r / base_rate, (float) o->total_latency); + pa_log_info(__FILE__": [%s] new rate is %u Hz; ratio is %0.3f; latency is %0.0f usec.", o->sink_input->name, r, (double) r / base_rate, (float) o->total_latency); pa_sink_input_set_rate(o->sink_input, r); } } @@ -297,13 +297,13 @@ int pa__init(pa_core *c, pa_module*m) { assert(c && m); if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": failed to parse module arguments\n"); + pa_log(__FILE__": failed to parse module arguments"); goto fail; } if ((rm = pa_modargs_get_value(ma, "resample_method", NULL))) { if ((resample_method = pa_parse_resample_method(rm)) < 0) { - pa_log(__FILE__": invalid resample method '%s'\n", rm); + pa_log(__FILE__": invalid resample method '%s'", rm); goto fail; } } @@ -320,22 +320,22 @@ int pa__init(pa_core *c, pa_module*m) { PA_LLIST_HEAD_INIT(struct output, u->outputs); if (pa_modargs_get_value_u32(ma, "adjust_time", &u->adjust_time) < 0) { - pa_log(__FILE__": failed to parse adjust_time value\n"); + pa_log(__FILE__": failed to parse adjust_time value"); goto fail; } if (!(master_name = pa_modargs_get_value(ma, "master", NULL)) || !(slaves = pa_modargs_get_value(ma, "slaves", NULL))) { - pa_log(__FILE__": no master or slave sinks specified\n"); + pa_log(__FILE__": no master or slave sinks specified"); goto fail; } if (!(master_sink = pa_namereg_get(c, master_name, PA_NAMEREG_SINK, 1))) { - pa_log(__FILE__": invalid master sink '%s'\n", master_name); + pa_log(__FILE__": invalid master sink '%s'", master_name); goto fail; } if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &master_sink->sample_spec, &master_sink->channel_map))) { - pa_log(__FILE__": failed to create sink\n"); + pa_log(__FILE__": failed to create sink"); goto fail; } @@ -345,7 +345,7 @@ int pa__init(pa_core *c, pa_module*m) { u->sink->userdata = u; if (!(u->master = output_new(u, master_sink, resample_method))) { - pa_log(__FILE__": failed to create master sink input on sink '%s'.\n", u->sink->name); + pa_log(__FILE__": failed to create master sink input on sink '%s'.", u->sink->name); goto fail; } @@ -354,20 +354,20 @@ int pa__init(pa_core *c, pa_module*m) { pa_sink *slave_sink; if (!(slave_sink = pa_namereg_get(c, n, PA_NAMEREG_SINK, 1))) { - pa_log(__FILE__": invalid slave sink '%s'\n", n); + pa_log(__FILE__": invalid slave sink '%s'", n); goto fail; } pa_xfree(n); if (!output_new(u, slave_sink, resample_method)) { - pa_log(__FILE__": failed to create slave sink input on sink '%s'.\n", slave_sink->name); + pa_log(__FILE__": failed to create slave sink input on sink '%s'.", slave_sink->name); goto fail; } } if (u->n_outputs <= 1) - pa_log_warn(__FILE__": WARNING: no slave sinks specified.\n"); + pa_log_warn(__FILE__": WARNING: no slave sinks specified."); if (u->adjust_time > 0) { pa_gettimeofday(&tv); diff --git a/src/modules/module-detect.c b/src/modules/module-detect.c index 18e22de6..b24d838b 100644 --- a/src/modules/module-detect.c +++ b/src/modules/module-detect.c @@ -66,7 +66,7 @@ static int detect_alsa(pa_core *c, int just_one) { if (!(f = fopen("/proc/asound/devices", "r"))) { if (errno != ENOENT) - pa_log_error(__FILE__": open(\"/proc/asound/devices\") failed: %s\n", strerror(errno)); + pa_log_error(__FILE__": open(\"/proc/asound/devices\") failed: %s", strerror(errno)); return -1; } @@ -129,7 +129,7 @@ static int detect_oss(pa_core *c, int just_one) { !(f = fopen("/proc/asound/oss/sndstat", "r"))) { if (errno != ENOENT) - pa_log_error(__FILE__": failed to open OSS sndstat device: %s\n", strerror(errno)); + pa_log_error(__FILE__": failed to open OSS sndstat device: %s", strerror(errno)); return -1; } @@ -185,7 +185,7 @@ static int detect_solaris(pa_core *c, int just_one) { if (stat(dev, &s) < 0) { if (errno != ENOENT) - pa_log_error(__FILE__": failed to open device %s: %s\n", dev, strerror(errno)); + pa_log_error(__FILE__": failed to open device %s: %s", dev, strerror(errno)); return -1; } @@ -227,12 +227,12 @@ int pa__init(pa_core *c, pa_module*m) { assert(m); if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": Failed to parse module arguments\n"); + pa_log(__FILE__": Failed to parse module arguments"); goto fail; } if (pa_modargs_get_value_boolean(ma, "just-one", &just_one) < 0) { - pa_log(__FILE__": just_one= expects a boolean argument.\n"); + pa_log(__FILE__": just_one= expects a boolean argument."); goto fail; } @@ -249,11 +249,11 @@ int pa__init(pa_core *c, pa_module*m) { if ((n = detect_waveout(c, just_one)) <= 0) #endif { - pa_log_warn(__FILE__": failed to detect any sound hardware.\n"); + pa_log_warn(__FILE__": failed to detect any sound hardware."); goto fail; } - pa_log_info(__FILE__": loaded %i modules.\n", n); + pa_log_info(__FILE__": loaded %i modules.", n); /* We were successful and can unload ourselves now. */ pa_module_unload_request(m); diff --git a/src/modules/module-esound-compat-spawnfd.c b/src/modules/module-esound-compat-spawnfd.c index 5c656be9..9b72448f 100644 --- a/src/modules/module-esound-compat-spawnfd.c +++ b/src/modules/module-esound-compat-spawnfd.c @@ -54,12 +54,12 @@ int pa__init(pa_core *c, pa_module*m) { if (!(ma = pa_modargs_new(m->argument, valid_modargs)) || pa_modargs_get_value_s32(ma, "fd", &fd) < 0 || fd < 0) { - pa_log(__FILE__": Failed to parse module arguments\n"); + pa_log(__FILE__": Failed to parse module arguments"); goto finish; } if (pa_loop_write(fd, &x, sizeof(x)) != sizeof(x)) - pa_log(__FILE__": WARNING: write(%u, 1, 1) failed: %s\n", fd, strerror(errno)); + pa_log(__FILE__": WARNING: write(%u, 1, 1) failed: %s", fd, strerror(errno)); close(fd); diff --git a/src/modules/module-esound-compat-spawnpid.c b/src/modules/module-esound-compat-spawnpid.c index 5daa1297..f8c07d31 100644 --- a/src/modules/module-esound-compat-spawnpid.c +++ b/src/modules/module-esound-compat-spawnpid.c @@ -54,12 +54,12 @@ int pa__init(pa_core *c, pa_module*m) { if (!(ma = pa_modargs_new(m->argument, valid_modargs)) || pa_modargs_get_value_u32(ma, "pid", &pid) < 0 || !pid) { - pa_log(__FILE__": Failed to parse module arguments\n"); + pa_log(__FILE__": Failed to parse module arguments"); goto finish; } if (kill(pid, SIGUSR1) < 0) - pa_log(__FILE__": WARNING: kill(%u) failed: %s\n", pid, strerror(errno)); + pa_log(__FILE__": WARNING: kill(%u) failed: %s", pid, strerror(errno)); pa_module_unload_request(m); diff --git a/src/modules/module-esound-sink.c b/src/modules/module-esound-sink.c index 4f724811..1cc75502 100644 --- a/src/modules/module-esound-sink.c +++ b/src/modules/module-esound-sink.c @@ -127,7 +127,7 @@ static int do_write(struct userdata *u) { assert(u->write_index < u->write_length); if ((r = pa_iochannel_write(u->io, (uint8_t*) u->write_data + u->write_index, u->write_length - u->write_index)) <= 0) { - pa_log(__FILE__": write() failed: %s\n", strerror(errno)); + pa_log(__FILE__": write() failed: %s", strerror(errno)); return -1; } @@ -149,7 +149,7 @@ static int do_write(struct userdata *u) { assert(u->memchunk.memblock && u->memchunk.length); if ((r = pa_iochannel_write(u->io, (uint8_t*) u->memchunk.memblock->data + u->memchunk.index, u->memchunk.length)) < 0) { - pa_log(__FILE__": write() failed: %s\n", strerror(errno)); + pa_log(__FILE__": write() failed: %s", strerror(errno)); return -1; } @@ -174,7 +174,7 @@ static int handle_response(struct userdata *u) { /* Process auth data */ if (!*(int32_t*) u->read_data) { - pa_log(__FILE__": Authentication failed: %s\n", strerror(errno)); + pa_log(__FILE__": Authentication failed: %s", strerror(errno)); return -1; } @@ -199,7 +199,7 @@ static int handle_response(struct userdata *u) { /* Process latency info */ u->latency = (pa_usec_t) ((double) (*(int32_t*) u->read_data) * 1000000 / 44100); if (u->latency > 10000000) { - pa_log(__FILE__": WARNING! Invalid latency information received from server\n"); + pa_log(__FILE__": WARNING! Invalid latency information received from server"); u->latency = 0; } @@ -244,7 +244,7 @@ static int do_read(struct userdata *u) { assert(u->read_index < u->read_length); if ((r = pa_iochannel_read(u->io, (uint8_t*) u->read_data + u->read_index, u->read_length - u->read_index)) <= 0) { - pa_log(__FILE__": read() failed: %s\n", r < 0 ? strerror(errno) : "EOF"); + pa_log(__FILE__": read() failed: %s", r < 0 ? strerror(errno) : "EOF"); cancel(u); return -1; } @@ -304,7 +304,7 @@ static void on_connection(PA_GCC_UNUSED pa_socket_client *c, pa_iochannel*io, vo u->client = NULL; if (!io) { - pa_log(__FILE__": connection failed: %s\n", strerror(errno)); + pa_log(__FILE__": connection failed: %s", strerror(errno)); cancel(u); return; } @@ -321,19 +321,19 @@ int pa__init(pa_core *c, pa_module*m) { assert(c && m); if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": failed to parse module arguments\n"); + pa_log(__FILE__": failed to parse module arguments"); goto fail; } ss = c->default_sample_spec; if (pa_modargs_get_sample_spec(ma, &ss) < 0) { - pa_log(__FILE__": invalid sample format specification\n"); + pa_log(__FILE__": invalid sample format specification"); goto fail; } if ((ss.format != PA_SAMPLE_U8 && ss.format != PA_SAMPLE_S16NE) || (ss.channels > 2)) { - pa_log(__FILE__": esound sample type support is limited to mono/stereo and U8 or S16NE sample data\n"); + pa_log(__FILE__": esound sample type support is limited to mono/stereo and U8 or S16NE sample data"); goto fail; } @@ -354,12 +354,12 @@ int pa__init(pa_core *c, pa_module*m) { u->latency = 0; if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, NULL))) { - pa_log(__FILE__": failed to create sink.\n"); + pa_log(__FILE__": failed to create sink."); goto fail; } if (!(u->client = pa_socket_client_new_string(u->core->mainloop, p = pa_modargs_get_value(ma, "server", ESD_UNIX_SOCKET_NAME), ESD_DEFAULT_PORT))) { - pa_log(__FILE__": failed to connect to server.\n"); + pa_log(__FILE__": failed to connect to server."); goto fail; } pa_socket_client_set_callback(u->client, on_connection, u); @@ -367,7 +367,7 @@ int pa__init(pa_core *c, 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"), u->write_data, ESD_KEY_LEN) < 0) { - pa_log(__FILE__": failed to load cookie\n"); + pa_log(__FILE__": failed to load cookie"); goto fail; } *(int32_t*) ((uint8_t*) u->write_data + ESD_KEY_LEN) = ESD_ENDIAN_KEY; diff --git a/src/modules/module-lirc.c b/src/modules/module-lirc.c index ea8a2bd2..3bb0dc74 100644 --- a/src/modules/module-lirc.c +++ b/src/modules/module-lirc.c @@ -69,7 +69,7 @@ static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e, PA_GC assert(u); if (events & (PA_IO_EVENT_HANGUP|PA_IO_EVENT_ERROR)) { - pa_log(__FILE__": lost connection to LIRC daemon.\n"); + pa_log(__FILE__": lost connection to LIRC daemon."); goto fail; } @@ -77,19 +77,19 @@ static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e, PA_GC char *c; if (lirc_nextcode(&code) != 0 || !code) { - pa_log(__FILE__": lirc_nextcode() failed.\n"); + pa_log(__FILE__": lirc_nextcode() failed."); goto fail; } c = pa_xstrdup(code); c[strcspn(c, "\n\r")] = 0; - pa_log_debug(__FILE__": raw IR code '%s'\n", c); + pa_log_debug(__FILE__": raw IR code '%s'", c); pa_xfree(c); while (lirc_code2char(u->config, code, &name) == 0 && name) { enum { INVALID, UP, DOWN, MUTE, RESET, MUTE_TOGGLE } volchange = INVALID; - pa_log_info(__FILE__": translated IR code '%s'\n", name); + pa_log_info(__FILE__": translated IR code '%s'", name); if (strcasecmp(name, "volume-up") == 0) volchange = UP; @@ -103,12 +103,12 @@ static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e, PA_GC volchange = RESET; if (volchange == INVALID) - pa_log_warn(__FILE__": recieved unknown IR code '%s'\n", name); + pa_log_warn(__FILE__": recieved unknown IR code '%s'", name); else { pa_sink *s; if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK, 1))) - pa_log(__FILE__": failed to get sink '%s'\n", u->sink_name); + pa_log(__FILE__": failed to get sink '%s'", u->sink_name); else { pa_volume_t v = pa_cvolume_avg(pa_sink_get_volume(s, PA_MIXER_HARDWARE)); pa_cvolume cv; @@ -173,12 +173,12 @@ int pa__init(pa_core *c, pa_module*m) { assert(c && m); if (lirc_in_use) { - pa_log(__FILE__": module-lirc may no be loaded twice.\n"); + pa_log(__FILE__": module-lirc may no be loaded twice."); return -1; } if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": Failed to parse module arguments\n"); + pa_log(__FILE__": Failed to parse module arguments"); goto fail; } @@ -191,12 +191,12 @@ int pa__init(pa_core *c, pa_module*m) { u->mute_toggle_save = 0; if ((u->lirc_fd = lirc_init((char*) pa_modargs_get_value(ma, "appname", "polypaudio"), 1)) < 0) { - pa_log(__FILE__": lirc_init() failed.\n"); + pa_log(__FILE__": lirc_init() failed."); goto fail; } if (lirc_readconfig((char*) pa_modargs_get_value(ma, "config", NULL), &u->config, NULL) < 0) { - pa_log(__FILE__": lirc_readconfig() failed.\n"); + pa_log(__FILE__": lirc_readconfig() failed."); goto fail; } diff --git a/src/modules/module-match.c b/src/modules/module-match.c index 1fb7233c..59817517 100644 --- a/src/modules/module-match.c +++ b/src/modules/module-match.c @@ -84,7 +84,7 @@ static int load_rules(struct userdata *u, const char *filename) { pa_open_config_file(DEFAULT_MATCH_TABLE_FILE, DEFAULT_MATCH_TABLE_FILE_USER, NULL, &fn); if (!f) { - pa_log(__FILE__": failed to open file '%s': %s\n", fn, strerror(errno)); + pa_log(__FILE__": failed to open file '%s': %s", fn, strerror(errno)); goto finish; } @@ -111,13 +111,13 @@ static int load_rules(struct userdata *u, const char *filename) { if (!*v) { - pa_log(__FILE__ ": [%s:%u] failed to parse line - too few words\n", filename, n); + pa_log(__FILE__ ": [%s:%u] failed to parse line - too few words", filename, n); goto finish; } *d = 0; if (pa_atou(v, &k) < 0) { - pa_log(__FILE__": [%s:%u] failed to parse volume\n", filename, n); + pa_log(__FILE__": [%s:%u] failed to parse volume", filename, n); goto finish; } @@ -125,7 +125,7 @@ static int load_rules(struct userdata *u, const char *filename) { if (regcomp(®ex, ln, REG_EXTENDED|REG_NOSUB) != 0) { - pa_log(__FILE__": [%s:%u] invalid regular expression\n", filename, n); + pa_log(__FILE__": [%s:%u] invalid regular expression", filename, n); goto finish; } @@ -173,7 +173,7 @@ static void callback(pa_core *c, pa_subscription_event_type_t t, uint32_t idx, v for (r = u->rules; r; r = r->next) { if (!regexec(&r->regex, si->name, 0, NULL, 0)) { pa_cvolume cv; - pa_log_debug(__FILE__": changing volume of sink input '%s' to 0x%03x\n", si->name, r->volume); + pa_log_debug(__FILE__": changing volume of sink input '%s' to 0x%03x", si->name, r->volume); pa_cvolume_set(&cv, r->volume, si->sample_spec.channels); pa_sink_input_set_volume(si, &cv); } @@ -186,7 +186,7 @@ int pa__init(pa_core *c, pa_module*m) { assert(c && m); if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": Failed to parse module arguments\n"); + pa_log(__FILE__": Failed to parse module arguments"); goto fail; } diff --git a/src/modules/module-mmkbd-evdev.c b/src/modules/module-mmkbd-evdev.c index b60f786d..79194ad8 100644 --- a/src/modules/module-mmkbd-evdev.c +++ b/src/modules/module-mmkbd-evdev.c @@ -81,7 +81,7 @@ static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e, PA_GC assert(u); if (events & (PA_IO_EVENT_HANGUP|PA_IO_EVENT_ERROR)) { - pa_log(__FILE__": lost connection to evdev device.\n"); + pa_log(__FILE__": lost connection to evdev device."); goto fail; } @@ -89,14 +89,14 @@ static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e, PA_GC struct input_event ev; if (pa_loop_read(u->fd, &ev, sizeof(ev)) <= 0) { - pa_log(__FILE__": failed to read from event device: %s\n", strerror(errno)); + pa_log(__FILE__": failed to read from event device: %s", strerror(errno)); goto fail; } if (ev.type == EV_KEY && (ev.value == 1 || ev.value == 2)) { enum { INVALID, UP, DOWN, MUTE_TOGGLE } volchange = INVALID; - pa_log_debug(__FILE__": key code=%u, value=%u\n", ev.code, ev.value); + pa_log_debug(__FILE__": key code=%u, value=%u", ev.code, ev.value); switch (ev.code) { case KEY_VOLUMEDOWN: volchange = DOWN; break; @@ -108,7 +108,7 @@ static void io_callback(pa_mainloop_api *io, PA_GCC_UNUSED pa_io_event *e, PA_GC pa_sink *s; if (!(s = pa_namereg_get(u->module->core, u->sink_name, PA_NAMEREG_SINK, 1))) - pa_log(__FILE__": failed to get sink '%s'\n", u->sink_name); + pa_log(__FILE__": failed to get sink '%s'", u->sink_name); else { pa_volume_t v = pa_cvolume_avg(pa_sink_get_volume(s, PA_MIXER_HARDWARE)); pa_cvolume cv; @@ -167,7 +167,7 @@ int pa__init(pa_core *c, pa_module*m) { assert(c && m); if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": Failed to parse module arguments\n"); + pa_log(__FILE__": Failed to parse module arguments"); goto fail; } @@ -179,40 +179,40 @@ int pa__init(pa_core *c, pa_module*m) { u->mute_toggle_save = 0; if ((u->fd = open(pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), O_RDONLY)) < 0) { - pa_log(__FILE__": failed to open evdev device: %s\n", strerror(errno)); + pa_log(__FILE__": failed to open evdev device: %s", strerror(errno)); goto fail; } if (ioctl(u->fd, EVIOCGVERSION, &version) < 0) { - pa_log(__FILE__": EVIOCGVERSION failed: %s\n", strerror(errno)); + pa_log(__FILE__": EVIOCGVERSION failed: %s", strerror(errno)); goto fail; } - pa_log_info(__FILE__": evdev driver version %i.%i.%i\n", version >> 16, (version >> 8) & 0xff, version & 0xff); + pa_log_info(__FILE__": evdev driver version %i.%i.%i", version >> 16, (version >> 8) & 0xff, version & 0xff); if(ioctl(u->fd, EVIOCGID, &input_id)) { - pa_log(__FILE__": EVIOCGID failed: %s\n", strerror(errno)); + pa_log(__FILE__": EVIOCGID failed: %s", strerror(errno)); goto fail; } - pa_log_info(__FILE__": evdev vendor 0x%04hx product 0x%04hx version 0x%04hx bustype %u\n", + pa_log_info(__FILE__": evdev vendor 0x%04hx product 0x%04hx version 0x%04hx bustype %u", input_id.vendor, input_id.product, input_id.version, input_id.bustype); if(ioctl(u->fd, EVIOCGNAME(sizeof(name)), name) < 0) { - pa_log(__FILE__": EVIOCGNAME failed: %s\n", strerror(errno)); + pa_log(__FILE__": EVIOCGNAME failed: %s", strerror(errno)); goto fail; } - pa_log_info(__FILE__": evdev device name: %s\n", name); + pa_log_info(__FILE__": evdev device name: %s", name); memset(evtype_bitmask, 0, sizeof(evtype_bitmask)); if (ioctl(u->fd, EVIOCGBIT(0, EV_MAX), evtype_bitmask) < 0) { - pa_log(__FILE__": EVIOCGBIT failed: %s\n", strerror(errno)); + pa_log(__FILE__": EVIOCGBIT failed: %s", strerror(errno)); goto fail; } if (!test_bit(EV_KEY, evtype_bitmask)) { - pa_log(__FILE__": device has no keys.\n"); + pa_log(__FILE__": device has no keys."); goto fail; } diff --git a/src/modules/module-native-protocol-fd.c b/src/modules/module-native-protocol-fd.c index abc531b3..e3caf55a 100644 --- a/src/modules/module-native-protocol-fd.c +++ b/src/modules/module-native-protocol-fd.c @@ -53,12 +53,12 @@ int pa__init(pa_core *c, pa_module*m) { assert(c && m); if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": failed to parse module arguments.\n"); + pa_log(__FILE__": failed to parse module arguments."); goto finish; } if (pa_modargs_get_value_s32(ma, "fd", &fd) < 0) { - pa_log(__FILE__": invalid file descriptor.\n"); + pa_log(__FILE__": invalid file descriptor."); goto finish; } diff --git a/src/modules/module-null-sink.c b/src/modules/module-null-sink.c index 5731a403..61178239 100644 --- a/src/modules/module-null-sink.c +++ b/src/modules/module-null-sink.c @@ -92,13 +92,13 @@ int pa__init(pa_core *c, pa_module*m) { assert(c && m); if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": failed to parse module arguments.\n"); + pa_log(__FILE__": failed to parse module arguments."); goto fail; } ss = c->default_sample_spec; if (pa_modargs_get_sample_spec(ma, &ss) < 0) { - pa_log(__FILE__": invalid sample format specification.\n"); + pa_log(__FILE__": invalid sample format specification."); goto fail; } @@ -108,7 +108,7 @@ int pa__init(pa_core *c, pa_module*m) { m->userdata = u; if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, NULL))) { - pa_log(__FILE__": failed to create sink.\n"); + pa_log(__FILE__": failed to create sink."); goto fail; } diff --git a/src/modules/module-oss-mmap.c b/src/modules/module-oss-mmap.c index 82f65a3c..9687c908 100644 --- a/src/modules/module-oss-mmap.c +++ b/src/modules/module-oss-mmap.c @@ -130,7 +130,7 @@ static void do_write(struct userdata *u) { update_usage(u); if (ioctl(u->fd, SNDCTL_DSP_GETOPTR, &info) < 0) { - pa_log(__FILE__": SNDCTL_DSP_GETOPTR: %s\n", strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_GETOPTR: %s", strerror(errno)); return; } @@ -192,7 +192,7 @@ static void do_read(struct userdata *u) { update_usage(u); if (ioctl(u->fd, SNDCTL_DSP_GETIPTR, &info) < 0) { - pa_log(__FILE__": SNDCTL_DSP_GETIPTR: %s\n", strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_GETIPTR: %s", strerror(errno)); return; } @@ -225,7 +225,7 @@ static int sink_get_hw_volume(pa_sink *s) { struct userdata *u = s->userdata; if (pa_oss_get_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) { - pa_log_info(__FILE__": device doesn't support reading mixer settings: %s\n", strerror(errno)); + pa_log_info(__FILE__": device doesn't support reading mixer settings: %s", strerror(errno)); s->get_hw_volume = NULL; return -1; } @@ -237,7 +237,7 @@ static int sink_set_hw_volume(pa_sink *s) { struct userdata *u = s->userdata; if (pa_oss_set_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) { - pa_log_info(__FILE__": device doesn't support writing mixer settings: %s\n", strerror(errno)); + pa_log_info(__FILE__": device doesn't support writing mixer settings: %s", strerror(errno)); s->set_hw_volume = NULL; return -1; } @@ -265,17 +265,17 @@ int pa__init(pa_core *c, pa_module*m) { u->core = c; if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": failed to parse module arguments.\n"); + pa_log(__FILE__": failed to parse module arguments."); goto fail; } if (pa_modargs_get_value_boolean(ma, "record", &record) < 0 || pa_modargs_get_value_boolean(ma, "playback", &playback) < 0) { - pa_log(__FILE__": record= and playback= expect numeric arguments.\n"); + pa_log(__FILE__": record= and playback= expect numeric arguments."); goto fail; } if (!playback && !record) { - pa_log(__FILE__": neither playback nor record enabled for device.\n"); + pa_log(__FILE__": neither playback nor record enabled for device."); goto fail; } @@ -284,13 +284,13 @@ int pa__init(pa_core *c, pa_module*m) { nfrags = 12; frag_size = 1024; if (pa_modargs_get_value_s32(ma, "fragments", &nfrags) < 0 || pa_modargs_get_value_s32(ma, "fragment_size", &frag_size) < 0) { - pa_log(__FILE__": failed to parse fragments arguments\n"); + pa_log(__FILE__": failed to parse fragments arguments"); goto fail; } u->sample_spec = c->default_sample_spec; if (pa_modargs_get_sample_spec(ma, &u->sample_spec) < 0) { - pa_log(__FILE__": failed to parse sample specification\n"); + pa_log(__FILE__": failed to parse sample specification"); goto fail; } @@ -298,16 +298,16 @@ int pa__init(pa_core *c, pa_module*m) { goto fail; if (pa_oss_get_hw_description(p, hwdesc, sizeof(hwdesc)) >= 0) - pa_log_info(__FILE__": hardware name is '%s'.\n", hwdesc); + pa_log_info(__FILE__": hardware name is '%s'.", hwdesc); else hwdesc[0] = 0; if (!(caps & DSP_CAP_MMAP) || !(caps & DSP_CAP_REALTIME) || !(caps & DSP_CAP_TRIGGER)) { - pa_log(__FILE__": OSS device not mmap capable.\n"); + pa_log(__FILE__": OSS device not mmap capable."); goto fail; } - pa_log_info(__FILE__": device opened in %s mode.\n", mode == O_WRONLY ? "O_WRONLY" : (mode == O_RDONLY ? "O_RDONLY" : "O_RDWR")); + pa_log_info(__FILE__": device opened in %s mode.", mode == O_WRONLY ? "O_WRONLY" : (mode == O_RDONLY ? "O_RDONLY" : "O_RDWR")); if (nfrags >= 2 && frag_size >= 1) if (pa_oss_set_fragments(u->fd, nfrags, frag_size) < 0) @@ -318,19 +318,19 @@ int pa__init(pa_core *c, pa_module*m) { if (mode != O_WRONLY) { if (ioctl(u->fd, SNDCTL_DSP_GETISPACE, &info) < 0) { - pa_log(__FILE__": SNDCTL_DSP_GETISPACE: %s\n", strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_GETISPACE: %s", strerror(errno)); goto fail; } - pa_log_info(__FILE__": input -- %u fragments of size %u.\n", info.fragstotal, info.fragsize); + pa_log_info(__FILE__": input -- %u fragments of size %u.", info.fragstotal, info.fragsize); u->in_mmap_length = (u->in_fragment_size = info.fragsize) * (u->in_fragments = info.fragstotal); if ((u->in_mmap = mmap(NULL, u->in_mmap_length, PROT_READ, MAP_SHARED, u->fd, 0)) == MAP_FAILED) { if (mode == O_RDWR) { - pa_log(__FILE__": mmap failed for input. Changing to O_WRONLY mode.\n"); + pa_log(__FILE__": mmap failed for input. Changing to O_WRONLY mode."); mode = O_WRONLY; } else { - pa_log(__FILE__": mmap(): %s\n", strerror(errno)); + pa_log(__FILE__": mmap(): %s", strerror(errno)); goto fail; } } else { @@ -353,19 +353,19 @@ int pa__init(pa_core *c, pa_module*m) { if (mode != O_RDONLY) { if (ioctl(u->fd, SNDCTL_DSP_GETOSPACE, &info) < 0) { - pa_log(__FILE__": SNDCTL_DSP_GETOSPACE: %s\n", strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_GETOSPACE: %s", strerror(errno)); goto fail; } - pa_log_info(__FILE__": output -- %u fragments of size %u.\n", info.fragstotal, info.fragsize); + pa_log_info(__FILE__": output -- %u fragments of size %u.", info.fragstotal, info.fragsize); u->out_mmap_length = (u->out_fragment_size = info.fragsize) * (u->out_fragments = info.fragstotal); if ((u->out_mmap = mmap(NULL, u->out_mmap_length, PROT_WRITE, MAP_SHARED, u->fd, 0)) == MAP_FAILED) { if (mode == O_RDWR) { - pa_log(__FILE__": mmap filed for output. Changing to O_RDONLY mode.\n"); + pa_log(__FILE__": mmap filed for output. Changing to O_RDONLY mode."); mode = O_RDONLY; } else { - pa_log(__FILE__": mmap(): %s\n", strerror(errno)); + pa_log(__FILE__": mmap(): %s", strerror(errno)); goto fail; } } else { @@ -392,12 +392,12 @@ int pa__init(pa_core *c, pa_module*m) { zero = 0; if (ioctl(u->fd, SNDCTL_DSP_SETTRIGGER, &zero) < 0) { - pa_log(__FILE__": SNDCTL_DSP_SETTRIGGER: %s\n", strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_SETTRIGGER: %s", strerror(errno)); goto fail; } if (ioctl(u->fd, SNDCTL_DSP_SETTRIGGER, &enable_bits) < 0) { - pa_log(__FILE__": SNDCTL_DSP_SETTRIGGER: %s\n", strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_SETTRIGGER: %s", strerror(errno)); goto fail; } diff --git a/src/modules/module-oss.c b/src/modules/module-oss.c index 0a3c6143..67ece5a7 100644 --- a/src/modules/module-oss.c +++ b/src/modules/module-oss.c @@ -133,7 +133,7 @@ static void do_write(struct userdata *u) { assert(memchunk->length); if ((r = pa_iochannel_write(u->io, (uint8_t*) memchunk->memblock->data + memchunk->index, memchunk->length)) < 0) { - pa_log(__FILE__": write() failed: %s\n", strerror(errno)); + pa_log(__FILE__": write() failed: %s", strerror(errno)); break; } @@ -186,7 +186,7 @@ static void do_read(struct userdata *u) { if ((r = pa_iochannel_read(u->io, memchunk.memblock->data, memchunk.memblock->length)) < 0) { pa_memblock_unref(memchunk.memblock); if (errno != EAGAIN) - pa_log(__FILE__": read() failed: %s\n", strerror(errno)); + pa_log(__FILE__": read() failed: %s", strerror(errno)); break; } @@ -221,7 +221,7 @@ static pa_usec_t sink_get_latency_cb(pa_sink *s) { assert(s && u && u->sink); if (ioctl(u->fd, SNDCTL_DSP_GETODELAY, &arg) < 0) { - pa_log_info(__FILE__": device doesn't support SNDCTL_DSP_GETODELAY: %s\n", strerror(errno)); + pa_log_info(__FILE__": device doesn't support SNDCTL_DSP_GETODELAY: %s", strerror(errno)); s->get_latency = NULL; return 0; } @@ -257,7 +257,7 @@ static int sink_get_hw_volume(pa_sink *s) { struct userdata *u = s->userdata; if (pa_oss_get_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) { - pa_log_info(__FILE__": device doesn't support reading mixer settings: %s\n", strerror(errno)); + pa_log_info(__FILE__": device doesn't support reading mixer settings: %s", strerror(errno)); s->get_hw_volume = NULL; return -1; } @@ -269,7 +269,7 @@ static int sink_set_hw_volume(pa_sink *s) { struct userdata *u = s->userdata; if (pa_oss_set_volume(u->fd, &s->sample_spec, &s->hw_volume) < 0) { - pa_log_info(__FILE__": device doesn't support writing mixer settings: %s\n", strerror(errno)); + pa_log_info(__FILE__": device doesn't support writing mixer settings: %s", strerror(errno)); s->set_hw_volume = NULL; return -1; } @@ -293,17 +293,17 @@ int pa__init(pa_core *c, pa_module*m) { assert(m); if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": failed to parse module arguments.\n"); + pa_log(__FILE__": failed to parse module arguments."); goto fail; } if (pa_modargs_get_value_boolean(ma, "record", &record) < 0 || pa_modargs_get_value_boolean(ma, "playback", &playback) < 0) { - pa_log(__FILE__": record= and playback= expect numeric argument.\n"); + pa_log(__FILE__": record= and playback= expect numeric argument."); goto fail; } if (!playback && !record) { - pa_log(__FILE__": neither playback nor record enabled for device.\n"); + pa_log(__FILE__": neither playback nor record enabled for device."); goto fail; } @@ -312,13 +312,13 @@ int pa__init(pa_core *c, pa_module*m) { nfrags = 12; frag_size = 1024; if (pa_modargs_get_value_s32(ma, "fragments", &nfrags) < 0 || pa_modargs_get_value_s32(ma, "fragment_size", &frag_size) < 0) { - pa_log(__FILE__": failed to parse fragments arguments\n"); + pa_log(__FILE__": failed to parse fragments arguments"); goto fail; } ss = c->default_sample_spec; if (pa_modargs_get_sample_spec(ma, &ss) < 0) { - pa_log(__FILE__": failed to parse sample specification\n"); + pa_log(__FILE__": failed to parse sample specification"); goto fail; } @@ -326,11 +326,11 @@ int pa__init(pa_core *c, pa_module*m) { goto fail; if (pa_oss_get_hw_description(p, hwdesc, sizeof(hwdesc)) >= 0) - pa_log_info(__FILE__": hardware name is '%s'.\n", hwdesc); + pa_log_info(__FILE__": hardware name is '%s'.", hwdesc); else hwdesc[0] = 0; - pa_log_info(__FILE__": device opened in %s mode.\n", mode == O_WRONLY ? "O_WRONLY" : (mode == O_RDONLY ? "O_RDONLY" : "O_RDWR")); + pa_log_info(__FILE__": device opened in %s mode.", mode == O_WRONLY ? "O_WRONLY" : (mode == O_RDONLY ? "O_RDONLY" : "O_RDWR")); if (nfrags >= 2 && frag_size >= 1) if (pa_oss_set_fragments(fd, nfrags, frag_size) < 0) @@ -340,7 +340,7 @@ int pa__init(pa_core *c, pa_module*m) { goto fail; if (ioctl(fd, SNDCTL_DSP_GETBLKSIZE, &frag_size) < 0) { - pa_log(__FILE__": SNDCTL_DSP_GETBLKSIZE: %s\n", strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_GETBLKSIZE: %s", strerror(errno)); goto fail; } assert(frag_size); @@ -351,13 +351,13 @@ int pa__init(pa_core *c, pa_module*m) { u->use_getospace = u->use_getispace = 0; if (ioctl(fd, SNDCTL_DSP_GETISPACE, &info) >= 0) { - pa_log_info(__FILE__": input -- %u fragments of size %u.\n", info.fragstotal, info.fragsize); + pa_log_info(__FILE__": input -- %u fragments of size %u.", info.fragstotal, info.fragsize); in_frag_size = info.fragsize; u->use_getispace = 1; } if (ioctl(fd, SNDCTL_DSP_GETOSPACE, &info) >= 0) { - pa_log_info(__FILE__": output -- %u fragments of size %u.\n", info.fragstotal, info.fragsize); + pa_log_info(__FILE__": output -- %u fragments of size %u.", info.fragstotal, info.fragsize); out_frag_size = info.fragsize; u->use_getospace = 1; } diff --git a/src/modules/module-pipe-sink.c b/src/modules/module-pipe-sink.c index 6ace377f..4ddf26ac 100644 --- a/src/modules/module-pipe-sink.c +++ b/src/modules/module-pipe-sink.c @@ -91,7 +91,7 @@ static void do_write(struct userdata *u) { assert(u->memchunk.memblock && u->memchunk.length); if ((r = pa_iochannel_write(u->io, (uint8_t*) u->memchunk.memblock->data + u->memchunk.index, u->memchunk.length)) < 0) { - pa_log(__FILE__": write() failed: %s\n", strerror(errno)); + pa_log(__FILE__": write() failed: %s", strerror(errno)); return; } @@ -141,32 +141,32 @@ int pa__init(pa_core *c, pa_module*m) { assert(c && m); if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": failed to parse module arguments\n"); + pa_log(__FILE__": failed to parse module arguments"); goto fail; } ss = c->default_sample_spec; if (pa_modargs_get_sample_spec(ma, &ss) < 0) { - pa_log(__FILE__": invalid sample format specification\n"); + pa_log(__FILE__": invalid sample format specification"); goto fail; } mkfifo(p = pa_modargs_get_value(ma, "file", DEFAULT_FIFO_NAME), 0777); if ((fd = open(p, O_RDWR)) < 0) { - pa_log(__FILE__": open('%s'): %s\n", p, strerror(errno)); + pa_log(__FILE__": open('%s'): %s", p, strerror(errno)); goto fail; } pa_fd_set_cloexec(fd, 1); if (fstat(fd, &st) < 0) { - pa_log(__FILE__": fstat('%s'): %s\n", p, strerror(errno)); + pa_log(__FILE__": fstat('%s'): %s", p, strerror(errno)); goto fail; } if (!S_ISFIFO(st.st_mode)) { - pa_log(__FILE__": '%s' is not a FIFO.\n", p); + pa_log(__FILE__": '%s' is not a FIFO.", p); goto fail; } @@ -177,7 +177,7 @@ int pa__init(pa_core *c, pa_module*m) { m->userdata = u; if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, NULL))) { - pa_log(__FILE__": failed to create sink.\n"); + pa_log(__FILE__": failed to create sink."); goto fail; } u->sink->notify = notify_cb; diff --git a/src/modules/module-pipe-source.c b/src/modules/module-pipe-source.c index a7bb0ce7..d3753d25 100644 --- a/src/modules/module-pipe-source.c +++ b/src/modules/module-pipe-source.c @@ -88,7 +88,7 @@ static void do_read(struct userdata *u) { assert(u->chunk.memblock && u->chunk.memblock->length > u->chunk.index); if ((r = pa_iochannel_read(u->io, (uint8_t*) u->chunk.memblock->data + u->chunk.index, u->chunk.memblock->length - u->chunk.index)) <= 0) { - pa_log(__FILE__": read() failed: %s\n", strerror(errno)); + pa_log(__FILE__": read() failed: %s", strerror(errno)); return; } @@ -119,32 +119,32 @@ int pa__init(pa_core *c, pa_module*m) { assert(c && m); if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": failed to parse module arguments\n"); + pa_log(__FILE__": failed to parse module arguments"); goto fail; } ss = c->default_sample_spec; if (pa_modargs_get_sample_spec(ma, &ss) < 0) { - pa_log(__FILE__": invalid sample format specification\n"); + pa_log(__FILE__": invalid sample format specification"); goto fail; } mkfifo(p = pa_modargs_get_value(ma, "file", DEFAULT_FIFO_NAME), 0777); if ((fd = open(p, O_RDWR)) < 0) { - pa_log(__FILE__": open('%s'): %s\n", p, strerror(errno)); + pa_log(__FILE__": open('%s'): %s", p, strerror(errno)); goto fail; } pa_fd_set_cloexec(fd, 1); if (fstat(fd, &st) < 0) { - pa_log(__FILE__": fstat('%s'): %s\n", p, strerror(errno)); + pa_log(__FILE__": fstat('%s'): %s", p, strerror(errno)); goto fail; } if (!S_ISFIFO(st.st_mode)) { - pa_log(__FILE__": '%s' is not a FIFO.\n", p); + pa_log(__FILE__": '%s' is not a FIFO.", p); goto fail; } @@ -154,7 +154,7 @@ int pa__init(pa_core *c, pa_module*m) { u->core = c; if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, NULL))) { - pa_log(__FILE__": failed to create source.\n"); + pa_log(__FILE__": failed to create source."); goto fail; } u->source->userdata = u; diff --git a/src/modules/module-protocol-stub.c b/src/modules/module-protocol-stub.c index 641e3624..749a7ace 100644 --- a/src/modules/module-protocol-stub.c +++ b/src/modules/module-protocol-stub.c @@ -161,12 +161,12 @@ static pa_socket_server *create_socket_server(pa_core *c, pa_modargs *ma) { const char *listen_on; if (pa_modargs_get_value_boolean(ma, "loopback", &loopback) < 0) { - pa_log(__FILE__": loopback= expects a boolean argument.\n"); + pa_log(__FILE__": loopback= expects a boolean argument."); return NULL; } if (pa_modargs_get_value_u32(ma, "port", &port) < 0 || port < 1 || port > 0xFFFF) { - pa_log(__FILE__": port= expects a numerical argument between 1 and 65535.\n"); + pa_log(__FILE__": port= expects a numerical argument between 1 and 65535."); return NULL; } @@ -194,12 +194,12 @@ static pa_socket_server *create_socket_server(pa_core *c, pa_modargs *ma) { pa_runtime_path(v, tmp, sizeof(tmp)); if (pa_make_secure_parent_dir(tmp) < 0) { - pa_log(__FILE__": Failed to create secure socket directory.\n"); + pa_log(__FILE__": Failed to create secure socket directory."); return NULL; } if ((r = pa_unix_socket_remove_stale(tmp)) < 0) { - pa_log(__FILE__": Failed to remove stale UNIX socket '%s': %s\n", tmp, strerror(errno)); + pa_log(__FILE__": Failed to remove stale UNIX socket '%s': %s", tmp, strerror(errno)); return NULL; } @@ -220,7 +220,7 @@ int pa__init(pa_core *c, pa_module*m) { assert(c && m); if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": Failed to parse module arguments\n"); + pa_log(__FILE__": Failed to parse module arguments"); goto finish; } @@ -246,9 +246,9 @@ void pa__done(pa_core *c, pa_module*m) { #if defined(USE_PROTOCOL_ESOUND) && !defined(USE_TCP_SOCKETS) if (remove(ESD_UNIX_SOCKET_NAME) != 0) - pa_log("%s: Failed to remove %s : %s.\n", __FILE__, ESD_UNIX_SOCKET_NAME, strerror (errno)); + pa_log("%s: Failed to remove %s : %s.", __FILE__, ESD_UNIX_SOCKET_NAME, strerror (errno)); if (remove(ESD_UNIX_SOCKET_DIR) != 0) - pa_log("%s: Failed to remove %s : %s.\n", __FILE__, ESD_UNIX_SOCKET_DIR, strerror (errno)); + pa_log("%s: Failed to remove %s : %s.", __FILE__, ESD_UNIX_SOCKET_DIR, strerror (errno)); #endif protocol_free(m->userdata); diff --git a/src/modules/module-sine.c b/src/modules/module-sine.c index 446e3974..d5a0fa47 100644 --- a/src/modules/module-sine.c +++ b/src/modules/module-sine.c @@ -110,7 +110,7 @@ int pa__init(pa_core *c, pa_module*m) { char t[256]; if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": Failed to parse module arguments\n"); + pa_log(__FILE__": Failed to parse module arguments"); goto fail; } @@ -123,7 +123,7 @@ int pa__init(pa_core *c, pa_module*m) { sink_name = pa_modargs_get_value(ma, "sink", NULL); if (!(sink = pa_namereg_get(c, sink_name, PA_NAMEREG_SINK, 1))) { - pa_log(__FILE__": No such sink.\n"); + pa_log(__FILE__": No such sink."); goto fail; } @@ -133,7 +133,7 @@ int pa__init(pa_core *c, pa_module*m) { frequency = 440; if (pa_modargs_get_value_u32(ma, "frequency", &frequency) < 0 || frequency < 1 || frequency > ss.rate/2) { - pa_log(__FILE__": Invalid frequency specification\n"); + pa_log(__FILE__": Invalid frequency specification"); goto fail; } diff --git a/src/modules/module-solaris.c b/src/modules/module-solaris.c index 7356cb7b..1de21aed 100644 --- a/src/modules/module-solaris.c +++ b/src/modules/module-solaris.c @@ -150,7 +150,7 @@ static void do_write(struct userdata *u) { len = memchunk->length; if ((r = pa_iochannel_write(u->io, (uint8_t*) memchunk->memblock->data + memchunk->index, len)) < 0) { - pa_log(__FILE__": write() failed: %s\n", strerror(errno)); + pa_log(__FILE__": write() failed: %s", strerror(errno)); return; } @@ -172,7 +172,7 @@ static void do_write(struct userdata *u) { * Write 0 bytes which will generate a SIGPOLL when "played". */ if (write(u->fd, NULL, 0) < 0) { - pa_log(__FILE__": write() failed: %s\n", strerror(errno)); + pa_log(__FILE__": write() failed: %s", strerror(errno)); return; } } @@ -196,7 +196,7 @@ static void do_read(struct userdata *u) { if ((r = pa_iochannel_read(u->io, memchunk.memblock->data, memchunk.memblock->length)) < 0) { pa_memblock_unref(memchunk.memblock); if (errno != EAGAIN) - pa_log(__FILE__": read() failed: %s\n", strerror(errno)); + pa_log(__FILE__": read() failed: %s", strerror(errno)); return; } @@ -283,9 +283,9 @@ static int sink_set_hw_volume_cb(pa_sink *s) { if (ioctl(u->fd, AUDIO_SETINFO, &info) < 0) { if (errno == EINVAL) - pa_log(__FILE__": AUDIO_SETINFO: Unsupported volume.\n"); + pa_log(__FILE__": AUDIO_SETINFO: Unsupported volume."); else - pa_log(__FILE__": AUDIO_SETINFO: %s\n", strerror(errno)); + pa_log(__FILE__": AUDIO_SETINFO: %s", strerror(errno)); return -1; } @@ -349,9 +349,9 @@ static int pa_solaris_auto_format(int fd, int mode, pa_sample_spec *ss) { if (ioctl(fd, AUDIO_SETINFO, &info) < 0) { if (errno == EINVAL) - pa_log(__FILE__": AUDIO_SETINFO: Unsupported sample format.\n"); + pa_log(__FILE__": AUDIO_SETINFO: Unsupported sample format."); else - pa_log(__FILE__": AUDIO_SETINFO: %s\n", strerror(errno)); + pa_log(__FILE__": AUDIO_SETINFO: %s", strerror(errno)); return -1; } @@ -367,9 +367,9 @@ static int pa_solaris_set_buffer(int fd, int buffer_size) { if (ioctl(fd, AUDIO_SETINFO, &info) < 0) { if (errno == EINVAL) - pa_log(__FILE__": AUDIO_SETINFO: Unsupported buffer size.\n"); + pa_log(__FILE__": AUDIO_SETINFO: Unsupported buffer size."); else - pa_log(__FILE__": AUDIO_SETINFO: %s\n", strerror(errno)); + pa_log(__FILE__": AUDIO_SETINFO: %s", strerror(errno)); return -1; } @@ -388,17 +388,17 @@ int pa__init(pa_core *c, pa_module*m) { assert(c && m); if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": failed to parse module arguments.\n"); + pa_log(__FILE__": failed to parse module arguments."); goto fail; } if (pa_modargs_get_value_boolean(ma, "record", &record) < 0 || pa_modargs_get_value_boolean(ma, "playback", &playback) < 0) { - pa_log(__FILE__": record= and playback= expect numeric argument.\n"); + pa_log(__FILE__": record= and playback= expect numeric argument."); goto fail; } if (!playback && !record) { - pa_log(__FILE__": neither playback nor record enabled for device.\n"); + pa_log(__FILE__": neither playback nor record enabled for device."); goto fail; } @@ -406,20 +406,20 @@ int pa__init(pa_core *c, pa_module*m) { buffer_size = 16384; if (pa_modargs_get_value_s32(ma, "buffer_size", &buffer_size) < 0) { - pa_log(__FILE__": failed to parse buffer size argument\n"); + pa_log(__FILE__": failed to parse buffer size argument"); goto fail; } ss = c->default_sample_spec; if (pa_modargs_get_sample_spec(ma, &ss) < 0) { - pa_log(__FILE__": failed to parse sample specification\n"); + pa_log(__FILE__": failed to parse sample specification"); goto fail; } if ((fd = open(p = pa_modargs_get_value(ma, "device", DEFAULT_DEVICE), mode | O_NONBLOCK)) < 0) goto fail; - pa_log_info(__FILE__": device opened in %s mode.\n", mode == O_WRONLY ? "O_WRONLY" : (mode == O_RDONLY ? "O_RDONLY" : "O_RDWR")); + pa_log_info(__FILE__": device opened in %s mode.", mode == O_WRONLY ? "O_WRONLY" : (mode == O_RDONLY ? "O_RDONLY" : "O_RDWR")); if (pa_solaris_auto_format(fd, mode, &ss) < 0) goto fail; diff --git a/src/modules/module-tunnel.c b/src/modules/module-tunnel.c index 136702fc..df9c51fb 100644 --- a/src/modules/module-tunnel.c +++ b/src/modules/module-tunnel.c @@ -182,7 +182,7 @@ static void command_stream_killed(pa_pdispatch *pd, PA_GCC_UNUSED uint32_t comma struct userdata *u = userdata; assert(pd && t && u && u->pdispatch == pd); - pa_log(__FILE__": stream killed\n"); + pa_log(__FILE__": stream killed"); die(u); } @@ -232,13 +232,13 @@ static void command_request(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED ui if (pa_tagstruct_getu32(t, &channel) < 0 || pa_tagstruct_getu32(t, &bytes) < 0 || !pa_tagstruct_eof(t)) { - pa_log(__FILE__": invalid protocol reply\n"); + pa_log(__FILE__": invalid protocol reply"); die(u); return; } if (channel != u->channel) { - pa_log(__FILE__": recieved data for invalid channel\n"); + pa_log(__FILE__": recieved data for invalid channel"); die(u); return; } @@ -260,9 +260,9 @@ static void stream_get_latency_callback(pa_pdispatch *pd, uint32_t command, PA_G if (command != PA_COMMAND_REPLY) { if (command == PA_COMMAND_ERROR) - pa_log(__FILE__": failed to get latency.\n"); + pa_log(__FILE__": failed to get latency."); else - pa_log(__FILE__": protocol error.\n"); + pa_log(__FILE__": protocol error."); die(u); return; } @@ -276,7 +276,7 @@ static void stream_get_latency_callback(pa_pdispatch *pd, uint32_t command, PA_G pa_tagstruct_get_timeval(t, &remote) < 0 || pa_tagstruct_getu64(t, &counter) < 0 || !pa_tagstruct_eof(t)) { - pa_log(__FILE__": invalid reply.\n"); + pa_log(__FILE__": invalid reply."); die(u); return; } @@ -303,7 +303,7 @@ static void stream_get_latency_callback(pa_pdispatch *pd, uint32_t command, PA_G u->host_latency = 0; #endif -/* pa_log(__FILE__": estimated host latency: %0.0f usec\n", (double) u->host_latency); */ +/* pa_log(__FILE__": estimated host latency: %0.0f usec", (double) u->host_latency); */ } static void request_latency(struct userdata *u) { @@ -335,9 +335,9 @@ static void create_stream_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UN if (command != PA_COMMAND_REPLY) { if (command == PA_COMMAND_ERROR) - pa_log(__FILE__": failed to create stream.\n"); + pa_log(__FILE__": failed to create stream."); else - pa_log(__FILE__": protocol error.\n"); + pa_log(__FILE__": protocol error."); die(u); return; } @@ -348,7 +348,7 @@ static void create_stream_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UN pa_tagstruct_getu32(t, &u->requested_bytes) < 0 || #endif !pa_tagstruct_eof(t)) { - pa_log(__FILE__": invalid reply.\n"); + pa_log(__FILE__": invalid reply."); die(u); return; } @@ -367,9 +367,9 @@ static void setup_complete_callback(pa_pdispatch *pd, uint32_t command, uint32_t if (command != PA_COMMAND_REPLY || !pa_tagstruct_eof(t)) { if (command == PA_COMMAND_ERROR) - pa_log(__FILE__": failed to authenticate\n"); + pa_log(__FILE__": failed to authenticate"); else - pa_log(__FILE__": protocol error.\n"); + pa_log(__FILE__": protocol error."); die(u); return; } @@ -426,7 +426,7 @@ static void pstream_die_callback(pa_pstream *p, void *userdata) { struct userdata *u = userdata; assert(p && u); - pa_log(__FILE__": stream died.\n"); + pa_log(__FILE__": stream died."); die(u); } @@ -436,7 +436,7 @@ static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, void *user assert(p && packet && u); if (pa_pdispatch_run(u->pdispatch, packet, u) < 0) { - pa_log(__FILE__": invalid packet\n"); + pa_log(__FILE__": invalid packet"); die(u); } } @@ -447,7 +447,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o assert(p && chunk && u); if (channel != u->channel) { - pa_log(__FILE__": recieved memory block on bad channel.\n"); + pa_log(__FILE__": recieved memory block on bad channel."); die(u); return; } @@ -466,7 +466,7 @@ static void on_connection(pa_socket_client *sc, pa_iochannel *io, void *userdata u->client = NULL; if (!io) { - pa_log(__FILE__": connection failed.\n"); + pa_log(__FILE__": connection failed."); pa_module_unload_request(u->module); return; } @@ -544,7 +544,7 @@ static int load_key(struct userdata *u, const char*fn) { u->auth_cookie_in_property = 0; if (!fn && pa_authkey_prop_get(u->core, PA_NATIVE_COOKIE_PROPERTY_NAME, u->auth_cookie, sizeof(u->auth_cookie)) >= 0) { - pa_log_debug(__FILE__": using already loaded auth cookie.\n"); + pa_log_debug(__FILE__": using already loaded auth cookie."); pa_authkey_prop_ref(u->core, PA_NATIVE_COOKIE_PROPERTY_NAME); u->auth_cookie_in_property = 1; return 0; @@ -556,7 +556,7 @@ static int load_key(struct userdata *u, const char*fn) { if (pa_authkey_load_auto(fn, u->auth_cookie, sizeof(u->auth_cookie)) < 0) return -1; - pa_log_debug(__FILE__": loading cookie from disk.\n"); + pa_log_debug(__FILE__": loading cookie from disk."); if (pa_authkey_prop_put(u->core, PA_NATIVE_COOKIE_PROPERTY_NAME, u->auth_cookie, sizeof(u->auth_cookie)) >= 0) u->auth_cookie_in_property = 1; @@ -572,7 +572,7 @@ int pa__init(pa_core *c, pa_module*m) { assert(c && m); if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": failed to parse module arguments\n"); + pa_log(__FILE__": failed to parse module arguments"); goto fail; } @@ -602,18 +602,18 @@ int pa__init(pa_core *c, pa_module*m) { goto fail; if (!(u->server_name = pa_xstrdup(pa_modargs_get_value(ma, "server", NULL)))) { - pa_log(__FILE__": no server specified.\n"); + pa_log(__FILE__": no server specified."); goto fail; } ss = c->default_sample_spec; if (pa_modargs_get_sample_spec(ma, &ss) < 0) { - pa_log(__FILE__": invalid sample format specification\n"); + pa_log(__FILE__": invalid sample format specification"); goto fail; } if (!(u->client = pa_socket_client_new_string(c->mainloop, u->server_name, PA_NATIVE_DEFAULT_PORT))) { - pa_log(__FILE__": failed to connect to server '%s'\n", u->server_name); + pa_log(__FILE__": failed to connect to server '%s'", u->server_name); goto fail; } @@ -624,7 +624,7 @@ int pa__init(pa_core *c, pa_module*m) { #ifdef TUNNEL_SINK if (!(u->sink = pa_sink_new(c, __FILE__, pa_modargs_get_value(ma, "sink_name", DEFAULT_SINK_NAME), 0, &ss, NULL))) { - pa_log(__FILE__": failed to create sink.\n"); + pa_log(__FILE__": failed to create sink."); goto fail; } @@ -636,7 +636,7 @@ int pa__init(pa_core *c, pa_module*m) { pa_sink_set_owner(u->sink, m); #else if (!(u->source = pa_source_new(c, __FILE__, pa_modargs_get_value(ma, "source_name", DEFAULT_SOURCE_NAME), 0, &ss, NULL))) { - pa_log(__FILE__": failed to create source.\n"); + pa_log(__FILE__": failed to create source."); goto fail; } diff --git a/src/modules/module-waveout.c b/src/modules/module-waveout.c index 2176e6e7..02f865c5 100644 --- a/src/modules/module-waveout.c +++ b/src/modules/module-waveout.c @@ -159,12 +159,12 @@ static void do_write(struct userdata *u) res = waveOutPrepareHeader(u->hwo, hdr, sizeof(WAVEHDR)); if (res != MMSYSERR_NOERROR) { - pa_log_error(__FILE__ ": ERROR: Unable to prepare waveOut block: %d\n", + pa_log_error(__FILE__ ": ERROR: Unable to prepare waveOut block: %d", res); } res = waveOutWrite(u->hwo, hdr, sizeof(WAVEHDR)); if (res != MMSYSERR_NOERROR) { - pa_log_error(__FILE__ ": ERROR: Unable to write waveOut block: %d\n", + pa_log_error(__FILE__ ": ERROR: Unable to write waveOut block: %d", res); } @@ -214,12 +214,12 @@ static void do_read(struct userdata *u) res = waveInPrepareHeader(u->hwi, hdr, sizeof(WAVEHDR)); if (res != MMSYSERR_NOERROR) { - pa_log_error(__FILE__ ": ERROR: Unable to prepare waveIn block: %d\n", + pa_log_error(__FILE__ ": ERROR: Unable to prepare waveIn block: %d", res); } res = waveInAddBuffer(u->hwi, hdr, sizeof(WAVEHDR)); if (res != MMSYSERR_NOERROR) { - pa_log_error(__FILE__ ": ERROR: Unable to add waveIn block: %d\n", + pa_log_error(__FILE__ ": ERROR: Unable to add waveIn block: %d", res); } @@ -378,7 +378,7 @@ static int ss_to_waveformat(pa_sample_spec *ss, LPWAVEFORMATEX wf) { wf->wFormatTag = WAVE_FORMAT_PCM; if (ss->channels > 2) { - pa_log_error(__FILE__": ERROR: More than two channels not supported.\n"); + pa_log_error(__FILE__": ERROR: More than two channels not supported."); return -1; } @@ -391,7 +391,7 @@ static int ss_to_waveformat(pa_sample_spec *ss, LPWAVEFORMATEX wf) { case 44100: break; default: - pa_log_error(__FILE__": ERROR: Unsupported sample rate.\n"); + pa_log_error(__FILE__": ERROR: Unsupported sample rate."); return -1; } @@ -402,7 +402,7 @@ static int ss_to_waveformat(pa_sample_spec *ss, LPWAVEFORMATEX wf) { else if (ss->format == PA_SAMPLE_S16NE) wf->wBitsPerSample = 16; else { - pa_log_error(__FILE__": ERROR: Unsupported sample format.\n"); + pa_log_error(__FILE__": ERROR: Unsupported sample format."); return -1; } @@ -429,30 +429,30 @@ int pa__init(pa_core *c, pa_module*m) { assert(c && m); if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": failed to parse module arguments.\n"); + pa_log(__FILE__": failed to parse module arguments."); goto fail; } if (pa_modargs_get_value_boolean(ma, "record", &record) < 0 || pa_modargs_get_value_boolean(ma, "playback", &playback) < 0) { - pa_log(__FILE__": record= and playback= expect boolean argument.\n"); + pa_log(__FILE__": record= and playback= expect boolean argument."); goto fail; } if (!playback && !record) { - pa_log(__FILE__": neither playback nor record enabled for device.\n"); + pa_log(__FILE__": neither playback nor record enabled for device."); goto fail; } nfrags = 20; frag_size = 1024; if (pa_modargs_get_value_s32(ma, "fragments", &nfrags) < 0 || pa_modargs_get_value_s32(ma, "fragment_size", &frag_size) < 0) { - pa_log(__FILE__": failed to parse fragments arguments\n"); + pa_log(__FILE__": failed to parse fragments arguments"); goto fail; } ss = c->default_sample_spec; if (pa_modargs_get_sample_spec(ma, &ss) < 0) { - pa_log(__FILE__": failed to parse sample specification\n"); + pa_log(__FILE__": failed to parse sample specification"); goto fail; } @@ -466,13 +466,13 @@ int pa__init(pa_core *c, pa_module*m) { goto fail; if (waveInStart(hwi) != MMSYSERR_NOERROR) goto fail; - pa_log_debug(__FILE__": Opened waveIn subsystem.\n"); + pa_log_debug(__FILE__": Opened waveIn subsystem."); } if (playback) { if (waveOutOpen(&hwo, WAVE_MAPPER, &wf, (DWORD_PTR)chunk_done_cb, (DWORD_PTR)u, CALLBACK_FUNCTION) != MMSYSERR_NOERROR) goto fail; - pa_log_debug(__FILE__": Opened waveOut subsystem.\n"); + pa_log_debug(__FILE__": Opened waveOut subsystem."); } InitializeCriticalSection(&u->crit); diff --git a/src/modules/module-x11-bell.c b/src/modules/module-x11-bell.c index d59f3f59..27ceb7f9 100644 --- a/src/modules/module-x11-bell.c +++ b/src/modules/module-x11-bell.c @@ -71,7 +71,7 @@ static int ring_bell(struct userdata *u, int percent) { assert(u); if (!(s = pa_namereg_get(u->core, u->sink_name, PA_NAMEREG_SINK, 1))) { - pa_log(__FILE__": Invalid sink: %s\n", u->sink_name); + pa_log(__FILE__": Invalid sink: %s", u->sink_name); return -1; } @@ -90,7 +90,7 @@ static int x11_event_callback(pa_x11_wrapper *w, XEvent *e, void *userdata) { bne = (XkbBellNotifyEvent*) e; if (ring_bell(u, bne->percent) < 0) { - pa_log_info(__FILE__": Ringing bell failed, reverting to X11 device bell.\n"); + pa_log_info(__FILE__": Ringing bell failed, reverting to X11 device bell."); XkbForceDeviceBell(pa_x11_wrapper_get_display(w), bne->device, bne->bell_class, bne->bell_id, bne->percent); } @@ -105,7 +105,7 @@ int pa__init(pa_core *c, pa_module*m) { assert(c && m); if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": failed to parse module arguments\n"); + pa_log(__FILE__": failed to parse module arguments"); goto fail; } @@ -124,7 +124,7 @@ int pa__init(pa_core *c, pa_module*m) { minor = XkbMinorVersion; if (!XkbLibraryVersion(&major, &minor)) { - pa_log(__FILE__": XkbLibraryVersion() failed\n"); + pa_log(__FILE__": XkbLibraryVersion() failed"); goto fail; } @@ -133,7 +133,7 @@ int pa__init(pa_core *c, pa_module*m) { if (!XkbQueryExtension(u->display, NULL, &u->xkb_event_base, NULL, &major, &minor)) { - pa_log(__FILE__": XkbQueryExtension() failed\n"); + pa_log(__FILE__": XkbQueryExtension() failed"); goto fail; } diff --git a/src/modules/module-x11-publish.c b/src/modules/module-x11-publish.c index 6d9036f5..cee9cb3f 100644 --- a/src/modules/module-x11-publish.c +++ b/src/modules/module-x11-publish.c @@ -78,7 +78,7 @@ static int load_key(struct userdata *u, const char*fn) { u->auth_cookie_in_property = 0; if (!fn && pa_authkey_prop_get(u->core, PA_NATIVE_COOKIE_PROPERTY_NAME, u->auth_cookie, sizeof(u->auth_cookie)) >= 0) { - pa_log_debug(__FILE__": using already loaded auth cookie.\n"); + pa_log_debug(__FILE__": using already loaded auth cookie."); pa_authkey_prop_ref(u->core, PA_NATIVE_COOKIE_PROPERTY_NAME); u->auth_cookie_in_property = 1; return 0; @@ -90,7 +90,7 @@ static int load_key(struct userdata *u, const char*fn) { if (pa_authkey_load_auto(fn, u->auth_cookie, sizeof(u->auth_cookie)) < 0) return -1; - pa_log_debug(__FILE__": loading cookie from disk.\n"); + pa_log_debug(__FILE__": loading cookie from disk."); if (pa_authkey_prop_put(u->core, PA_NATIVE_COOKIE_PROPERTY_NAME, u->auth_cookie, sizeof(u->auth_cookie)) >= 0) u->auth_cookie_in_property = 1; @@ -108,7 +108,7 @@ int pa__init(pa_core *c, pa_module*m) { pa_strlist *l; if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": failed to parse module arguments\n"); + pa_log(__FILE__": failed to parse module arguments"); goto fail; } @@ -169,7 +169,7 @@ void pa__done(pa_core *c, pa_module*m) { /* Yes, here is a race condition */ if (!pa_x11_get_prop(u->display, "POLYP_ID", t, sizeof(t)) || strcmp(t, u->id)) - pa_log("WARNING: Polypaudio information vanished from X11!\n"); + pa_log_warn(__FILE__": Polypaudio information vanished from X11!"); else { pa_x11_del_prop(u->display, "POLYP_ID"); pa_x11_del_prop(u->display, "POLYP_SERVER"); diff --git a/src/modules/module-zeroconf-publish.c b/src/modules/module-zeroconf-publish.c index d79355ce..f8607bef 100644 --- a/src/modules/module-zeroconf-publish.c +++ b/src/modules/module-zeroconf-publish.c @@ -141,7 +141,7 @@ static int publish_service(struct userdata *u, struct service *s) { snprintf(t, sizeof(t), "Networked Audio Device %s on %s", s->name, pa_get_host_name(hn, sizeof(hn))); if (sw_text_record_init(&txt) != SW_OKAY) { - pa_log(__FILE__": sw_text_record_init() failed\n"); + pa_log(__FILE__": sw_text_record_init() failed"); goto finish; } free_txt = 1; @@ -168,7 +168,7 @@ static int publish_service(struct userdata *u, struct service *s) { s->loaded.type == PA_NAMEREG_SINK ? SERVICE_NAME_SINK : SERVICE_NAME_SOURCE, NULL, NULL, u->port, sw_text_record_bytes(txt), sw_text_record_len(txt), publish_reply, s, &s->oid) != SW_OKAY) { - pa_log(__FILE__": failed to register sink on zeroconf.\n"); + pa_log(__FILE__": failed to register sink on zeroconf."); goto finish; } @@ -179,7 +179,7 @@ static int publish_service(struct userdata *u, struct service *s) { s->autoload.type == PA_NAMEREG_SINK ? SERVICE_NAME_SINK : SERVICE_NAME_SOURCE, NULL, NULL, u->port, sw_text_record_bytes(txt), sw_text_record_len(txt), publish_reply, s, &s->oid) != SW_OKAY) { - pa_log(__FILE__": failed to register sink on zeroconf.\n"); + pa_log(__FILE__": failed to register sink on zeroconf."); goto finish; } @@ -391,12 +391,12 @@ int pa__init(pa_core *c, pa_module*m) { sw_text_record txt; if (!(ma = pa_modargs_new(m->argument, valid_modargs))) { - pa_log(__FILE__": failed to parse module arguments.\n"); + pa_log(__FILE__": failed to parse module arguments."); goto fail; } if (pa_modargs_get_value_u32(ma, "port", &port) < 0 || port == 0 || port >= 0xFFFF) { - pa_log(__FILE__": invalid port specified.\n"); + pa_log(__FILE__": invalid port specified."); goto fail; } @@ -433,7 +433,7 @@ int pa__init(pa_core *c, pa_module*m) { snprintf(t, sizeof(t), "Networked Audio Server on %s", pa_get_host_name(hn, sizeof(hn))); if (sw_text_record_init(&txt) != SW_OKAY) { - pa_log(__FILE__": sw_text_record_init() failed\n"); + pa_log(__FILE__": sw_text_record_init() failed"); goto fail; } free_txt = 1; @@ -444,7 +444,7 @@ int pa__init(pa_core *c, pa_module*m) { SERVICE_NAME_SERVER, NULL, NULL, u->port, sw_text_record_bytes(txt), sw_text_record_len(txt), publish_reply, u, &u->server_oid) != SW_OKAY) { - pa_log(__FILE__": failed to register server on zeroconf.\n"); + pa_log(__FILE__": failed to register server on zeroconf."); goto fail; } diff --git a/src/modules/oss-util.c b/src/modules/oss-util.c index 9fb5d38a..2c12e28d 100644 --- a/src/modules/oss-util.c +++ b/src/modules/oss-util.c @@ -51,7 +51,7 @@ int pa_oss_open(const char *device, int *mode, int* pcaps) { tcaps = pcaps ? pcaps : &dcaps; if (ioctl(fd, SNDCTL_DSP_GETCAPS, tcaps) < 0) { - pa_log(__FILE__": SNDCTL_DSP_GETCAPS: %s\n", strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_GETCAPS: %s", strerror(errno)); goto fail; } @@ -63,20 +63,20 @@ int pa_oss_open(const char *device, int *mode, int* pcaps) { if ((fd = open(device, (*mode = O_WRONLY)|O_NDELAY)) < 0) { if ((fd = open(device, (*mode = O_RDONLY)|O_NDELAY)) < 0) { - pa_log(__FILE__": open('%s'): %s\n", device, strerror(errno)); + pa_log(__FILE__": open('%s'): %s", device, strerror(errno)); goto fail; } } } else { if ((fd = open(device, *mode|O_NDELAY)) < 0) { - pa_log(__FILE__": open('%s'): %s\n", device, strerror(errno)); + pa_log(__FILE__": open('%s'): %s", device, strerror(errno)); goto fail; } } if (pcaps) { if (ioctl(fd, SNDCTL_DSP_GETCAPS, pcaps) < 0) { - pa_log(__FILE__": SNDCTL_DSP_GETCAPS: %s\n", strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_GETCAPS: %s", strerror(errno)); goto fail; } } @@ -114,7 +114,7 @@ int pa_oss_auto_format(int fd, pa_sample_spec *ss) { if (ioctl(fd, SNDCTL_DSP_SETFMT, &format) < 0 || format != f) { format = AFMT_U8; if (ioctl(fd, SNDCTL_DSP_SETFMT, &format) < 0 || format != AFMT_U8) { - pa_log(__FILE__": SNDCTL_DSP_SETFMT: %s\n", format != AFMT_U8 ? "No supported sample format" : strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_SETFMT: %s", format != AFMT_U8 ? "No supported sample format" : strerror(errno)); return -1; } else ss->format = PA_SAMPLE_U8; @@ -126,7 +126,7 @@ int pa_oss_auto_format(int fd, pa_sample_spec *ss) { channels = ss->channels; if (ioctl(fd, SNDCTL_DSP_CHANNELS, &channels) < 0) { - pa_log(__FILE__": SNDCTL_DSP_CHANNELS: %s\n", strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_CHANNELS: %s", strerror(errno)); return -1; } assert(channels); @@ -134,7 +134,7 @@ int pa_oss_auto_format(int fd, pa_sample_spec *ss) { speed = ss->rate; if (ioctl(fd, SNDCTL_DSP_SPEED, &speed) < 0) { - pa_log(__FILE__": SNDCTL_DSP_SPEED: %s\n", strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_SPEED: %s", strerror(errno)); return -1; } assert(speed); @@ -160,7 +160,7 @@ int pa_oss_set_fragments(int fd, int nfrags, int frag_size) { arg = ((int) nfrags << 16) | simple_log2(frag_size); if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &arg) < 0) { - pa_log(__FILE__": SNDCTL_DSP_SETFRAGMENT: %s\n", strerror(errno)); + pa_log(__FILE__": SNDCTL_DSP_SETFRAGMENT: %s", strerror(errno)); return -1; } @@ -183,7 +183,7 @@ int pa_oss_get_volume(int fd, const pa_sample_spec *ss, pa_cvolume *volume) { if ((volume->channels = ss->channels) >= 2) volume->values[1] = (((vol >> 8) & 0xFF) * PA_VOLUME_NORM) / 100; - pa_log_debug(__FILE__": Read mixer settings: %s\n", pa_cvolume_snprint(cv, sizeof(cv), volume)); + pa_log_debug(__FILE__": Read mixer settings: %s", pa_cvolume_snprint(cv, sizeof(cv), volume)); return 0; } @@ -199,7 +199,7 @@ int pa_oss_set_volume(int fd, const pa_sample_spec *ss, const pa_cvolume *volume if (ioctl(fd, SOUND_MIXER_WRITE_PCM, &vol) < 0) return -1; - pa_log_debug(__FILE__": Wrote mixer settings: %s\n", pa_cvolume_snprint(cv, sizeof(cv), volume)); + pa_log_debug(__FILE__": Wrote mixer settings: %s", pa_cvolume_snprint(cv, sizeof(cv), volume)); return 0; } @@ -228,7 +228,7 @@ int pa_oss_get_hw_description(const char *dev, char *name, size_t l) { !(f = fopen("/proc/asound/oss/sndstat", "r"))) { if (errno != ENOENT) - pa_log_warn(__FILE__": failed to open OSS sndstat device: %s\n", strerror(errno)); + pa_log_warn(__FILE__": failed to open OSS sndstat device: %s", strerror(errno)); return -1; } diff --git a/src/polyp/browser.c b/src/polyp/browser.c index ce4c0103..de5c751a 100644 --- a/src/polyp/browser.c +++ b/src/polyp/browser.c @@ -48,7 +48,7 @@ static void io_callback(pa_mainloop_api*a, pa_io_event*e, int fd, pa_io_event_fl assert(a && b && b->mainloop == a); if (events != PA_IO_EVENT_INPUT || sw_discovery_read_socket(b->discovery) != SW_OKAY) { - pa_log(__FILE__": connection to HOWL daemon failed.\n"); + pa_log(__FILE__": connection to HOWL daemon failed."); b->mainloop->io_free(b->io_event); b->io_event = NULL; return; @@ -131,7 +131,7 @@ static sw_result resolve_reply( uint32_t val_len; if (sw_text_record_iterator_init(&iterator, text_record, text_record_len) != SW_OKAY) { - pa_log("sw_text_record_string_iterator_init() failed.\n"); + pa_log_error(__FILE__": sw_text_record_string_iterator_init() failed."); goto fail; } @@ -244,7 +244,7 @@ static sw_result browse_reply( sw_discovery_oid oid; if (sw_discovery_resolve(b->discovery, 0, name, type, domain, resolve_reply, b, &oid) != SW_OKAY) - pa_log("sw_discovery_resolve() failed\n"); + pa_log_error(__FILE__": sw_discovery_resolve() failed"); break; } @@ -282,7 +282,7 @@ pa_browser *pa_browser_new(pa_mainloop_api *mainloop) { b->userdata = NULL; if (sw_discovery_init(&b->discovery) != SW_OKAY) { - pa_log("sw_discovery_init() failed.\n"); + pa_log_error(__FILE__": sw_discovery_init() failed."); pa_xfree(b); return NULL; } @@ -291,7 +291,7 @@ pa_browser *pa_browser_new(pa_mainloop_api *mainloop) { sw_discovery_browse(b->discovery, 0, SERVICE_NAME_SINK, NULL, browse_reply, b, &oid) != SW_OKAY || sw_discovery_browse(b->discovery, 0, SERVICE_NAME_SOURCE, NULL, browse_reply, b, &oid) != SW_OKAY) { - pa_log("sw_discovery_browse() failed.\n"); + pa_log_error(__FILE__": sw_discovery_browse() failed."); sw_discovery_fina(b->discovery); pa_xfree(b); diff --git a/src/polyp/client-conf-x11.c b/src/polyp/client-conf-x11.c index 9e863bc7..7187d86b 100644 --- a/src/polyp/client-conf-x11.c +++ b/src/polyp/client-conf-x11.c @@ -45,7 +45,7 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) { goto finish; if (!(d = XOpenDisplay(dname))) { - pa_log(__FILE__": XOpenDisplay() failed\n"); + pa_log(__FILE__": XOpenDisplay() failed"); goto finish; } @@ -68,7 +68,7 @@ int pa_client_conf_from_x11(pa_client_conf *c, const char *dname) { uint8_t cookie[PA_NATIVE_COOKIE_LENGTH]; if (pa_parsehex(t, cookie, sizeof(cookie)) != sizeof(cookie)) { - pa_log(__FILE__": failed to parse cookie data\n"); + pa_log(__FILE__": failed to parse cookie data"); goto finish; } diff --git a/src/polyp/client-conf.c b/src/polyp/client-conf.c index 328d01c9..4202b14c 100644 --- a/src/polyp/client-conf.c +++ b/src/polyp/client-conf.c @@ -122,7 +122,7 @@ int pa_client_conf_load(pa_client_conf *c, const char *filename) { pa_open_config_file(DEFAULT_CLIENT_CONFIG_FILE, DEFAULT_CLIENT_CONFIG_FILE_USER, ENV_CLIENT_CONFIG_FILE, &fn); if (!f && errno != EINTR) { - pa_log(__FILE__": WARNING: failed to open configuration file '%s': %s\n", filename, strerror(errno)); + pa_log(__FILE__": WARNING: failed to open configuration file '%s': %s", filename, strerror(errno)); goto finish; } diff --git a/src/polyp/context.c b/src/polyp/context.c index 906a0d89..8e999225 100644 --- a/src/polyp/context.c +++ b/src/polyp/context.c @@ -424,7 +424,7 @@ static int context_connect_spawn(pa_context *c) { pa_context_ref(c); if (socketpair(AF_UNIX, SOCK_STREAM, 0, fds) < 0) { - pa_log(__FILE__": socketpair() failed: %s\n", strerror(errno)); + pa_log(__FILE__": socketpair() failed: %s", strerror(errno)); pa_context_fail(c, PA_ERR_INTERNAL); goto fail; } @@ -438,7 +438,7 @@ static int context_connect_spawn(pa_context *c) { c->spawn_api.prefork(); if ((pid = fork()) < 0) { - pa_log(__FILE__": fork() failed: %s\n", strerror(errno)); + pa_log(__FILE__": fork() failed: %s", strerror(errno)); pa_context_fail(c, PA_ERR_INTERNAL); if (c->spawn_api.postfork) @@ -494,7 +494,7 @@ static int context_connect_spawn(pa_context *c) { c->spawn_api.postfork(); if (r < 0) { - pa_log(__FILE__": waitpid() failed: %s\n", strerror(errno)); + pa_log(__FILE__": waitpid() failed: %s", strerror(errno)); pa_context_fail(c, PA_ERR_INTERNAL); goto fail; } else if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { @@ -556,7 +556,7 @@ static int try_next_connection(pa_context *c) { goto finish; } - pa_log_debug(__FILE__": Trying to connect to %s...\n", u); + pa_log_debug(__FILE__": Trying to connect to %s...", u); pa_xfree(c->server); c->server = pa_xstrdup(u); @@ -714,8 +714,8 @@ int pa_context_is_pending(pa_context *c) { assert(c); assert(c->ref >= 1); -/* pa_log("pstream: %i\n", pa_pstream_is_pending(c->pstream)); */ -/* pa_log("pdispatch: %i\n", pa_pdispatch_is_pending(c->pdispatch)); */ +/* pa_log("pstream: %i", pa_pstream_is_pending(c->pstream)); */ +/* pa_log("pdispatch: %i", pa_pdispatch_is_pending(c->pdispatch)); */ return (c->pstream && pa_pstream_is_pending(c->pstream)) || (c->pdispatch && pa_pdispatch_is_pending(c->pdispatch)) || diff --git a/src/polyp/mainloop-signal.c b/src/polyp/mainloop-signal.c index 00804324..0b33c44b 100644 --- a/src/polyp/mainloop-signal.c +++ b/src/polyp/mainloop-signal.c @@ -104,12 +104,12 @@ static void defer(pa_mainloop_api*a, PA_GCC_UNUSED pa_defer_event*e, PA_GCC_UNUS while (sigs) { if ((r = read(signal_pipe[0], &sig, sizeof(sig))) < 0) { - pa_log(__FILE__": read(): %s\n", strerror(errno)); + pa_log(__FILE__": read(): %s", strerror(errno)); return; } if (r != sizeof(sig)) { - pa_log(__FILE__": short read()\n"); + pa_log(__FILE__": short read()"); return; } @@ -130,12 +130,12 @@ static void callback(pa_mainloop_api*a, pa_io_event*e, int fd, pa_io_event_flags if (errno == EAGAIN) return; - pa_log(__FILE__": read(): %s\n", strerror(errno)); + pa_log(__FILE__": read(): %s", strerror(errno)); return; } if (r != sizeof(sig)) { - pa_log(__FILE__": short read()\n"); + pa_log(__FILE__": short read()"); return; } @@ -150,7 +150,7 @@ int pa_signal_init(pa_mainloop_api *a) { #else if (pipe(signal_pipe) < 0) { #endif - pa_log(__FILE__": pipe() failed: %s\n", strerror(errno)); + pa_log(__FILE__": pipe() failed: %s", strerror(errno)); return -1; } diff --git a/src/polyp/mainloop.c b/src/polyp/mainloop.c index e975d7d7..95c336e4 100644 --- a/src/polyp/mainloop.c +++ b/src/polyp/mainloop.c @@ -145,7 +145,7 @@ static pa_io_event* mainloop_io_new( if ((select((SELECT_TYPE_ARG1) fd, NULL, NULL, SELECT_TYPE_ARG234 &xset, SELECT_TYPE_ARG5 &tv) == -1) && (WSAGetLastError() == WSAENOTSOCK)) { - pa_log_warn(__FILE__": WARNING: cannot monitor non-socket file descriptors.\n"); + pa_log_warn(__FILE__": WARNING: cannot monitor non-socket file descriptors."); e->dead = 1; } } @@ -725,7 +725,7 @@ int pa_mainloop_iterate(pa_mainloop *m, int block, int *retval) { r = pa_mainloop_poll(m); if (r < 0) { - pa_log(__FILE__": poll(): %s\n", strerror(errno)); + pa_log(__FILE__": poll(): %s", strerror(errno)); return r; } @@ -774,7 +774,7 @@ int pa_mainloop_deferred_pending(pa_mainloop *m) { void pa_mainloop_dump(pa_mainloop *m) { assert(m); - pa_log(__FILE__": Dumping mainloop sources START\n"); + pa_log(__FILE__": Dumping mainloop sources START"); { uint32_t idx = PA_IDXSET_INVALID; @@ -783,7 +783,7 @@ void pa_mainloop_dump(pa_mainloop *m) { if (e->dead) continue; - pa_log(__FILE__": kind=io fd=%i events=%i callback=%p userdata=%p\n", e->fd, (int) e->events, (void*) e->callback, (void*) e->userdata); + pa_log(__FILE__": kind=io fd=%i events=%i callback=%p userdata=%p", e->fd, (int) e->events, (void*) e->callback, (void*) e->userdata); } } { @@ -793,7 +793,7 @@ void pa_mainloop_dump(pa_mainloop *m) { if (e->dead) continue; - pa_log(__FILE__": kind=defer enabled=%i callback=%p userdata=%p\n", e->enabled, (void*) e->callback, (void*) e->userdata); + pa_log(__FILE__": kind=defer enabled=%i callback=%p userdata=%p", e->enabled, (void*) e->callback, (void*) e->userdata); } } { @@ -803,11 +803,11 @@ void pa_mainloop_dump(pa_mainloop *m) { if (e->dead) continue; - pa_log(__FILE__": kind=time enabled=%i time=%lu.%lu callback=%p userdata=%p\n", e->enabled, (unsigned long) e->timeval.tv_sec, (unsigned long) e->timeval.tv_usec, (void*) e->callback, (void*) e->userdata); + pa_log(__FILE__": kind=time enabled=%i time=%lu.%lu callback=%p userdata=%p", e->enabled, (unsigned long) e->timeval.tv_sec, (unsigned long) e->timeval.tv_usec, (void*) e->callback, (void*) e->userdata); } } - pa_log(__FILE__": Dumping mainloop sources STOP\n"); + pa_log(__FILE__": Dumping mainloop sources STOP"); } #endif diff --git a/src/polyp/stream.c b/src/polyp/stream.c index 5ab91815..8bdb9059 100644 --- a/src/polyp/stream.c +++ b/src/polyp/stream.c @@ -289,7 +289,7 @@ static void ipol_callback(pa_mainloop_api *m, pa_time_event *e, PA_GCC_UNUSED co pa_stream_ref(s); -/* pa_log("requesting new ipol data\n"); */ +/* pa_log("requesting new ipol data"); */ if (s->state == PA_STREAM_READY && !s->ipol_requested) { pa_operation_unref(pa_stream_get_latency_info(s, NULL, NULL)); @@ -655,7 +655,7 @@ static void stream_get_latency_info_callback(pa_pdispatch *pd, uint32_t command, } if (o->stream->interpolate) { -/* pa_log("new interpol data\n"); */ +/* pa_log("new interpol data"); */ o->stream->ipol_timestamp = i.timestamp; o->stream->ipol_usec = pa_stream_get_time(o->stream, &i); o->stream->ipol_requested = 0; diff --git a/src/polypcore/authkey.c b/src/polypcore/authkey.c index e3fc9f60..80480c16 100644 --- a/src/polypcore/authkey.c +++ b/src/polypcore/authkey.c @@ -52,7 +52,7 @@ static int generate(int fd, void *ret_data, size_t length) { ftruncate(fd, 0); if ((r = pa_loop_write(fd, ret_data, length)) < 0 || (size_t) r != length) { - pa_log(__FILE__": failed to write cookie file: %s\n", strerror(errno)); + pa_log(__FILE__": failed to write cookie file: %s", strerror(errno)); return -1; } @@ -70,7 +70,7 @@ static int load(const char *fn, void *data, size_t length) { if ((fd = open(fn, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR)) < 0) { if (errno != EACCES || (fd = open(fn, O_RDONLY)) < 0) { - pa_log(__FILE__": failed to open cookie file '%s': %s\n", fn, strerror(errno)); + pa_log(__FILE__": failed to open cookie file '%s': %s", fn, strerror(errno)); goto finish; } else writable = 0; @@ -79,14 +79,14 @@ static int load(const char *fn, void *data, size_t length) { unlock = pa_lock_fd(fd, 1) >= 0; if ((r = pa_loop_read(fd, data, length)) < 0) { - pa_log(__FILE__": failed to read cookie file '%s': %s\n", fn, strerror(errno)); + pa_log(__FILE__": failed to read cookie file '%s': %s", fn, strerror(errno)); goto finish; } if ((size_t) r != length) { if (!writable) { - pa_log(__FILE__": unable to write cookie to read only file\n"); + pa_log(__FILE__": unable to write cookie to read only file"); goto finish; } @@ -118,7 +118,7 @@ int pa_authkey_load(const char *path, void *data, size_t length) { ret = load(path, data, length); if (ret < 0) - pa_log(__FILE__": Failed to load authorization key '%s': %s\n", path, + pa_log(__FILE__": Failed to load authorization key '%s': %s", path, (ret == -1) ? strerror(errno) : "file corrupt"); return ret; @@ -175,14 +175,14 @@ int pa_authkey_save(const char *fn, const void *data, size_t length) { return -2; if ((fd = open(p, O_RDWR|O_CREAT, S_IRUSR|S_IWUSR)) < 0) { - pa_log(__FILE__": failed to open cookie file '%s': %s\n", fn, strerror(errno)); + pa_log(__FILE__": failed to open cookie file '%s': %s", fn, strerror(errno)); goto finish; } unlock = pa_lock_fd(fd, 1) >= 0; if ((r = pa_loop_write(fd, data, length)) < 0 || (size_t) r != length) { - pa_log(__FILE__": failed to read cookie file '%s': %s\n", fn, strerror(errno)); + pa_log(__FILE__": failed to read cookie file '%s': %s", fn, strerror(errno)); goto finish; } diff --git a/src/polypcore/cli.c b/src/polypcore/cli.c index 295ce625..583f6845 100644 --- a/src/polypcore/cli.c +++ b/src/polypcore/cli.c @@ -103,7 +103,7 @@ static void client_kill(pa_client *client) { assert(client && client->userdata); c = client->userdata; - pa_log_debug(__FILE__": CLI client killed.\n"); + pa_log_debug(__FILE__": CLI client killed."); if (c->defer_kill) c->kill_requested = 1; else { @@ -119,7 +119,7 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) { assert(line && c); if (!s) { - pa_log_debug(__FILE__": CLI got EOF from user.\n"); + pa_log_debug(__FILE__": CLI got EOF from user."); if (c->eof_callback) c->eof_callback(c, c->userdata); diff --git a/src/polypcore/client.c b/src/polypcore/client.c index 7fe5a9fc..852f87b0 100644 --- a/src/polypcore/client.c +++ b/src/polypcore/client.c @@ -51,7 +51,7 @@ pa_client *pa_client_new(pa_core *core, const char *name, const char *driver) { r = pa_idxset_put(core->clients, c, &c->index); assert(c->index != PA_IDXSET_INVALID && r >= 0); - pa_log_info(__FILE__": created %u \"%s\"\n", c->index, c->name); + pa_log_info(__FILE__": created %u \"%s\"", c->index, c->name); pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_CLIENT|PA_SUBSCRIPTION_EVENT_NEW, c->index); pa_core_check_quit(core); @@ -66,7 +66,7 @@ void pa_client_free(pa_client *c) { pa_core_check_quit(c->core); - pa_log_info(__FILE__": freed %u \"%s\"\n", c->index, c->name); + pa_log_info(__FILE__": freed %u \"%s\"", c->index, c->name); pa_subscription_post(c->core, PA_SUBSCRIPTION_EVENT_CLIENT|PA_SUBSCRIPTION_EVENT_REMOVE, c->index); pa_xfree(c->name); pa_xfree(c->driver); @@ -76,7 +76,7 @@ void pa_client_free(pa_client *c) { void pa_client_kill(pa_client *c) { assert(c); if (!c->kill) { - pa_log_warn(__FILE__": kill() operation not implemented for client %u\n", c->index); + pa_log_warn(__FILE__": kill() operation not implemented for client %u", c->index); return; } diff --git a/src/polypcore/conf-parser.c b/src/polypcore/conf-parser.c index 7eeda02b..26fc33b5 100644 --- a/src/polypcore/conf-parser.c +++ b/src/polypcore/conf-parser.c @@ -45,7 +45,7 @@ static int next_assignment(const char *filename, unsigned line, const pa_config_ if (!strcmp(lvalue, t->lvalue)) return t->parse(filename, line, lvalue, rvalue, t->data, userdata); - pa_log(__FILE__": [%s:%u] Unknown lvalue '%s'.\n", filename, line, lvalue); + pa_log(__FILE__": [%s:%u] Unknown lvalue '%s'.", filename, line, lvalue); return -1; } @@ -88,7 +88,7 @@ static int parse_line(const char *filename, unsigned line, const pa_config_item return 0; if (!(e = strchr(b, '='))) { - pa_log(__FILE__": [%s:%u] Missing '='.\n", filename, line); + pa_log(__FILE__": [%s:%u] Missing '='.", filename, line); return -1; } @@ -111,7 +111,7 @@ int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, void goto finish; } - pa_log(__FILE__": WARNING: failed to open configuration file '%s': %s\n", filename, strerror(errno)); + pa_log(__FILE__": WARNING: failed to open configuration file '%s': %s", filename, strerror(errno)); goto finish; } @@ -121,7 +121,7 @@ int pa_config_parse(const char *filename, FILE *f, const pa_config_item *t, void if (feof(f)) break; - pa_log(__FILE__": WARNING: failed to read configuration file '%s': %s\n", filename, strerror(errno)); + pa_log(__FILE__": WARNING: failed to read configuration file '%s': %s", filename, strerror(errno)); goto finish; } @@ -145,7 +145,7 @@ int pa_config_parse_int(const char *filename, unsigned line, const char *lvalue, assert(filename && lvalue && rvalue && data); if (pa_atoi(rvalue, &k) < 0) { - pa_log(__FILE__": [%s:%u] Failed to parse numeric value: %s\n", filename, line, rvalue); + pa_log(__FILE__": [%s:%u] Failed to parse numeric value: %s", filename, line, rvalue); return -1; } @@ -158,7 +158,7 @@ int pa_config_parse_bool(const char *filename, unsigned line, const char *lvalue assert(filename && lvalue && rvalue && data); if ((k = pa_parse_boolean(rvalue)) < 0) { - pa_log(__FILE__": [%s:%u] Failed to parse boolean value: %s\n", filename, line, rvalue); + pa_log(__FILE__": [%s:%u] Failed to parse boolean value: %s", filename, line, rvalue); return -1; } diff --git a/src/polypcore/core-scache.c b/src/polypcore/core-scache.c index 69199a33..1803931e 100644 --- a/src/polypcore/core-scache.c +++ b/src/polypcore/core-scache.c @@ -341,7 +341,7 @@ static void add_file(pa_core *c, const char *pathname) { e = pa_path_get_filename(pathname); if (stat(pathname, &st) < 0) { - pa_log(__FILE__": stat('%s') failed: %s\n", pathname, strerror(errno)); + pa_log(__FILE__": stat('%s') failed: %s", pathname, strerror(errno)); return; } @@ -363,7 +363,7 @@ int pa_scache_add_directory_lazy(pa_core *c, const char *pathname) { /* If that fails, try to open it as shell glob */ if (glob(pathname, GLOB_ERR|GLOB_NOSORT, NULL, &p) < 0) { - pa_log(__FILE__": Failed to open directory: %s\n", strerror(errno)); + pa_log(__FILE__": Failed to open directory: %s", strerror(errno)); return -1; } diff --git a/src/polypcore/core-subscribe.c b/src/polypcore/core-subscribe.c index 4d792966..e2dd9ae3 100644 --- a/src/polypcore/core-subscribe.c +++ b/src/polypcore/core-subscribe.c @@ -158,7 +158,7 @@ void pa_subscription_free_all(pa_core *c) { break; } - pa_log(__FILE__": %u\n", e->index); + pa_log(__FILE__": %u", e->index); }*/ /* Deferred callback for dispatching subscirption events */ diff --git a/src/polypcore/ioline.c b/src/polypcore/ioline.c index 3f2de5a2..eb8fdda5 100644 --- a/src/polypcore/ioline.c +++ b/src/polypcore/ioline.c @@ -274,7 +274,7 @@ static int do_read(pa_ioline *l) { pa_ioline_puts(l, "\nExiting.\n"); do_write(l); } else if (r < 0) { - pa_log(__FILE__": read() failed: %s\n", strerror(errno)); + pa_log(__FILE__": read() failed: %s", strerror(errno)); failure(l); return -1; } @@ -296,7 +296,7 @@ static int do_write(pa_ioline *l) { while (!l->dead && pa_iochannel_is_writable(l->io) && l->wbuf_valid_length) { if ((r = pa_iochannel_write(l->io, l->wbuf+l->wbuf_index, l->wbuf_valid_length)) < 0) { - pa_log(__FILE__": write() failed: %s\n", r < 0 ? strerror(errno) : "EOF"); + pa_log(__FILE__": write() failed: %s", r < 0 ? strerror(errno) : "EOF"); failure(l); return -1; } diff --git a/src/polypcore/log.c b/src/polypcore/log.c index c7bf7be9..29c4c480 100644 --- a/src/polypcore/log.c +++ b/src/polypcore/log.c @@ -26,6 +26,8 @@ #include #include #include +#include +#include #ifdef HAVE_SYSLOG_H #include @@ -73,6 +75,8 @@ void pa_log_set_target(pa_log_target_t t, void (*func)(pa_log_level_t l, const c void pa_log_levelv(pa_log_level_t level, const char *format, va_list ap) { const char *e; + char *text, *t, *n; + assert(level < PA_LOG_LEVEL_MAX); if ((e = getenv(ENV_LOGLEVEL))) @@ -81,31 +85,55 @@ void pa_log_levelv(pa_log_level_t level, const char *format, va_list ap) { if (level > maximal_level) return; - switch (log_target) { - case PA_LOG_STDERR: - vfprintf(stderr, format, ap); - break; + text = pa_vsprintf_malloc(format, ap); + + for (t = text; t; t = n) { + if ((n = strchr(t, '\n'))) { + *n = 0; + n++; + } + if (!*t) + continue; + + switch (log_target) { + case PA_LOG_STDERR: { + const char *prefix = "", *suffix = ""; + + /* Yes indeed. Useless, but fun! */ + if (isatty(STDERR_FILENO)) { + if (level <= PA_LOG_ERROR) { + prefix = "\x1B[1;31m"; + suffix = "\x1B[0m"; + } else if (level <= PA_LOG_WARN) { + prefix = "\x1B[1m"; + suffix = "\x1B[0m"; + } + } + fprintf(stderr, "%s%s%s\n", prefix, t, suffix); + break; + } + #ifdef HAVE_SYSLOG_H - case PA_LOG_SYSLOG: - openlog(log_ident ? log_ident : "???", LOG_PID, LOG_USER); - vsyslog(level_to_syslog[level], format, ap); - closelog(); - break; + case PA_LOG_SYSLOG: + openlog(log_ident ? log_ident : "???", LOG_PID, LOG_USER); + syslog(level_to_syslog[level], "%s", t); + closelog(); + break; #endif - - case PA_LOG_USER: { - char *t = pa_vsprintf_malloc(format, ap); - assert(user_log_func); - user_log_func(level, t); - pa_xfree(t); + + case PA_LOG_USER: + user_log_func(level, t); + break; + + case PA_LOG_NULL: + default: + break; } - - case PA_LOG_NULL: - default: - break; } + pa_xfree(text); + } void pa_log_level(pa_log_level_t level, const char *format, ...) { diff --git a/src/polypcore/memblockq.c b/src/polypcore/memblockq.c index 05c810bd..9b12a810 100644 --- a/src/polypcore/memblockq.c +++ b/src/polypcore/memblockq.c @@ -76,7 +76,7 @@ pa_memblockq* pa_memblockq_new( bq->read_index = bq->write_index = idx; bq->memblock_stat = s; - pa_log_debug(__FILE__": memblockq requested: maxlength=%u, tlength=%u, base=%u, prebuf=%u, minreq=%u\n", maxlength, tlength, base, prebuf, minreq); + pa_log_debug(__FILE__": memblockq requested: maxlength=%u, tlength=%u, base=%u, prebuf=%u, minreq=%u", maxlength, tlength, base, prebuf, minreq); bq->maxlength = ((maxlength+base-1)/base)*base; assert(bq->maxlength >= base); @@ -98,7 +98,7 @@ pa_memblockq* pa_memblockq_new( if (!bq->minreq) bq->minreq = 1; - pa_log_debug(__FILE__": memblockq sanitized: maxlength=%u, tlength=%u, base=%u, prebuf=%u, minreq=%u\n", bq->maxlength, bq->tlength, bq->base, bq->prebuf, bq->minreq); + pa_log_debug(__FILE__": memblockq sanitized: maxlength=%u, tlength=%u, base=%u, prebuf=%u, minreq=%u", bq->maxlength, bq->tlength, bq->base, bq->prebuf, bq->minreq); bq->state = bq->prebuf ? PREBUF : RUNNING; bq->silence = silence ? pa_memblock_ref(silence) : NULL; diff --git a/src/polypcore/modinfo.c b/src/polypcore/modinfo.c index 4204bb34..e090a42f 100644 --- a/src/polypcore/modinfo.c +++ b/src/polypcore/modinfo.c @@ -65,7 +65,7 @@ pa_modinfo *pa_modinfo_get_by_name(const char *name) { assert(name); if (!(dl = lt_dlopenext(name))) { - pa_log(__FILE__": Failed to open module \"%s\": %s\n", name, lt_dlerror()); + pa_log(__FILE__": Failed to open module \"%s\": %s", name, lt_dlerror()); return NULL; } diff --git a/src/polypcore/module.c b/src/polypcore/module.c index 75385354..5412f397 100644 --- a/src/polypcore/module.c +++ b/src/polypcore/module.c @@ -69,17 +69,17 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) { m->argument = pa_xstrdup(argument); if (!(m->dl = lt_dlopenext(name))) { - pa_log(__FILE__": Failed to open module \"%s\": %s\n", name, lt_dlerror()); + pa_log(__FILE__": Failed to open module \"%s\": %s", name, lt_dlerror()); goto fail; } if (!(m->init = (int (*)(pa_core *_c, pa_module*_m)) lt_dlsym(m->dl, PA_SYMBOL_INIT))) { - pa_log(__FILE__": Failed to load module \"%s\": symbol \""PA_SYMBOL_INIT"\" not found.\n", name); + pa_log(__FILE__": Failed to load module \"%s\": symbol \""PA_SYMBOL_INIT"\" not found.", name); goto fail; } if (!(m->done = (void (*)(pa_core *_c, pa_module*_m)) lt_dlsym(m->dl, PA_SYMBOL_DONE))) { - pa_log(__FILE__": Failed to load module \"%s\": symbol \""PA_SYMBOL_DONE"\" not found.\n", name); + pa_log(__FILE__": Failed to load module \"%s\": symbol \""PA_SYMBOL_DONE"\" not found.", name); goto fail; } @@ -91,7 +91,7 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) { assert(m->init); if (m->init(c, m) < 0) { - pa_log_error(__FILE__": Failed to load module \"%s\" (argument: \"%s\"): initialization failed.\n", name, argument ? argument : ""); + pa_log_error(__FILE__": Failed to load module \"%s\" (argument: \"%s\"): initialization failed.", name, argument ? argument : ""); goto fail; } @@ -110,7 +110,7 @@ pa_module* pa_module_load(pa_core *c, const char *name, const char *argument) { r = pa_idxset_put(c->modules, m, &m->index); assert(r >= 0 && m->index != PA_IDXSET_INVALID); - pa_log_info(__FILE__": Loaded \"%s\" (index: #%u; argument: \"%s\").\n", m->name, m->index, m->argument ? m->argument : ""); + pa_log_info(__FILE__": Loaded \"%s\" (index: #%u; argument: \"%s\").", m->name, m->index, m->argument ? m->argument : ""); pa_subscription_post(c, PA_SUBSCRIPTION_EVENT_MODULE|PA_SUBSCRIPTION_EVENT_NEW, m->index); @@ -137,13 +137,13 @@ static void pa_module_free(pa_module *m) { if (m->core->disallow_module_loading) return; - pa_log_info(__FILE__": Unloading \"%s\" (index: #%u).\n", m->name, m->index); + pa_log_info(__FILE__": Unloading \"%s\" (index: #%u).", m->name, m->index); m->done(m->core, m); lt_dlclose(m->dl); - pa_log_info(__FILE__": Unloaded \"%s\" (index: #%u).\n", m->name, m->index); + pa_log_info(__FILE__": Unloaded \"%s\" (index: #%u).", m->name, m->index); pa_subscription_post(m->core, PA_SUBSCRIPTION_EVENT_MODULE|PA_SUBSCRIPTION_EVENT_REMOVE, m->index); diff --git a/src/polypcore/pdispatch.c b/src/polypcore/pdispatch.c index 2cc90bc2..56a21bd6 100644 --- a/src/polypcore/pdispatch.c +++ b/src/polypcore/pdispatch.c @@ -196,7 +196,7 @@ int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*packet, void *userdata) { if (!(p = command_names[command])) snprintf((char*) (p = t), sizeof(t), "%u", command); - pa_log(__FILE__": Recieved opcode <%s>\n", p); + pa_log(__FILE__": Recieved opcode <%s>", p); } #endif @@ -215,7 +215,7 @@ int pa_pdispatch_run(pa_pdispatch *pd, pa_packet*packet, void *userdata) { (*c)(pd, command, tag, ts, userdata); } else { - pa_log(__FILE__": Recieved unsupported command %u\n", command); + pa_log(__FILE__": Recieved unsupported command %u", command); goto finish; } diff --git a/src/polypcore/pid.c b/src/polypcore/pid.c index 3f33365a..374b5506 100644 --- a/src/polypcore/pid.c +++ b/src/polypcore/pid.c @@ -54,7 +54,7 @@ static pid_t read_pid(const char *fn, int fd) { assert(fn && fd >= 0); if ((r = pa_loop_read(fd, t, sizeof(t)-1)) < 0) { - pa_log(__FILE__": WARNING: failed to read PID file '%s': %s\n", fn, strerror(errno)); + pa_log(__FILE__": WARNING: failed to read PID file '%s': %s", fn, strerror(errno)); return (pid_t) -1; } @@ -66,7 +66,7 @@ static pid_t read_pid(const char *fn, int fd) { *e = 0; if (pa_atou(t, &pid) < 0) { - pa_log(__FILE__": WARNING: failed to parse PID file '%s'\n", fn); + pa_log(__FILE__": WARNING: failed to parse PID file '%s'", fn); return (pid_t) -1; } @@ -84,7 +84,7 @@ static int open_pid_file(const char *fn, int mode) { if ((fd = open(fn, mode, S_IRUSR|S_IWUSR)) < 0) { if (mode != O_RDONLY || errno != ENOENT) - pa_log(__FILE__": WARNING: failed to open PID file '%s': %s\n", fn, strerror(errno)); + pa_log(__FILE__": WARNING: failed to open PID file '%s': %s", fn, strerror(errno)); goto fail; } @@ -93,7 +93,7 @@ static int open_pid_file(const char *fn, int mode) { goto fail; if (fstat(fd, &st) < 0) { - pa_log(__FILE__": Failed to fstat() PID file '%s': %s\n", fn, strerror(errno)); + pa_log(__FILE__": Failed to fstat() PID file '%s': %s", fn, strerror(errno)); goto fail; } @@ -105,7 +105,7 @@ static int open_pid_file(const char *fn, int mode) { goto fail; if (close(fd) < 0) { - pa_log(__FILE__": Failed to close file '%s': %s\n", fn, strerror(errno)); + pa_log(__FILE__": Failed to close file '%s': %s", fn, strerror(errno)); goto fail; } @@ -145,7 +145,7 @@ int pa_pid_file_create(void) { goto fail; if ((pid = read_pid(fn, fd)) == (pid_t) -1) - pa_log(__FILE__": corrupt PID file, overwriting.\n"); + pa_log(__FILE__": corrupt PID file, overwriting."); else if (pid > 0) { #ifdef OS_IS_WIN32 if ((process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid)) != NULL) { @@ -153,16 +153,16 @@ int pa_pid_file_create(void) { #else if (kill(pid, 0) >= 0 || errno != ESRCH) { #endif - pa_log(__FILE__": daemon already running.\n"); + pa_log(__FILE__": daemon already running."); goto fail; } - pa_log(__FILE__": stale PID file, overwriting.\n"); + pa_log(__FILE__": stale PID file, overwriting."); } /* Overwrite the current PID file */ if (lseek(fd, 0, SEEK_SET) == (off_t) -1 || ftruncate(fd, 0) < 0) { - pa_log(__FILE__": failed to truncate PID fil: %s.\n", strerror(errno)); + pa_log(__FILE__": failed to truncate PID fil: %s.", strerror(errno)); goto fail; } @@ -170,7 +170,7 @@ int pa_pid_file_create(void) { l = strlen(t); if (pa_loop_write(fd, t, l) != (ssize_t) l) { - pa_log(__FILE__": failed to write PID file.\n"); + pa_log(__FILE__": failed to write PID file."); goto fail; } @@ -195,7 +195,7 @@ int pa_pid_file_remove(void) { pa_runtime_path("pid", fn, sizeof(fn)); if ((fd = open_pid_file(fn, O_RDWR)) < 0) { - pa_log(__FILE__": WARNING: failed to open PID file '%s': %s\n", fn, strerror(errno)); + pa_log(__FILE__": WARNING: failed to open PID file '%s': %s", fn, strerror(errno)); goto fail; } @@ -203,12 +203,12 @@ int pa_pid_file_remove(void) { goto fail; if (pid != getpid()) { - pa_log(__FILE__": WARNING: PID file '%s' not mine!\n", fn); + pa_log(__FILE__": WARNING: PID file '%s' not mine!", fn); goto fail; } if (ftruncate(fd, 0) < 0) { - pa_log(__FILE__": failed to truncate PID file '%s': %s\n", fn, strerror(errno)); + pa_log(__FILE__": failed to truncate PID file '%s': %s", fn, strerror(errno)); goto fail; } @@ -219,7 +219,7 @@ int pa_pid_file_remove(void) { #endif if (unlink(fn) < 0) { - pa_log(__FILE__": failed to remove PID file '%s': %s\n", fn, strerror(errno)); + pa_log(__FILE__": failed to remove PID file '%s': %s", fn, strerror(errno)); goto fail; } diff --git a/src/polypcore/protocol-cli.c b/src/polypcore/protocol-cli.c index cb7e8f6f..7dd489f7 100644 --- a/src/polypcore/protocol-cli.c +++ b/src/polypcore/protocol-cli.c @@ -55,7 +55,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata) assert(s && io && p); if (pa_idxset_size(p->connections)+1 > MAX_CONNECTIONS) { - pa_log(__FILE__": Warning! Too many connections (%u), dropping incoming connection.\n", MAX_CONNECTIONS); + pa_log(__FILE__": Warning! Too many connections (%u), dropping incoming connection.", MAX_CONNECTIONS); pa_iochannel_free(io); return; } diff --git a/src/polypcore/protocol-esound.c b/src/polypcore/protocol-esound.c index 8a0a3356..aa46e2b9 100644 --- a/src/polypcore/protocol-esound.c +++ b/src/polypcore/protocol-esound.c @@ -269,7 +269,7 @@ static int esd_proto_connect(struct connection *c, PA_GCC_UNUSED esd_proto_t req if (!c->authorized) { if (memcmp(data, c->protocol->esd_key, ESD_KEY_LEN) != 0) { - pa_log(__FILE__": kicked client with invalid authorization key.\n"); + pa_log(__FILE__": kicked client with invalid authorization key."); return -1; } @@ -286,7 +286,7 @@ static int esd_proto_connect(struct connection *c, PA_GCC_UNUSED esd_proto_t req else if (ekey == ESD_SWAP_ENDIAN_KEY) c->swap_byte_order = 1; else { - pa_log(__FILE__": client sent invalid endian key\n"); + pa_log(__FILE__": client sent invalid endian key"); return -1; } @@ -311,12 +311,12 @@ static int esd_proto_stream_play(struct connection *c, PA_GCC_UNUSED esd_proto_t format_esd2native(format, c->swap_byte_order, &ss); if (!pa_sample_spec_valid(&ss)) { - pa_log(__FILE__": invalid sample specification\n"); + pa_log(__FILE__": invalid sample specification"); return -1; } if (!(sink = pa_namereg_get(c->protocol->core, c->protocol->sink_name, PA_NAMEREG_SINK, 1))) { - pa_log(__FILE__": no such sink\n"); + pa_log(__FILE__": no such sink"); return -1; } @@ -328,7 +328,7 @@ static int esd_proto_stream_play(struct connection *c, PA_GCC_UNUSED esd_proto_t assert(!c->sink_input && !c->input_memblockq); if (!(c->sink_input = pa_sink_input_new(sink, __FILE__, name, &ss, NULL, 0, -1))) { - pa_log(__FILE__": failed to create sink input.\n"); + pa_log(__FILE__": failed to create sink input."); return -1; } @@ -375,7 +375,7 @@ static int esd_proto_stream_record(struct connection *c, esd_proto_t request, co format_esd2native(format, c->swap_byte_order, &ss); if (!pa_sample_spec_valid(&ss)) { - pa_log(__FILE__": invalid sample specification.\n"); + pa_log(__FILE__": invalid sample specification."); return -1; } @@ -383,19 +383,19 @@ static int esd_proto_stream_record(struct connection *c, esd_proto_t request, co pa_sink* sink; if (!(sink = pa_namereg_get(c->protocol->core, c->protocol->sink_name, PA_NAMEREG_SINK, 1))) { - pa_log(__FILE__": no such sink.\n"); + pa_log(__FILE__": no such sink."); return -1; } if (!(source = sink->monitor_source)) { - pa_log(__FILE__": no such monitor source.\n"); + pa_log(__FILE__": no such monitor source."); return -1; } } else { assert(request == ESD_PROTO_STREAM_REC); if (!(source = pa_namereg_get(c->protocol->core, c->protocol->source_name, PA_NAMEREG_SOURCE, 1))) { - pa_log(__FILE__": no such source.\n"); + pa_log(__FILE__": no such source."); return -1; } } @@ -408,7 +408,7 @@ static int esd_proto_stream_record(struct connection *c, esd_proto_t request, co assert(!c->output_memblockq && !c->source_output); if (!(c->source_output = pa_source_output_new(source, __FILE__, name, &ss, NULL, -1))) { - pa_log(__FILE__": failed to create source output\n"); + pa_log(__FILE__": failed to create source output"); return -1; } @@ -733,14 +733,14 @@ static void client_kill_cb(pa_client *c) { static int do_read(struct connection *c) { assert(c && c->io); -/* pa_log("READ\n"); */ +/* pa_log("READ"); */ if (c->state == ESD_NEXT_REQUEST) { ssize_t r; assert(c->read_data_length < sizeof(c->request)); if ((r = pa_iochannel_read(c->io, ((uint8_t*) &c->request) + c->read_data_length, sizeof(c->request) - c->read_data_length)) <= 0) { - pa_log_debug(__FILE__": read() failed: %s\n", r < 0 ? strerror(errno) : "EOF"); + pa_log_debug(__FILE__": read() failed: %s", r < 0 ? strerror(errno) : "EOF"); return -1; } @@ -750,16 +750,16 @@ static int do_read(struct connection *c) { c->request = MAYBE_INT32_SWAP(c->swap_byte_order, c->request); if (c->request < ESD_PROTO_CONNECT || c->request > ESD_PROTO_MAX) { - pa_log(__FILE__": recieved invalid request.\n"); + pa_log(__FILE__": recieved invalid request."); return -1; } handler = proto_map+c->request; -/* pa_log(__FILE__": executing request #%u\n", c->request); */ +/* pa_log(__FILE__": executing request #%u", c->request); */ if (!handler->proc) { - pa_log(__FILE__": recieved unimplemented request #%u.\n", c->request); + pa_log(__FILE__": recieved unimplemented request #%u.", c->request); return -1; } @@ -788,7 +788,7 @@ static int do_read(struct connection *c) { assert(c->read_data && c->read_data_length < handler->data_length); if ((r = pa_iochannel_read(c->io, (uint8_t*) c->read_data + c->read_data_length, handler->data_length - c->read_data_length)) <= 0) { - pa_log_debug(__FILE__": read() failed: %s\n", r < 0 ? strerror(errno) : "EOF"); + pa_log_debug(__FILE__": read() failed: %s", r < 0 ? strerror(errno) : "EOF"); return -1; } @@ -808,7 +808,7 @@ static int do_read(struct connection *c) { assert(c->scache.memchunk.memblock && c->scache.name && c->scache.memchunk.index < c->scache.memchunk.length); if ((r = pa_iochannel_read(c->io, (uint8_t*) c->scache.memchunk.memblock->data+c->scache.memchunk.index, c->scache.memchunk.length-c->scache.memchunk.index)) <= 0) { - pa_log_debug(__FILE__": read() failed: %s\n", r < 0 ? strerror(errno) : "EOF"); + pa_log_debug(__FILE__": read() failed: %s", r < 0 ? strerror(errno) : "EOF"); return -1; } @@ -843,7 +843,7 @@ static int do_read(struct connection *c) { assert(c->input_memblockq); -/* pa_log("STREAMING_DATA\n"); */ +/* pa_log("STREAMING_DATA"); */ if (!(l = pa_memblockq_missing(c->input_memblockq))) return 0; @@ -865,7 +865,7 @@ static int do_read(struct connection *c) { } if ((r = pa_iochannel_read(c->io, (uint8_t*) c->playback.current_memblock->data+c->playback.memblock_index, l)) <= 0) { - pa_log_debug(__FILE__": read() failed: %s\n", r < 0 ? strerror(errno) : "EOF"); + pa_log_debug(__FILE__": read() failed: %s", r < 0 ? strerror(errno) : "EOF"); return -1; } @@ -888,14 +888,14 @@ static int do_read(struct connection *c) { static int do_write(struct connection *c) { assert(c && c->io); -/* pa_log("WRITE\n"); */ +/* pa_log("WRITE"); */ if (c->write_data_length) { ssize_t r; assert(c->write_data_index < c->write_data_length); if ((r = pa_iochannel_write(c->io, (uint8_t*) c->write_data+c->write_data_index, c->write_data_length-c->write_data_index)) < 0) { - pa_log(__FILE__": write() failed: %s\n", strerror(errno)); + pa_log(__FILE__": write() failed: %s", strerror(errno)); return -1; } @@ -914,7 +914,7 @@ static int do_write(struct connection *c) { if ((r = pa_iochannel_write(c->io, (uint8_t*) chunk.memblock->data+chunk.index, chunk.length)) < 0) { pa_memblock_unref(chunk.memblock); - pa_log(__FILE__": write(): %s\n", strerror(errno)); + pa_log(__FILE__": write(): %s", strerror(errno)); return -1; } @@ -967,7 +967,7 @@ static void io_callback(pa_iochannel*io, void *userdata) { struct connection *c = userdata; assert(io && c && c->io == io); -/* pa_log("IO\n"); */ +/* pa_log("IO"); */ do_work(c); } @@ -978,7 +978,7 @@ static void defer_callback(pa_mainloop_api*a, pa_defer_event *e, void *userdata) struct connection *c = userdata; assert(a && c && c->defer_event == e); -/* pa_log("DEFER\n"); */ +/* pa_log("DEFER"); */ do_work(c); } @@ -1005,7 +1005,7 @@ static void sink_input_drop_cb(pa_sink_input *i, const pa_memchunk *chunk, size_ struct connection*c = i->userdata; assert(i && c && length); -/* pa_log("DROP\n"); */ +/* pa_log("DROP"); */ pa_memblockq_drop(c->input_memblockq, chunk, length); @@ -1072,7 +1072,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata) assert(s && io && p); if (pa_idxset_size(p->connections)+1 > MAX_CONNECTIONS) { - pa_log(__FILE__": Warning! Too many connections (%u), dropping incoming connection.\n", MAX_CONNECTIONS); + pa_log(__FILE__": Warning! Too many connections (%u), dropping incoming connection.", MAX_CONNECTIONS); pa_iochannel_free(io); return; } @@ -1142,7 +1142,7 @@ pa_protocol_esound* pa_protocol_esound_new(pa_core*core, pa_socket_server *serve p = pa_xmalloc(sizeof(pa_protocol_esound)); if (pa_modargs_get_value_boolean(ma, "public", &public) < 0) { - pa_log(__FILE__": public= expects a boolean argument.\n"); + pa_log(__FILE__": public= expects a boolean argument."); return NULL; } diff --git a/src/polypcore/protocol-http.c b/src/polypcore/protocol-http.c index f0b78124..85ddebee 100644 --- a/src/polypcore/protocol-http.c +++ b/src/polypcore/protocol-http.c @@ -143,7 +143,7 @@ static void line_callback(pa_ioline *line, const char *s, void *userdata) { /* We're done */ c->state = DATA; - pa_log_info(__FILE__": request for %s\n", c->url); + pa_log_info(__FILE__": request for %s", c->url); if (!strcmp(c->url, URL_ROOT)) { char txt[256]; @@ -222,7 +222,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata) assert(s && io && p); if (pa_idxset_size(p->connections)+1 > MAX_CONNECTIONS) { - pa_log_warn(__FILE__": Warning! Too many connections (%u), dropping incoming connection.\n", MAX_CONNECTIONS); + pa_log_warn(__FILE__": Warning! Too many connections (%u), dropping incoming connection.", MAX_CONNECTIONS); pa_iochannel_free(io); return; } diff --git a/src/polypcore/protocol-native.c b/src/polypcore/protocol-native.c index aba12036..dce6b346 100644 --- a/src/polypcore/protocol-native.c +++ b/src/polypcore/protocol-native.c @@ -507,7 +507,7 @@ static void request_bytes(struct playback_stream *s) { pa_tagstruct_putu32(t, l); pa_pstream_send_tagstruct(s->connection->pstream, t); -/* pa_log(__FILE__": Requesting %u bytes\n", l); */ +/* pa_log(__FILE__": Requesting %u bytes", l); */ } static void send_memblock(struct connection *c) { @@ -585,11 +585,11 @@ static int sink_input_peek_cb(pa_sink_input *i, pa_memchunk *chunk) { } if (pa_memblockq_peek(s->memblockq, chunk) < 0) { -/* pa_log(__FILE__": peek: failure\n"); */ +/* pa_log(__FILE__": peek: failure"); */ return -1; } -/* pa_log(__FILE__": peek: %u\n", chunk->length); */ +/* pa_log(__FILE__": peek: %u", chunk->length); */ return 0; } @@ -608,7 +608,7 @@ static void sink_input_drop_cb(pa_sink_input *i, const pa_memchunk *chunk, size_ s->drain_request = 0; } -/* pa_log(__FILE__": after_drop: %u %u\n", pa_memblockq_get_length(s->memblockq), pa_memblockq_is_readable(s->memblockq)); */ +/* pa_log(__FILE__": after_drop: %u %u", pa_memblockq_get_length(s->memblockq), pa_memblockq_is_readable(s->memblockq)); */ } static void sink_input_kill_cb(pa_sink_input *i) { @@ -622,7 +622,7 @@ static pa_usec_t sink_input_get_latency_cb(pa_sink_input *i) { assert(i && i->userdata); s = i->userdata; - /*pa_log(__FILE__": get_latency: %u\n", pa_memblockq_get_length(s->memblockq));*/ + /*pa_log(__FILE__": get_latency: %u", pa_memblockq_get_length(s->memblockq));*/ return pa_bytes_to_usec(pa_memblockq_get_length(s->memblockq), &s->sink_input->sample_spec); } @@ -635,7 +635,7 @@ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk) s = o->userdata; if (pa_memblockq_push_align(s->memblockq, chunk) < 0) { - pa_log_warn(__FILE__": Failed to push data into output queue.\n"); + pa_log_warn(__FILE__": Failed to push data into output queue."); return; } @@ -654,7 +654,7 @@ static pa_usec_t source_output_get_latency_cb(pa_source_output *o) { assert(o && o->userdata); s = o->userdata; - /*pa_log(__FILE__": get_latency: %u\n", pa_memblockq_get_length(s->memblockq));*/ + /*pa_log(__FILE__": get_latency: %u", pa_memblockq_get_length(s->memblockq));*/ return pa_bytes_to_usec(pa_memblockq_get_length(s->memblockq), &o->sample_spec); } @@ -662,7 +662,7 @@ static pa_usec_t source_output_get_latency_cb(pa_source_output *o) { /*** pdispatch callbacks ***/ static void protocol_error(struct connection *c) { - pa_log(__FILE__": protocol error, kicking client\n"); + pa_log(__FILE__": protocol error, kicking client"); connection_free(c); } @@ -868,7 +868,7 @@ static void command_auth(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC_UNUSED uint32_t if (!c->authorized) { if (memcmp(c->protocol->auth_cookie, cookie, PA_NATIVE_COOKIE_LENGTH) != 0) { - pa_log(__FILE__": Denied access to client with invalid authorization key.\n"); + pa_log(__FILE__": Denied access to client with invalid authorization key."); pa_pstream_send_error(c->pstream, tag, PA_ERR_ACCESS); return; } @@ -958,10 +958,10 @@ static void command_drain_playback_stream(PA_GCC_UNUSED pa_pdispatch *pd, PA_GCC pa_memblockq_prebuf_disable(s->memblockq); if (!pa_memblockq_is_readable(s->memblockq)) { -/* pa_log("immediate drain: %u\n", pa_memblockq_get_length(s->memblockq)); */ +/* pa_log("immediate drain: %u", pa_memblockq_get_length(s->memblockq)); */ pa_pstream_send_simple_ack(c->pstream, tag); } else { -/* pa_log("slow drain triggered\n"); */ +/* pa_log("slow drain triggered"); */ s->drain_request = 1; s->drain_tag = tag; @@ -1967,7 +1967,7 @@ static void pstream_packet_callback(pa_pstream *p, pa_packet *packet, void *user assert(p && packet && packet->data && c); if (pa_pdispatch_run(c->pdispatch, packet, c) < 0) { - pa_log(__FILE__": invalid packet.\n"); + pa_log(__FILE__": invalid packet."); connection_free(c); } } @@ -1978,7 +1978,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o assert(p && chunk && userdata); if (!(stream = pa_idxset_get_by_index(c->output_streams, channel))) { - pa_log(__FILE__": client sent block for invalid stream.\n"); + pa_log(__FILE__": client sent block for invalid stream."); connection_free(c); return; } @@ -1995,7 +1995,7 @@ static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t o if (pa_memblockq_push_align(ps->memblockq, chunk) < 0) { pa_tagstruct *t; - pa_log_warn(__FILE__": failed to push data into queue\n"); + pa_log_warn(__FILE__": failed to push data into queue"); /* Pushing this block into the queue failed, so we simulate * it by skipping ahead */ @@ -2050,7 +2050,7 @@ static void pstream_die_callback(pa_pstream *p, void *userdata) { assert(p && c); connection_free(c); -/* pa_log(__FILE__": connection died.\n");*/ +/* pa_log(__FILE__": connection died.");*/ } @@ -2084,7 +2084,7 @@ static void on_connection(PA_GCC_UNUSED pa_socket_server*s, pa_iochannel *io, vo assert(io && p); if (pa_idxset_size(p->connections)+1 > MAX_CONNECTIONS) { - pa_log_warn(__FILE__": Warning! Too many connections (%u), dropping incoming connection.\n", MAX_CONNECTIONS); + pa_log_warn(__FILE__": Warning! Too many connections (%u), dropping incoming connection.", MAX_CONNECTIONS); pa_iochannel_free(io); return; } @@ -2138,7 +2138,7 @@ static int load_key(pa_protocol_native*p, const char*fn) { p->auth_cookie_in_property = 0; if (!fn && pa_authkey_prop_get(p->core, PA_NATIVE_COOKIE_PROPERTY_NAME, p->auth_cookie, sizeof(p->auth_cookie)) >= 0) { - pa_log_info(__FILE__": using already loaded auth cookie.\n"); + pa_log_info(__FILE__": using already loaded auth cookie."); pa_authkey_prop_ref(p->core, PA_NATIVE_COOKIE_PROPERTY_NAME); p->auth_cookie_in_property = 1; return 0; @@ -2150,7 +2150,7 @@ static int load_key(pa_protocol_native*p, const char*fn) { if (pa_authkey_load_auto(fn, p->auth_cookie, sizeof(p->auth_cookie)) < 0) return -1; - pa_log_info(__FILE__": loading cookie from disk.\n"); + pa_log_info(__FILE__": loading cookie from disk."); if (pa_authkey_prop_put(p->core, PA_NATIVE_COOKIE_PROPERTY_NAME, p->auth_cookie, sizeof(p->auth_cookie)) >= 0) p->auth_cookie_in_property = 1; @@ -2164,7 +2164,7 @@ static pa_protocol_native* protocol_new_internal(pa_core *c, pa_module *m, pa_mo assert(c && ma); if (pa_modargs_get_value_boolean(ma, "public", &public) < 0) { - pa_log(__FILE__": public= expects a boolean argument.\n"); + pa_log(__FILE__": public= expects a boolean argument."); return NULL; } diff --git a/src/polypcore/protocol-simple.c b/src/polypcore/protocol-simple.c index fac54239..c2f53444 100644 --- a/src/polypcore/protocol-simple.c +++ b/src/polypcore/protocol-simple.c @@ -132,7 +132,7 @@ static int do_read(struct connection *c) { } if ((r = pa_iochannel_read(c->io, (uint8_t*) c->playback.current_memblock->data+c->playback.memblock_index, l)) <= 0) { - pa_log_debug(__FILE__": read() failed: %s\n", r == 0 ? "EOF" : strerror(errno)); + pa_log_debug(__FILE__": read() failed: %s", r == 0 ? "EOF" : strerror(errno)); return -1; } @@ -166,7 +166,7 @@ static int do_write(struct connection *c) { if ((r = pa_iochannel_write(c->io, (uint8_t*) chunk.memblock->data+chunk.index, chunk.length)) < 0) { pa_memblock_unref(chunk.memblock); - pa_log(__FILE__": write(): %s\n", strerror(errno)); + pa_log(__FILE__": write(): %s", strerror(errno)); return -1; } @@ -313,7 +313,7 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata) assert(s && io && p); if (pa_idxset_size(p->connections)+1 > MAX_CONNECTIONS) { - pa_log(__FILE__": Warning! Too many connections (%u), dropping incoming connection.\n", MAX_CONNECTIONS); + pa_log(__FILE__": Warning! Too many connections (%u), dropping incoming connection.", MAX_CONNECTIONS); pa_iochannel_free(io); return; } @@ -342,12 +342,12 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata) size_t l; if (!(sink = pa_namereg_get(p->core, p->sink_name, PA_NAMEREG_SINK, 1))) { - pa_log(__FILE__": Failed to get sink.\n"); + pa_log(__FILE__": Failed to get sink."); goto fail; } if (!(c->sink_input = pa_sink_input_new(sink, __FILE__, c->client->name, &p->sample_spec, NULL, 0, -1))) { - pa_log(__FILE__": Failed to create sink input.\n"); + pa_log(__FILE__": Failed to create sink input."); goto fail; } @@ -380,13 +380,13 @@ static void on_connection(pa_socket_server*s, pa_iochannel *io, void *userdata) size_t l; if (!(source = pa_namereg_get(p->core, p->source_name, PA_NAMEREG_SOURCE, 1))) { - pa_log(__FILE__": Failed to get source.\n"); + pa_log(__FILE__": Failed to get source."); goto fail; } c->source_output = pa_source_output_new(source, __FILE__, c->client->name, &p->sample_spec, NULL, -1); if (!c->source_output) { - pa_log(__FILE__": Failed to create source output.\n"); + pa_log(__FILE__": Failed to create source output."); goto fail; } c->source_output->owner = p->module; @@ -437,7 +437,7 @@ pa_protocol_simple* pa_protocol_simple_new(pa_core *core, pa_socket_server *serv p->sample_spec = core->default_sample_spec; if (pa_modargs_get_sample_spec(ma, &p->sample_spec) < 0) { - pa_log(__FILE__": Failed to parse sample type specification.\n"); + pa_log(__FILE__": Failed to parse sample type specification."); goto fail; } @@ -446,20 +446,20 @@ pa_protocol_simple* pa_protocol_simple_new(pa_core *core, pa_socket_server *serv enable = 0; if (pa_modargs_get_value_boolean(ma, "record", &enable) < 0) { - pa_log(__FILE__": record= expects a numeric argument.\n"); + pa_log(__FILE__": record= expects a numeric argument."); goto fail; } p->mode = enable ? RECORD : 0; enable = 1; if (pa_modargs_get_value_boolean(ma, "playback", &enable) < 0) { - pa_log(__FILE__": playback= expects a numeric argument.\n"); + pa_log(__FILE__": playback= expects a numeric argument."); goto fail; } p->mode |= enable ? PLAYBACK : 0; if ((p->mode & (RECORD|PLAYBACK)) == 0) { - pa_log(__FILE__": neither playback nor recording enabled for protocol.\n"); + pa_log(__FILE__": neither playback nor recording enabled for protocol."); goto fail; } diff --git a/src/polypcore/pstream.c b/src/polypcore/pstream.c index c697dc3d..b1e8bd06 100644 --- a/src/polypcore/pstream.c +++ b/src/polypcore/pstream.c @@ -246,7 +246,7 @@ void pa_pstream_send_packet(pa_pstream*p, pa_packet *packet) { if (p->dead) return; -/* pa_log(__FILE__": push-packet %p\n", packet); */ +/* pa_log(__FILE__": push-packet %p", packet); */ i = pa_xnew(struct item_info, 1); i->type = PA_PSTREAM_ITEM_PACKET; @@ -263,7 +263,7 @@ void pa_pstream_send_memblock(pa_pstream*p, uint32_t channel, int64_t offset, pa if (p->dead) return; -/* pa_log(__FILE__": push-memblock %p\n", chunk); */ +/* pa_log(__FILE__": push-memblock %p", chunk); */ i = pa_xnew(struct item_info, 1); i->type = PA_PSTREAM_ITEM_MEMBLOCK; @@ -301,7 +301,7 @@ static void prepare_next_write_item(pa_pstream *p) { p->write.index = 0; if (p->write.current->type == PA_PSTREAM_ITEM_PACKET) { - /*pa_log(__FILE__": pop-packet %p\n", p->write.current->packet);*/ + /*pa_log(__FILE__": pop-packet %p", p->write.current->packet);*/ assert(p->write.current->packet); p->write.data = p->write.current->packet->data; @@ -385,7 +385,7 @@ static int do_read(pa_pstream *p) { /* Frame size too large */ if (ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_LENGTH]) > FRAME_SIZE_MAX) { - pa_log_warn(__FILE__": Frame size too large\n"); + pa_log_warn(__FILE__": Frame size too large"); return -1; } @@ -401,7 +401,7 @@ static int do_read(pa_pstream *p) { p->read.data = p->read.memblock->data; if (ntohl(p->read.descriptor[PA_PSTREAM_DESCRIPTOR_SEEK]) > PA_SEEK_RELATIVE_END) { - pa_log_warn(__FILE__": Invalid seek mode\n"); + pa_log_warn(__FILE__": Invalid seek mode"); return -1; } } diff --git a/src/polypcore/random.c b/src/polypcore/random.c index 756c3218..1c2280e3 100644 --- a/src/polypcore/random.c +++ b/src/polypcore/random.c @@ -49,7 +49,7 @@ void pa_random(void *ret_data, size_t length) { if ((fd = open(RANDOM_DEVICE, O_RDONLY)) >= 0) { if ((r = pa_loop_read(fd, ret_data, length)) < 0 || (size_t) r != length) - pa_log_error(__FILE__": failed to read entropy from '%s'\n", RANDOM_DEVICE); + pa_log_error(__FILE__": failed to read entropy from '%s'", RANDOM_DEVICE); close(fd); } diff --git a/src/polypcore/sample-util.c b/src/polypcore/sample-util.c index e588446d..2c3fbd79 100644 --- a/src/polypcore/sample-util.c +++ b/src/polypcore/sample-util.c @@ -330,7 +330,7 @@ void pa_volume_memchunk(pa_memchunk*c, const pa_sample_spec *spec, const pa_cvol } default: - pa_log_error(__FILE__": ERROR: Unable to change volume of format %s.\n", + pa_log_error(__FILE__": ERROR: Unable to change volume of format %s.", pa_sample_format_to_string(spec->format)); abort(); } diff --git a/src/polypcore/sink-input.c b/src/polypcore/sink-input.c index 1dc7df0f..f12a85e1 100644 --- a/src/polypcore/sink-input.c +++ b/src/polypcore/sink-input.c @@ -57,7 +57,7 @@ pa_sink_input* pa_sink_input_new( assert(s->state == PA_SINK_RUNNING); if (pa_idxset_size(s->inputs) >= PA_MAX_INPUTS_PER_SINK) { - pa_log_warn(__FILE__": Failed to create sink input: too many inputs per sink.\n"); + pa_log_warn(__FILE__": Failed to create sink input: too many inputs per sink."); return NULL; } @@ -106,7 +106,7 @@ pa_sink_input* pa_sink_input_new( assert(r == 0); pa_sample_spec_snprint(st, sizeof(st), spec); - pa_log_info(__FILE__": created %u \"%s\" on %u with sample spec \"%s\"\n", i->index, i->name, s->index, st); + pa_log_info(__FILE__": created %u \"%s\" on %u with sample spec \"%s\"", i->index, i->name, s->index, st); pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SINK_INPUT|PA_SUBSCRIPTION_EVENT_NEW, i->index); @@ -141,7 +141,7 @@ static void sink_input_free(pa_sink_input* i) { if (i->state != PA_SINK_INPUT_DISCONNECTED) pa_sink_input_disconnect(i); - pa_log_info(__FILE__": freed %u \"%s\"\n", i->index, i->name); + pa_log_info(__FILE__": freed %u \"%s\"", i->index, i->name); if (i->resampled_chunk.memblock) pa_memblock_unref(i->resampled_chunk.memblock); diff --git a/src/polypcore/sink.c b/src/polypcore/sink.c index 1f374f5e..cb072c35 100644 --- a/src/polypcore/sink.c +++ b/src/polypcore/sink.c @@ -95,7 +95,7 @@ pa_sink* pa_sink_new( assert(s->index != PA_IDXSET_INVALID && r >= 0); pa_sample_spec_snprint(st, sizeof(st), spec); - pa_log_info(__FILE__": created %u \"%s\" with sample spec \"%s\"\n", s->index, s->name, st); + pa_log_info(__FILE__": created %u \"%s\" with sample spec \"%s\"", s->index, s->name, st); n = pa_sprintf_malloc("%s_monitor", name); s->monitor_source = pa_source_new(core, driver, n, 0, spec, map); @@ -143,7 +143,7 @@ static void sink_free(pa_sink *s) { if (s->state != PA_SINK_DISCONNECTED) pa_sink_disconnect(s); - pa_log_info(__FILE__": freed %u \"%s\"\n", s->index, s->name); + pa_log_info(__FILE__": freed %u \"%s\"", s->index, s->name); pa_source_unref(s->monitor_source); s->monitor_source = NULL; @@ -270,7 +270,7 @@ int pa_sink_render(pa_sink*s, size_t length, pa_memchunk *result) { result->memblock = pa_memblock_new(length, s->core->memblock_stat); assert(result->memblock); -/* pa_log("mixing %i\n", n); */ +/* pa_log("mixing %i", n); */ result->length = pa_mix(info, n, result->memblock->data, length, &s->sample_spec, &s->sw_volume); result->index = 0; diff --git a/src/polypcore/socket-client.c b/src/polypcore/socket-client.c index 3662e89c..d73b22d1 100644 --- a/src/polypcore/socket-client.c +++ b/src/polypcore/socket-client.c @@ -137,17 +137,17 @@ static void do_call(pa_socket_client *c) { lerror = sizeof(error); if (getsockopt(c->fd, SOL_SOCKET, SO_ERROR, (void*)&error, &lerror) < 0) { - pa_log(__FILE__": getsockopt(): %s\n", strerror(errno)); + pa_log(__FILE__": getsockopt(): %s", strerror(errno)); goto finish; } if (lerror != sizeof(error)) { - pa_log(__FILE__": getsockopt() returned invalid size.\n"); + pa_log(__FILE__": getsockopt() returned invalid size."); goto finish; } if (error != 0) { - pa_log_debug(__FILE__": connect(): %s\n", strerror(error)); + pa_log_debug(__FILE__": connect(): %s", strerror(error)); errno = error; goto finish; } @@ -188,7 +188,7 @@ static int do_connect(pa_socket_client *c, const struct sockaddr *sa, socklen_t if ((r = connect(c->fd, sa, len)) < 0) { if (errno != EINPROGRESS) { - /*pa_log(__FILE__": connect(): %s\n", strerror(errno));*/ + /*pa_log(__FILE__": connect(): %s", strerror(errno));*/ return -1; } @@ -259,7 +259,7 @@ static int sockaddr_prepare(pa_socket_client *c, const struct sockaddr *sa, size } if ((c->fd = socket(sa->sa_family, SOCK_STREAM, 0)) < 0) { - pa_log(__FILE__": socket(): %s\n", strerror(errno)); + pa_log(__FILE__": socket(): %s", strerror(errno)); return -1; } diff --git a/src/polypcore/socket-server.c b/src/polypcore/socket-server.c index b1297496..f2e15085 100644 --- a/src/polypcore/socket-server.c +++ b/src/polypcore/socket-server.c @@ -88,7 +88,7 @@ static void callback(pa_mainloop_api *mainloop, pa_io_event *e, int fd, PA_GCC_U pa_socket_server_ref(s); if ((nfd = accept(fd, NULL, NULL)) < 0) { - pa_log(__FILE__": accept(): %s\n", strerror(errno)); + pa_log(__FILE__": accept(): %s", strerror(errno)); goto finish; } @@ -107,12 +107,12 @@ static void callback(pa_mainloop_api *mainloop, pa_io_event *e, int fd, PA_GCC_U request_init(&req, RQ_DAEMON, s->tcpwrap_service, RQ_FILE, nfd, NULL); fromhost(&req); if (!hosts_access(&req)) { - pa_log_warn(__FILE__": TCP connection refused by tcpwrap.\n"); + pa_log_warn(__FILE__": TCP connection refused by tcpwrap."); close(nfd); goto finish; } - pa_log_info(__FILE__": TCP connection accepted by tcpwrap.\n"); + pa_log_info(__FILE__": TCP connection accepted by tcpwrap."); } #endif @@ -167,7 +167,7 @@ pa_socket_server* pa_socket_server_new_unix(pa_mainloop_api *m, const char *file assert(m && filename); if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) { - pa_log(__FILE__": socket(): %s\n", strerror(errno)); + pa_log(__FILE__": socket(): %s", strerror(errno)); goto fail; } @@ -180,12 +180,12 @@ pa_socket_server* pa_socket_server_new_unix(pa_mainloop_api *m, const char *file pa_socket_low_delay(fd); if (bind(fd, (struct sockaddr*) &sa, SUN_LEN(&sa)) < 0) { - pa_log(__FILE__": bind(): %s\n", strerror(errno)); + pa_log(__FILE__": bind(): %s", strerror(errno)); goto fail; } if (listen(fd, 5) < 0) { - pa_log(__FILE__": listen(): %s\n", strerror(errno)); + pa_log(__FILE__": listen(): %s", strerror(errno)); goto fail; } @@ -221,14 +221,14 @@ pa_socket_server* pa_socket_server_new_ipv4(pa_mainloop_api *m, uint32_t address assert(m && port); if ((fd = socket(PF_INET, SOCK_STREAM, 0)) < 0) { - pa_log(__FILE__": socket(PF_INET): %s\n", strerror(errno)); + pa_log(__FILE__": socket(PF_INET): %s", strerror(errno)); goto fail; } pa_fd_set_cloexec(fd, 1); if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void*)&on, sizeof(on)) < 0) - pa_log(__FILE__": setsockopt(): %s\n", strerror(errno)); + pa_log(__FILE__": setsockopt(): %s", strerror(errno)); pa_socket_tcp_low_delay(fd); @@ -238,12 +238,12 @@ pa_socket_server* pa_socket_server_new_ipv4(pa_mainloop_api *m, uint32_t address sa.sin_addr.s_addr = htonl(address); if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) { - pa_log(__FILE__": bind(): %s\n", strerror(errno)); + pa_log(__FILE__": bind(): %s", strerror(errno)); goto fail; } if (listen(fd, 5) < 0) { - pa_log(__FILE__": listen(): %s\n", strerror(errno)); + pa_log(__FILE__": listen(): %s", strerror(errno)); goto fail; } @@ -270,14 +270,14 @@ pa_socket_server* pa_socket_server_new_ipv6(pa_mainloop_api *m, const uint8_t ad assert(m && port); if ((fd = socket(PF_INET6, SOCK_STREAM, 0)) < 0) { - pa_log(__FILE__": socket(PF_INET6): %s\n", strerror(errno)); + pa_log(__FILE__": socket(PF_INET6): %s", strerror(errno)); goto fail; } pa_fd_set_cloexec(fd, 1); if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, (void*)&on, sizeof(on)) < 0) - pa_log(__FILE__": setsockopt(): %s\n", strerror(errno)); + pa_log(__FILE__": setsockopt(): %s", strerror(errno)); pa_socket_tcp_low_delay(fd); @@ -287,12 +287,12 @@ pa_socket_server* pa_socket_server_new_ipv6(pa_mainloop_api *m, const uint8_t ad memcpy(sa.sin6_addr.s6_addr, address, 16); if (bind(fd, (struct sockaddr *) &sa, sizeof(sa)) < 0) { - pa_log(__FILE__": bind(): %s\n", strerror(errno)); + pa_log(__FILE__": bind(): %s", strerror(errno)); goto fail; } if (listen(fd, 5) < 0) { - pa_log(__FILE__": listen(): %s\n", strerror(errno)); + pa_log(__FILE__": listen(): %s", strerror(errno)); goto fail; } @@ -348,7 +348,7 @@ pa_socket_server* pa_socket_server_new_ip_string(pa_mainloop_api *m, const char if (inet_pton(AF_INET, name, &ipv4) > 0) return pa_socket_server_new_ipv4(m, ntohl(ipv4), port, tcpwrap_service); - pa_log_warn(__FILE__": failed to parse '%s'.\n", name); + pa_log_warn(__FILE__": failed to parse '%s'.", name); return NULL; } @@ -392,7 +392,7 @@ char *pa_socket_server_get_address(pa_socket_server *s, char *c, size_t l) { socklen_t sa_len = sizeof(sa); if (getsockname(s->fd, (struct sockaddr*) &sa, &sa_len) < 0) { - pa_log(__FILE__": getsockname() failed: %s\n", strerror(errno)); + pa_log(__FILE__": getsockname() failed: %s", strerror(errno)); return NULL; } @@ -413,7 +413,7 @@ char *pa_socket_server_get_address(pa_socket_server *s, char *c, size_t l) { char ip[INET6_ADDRSTRLEN]; if (!inet_ntop(AF_INET6, &sa.sin6_addr, ip, sizeof(ip))) { - pa_log(__FILE__": inet_ntop() failed: %s\n", strerror(errno)); + pa_log(__FILE__": inet_ntop() failed: %s", strerror(errno)); return NULL; } @@ -428,7 +428,7 @@ char *pa_socket_server_get_address(pa_socket_server *s, char *c, size_t l) { socklen_t sa_len = sizeof(sa); if (getsockname(s->fd, (struct sockaddr*) &sa, &sa_len) < 0) { - pa_log(__FILE__": getsockname() failed: %s\n", strerror(errno)); + pa_log(__FILE__": getsockname() failed: %s", strerror(errno)); return NULL; } @@ -448,7 +448,7 @@ char *pa_socket_server_get_address(pa_socket_server *s, char *c, size_t l) { char ip[INET_ADDRSTRLEN]; if (!inet_ntop(AF_INET, &sa.sin_addr, ip, sizeof(ip))) { - pa_log(__FILE__": inet_ntop() failed: %s\n", strerror(errno)); + pa_log(__FILE__": inet_ntop() failed: %s", strerror(errno)); return NULL; } diff --git a/src/polypcore/socket-util.c b/src/polypcore/socket-util.c index 5ffe5302..915c7f22 100644 --- a/src/polypcore/socket-util.c +++ b/src/polypcore/socket-util.c @@ -172,7 +172,7 @@ int pa_socket_set_rcvbuf(int fd, size_t l) { assert(fd >= 0); /* if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (void*)&l, sizeof(l)) < 0) { */ -/* pa_log(__FILE__": SO_RCVBUF: %s\n", strerror(errno)); */ +/* pa_log(__FILE__": SO_RCVBUF: %s", strerror(errno)); */ /* return -1; */ /* } */ @@ -183,7 +183,7 @@ int pa_socket_set_sndbuf(int fd, size_t l) { assert(fd >= 0); /* if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, (void*)&l, sizeof(l)) < 0) { */ -/* pa_log(__FILE__": SO_SNDBUF: %s\n", strerror(errno)); */ +/* pa_log(__FILE__": SO_SNDBUF: %s", strerror(errno)); */ /* return -1; */ /* } */ @@ -197,7 +197,7 @@ int pa_unix_socket_is_stale(const char *fn) { int fd = -1, ret = -1; if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) { - pa_log(__FILE__": socket(): %s\n", strerror(errno)); + pa_log(__FILE__": socket(): %s", strerror(errno)); goto finish; } diff --git a/src/polypcore/sound-file-stream.c b/src/polypcore/sound-file-stream.c index 644e578f..e242cfea 100644 --- a/src/polypcore/sound-file-stream.c +++ b/src/polypcore/sound-file-stream.c @@ -131,7 +131,7 @@ int pa_play_file(pa_sink *sink, const char *fname, const pa_cvolume *volume) { memset(&sfinfo, 0, sizeof(sfinfo)); if (!(u->sndfile = sf_open(fname, SFM_READ, &sfinfo))) { - pa_log(__FILE__": Failed to open file %s\n", fname); + pa_log(__FILE__": Failed to open file %s", fname); goto fail; } @@ -154,7 +154,7 @@ int pa_play_file(pa_sink *sink, const char *fname, const pa_cvolume *volume) { ss.channels = sfinfo.channels; if (!pa_sample_spec_valid(&ss)) { - pa_log(__FILE__": Unsupported sample format in file %s\n", fname); + pa_log(__FILE__": Unsupported sample format in file %s", fname); goto fail; } diff --git a/src/polypcore/sound-file.c b/src/polypcore/sound-file.c index cf23e0ac..d86141ce 100644 --- a/src/polypcore/sound-file.c +++ b/src/polypcore/sound-file.c @@ -49,7 +49,7 @@ int pa_sound_file_load(const char *fname, pa_sample_spec *ss, pa_memchunk *chunk memset(&sfinfo, 0, sizeof(sfinfo)); if (!(sf = sf_open(fname, SFM_READ, &sfinfo))) { - pa_log(__FILE__": Failed to open file %s\n", fname); + pa_log(__FILE__": Failed to open file %s", fname); goto finish; } @@ -71,12 +71,12 @@ int pa_sound_file_load(const char *fname, pa_sample_spec *ss, pa_memchunk *chunk ss->channels = sfinfo.channels; if (!pa_sample_spec_valid(ss)) { - pa_log(__FILE__": Unsupported sample format in file %s\n", fname); + pa_log(__FILE__": Unsupported sample format in file %s", fname); goto finish; } if ((l = pa_frame_size(ss)*sfinfo.frames) > MAX_FILE_SIZE) { - pa_log(__FILE__": File too large\n"); + pa_log(__FILE__": File too large"); goto finish; } @@ -86,7 +86,7 @@ int pa_sound_file_load(const char *fname, pa_sample_spec *ss, pa_memchunk *chunk chunk->length = l; if (readf_function(sf, chunk->memblock->data, sfinfo.frames) != sfinfo.frames) { - pa_log(__FILE__": Premature file end\n"); + pa_log(__FILE__": Premature file end"); goto finish; } @@ -110,7 +110,7 @@ int pa_sound_file_too_big_to_cache(const char *fname) { pa_sample_spec ss; if (!(sf = sf_open(fname, SFM_READ, &sfinfo))) { - pa_log(__FILE__": Failed to open file %s\n", fname); + pa_log(__FILE__": Failed to open file %s", fname); return 0; } @@ -132,7 +132,7 @@ int pa_sound_file_too_big_to_cache(const char *fname) { ss.channels = sfinfo.channels; if ((pa_frame_size(&ss) * sfinfo.frames) > MAX_FILE_SIZE) { - pa_log(__FILE__": File too large %s\n", fname); + pa_log(__FILE__": File too large %s", fname); return 1; } diff --git a/src/polypcore/source-output.c b/src/polypcore/source-output.c index d6201b4d..0cb5f356 100644 --- a/src/polypcore/source-output.c +++ b/src/polypcore/source-output.c @@ -53,7 +53,7 @@ pa_source_output* pa_source_output_new( assert(s->state == PA_SOURCE_RUNNING); if (pa_idxset_size(s->outputs) >= PA_MAX_OUTPUTS_PER_SOURCE) { - pa_log(__FILE__": Failed to create source output: too many outputs per source.\n"); + pa_log(__FILE__": Failed to create source output: too many outputs per source."); return NULL; } @@ -95,7 +95,7 @@ pa_source_output* pa_source_output_new( assert(r == 0); pa_sample_spec_snprint(st, sizeof(st), spec); - pa_log_info(__FILE__": created %u \"%s\" on %u with sample spec \"%s\"\n", o->index, o->name, s->index, st); + pa_log_info(__FILE__": created %u \"%s\" on %u with sample spec \"%s\"", o->index, o->name, s->index, st); pa_subscription_post(s->core, PA_SUBSCRIPTION_EVENT_SOURCE_OUTPUT|PA_SUBSCRIPTION_EVENT_NEW, o->index); @@ -127,7 +127,7 @@ static void source_output_free(pa_source_output* o) { if (o->state != PA_SOURCE_OUTPUT_DISCONNECTED) pa_source_output_disconnect(o); - pa_log_info(__FILE__": freed %u \"%s\"\n", o->index, o->name); + pa_log_info(__FILE__": freed %u \"%s\"", o->index, o->name); if (o->resampler) pa_resampler_free(o->resampler); diff --git a/src/polypcore/source.c b/src/polypcore/source.c index 8bca8a1d..e97c31d8 100644 --- a/src/polypcore/source.c +++ b/src/polypcore/source.c @@ -91,7 +91,7 @@ pa_source* pa_source_new( assert(s->index != PA_IDXSET_INVALID && r >= 0); pa_sample_spec_snprint(st, sizeof(st), spec); - pa_log_info(__FILE__": created %u \"%s\" with sample spec \"%s\"\n", s->index, s->name, st); + pa_log_info(__FILE__": created %u \"%s\" with sample spec \"%s\"", s->index, s->name, st); pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_SOURCE | PA_SUBSCRIPTION_EVENT_NEW, s->index); @@ -130,7 +130,7 @@ static void source_free(pa_source *s) { if (s->state != PA_SOURCE_DISCONNECTED) pa_source_disconnect(s); - pa_log_info(__FILE__": freed %u \"%s\"\n", s->index, s->name); + pa_log_info(__FILE__": freed %u \"%s\"", s->index, s->name); pa_idxset_free(s->outputs, NULL, NULL); diff --git a/src/polypcore/util.c b/src/polypcore/util.c index 2ae94d25..f53eef34 100644 --- a/src/polypcore/util.c +++ b/src/polypcore/util.c @@ -120,10 +120,10 @@ void pa_make_nonblock_fd(int fd) { u_long arg = 1; if (ioctlsocket(fd, FIONBIO, &arg) < 0) { if (WSAGetLastError() == WSAENOTSOCK) - pa_log_warn(__FILE__": WARNING: Only sockets can be made non-blocking!\n"); + pa_log_warn(__FILE__": WARNING: Only sockets can be made non-blocking!"); } #else - pa_log_warn(__FILE__": WARNING: Non-blocking I/O not supported.!\n"); + pa_log_warn(__FILE__": WARNING: Non-blocking I/O not supported.!"); #endif } @@ -242,7 +242,7 @@ void pa_check_signal_is_blocked(int sig) { if (pthread_sigmask(SIG_SETMASK, NULL, &set) < 0) { #endif if (sigprocmask(SIG_SETMASK, NULL, &set) < 0) { - pa_log(__FILE__": sigprocmask() failed: %s\n", strerror(errno)); + pa_log(__FILE__": sigprocmask() failed: %s", strerror(errno)); return; } #ifdef HAVE_PTHREAD @@ -255,16 +255,16 @@ void pa_check_signal_is_blocked(int sig) { /* Check whether the signal is trapped */ if (sigaction(sig, NULL, &sa) < 0) { - pa_log(__FILE__": sigaction() failed: %s\n", strerror(errno)); + pa_log(__FILE__": sigaction() failed: %s", strerror(errno)); return; } if (sa.sa_handler != SIG_DFL) return; - pa_log(__FILE__": WARNING: %s is not trapped. This might cause malfunction!\n", pa_strsignal(sig)); + pa_log(__FILE__": WARNING: %s is not trapped. This might cause malfunction!", pa_strsignal(sig)); #else /* HAVE_SIGACTION */ - pa_log(__FILE__": WARNING: %s might not be trapped. This might cause malfunction!\n", pa_strsignal(sig)); + pa_log(__FILE__": WARNING: %s might not be trapped. This might cause malfunction!", pa_strsignal(sig)); #endif } @@ -366,7 +366,7 @@ char *pa_get_user_name(char *s, size_t l) { char *pa_get_host_name(char *s, size_t l) { assert(s && l > 0); if (gethostname(s, l) < 0) { - pa_log(__FILE__": gethostname(): %s\n", strerror(errno)); + pa_log(__FILE__": gethostname(): %s", strerror(errno)); return NULL; } s[l-1] = 0; @@ -393,12 +393,12 @@ char *pa_get_home_dir(char *s, size_t l) { #ifdef HAVE_PWD_H #ifdef HAVE_GETPWUID_R if (getpwuid_r(getuid(), &pw, buf, sizeof(buf), &r) != 0 || !r) { - pa_log(__FILE__": getpwuid_r() failed\n"); + pa_log(__FILE__": getpwuid_r() failed"); #else /* XXX Not thread-safe, but needed on OSes (e.g. FreeBSD 4.X) * that do not support getpwuid_r. */ if ((r = getpwuid(getuid())) == NULL) { - pa_log(__FILE__": getpwuid_r() failed\n"); + pa_log(__FILE__": getpwuid_r() failed"); #endif return NULL; } @@ -534,9 +534,9 @@ void pa_raise_priority(void) { #ifdef HAVE_SYS_RESOURCE_H if (setpriority(PRIO_PROCESS, 0, NICE_LEVEL) < 0) - pa_log_warn(__FILE__": setpriority() failed: %s\n", strerror(errno)); + pa_log_warn(__FILE__": setpriority() failed: %s", strerror(errno)); else - pa_log_info(__FILE__": Successfully gained nice level %i.\n", NICE_LEVEL); + pa_log_info(__FILE__": Successfully gained nice level %i.", NICE_LEVEL); #endif #ifdef _POSIX_PRIORITY_SCHEDULING @@ -544,25 +544,25 @@ void pa_raise_priority(void) { struct sched_param sp; if (sched_getparam(0, &sp) < 0) { - pa_log(__FILE__": sched_getparam() failed: %s\n", strerror(errno)); + pa_log(__FILE__": sched_getparam() failed: %s", strerror(errno)); return; } sp.sched_priority = 1; if (sched_setscheduler(0, SCHED_FIFO, &sp) < 0) { - pa_log_warn(__FILE__": sched_setscheduler() failed: %s\n", strerror(errno)); + pa_log_warn(__FILE__": sched_setscheduler() failed: %s", strerror(errno)); return; } - pa_log_info(__FILE__": Successfully enabled SCHED_FIFO scheduling.\n"); + pa_log_info(__FILE__": Successfully enabled SCHED_FIFO scheduling."); } #endif #ifdef OS_IS_WIN32 if (!SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS)) - pa_log_warn(__FILE__": SetPriorityClass() failed: 0x%08X\n", GetLastError()); + pa_log_warn(__FILE__": SetPriorityClass() failed: 0x%08X", GetLastError()); else - pa_log_info(__FILE__": Successfully gained high priority class.\n"); + pa_log_info(__FILE__": Successfully gained high priority class."); #endif } @@ -741,7 +741,7 @@ static int is_group(gid_t gid, const char *name) { data = pa_xmalloc(n); if (getgrgid_r(gid, &group, data, n, &result) < 0 || !result) { - pa_log(__FILE__ ": getgrgid_r(%u) failed: %s\n", gid, strerror(errno)); + pa_log(__FILE__ ": getgrgid_r(%u) failed: %s", gid, strerror(errno)); goto finish; } @@ -754,7 +754,7 @@ finish: /* XXX Not thread-safe, but needed on OSes (e.g. FreeBSD 4.X) that do not * support getgrgid_r. */ if ((result = getgrgid(gid)) == NULL) { - pa_log(__FILE__ ": getgrgid(%u) failed: %s\n", gid, strerror(errno)); + pa_log(__FILE__ ": getgrgid(%u) failed: %s", gid, strerror(errno)); goto finish; } @@ -777,7 +777,7 @@ int pa_uid_in_group(const char *name, gid_t *gid) { gids = pa_xmalloc(sizeof(GETGROUPS_T)*n); if ((n = getgroups(n, gids)) < 0) { - pa_log(__FILE__": getgroups() failed: %s\n", strerror(errno)); + pa_log(__FILE__": getgroups() failed: %s", strerror(errno)); goto finish; } @@ -834,7 +834,7 @@ int pa_lock_fd(int fd, int b) { return 0; } - pa_log(__FILE__": %slock failed: %s\n", !b ? "un" : "", strerror(errno)); + pa_log(__FILE__": %slock failed: %s", !b ? "un" : "", strerror(errno)); #endif #ifdef OS_IS_WIN32 @@ -845,7 +845,7 @@ int pa_lock_fd(int fd, int b) { if (!b && UnlockFile(h, 0, 0, 0xFFFFFFFF, 0xFFFFFFFF)) return 0; - pa_log(__FILE__": %slock failed: 0x%08X\n", !b ? "un" : "", GetLastError()); + pa_log(__FILE__": %slock failed: 0x%08X", !b ? "un" : "", GetLastError()); #endif return -1; @@ -868,17 +868,17 @@ int pa_lock_lockfile(const char *fn) { struct stat st; if ((fd = open(fn, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR)) < 0) { - pa_log(__FILE__": failed to create lock file '%s': %s\n", fn, strerror(errno)); + pa_log(__FILE__": failed to create lock file '%s': %s", fn, strerror(errno)); goto fail; } if (pa_lock_fd(fd, 1) < 0) { - pa_log(__FILE__": failed to lock file '%s'.\n", fn); + pa_log(__FILE__": failed to lock file '%s'.", fn); goto fail; } if (fstat(fd, &st) < 0) { - pa_log(__FILE__": failed to fstat() file '%s'.\n", fn); + pa_log(__FILE__": failed to fstat() file '%s'.", fn); goto fail; } @@ -887,12 +887,12 @@ int pa_lock_lockfile(const char *fn) { break; if (pa_lock_fd(fd, 0) < 0) { - pa_log(__FILE__": failed to unlock file '%s'.\n", fn); + pa_log(__FILE__": failed to unlock file '%s'.", fn); goto fail; } if (close(fd) < 0) { - pa_log(__FILE__": failed to close file '%s'.\n", fn); + pa_log(__FILE__": failed to close file '%s'.", fn); goto fail; } @@ -915,17 +915,17 @@ int pa_unlock_lockfile(const char *fn, int fd) { assert(fn && fd >= 0); if (unlink(fn) < 0) { - pa_log_warn(__FILE__": WARNING: unable to remove lock file '%s': %s\n", fn, strerror(errno)); + pa_log_warn(__FILE__": WARNING: unable to remove lock file '%s': %s", fn, strerror(errno)); r = -1; } if (pa_lock_fd(fd, 0) < 0) { - pa_log_warn(__FILE__": WARNING: failed to unlock file '%s'.\n", fn); + pa_log_warn(__FILE__": WARNING: failed to unlock file '%s'.", fn); r = -1; } if (close(fd) < 0) { - pa_log_warn(__FILE__": WARNING: failed to close lock file '%s': %s\n", fn, strerror(errno)); + pa_log_warn(__FILE__": WARNING: failed to close lock file '%s': %s", fn, strerror(errno)); r = -1; } diff --git a/src/polypcore/x11wrap.c b/src/polypcore/x11wrap.c index 9414fbdf..21a7f307 100644 --- a/src/polypcore/x11wrap.c +++ b/src/polypcore/x11wrap.c @@ -138,7 +138,7 @@ static pa_x11_wrapper* x11_wrapper_new(pa_core *c, const char *name, const char int r; if (!(d = XOpenDisplay(name))) { - pa_log(__FILE__": XOpenDisplay() failed\n"); + pa_log(__FILE__": XOpenDisplay() failed"); return NULL; } diff --git a/src/utils/pacmd.c b/src/utils/pacmd.c index 4054bc2c..a71e0e93 100644 --- a/src/utils/pacmd.c +++ b/src/utils/pacmd.c @@ -46,12 +46,12 @@ int main(PA_GCC_UNUSED int main, PA_GCC_UNUSED char*argv[]) { fd_set ifds, ofds; if (pa_pid_file_check_running(&pid) < 0) { - pa_log(__FILE__": no Polypaudio daemon running\n"); + pa_log(__FILE__": no Polypaudio daemon running"); goto fail; } if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) { - pa_log(__FILE__": socket(PF_UNIX, SOCK_STREAM, 0): %s\n", strerror(errno)); + pa_log(__FILE__": socket(PF_UNIX, SOCK_STREAM, 0): %s", strerror(errno)); goto fail; } @@ -63,7 +63,7 @@ int main(PA_GCC_UNUSED int main, PA_GCC_UNUSED char*argv[]) { int r; if ((r = connect(fd, (struct sockaddr*) &sa, sizeof(sa))) < 0 && (errno != ECONNREFUSED && errno != ENOENT)) { - pa_log(__FILE__": connect() failed: %s\n", strerror(errno)); + pa_log(__FILE__": connect() failed: %s", strerror(errno)); goto fail; } @@ -71,7 +71,7 @@ int main(PA_GCC_UNUSED int main, PA_GCC_UNUSED char*argv[]) { break; if (pa_pid_file_kill(SIGUSR2, NULL) < 0) { - pa_log(__FILE__": failed to kill Polypaudio daemon.\n"); + pa_log(__FILE__": failed to kill Polypaudio daemon."); goto fail; } @@ -79,7 +79,7 @@ int main(PA_GCC_UNUSED int main, PA_GCC_UNUSED char*argv[]) { } if (i >= 5) { - pa_log(__FILE__": daemon not responding.\n"); + pa_log(__FILE__": daemon not responding."); goto fail; } @@ -94,7 +94,7 @@ int main(PA_GCC_UNUSED int main, PA_GCC_UNUSED char*argv[]) { for (;;) { if (select(FD_SETSIZE, &ifds, &ofds, NULL, NULL) < 0) { - pa_log(__FILE__": select() failed: %s\n", strerror(errno)); + pa_log(__FILE__": select() failed: %s", strerror(errno)); goto fail; } @@ -106,7 +106,7 @@ int main(PA_GCC_UNUSED int main, PA_GCC_UNUSED char*argv[]) { if (r == 0) break; - pa_log(__FILE__": read() failed: %s\n", strerror(errno)); + pa_log(__FILE__": read() failed: %s", strerror(errno)); goto fail; } @@ -122,7 +122,7 @@ int main(PA_GCC_UNUSED int main, PA_GCC_UNUSED char*argv[]) { if (r == 0) break; - pa_log(__FILE__": read() failed: %s\n", strerror(errno)); + pa_log(__FILE__": read() failed: %s", strerror(errno)); goto fail; } @@ -135,7 +135,7 @@ int main(PA_GCC_UNUSED int main, PA_GCC_UNUSED char*argv[]) { assert(obuf_length); if ((r = write(1, obuf + obuf_index, obuf_length)) < 0) { - pa_log(__FILE__": write() failed: %s\n", strerror(errno)); + pa_log(__FILE__": write() failed: %s", strerror(errno)); goto fail; } @@ -149,7 +149,7 @@ int main(PA_GCC_UNUSED int main, PA_GCC_UNUSED char*argv[]) { assert(ibuf_length); if ((r = write(fd, ibuf + ibuf_index, ibuf_length)) < 0) { - pa_log(__FILE__": write() failed: %s\n", strerror(errno)); + pa_log(__FILE__": write() failed: %s", strerror(errno)); goto fail; } diff --git a/src/utils/pax11publish.c b/src/utils/pax11publish.c index 56b62d37..e4358894 100644 --- a/src/utils/pax11publish.c +++ b/src/utils/pax11publish.c @@ -90,7 +90,7 @@ int main(int argc, char *argv[]) { } if (!(d = XOpenDisplay(dname))) { - pa_log(__FILE__": XOpenDisplay() failed\n"); + pa_log(__FILE__": XOpenDisplay() failed"); goto finish; } -- cgit