From d6d4de11232946ba57a8b40863a0fcb2ef923349 Mon Sep 17 00:00:00 2001 From: Avuton Olrich Date: Sat, 3 Oct 2009 05:44:26 -0700 Subject: Modify version string to post-release version 0.15.5~git --- NEWS | 3 +++ configure.ac | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 435a4720e..3847f0eda 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +ver 0.15.5 (2009/??/??) + + ver 0.15.4 (2009/10/03) * decoders: - vorbis: revert "faster tag scanning with ov_test_callback()" diff --git a/configure.ac b/configure.ac index 5f07ddd7c..d476a74a9 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ(2.60) -AC_INIT(mpd, 0.15.4, musicpd-dev-team@lists.sourceforge.net) +AC_INIT(mpd, 0.15.5~git, musicpd-dev-team@lists.sourceforge.net) AC_CONFIG_SRCDIR([src/main.c]) AM_INIT_AUTOMAKE([foreign 1.9 dist-bzip2]) AM_CONFIG_HEADER(config.h) -- cgit v1.2.3 From 016558093ba9fa7bd030367e50feca303fb012ca Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 11 Oct 2009 23:09:38 +0200 Subject: input/curl: moved code to fill_buffer() --- src/input/curl_input_plugin.c | 67 ++++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 27 deletions(-) diff --git a/src/input/curl_input_plugin.c b/src/input/curl_input_plugin.c index a140556c5..4ed8e5b5b 100644 --- a/src/input/curl_input_plugin.c +++ b/src/input/curl_input_plugin.c @@ -282,6 +282,42 @@ input_curl_select(struct input_curl *c) return ret; } +static bool +fill_buffer(struct input_stream *is) +{ + struct input_curl *c = is->data; + CURLMcode mcode = CURLM_CALL_MULTI_PERFORM; + + while (!c->eof && g_queue_is_empty(c->buffers)) { + int running_handles; + bool bret; + + if (mcode != CURLM_CALL_MULTI_PERFORM) { + /* if we're still here, there is no input yet + - wait for input */ + int ret = input_curl_select(c); + if (ret <= 0) + /* no data yet or error */ + return false; + } + + mcode = curl_multi_perform(c->multi, &running_handles); + if (mcode != CURLM_OK && mcode != CURLM_CALL_MULTI_PERFORM) { + g_warning("curl_multi_perform() failed: %s\n", + curl_multi_strerror(mcode)); + c->eof = true; + is->ready = true; + return false; + } + + bret = input_curl_multi_info_read(is); + if (!bret) + return false; + } + + return true; +} + /** * Mark a part of the buffer object as consumed. */ @@ -381,7 +417,7 @@ static size_t input_curl_read(struct input_stream *is, void *ptr, size_t size) { struct input_curl *c = is->data; - CURLMcode mcode = CURLM_CALL_MULTI_PERFORM; + bool success; GQueue *rewind_buffers; size_t nbytes = 0; char *dest = ptr; @@ -409,32 +445,9 @@ input_curl_read(struct input_stream *is, void *ptr, size_t size) /* fill the buffer */ - while (!c->eof && g_queue_is_empty(c->buffers)) { - int running_handles; - bool bret; - - if (mcode != CURLM_CALL_MULTI_PERFORM) { - /* if we're still here, there is no input yet - - wait for input */ - int ret = input_curl_select(c); - if (ret <= 0) - /* no data yet or error */ - return 0; - } - - mcode = curl_multi_perform(c->multi, &running_handles); - if (mcode != CURLM_OK && mcode != CURLM_CALL_MULTI_PERFORM) { - g_warning("curl_multi_perform() failed: %s\n", - curl_multi_strerror(mcode)); - c->eof = true; - is->ready = true; - return 0; - } - - bret = input_curl_multi_info_read(is); - if (!bret) - return 0; - } + success = fill_buffer(is); + if (!success) + return 0; /* send buffer contents */ -- cgit v1.2.3 From af92b1c2d815befec7bd9541e76c5402bcbf05c4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 11 Oct 2009 23:13:49 +0200 Subject: input/curl: don't abort if a packet has only metadata When a received chunk of data has only icy-metadata, there was no usable data left for input_curl_read() to return, and thus it returned 0 bytes. "0" however is a special value for "end of file" or "error". This patch makes input_curl_read() read more data from the socket, until the read request can be fulfilled (or until there's really EOF). --- NEWS | 2 ++ src/input/curl_input_plugin.c | 42 ++++++++++++++++++++++-------------------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/NEWS b/NEWS index 3847f0eda..9ece8b56b 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,6 @@ ver 0.15.5 (2009/??/??) +* input: + - curl: don't abort if a packet has only metadata ver 0.15.4 (2009/10/03) diff --git a/src/input/curl_input_plugin.c b/src/input/curl_input_plugin.c index 4ed8e5b5b..b83bcd918 100644 --- a/src/input/curl_input_plugin.c +++ b/src/input/curl_input_plugin.c @@ -443,31 +443,33 @@ input_curl_read(struct input_stream *is, void *ptr, size_t size) } #endif - /* fill the buffer */ + do { + /* fill the buffer */ - success = fill_buffer(is); - if (!success) - return 0; + success = fill_buffer(is); + if (!success) + return 0; - /* send buffer contents */ + /* send buffer contents */ - if (c->rewind != NULL && - (!g_queue_is_empty(c->rewind) || is->offset == 0)) - /* at the beginning or already writing the rewind - buffer list */ - rewind_buffers = c->rewind; - else - /* we don't need the rewind buffers anymore */ - rewind_buffers = NULL; + if (c->rewind != NULL && + (!g_queue_is_empty(c->rewind) || is->offset == 0)) + /* at the beginning or already writing the rewind + buffer list */ + rewind_buffers = c->rewind; + else + /* we don't need the rewind buffers anymore */ + rewind_buffers = NULL; - while (size > 0 && !g_queue_is_empty(c->buffers)) { - size_t copy = read_from_buffer(&c->icy_metadata, c->buffers, - dest + nbytes, size, - rewind_buffers); + while (size > 0 && !g_queue_is_empty(c->buffers)) { + size_t copy = read_from_buffer(&c->icy_metadata, c->buffers, + dest + nbytes, size, + rewind_buffers); - nbytes += copy; - size -= copy; - } + nbytes += copy; + size -= copy; + } + } while (nbytes == 0); if (icy_defined(&c->icy_metadata)) copy_icy_tag(c); -- cgit v1.2.3 From a1d868eb56bab5063f367e392624e3b3de5ea4d3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 11 Oct 2009 23:14:16 +0200 Subject: decoder_thread: change the fallback decoder name to "mad" When there is no Content-Type response header, try the "mad" decoder plugin. It uesd to be named "mp3", and we forgot to change the fallback name in decoder_thread.c. --- NEWS | 1 + src/decoder_thread.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 9ece8b56b..311667f58 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ ver 0.15.5 (2009/??/??) * input: - curl: don't abort if a packet has only metadata +* decoder_thread: change the fallback decoder name to "mad" ver 0.15.4 (2009/10/03) diff --git a/src/decoder_thread.c b/src/decoder_thread.c index 2b1a6299a..d6ff058ec 100644 --- a/src/decoder_thread.c +++ b/src/decoder_thread.c @@ -169,7 +169,7 @@ static void decoder_run_song(const struct song *song, const char *uri) if (plugin == NULL) { /* we already know our mp3Plugin supports streams, no * need to check for stream{Types,DecodeFunc} */ - if ((plugin = decoder_plugin_from_name("mp3"))) { + if ((plugin = decoder_plugin_from_name("mad"))) { ret = decoder_stream_decode(plugin, &decoder, &input_stream); } -- cgit v1.2.3 From 9a3f5ff977951781453fbe1e597dbd6eb5f7494a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 11 Oct 2009 23:15:38 +0200 Subject: riff, aiff: fixed "limited range" gcc warning On 32 bit systems with large file support enabled (i.e. "sizeof(off_t) > sizeof(size_t)") gcc emits a warning because a size_t cast to off_t can never become negative. --- NEWS | 2 ++ src/aiff.c | 10 +++++----- src/riff.c | 10 +++++----- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index 311667f58..08057a86e 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ ver 0.15.5 (2009/??/??) * input: - curl: don't abort if a packet has only metadata +* tags: + - riff, aiff: fixed "limited range" gcc warning * decoder_thread: change the fallback decoder name to "mad" diff --git a/src/aiff.c b/src/aiff.c index f77e86d2b..d4bec628b 100644 --- a/src/aiff.c +++ b/src/aiff.c @@ -84,6 +84,11 @@ aiff_seek_id3(FILE *file) return 0; size = GUINT32_FROM_BE(chunk.size); + if (size > G_MAXINT32) + /* too dangerous, bail out: possible integer + underflow when casting to off_t */ + return 0; + if (size % 2 != 0) /* pad byte */ ++size; @@ -92,11 +97,6 @@ aiff_seek_id3(FILE *file) /* found it! */ return size; - if ((off_t)size < 0) - /* integer underflow after cast to signed - type */ - return 0; - ret = fseek(file, size, SEEK_CUR); if (ret != 0) return 0; diff --git a/src/riff.c b/src/riff.c index 7227fd3c8..a8ea9dd42 100644 --- a/src/riff.c +++ b/src/riff.c @@ -83,6 +83,11 @@ riff_seek_id3(FILE *file) return 0; size = GUINT32_FROM_LE(chunk.size); + if (size > G_MAXINT32) + /* too dangerous, bail out: possible integer + underflow when casting to off_t */ + return 0; + if (size % 2 != 0) /* pad byte */ ++size; @@ -91,11 +96,6 @@ riff_seek_id3(FILE *file) /* found it! */ return size; - if ((off_t)size < 0) - /* integer underflow after cast to signed - type */ - return 0; - ret = fseek(file, size, SEEK_CUR); if (ret != 0) return 0; -- cgit v1.2.3