From e6c3acaa6fc6f2003b118a93306a8508e13f0fb1 Mon Sep 17 00:00:00 2001 From: Andreas Wiese Date: Fri, 14 Jan 2011 15:43:51 +0100 Subject: Fix NDEBUG test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit needs to be included unconditionally from definition of NDEBUG, since »bool« doesn't get defined otherwise. Signed-off-by: Andreas Wiese --- src/pipe.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/pipe.h b/src/pipe.h index 2825b320a..b15cd76c1 100644 --- a/src/pipe.h +++ b/src/pipe.h @@ -20,9 +20,9 @@ #ifndef MPD_PIPE_H #define MPD_PIPE_H -#ifndef NDEBUG #include +#ifndef NDEBUG struct audio_format; #endif -- cgit v1.2.3 From 03018611f8b9d7ed6d55ee45ccf2b69958c05caf Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 31 Jan 2011 07:19:34 +0100 Subject: update: log all file permission problems --- src/update.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/update.c b/src/update.c index d5c9779c8..9a1e7d29b 100644 --- a/src/update.c +++ b/src/update.c @@ -254,6 +254,9 @@ stat_directory(const struct directory *directory, struct stat *st) if (path_fs == NULL) return -1; ret = stat(path_fs, st); + if (ret < 0) + g_warning("Failed to stat %s: %s", path_fs, g_strerror(errno)); + g_free(path_fs); return ret; } @@ -270,6 +273,9 @@ stat_directory_child(const struct directory *parent, const char *name, return -1; ret = stat(path_fs, st); + if (ret < 0) + g_warning("Failed to stat %s: %s", path_fs, g_strerror(errno)); + g_free(path_fs); return ret; } -- cgit v1.2.3 From 2a1f4539f6115f6d01f33b60adf0118122c7018a Mon Sep 17 00:00:00 2001 From: Christopher Brannon Date: Sun, 13 Feb 2011 01:37:28 +0000 Subject: Insure proper initialization of stack-allocated struct. Version 1.0.0 of the libao library added a new field to the ao_sample_format struct. It is a char * named matrix. When an ao_sample_format is allocated on the stack, this field contains garbage. The proper course is to insure that is initialized to NULL. NULL indicates that we do not want any mapping. The struct is now initialized using a static initializer, and this technique is compatible with all known versions of libao. --- src/output/ao_plugin.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/output/ao_plugin.c b/src/output/ao_plugin.c index 12d2b7552..63a43ddf0 100644 --- a/src/output/ao_plugin.c +++ b/src/output/ao_plugin.c @@ -25,6 +25,9 @@ #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "ao" +/* An ao_sample_format, with all fields set to zero: */ +static const ao_sample_format OUR_AO_FORMAT_INITIALIZER; + static unsigned ao_output_ref; struct ao_data { @@ -166,7 +169,7 @@ static bool ao_output_open(void *data, struct audio_format *audio_format, GError **error) { - ao_sample_format format; + ao_sample_format format = OUR_AO_FORMAT_INITIALIZER; struct ao_data *ad = (struct ao_data *)data; /* support for 24 bit samples in libao is currently dubious, -- cgit v1.2.3 From ce370bee60f685d9e7b109ac67ae656b46779f88 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 25 Feb 2011 10:46:44 +0100 Subject: output/jack: rename variable sample_size to jack_sample_size --- src/output/jack_plugin.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/output/jack_plugin.c b/src/output/jack_plugin.c index 5dc1eca24..4b71dc8c4 100644 --- a/src/output/jack_plugin.c +++ b/src/output/jack_plugin.c @@ -36,7 +36,7 @@ #undef G_LOG_DOMAIN #define G_LOG_DOMAIN "jack" -static const size_t sample_size = sizeof(jack_default_audio_sample_t); +static const size_t jack_sample_size = sizeof(jack_default_audio_sample_t); static const char *const port_names[2] = { "left", "right", @@ -118,14 +118,15 @@ mpd_jack_process(jack_nframes_t nframes, void *arg) for (unsigned i = 0; i < G_N_ELEMENTS(jd->ringbuffer); ++i) { available = jack_ringbuffer_read_space(jd->ringbuffer[i]); - assert(available % sample_size == 0); - available /= sample_size; + assert(available % jack_sample_size == 0); + available /= jack_sample_size; if (available > nframes) available = nframes; out = jack_port_get_buffer(jd->ports[i], nframes); jack_ringbuffer_read(jd->ringbuffer[i], - (char *)out, available * sample_size); + (char *)out, + available * jack_sample_size); while (available < nframes) /* ringbuffer underrun, fill with silence */ @@ -430,7 +431,7 @@ mpd_jack_play(void *data, const void *chunk, size_t size, GError **error) g_usleep(1000); } - space /= sample_size; + space /= jack_sample_size; if (space < size) size = space; -- cgit v1.2.3 From 1674a4ec828ebd6822e1d1622d9fcdae5140a61d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 27 Feb 2011 23:26:50 +0100 Subject: output/jack: fix crash with mono playback With mono sound, jack_sample_size is smaller than frame_size (4 vs 2 bytes), and "space/jack_sample_size==0". That means mpd_jack_play() will return 0, although no error has occurred. --- src/output/jack_plugin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/output/jack_plugin.c b/src/output/jack_plugin.c index 4b71dc8c4..0a0b8377f 100644 --- a/src/output/jack_plugin.c +++ b/src/output/jack_plugin.c @@ -423,7 +423,7 @@ mpd_jack_play(void *data, const void *chunk, size_t size, GError **error) /* send data symmetrically */ space = space1; - if (space >= frame_size) + if (space >= jack_sample_size) break; /* XXX do something more intelligent to -- cgit v1.2.3