From a56949e9faa691ef6f1002744aa3fbfeb6dae47c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 23 Dec 2014 20:51:08 +0100 Subject: decoder/ffmpeg: support interleaved floating point --- NEWS | 1 + src/decoder/plugins/FfmpegDecoderPlugin.cxx | 1 + 2 files changed, 2 insertions(+) diff --git a/NEWS b/NEWS index f09d77217..3443e503f 100644 --- a/NEWS +++ b/NEWS @@ -3,6 +3,7 @@ ver 0.19.8 (not yet released) - mms: reduce delay at the beginning of playback * decoder - dsdiff, dsf: allow ID3 tags larger than 4 kB + - ffmpeg: support interleaved floating point ver 0.19.7 (2014/12/17) * input diff --git a/src/decoder/plugins/FfmpegDecoderPlugin.cxx b/src/decoder/plugins/FfmpegDecoderPlugin.cxx index 494f4048b..722f954e2 100644 --- a/src/decoder/plugins/FfmpegDecoderPlugin.cxx +++ b/src/decoder/plugins/FfmpegDecoderPlugin.cxx @@ -374,6 +374,7 @@ ffmpeg_sample_format(enum AVSampleFormat sample_fmt) case AV_SAMPLE_FMT_S32P: return SampleFormat::S32; + case AV_SAMPLE_FMT_FLT: case AV_SAMPLE_FMT_FLTP: return SampleFormat::FLOAT; -- cgit v1.2.3 From 805caa30cee49e2a3d75d841abd9b1b452f9ec8b Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 26 Dec 2014 13:23:04 +0100 Subject: configure.ac: prepare for 0.18.22 --- NEWS | 2 ++ configure.ac | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 4db5f0300..dc51ab6fb 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,5 @@ +ver 0.18.22 (not yet released) + ver 0.18.21 (2014/12/17) * playlist - embcue: fix filename suffix detection diff --git a/configure.ac b/configure.ac index e0480640d..e253aa52f 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ AC_PREREQ(2.60) -AC_INIT(mpd, 0.18.21, mpd-devel@musicpd.org) +AC_INIT(mpd, 0.18.22, mpd-devel@musicpd.org) VERSION_MAJOR=0 VERSION_MINOR=18 -VERSION_REVISION=21 +VERSION_REVISION=22 VERSION_EXTRA=0 AC_CONFIG_SRCDIR([src/Main.cxx]) -- cgit v1.2.3 From 2a86554ac452fff2ee3c279ceb792fbd3449d448 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 28 Nov 2014 18:55:09 +0100 Subject: Compiler.h: add macro GCC_MAKE_VERSION() --- src/Compiler.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/Compiler.h b/src/Compiler.h index 94abdcff3..fa2bf5dde 100644 --- a/src/Compiler.h +++ b/src/Compiler.h @@ -20,22 +20,20 @@ #ifndef COMPILER_H #define COMPILER_H +#define GCC_MAKE_VERSION(major, minor, patchlevel) ((major) * 10000 + (minor) * 100 + patchlevel) + #define GCC_CHECK_VERSION(major, minor) \ (defined(__GNUC__) && \ (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))) #ifdef __GNUC__ -#define GCC_VERSION (__GNUC__ * 10000 \ - + __GNUC_MINOR__ * 100 \ - + __GNUC_PATCHLEVEL__) +#define GCC_VERSION GCC_MAKE_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) #else #define GCC_VERSION 0 #endif #ifdef __clang__ -# define CLANG_VERSION (__clang_major__ * 10000 \ - + __clang_minor__ * 100 \ - + __clang_patchlevel__) +# define CLANG_VERSION GCC_MAKE_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__) # if __clang_major__ < 3 # error Sorry, your clang version is too old. You need at least version 3.1. # endif -- cgit v1.2.3 From 92eeca3ba77446b760d3d64d9c50a08029bd4500 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 28 Nov 2014 19:06:17 +0100 Subject: util/Manual: reimplement GCC_CHECK_VERSION() using GCC_MAKE_VERSION() --- src/Compiler.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Compiler.h b/src/Compiler.h index fa2bf5dde..14dd5d248 100644 --- a/src/Compiler.h +++ b/src/Compiler.h @@ -22,16 +22,15 @@ #define GCC_MAKE_VERSION(major, minor, patchlevel) ((major) * 10000 + (minor) * 100 + patchlevel) -#define GCC_CHECK_VERSION(major, minor) \ - (defined(__GNUC__) && \ - (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))) - #ifdef __GNUC__ #define GCC_VERSION GCC_MAKE_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) #else #define GCC_VERSION 0 #endif +#define GCC_CHECK_VERSION(major, minor) \ + (defined(__GNUC__) && GCC_VERSION >= GCC_MAKE_VERSION(major, minor, 0)) + #ifdef __clang__ # define CLANG_VERSION GCC_MAKE_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__) # if __clang_major__ < 3 -- cgit v1.2.3 From 0964b06240947e94fc2732107815fff41856d481 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 28 Nov 2014 18:57:48 +0100 Subject: Compiler.h: add macro GCC_OLDER_THAN() --- src/Compiler.h | 12 ++++++++++-- src/util/Manual.hxx | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Compiler.h b/src/Compiler.h index 14dd5d248..82a192394 100644 --- a/src/Compiler.h +++ b/src/Compiler.h @@ -31,13 +31,21 @@ #define GCC_CHECK_VERSION(major, minor) \ (defined(__GNUC__) && GCC_VERSION >= GCC_MAKE_VERSION(major, minor, 0)) +/** + * Are we building with gcc (not clang or any other compiler) and a + * version older than the specified one? + */ +#define GCC_OLDER_THAN(major, minor) \ + (defined(__GNUC__) && !defined(__clang__) && \ + GCC_VERSION < GCC_MAKE_VERSION(major, minor, 0)) + #ifdef __clang__ # define CLANG_VERSION GCC_MAKE_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__) # if __clang_major__ < 3 # error Sorry, your clang version is too old. You need at least version 3.1. # endif #elif defined(__GNUC__) -# if !GCC_CHECK_VERSION(4,6) +# if GCC_OLDER_THAN(4,6) # error Sorry, your gcc version is too old. You need at least version 4.6. # endif #else @@ -138,7 +146,7 @@ #if defined(__cplusplus) /* support for C++11 "override" was added in gcc 4.7 */ -#if !defined(__clang__) && !GCC_CHECK_VERSION(4,7) +#if GCC_OLDER_THAN(4,7) #define override #define final #endif diff --git a/src/util/Manual.hxx b/src/util/Manual.hxx index baab0a555..75cffac06 100644 --- a/src/util/Manual.hxx +++ b/src/util/Manual.hxx @@ -35,7 +35,7 @@ #include #include -#if !defined(__clang__) && __GNUC__ && !GCC_CHECK_VERSION(4,8) +#if GCC_OLDER_THAN(4,8) #include #endif @@ -54,7 +54,7 @@ */ template class Manual { -#if !defined(__clang__) && __GNUC__ && !GCC_CHECK_VERSION(4,8) +#if GCC_OLDER_THAN(4,8) /* no alignas() on gcc < 4.8: apply worst-case fallback */ __attribute__((aligned(8))) #else -- cgit v1.2.3 From 6b4ac669629d7adf821700ae9284b057dd1907d8 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 26 Dec 2014 13:29:44 +0100 Subject: Compiler.h: add macro CLANG_CHECK_VERSION() --- src/Compiler.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Compiler.h b/src/Compiler.h index 82a192394..b736b5ac7 100644 --- a/src/Compiler.h +++ b/src/Compiler.h @@ -52,6 +52,13 @@ # warning Untested compiler. Use at your own risk! #endif +/** + * Are we building with the specified version of clang or newer? + */ +#define CLANG_CHECK_VERSION(major, minor) \ + (defined(__clang__) && \ + CLANG_VERSION >= GCC_MAKE_VERSION(major, minor, 0)) + #if GCC_CHECK_VERSION(4,0) /* GCC 4.x */ -- cgit v1.2.3 From 705b3c6b63bd41f1eefe27c8d5291e3897026238 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 26 Dec 2014 13:37:38 +0100 Subject: util/ASCII: fix indent --- src/util/ASCII.hxx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/util/ASCII.hxx b/src/util/ASCII.hxx index 19a18a1bb..cd26d9dec 100644 --- a/src/util/ASCII.hxx +++ b/src/util/ASCII.hxx @@ -43,24 +43,24 @@ gcc_pure gcc_nonnull_all static inline bool StringEqualsCaseASCII(const char *a, const char *b) { - assert(a != nullptr); - assert(b != nullptr); + assert(a != nullptr); + assert(b != nullptr); - /* note: strcasecmp() depends on the locale, but for ASCII-only - strings, it's safe to use */ - return strcasecmp(a, b) == 0; + /* note: strcasecmp() depends on the locale, but for ASCII-only + strings, it's safe to use */ + return strcasecmp(a, b) == 0; } gcc_pure gcc_nonnull_all static inline bool StringEqualsCaseASCII(const char *a, const char *b, size_t n) { - assert(a != nullptr); - assert(b != nullptr); + assert(a != nullptr); + assert(b != nullptr); - /* note: strcasecmp() depends on the locale, but for ASCII-only - strings, it's safe to use */ - return strncasecmp(a, b, n) == 0; + /* note: strcasecmp() depends on the locale, but for ASCII-only + strings, it's safe to use */ + return strncasecmp(a, b, n) == 0; } #endif -- cgit v1.2.3 From a5049136ffe020cd17109985e697fe2e8e1a18d5 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 26 Dec 2014 13:43:27 +0100 Subject: DatabaseGlue: convert nullptr check to assertion --- src/DatabaseGlue.cxx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/DatabaseGlue.cxx b/src/DatabaseGlue.cxx index 013a3e329..fb41b40b7 100644 --- a/src/DatabaseGlue.cxx +++ b/src/DatabaseGlue.cxx @@ -112,13 +112,12 @@ db_get_root(void) Directory * db_get_directory(const char *name) { + assert(name != nullptr); + if (db == nullptr) return nullptr; Directory *music_root = db_get_root(); - if (name == nullptr) - return music_root; - return music_root->LookupDirectory(name); } -- cgit v1.2.3 From 53f40448901ffe0d953c81939d031c63cdf3779a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 26 Dec 2014 13:40:17 +0100 Subject: util/{ASCII,UriUtil}, ...: work around -Wtautological-pointer-compare New in clang 3.6. --- NEWS | 1 + src/DatabaseGlue.cxx | 3 +++ src/DecoderPlugin.cxx | 6 ++++++ src/Directory.cxx | 3 +++ src/InputStream.cxx | 6 ++++++ src/SongFilter.cxx | 3 +++ src/fs/Charset.cxx | 6 ++++++ src/fs/Traits.cxx | 6 ++++++ src/tag/TagBuilder.cxx | 9 +++++++++ src/util/ASCII.hxx | 6 ++++++ src/util/UriUtil.cxx | 3 +++ 11 files changed, 52 insertions(+) diff --git a/NEWS b/NEWS index dc51ab6fb..df37e6ceb 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,5 @@ ver 0.18.22 (not yet released) +* fix clang 3.6 warnings ver 0.18.21 (2014/12/17) * playlist diff --git a/src/DatabaseGlue.cxx b/src/DatabaseGlue.cxx index fb41b40b7..50deaf48e 100644 --- a/src/DatabaseGlue.cxx +++ b/src/DatabaseGlue.cxx @@ -112,7 +112,10 @@ db_get_root(void) Directory * db_get_directory(const char *name) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(name != nullptr); +#endif if (db == nullptr) return nullptr; diff --git a/src/DecoderPlugin.cxx b/src/DecoderPlugin.cxx index 77ed90882..5170555f5 100644 --- a/src/DecoderPlugin.cxx +++ b/src/DecoderPlugin.cxx @@ -26,7 +26,10 @@ bool DecoderPlugin::SupportsSuffix(const char *suffix) const { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(suffix != nullptr); +#endif return suffixes != nullptr && string_array_contains(suffixes, suffix); @@ -35,7 +38,10 @@ DecoderPlugin::SupportsSuffix(const char *suffix) const bool DecoderPlugin::SupportsMimeType(const char *mime_type) const { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(mime_type != nullptr); +#endif return mime_types != nullptr && string_array_contains(mime_types, mime_type); diff --git a/src/Directory.cxx b/src/Directory.cxx index b2942588e..238bd149c 100644 --- a/src/Directory.cxx +++ b/src/Directory.cxx @@ -40,7 +40,10 @@ extern "C" { inline Directory * Directory::Allocate(const char *path) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(path != nullptr); +#endif const size_t path_size = strlen(path) + 1; Directory *directory = diff --git a/src/InputStream.cxx b/src/InputStream.cxx index 28a0aad1a..73b581d2d 100644 --- a/src/InputStream.cxx +++ b/src/InputStream.cxx @@ -155,7 +155,10 @@ InputStream::IsAvailable() size_t InputStream::Read(void *ptr, size_t _size, Error &error) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(ptr != nullptr); +#endif assert(_size > 0); return plugin.read(this, ptr, _size, error); @@ -164,7 +167,10 @@ InputStream::Read(void *ptr, size_t _size, Error &error) size_t InputStream::LockRead(void *ptr, size_t _size, Error &error) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(ptr != nullptr); +#endif assert(_size > 0); const ScopeLock protect(mutex); diff --git a/src/SongFilter.cxx b/src/SongFilter.cxx index 235dfe7a0..01f9d8bb2 100644 --- a/src/SongFilter.cxx +++ b/src/SongFilter.cxx @@ -78,7 +78,10 @@ SongFilter::Item::Item(unsigned _tag, const char *_value, bool _fold_case) bool SongFilter::Item::StringMatch(const char *s) const { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(s != nullptr); +#endif if (fold_case) { char *p = g_utf8_casefold(s, -1); diff --git a/src/fs/Charset.cxx b/src/fs/Charset.cxx index dad5779f9..0b598ef46 100644 --- a/src/fs/Charset.cxx +++ b/src/fs/Charset.cxx @@ -79,7 +79,10 @@ GetFSCharset() std::string PathToUTF8(const char *path_fs) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(path_fs != nullptr); +#endif if (fs_charset.empty()) return std::string(path_fs); @@ -109,7 +112,10 @@ PathToUTF8(const char *path_fs) char * PathFromUTF8(const char *path_utf8) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(path_utf8 != nullptr); +#endif if (fs_charset.empty()) return g_strdup(path_utf8); diff --git a/src/fs/Traits.cxx b/src/fs/Traits.cxx index 2c3ce075b..47cb5aee3 100644 --- a/src/fs/Traits.cxx +++ b/src/fs/Traits.cxx @@ -25,7 +25,10 @@ const char * PathTraits::GetBaseUTF8(const char *p) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(p != nullptr); +#endif const char *slash = strrchr(p, SEPARATOR_UTF8); return slash != nullptr @@ -36,7 +39,10 @@ PathTraits::GetBaseUTF8(const char *p) std::string PathTraits::GetParentUTF8(const char *p) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(p != nullptr); +#endif const char *slash = strrchr(p, SEPARATOR_UTF8); return slash != nullptr diff --git a/src/tag/TagBuilder.cxx b/src/tag/TagBuilder.cxx index 25e5cc24b..083b43d69 100644 --- a/src/tag/TagBuilder.cxx +++ b/src/tag/TagBuilder.cxx @@ -77,7 +77,10 @@ TagBuilder::Commit() inline void TagBuilder::AddItemInternal(TagType type, const char *value, size_t length) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(value != nullptr); +#endif assert(length > 0); char *p = FixTagString(value, length); @@ -98,7 +101,10 @@ TagBuilder::AddItemInternal(TagType type, const char *value, size_t length) void TagBuilder::AddItem(TagType type, const char *value, size_t length) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(value != nullptr); +#endif if (length == 0 || ignore_tag_items[type]) return; @@ -109,7 +115,10 @@ TagBuilder::AddItem(TagType type, const char *value, size_t length) void TagBuilder::AddItem(TagType type, const char *value) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(value != nullptr); +#endif AddItem(type, value, strlen(value)); } diff --git a/src/util/ASCII.hxx b/src/util/ASCII.hxx index cd26d9dec..9f7147338 100644 --- a/src/util/ASCII.hxx +++ b/src/util/ASCII.hxx @@ -43,8 +43,11 @@ gcc_pure gcc_nonnull_all static inline bool StringEqualsCaseASCII(const char *a, const char *b) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(a != nullptr); assert(b != nullptr); +#endif /* note: strcasecmp() depends on the locale, but for ASCII-only strings, it's safe to use */ @@ -55,8 +58,11 @@ gcc_pure gcc_nonnull_all static inline bool StringEqualsCaseASCII(const char *a, const char *b, size_t n) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(a != nullptr); assert(b != nullptr); +#endif /* note: strcasecmp() depends on the locale, but for ASCII-only strings, it's safe to use */ diff --git a/src/util/UriUtil.cxx b/src/util/UriUtil.cxx index 1783fbca5..6dd5a42e1 100644 --- a/src/util/UriUtil.cxx +++ b/src/util/UriUtil.cxx @@ -128,8 +128,11 @@ uri_remove_auth(const char *uri) bool uri_is_child(const char *parent, const char *child) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(parent != nullptr); assert(child != nullptr); +#endif const size_t parent_length = strlen(parent); return memcmp(parent, child, parent_length) == 0 && -- cgit v1.2.3 From df3317110766f659b6cc3e80b61c5fd88c4ce6b3 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 26 Dec 2014 13:46:07 +0100 Subject: db/{simple,proxy}, ...: add "override" keywords Fixes -Winconsistent-missing-override (clang 3.6). --- src/db/ProxyDatabasePlugin.cxx | 2 +- src/db/SimpleDatabasePlugin.hxx | 2 +- src/filter/ChainFilterPlugin.cxx | 9 +++++---- src/filter/NormalizeFilterPlugin.cxx | 9 +++++---- src/filter/ReplayGainFilterPlugin.cxx | 9 +++++---- src/filter/RouteFilterPlugin.cxx | 9 +++++---- src/filter/VolumeFilterPlugin.cxx | 8 ++++---- 7 files changed, 26 insertions(+), 22 deletions(-) diff --git a/src/db/ProxyDatabasePlugin.cxx b/src/db/ProxyDatabasePlugin.cxx index cb1bcdc6b..92fe6ebac 100644 --- a/src/db/ProxyDatabasePlugin.cxx +++ b/src/db/ProxyDatabasePlugin.cxx @@ -57,7 +57,7 @@ public: virtual void Close() override; virtual Song *GetSong(const char *uri_utf8, Error &error) const override; - virtual void ReturnSong(Song *song) const; + void ReturnSong(Song *song) const override; virtual bool Visit(const DatabaseSelection &selection, VisitDirectory visit_directory, diff --git a/src/db/SimpleDatabasePlugin.hxx b/src/db/SimpleDatabasePlugin.hxx index dfe981dd8..6424feaa6 100644 --- a/src/db/SimpleDatabasePlugin.hxx +++ b/src/db/SimpleDatabasePlugin.hxx @@ -61,7 +61,7 @@ public: virtual Song *GetSong(const char *uri_utf8, Error &error) const override; - virtual void ReturnSong(Song *song) const; + void ReturnSong(Song *song) const override; virtual bool Visit(const DatabaseSelection &selection, VisitDirectory visit_directory, diff --git a/src/filter/ChainFilterPlugin.cxx b/src/filter/ChainFilterPlugin.cxx index cb52b86ca..b000d53ce 100644 --- a/src/filter/ChainFilterPlugin.cxx +++ b/src/filter/ChainFilterPlugin.cxx @@ -52,10 +52,11 @@ public: children.emplace_back(name, filter); } - virtual AudioFormat Open(AudioFormat &af, Error &error) override; - virtual void Close(); - virtual const void *FilterPCM(const void *src, size_t src_size, - size_t *dest_size_r, Error &error); + /* virtual methods from class Filter */ + AudioFormat Open(AudioFormat &af, Error &error) override; + void Close() override; + const void *FilterPCM(const void *src, size_t src_size, + size_t *dest_size_r, Error &error) override; private: /** diff --git a/src/filter/NormalizeFilterPlugin.cxx b/src/filter/NormalizeFilterPlugin.cxx index 6c4f6b0e5..60d0f3204 100644 --- a/src/filter/NormalizeFilterPlugin.cxx +++ b/src/filter/NormalizeFilterPlugin.cxx @@ -34,10 +34,11 @@ class NormalizeFilter final : public Filter { PcmBuffer buffer; public: - virtual AudioFormat Open(AudioFormat &af, Error &error) override; - virtual void Close(); - virtual const void *FilterPCM(const void *src, size_t src_size, - size_t *dest_size_r, Error &error); + /* virtual methods from class Filter */ + AudioFormat Open(AudioFormat &af, Error &error) override; + void Close() override; + const void *FilterPCM(const void *src, size_t src_size, + size_t *dest_size_r, Error &error) override; }; static Filter * diff --git a/src/filter/ReplayGainFilterPlugin.cxx b/src/filter/ReplayGainFilterPlugin.cxx index b2dcde4cc..b79b4fb87 100644 --- a/src/filter/ReplayGainFilterPlugin.cxx +++ b/src/filter/ReplayGainFilterPlugin.cxx @@ -116,10 +116,11 @@ public: */ void Update(); - virtual AudioFormat Open(AudioFormat &af, Error &error) override; - virtual void Close(); - virtual const void *FilterPCM(const void *src, size_t src_size, - size_t *dest_size_r, Error &error); + /* virtual methods from class Filter */ + AudioFormat Open(AudioFormat &af, Error &error) override; + void Close() override; + const void *FilterPCM(const void *src, size_t src_size, + size_t *dest_size_r, Error &error) override; }; void diff --git a/src/filter/RouteFilterPlugin.cxx b/src/filter/RouteFilterPlugin.cxx index d9042c21f..335cfe6bd 100644 --- a/src/filter/RouteFilterPlugin.cxx +++ b/src/filter/RouteFilterPlugin.cxx @@ -120,10 +120,11 @@ public: */ bool Configure(const config_param ¶m, Error &error); - virtual AudioFormat Open(AudioFormat &af, Error &error) override; - virtual void Close(); - virtual const void *FilterPCM(const void *src, size_t src_size, - size_t *dest_size_r, Error &error); + /* virtual methods from class Filter */ + AudioFormat Open(AudioFormat &af, Error &error) override; + void Close() override; + const void *FilterPCM(const void *src, size_t src_size, + size_t *dest_size_r, Error &error) override; }; bool diff --git a/src/filter/VolumeFilterPlugin.cxx b/src/filter/VolumeFilterPlugin.cxx index 1b663f6eb..66afdea88 100644 --- a/src/filter/VolumeFilterPlugin.cxx +++ b/src/filter/VolumeFilterPlugin.cxx @@ -57,10 +57,10 @@ public: volume = _volume; } - virtual AudioFormat Open(AudioFormat &af, Error &error) override; - virtual void Close(); - virtual const void *FilterPCM(const void *src, size_t src_size, - size_t *dest_size_r, Error &error); + AudioFormat Open(AudioFormat &af, Error &error) override; + void Close() override; + const void *FilterPCM(const void *src, size_t src_size, + size_t *dest_size_r, Error &error) override; }; static constexpr Domain volume_domain("pcm_volume"); -- cgit v1.2.3 From 665031467a55a32be306191514ac81f73ac41de7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 26 Dec 2014 13:50:54 +0100 Subject: db/proxy, output/shout: fix implicit nullptr/bool conversion Return false on error, not nullptr. --- src/db/ProxyDatabasePlugin.cxx | 6 +++--- src/output/ShoutOutputPlugin.cxx | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/db/ProxyDatabasePlugin.cxx b/src/db/ProxyDatabasePlugin.cxx index 92fe6ebac..1751e0950 100644 --- a/src/db/ProxyDatabasePlugin.cxx +++ b/src/db/ProxyDatabasePlugin.cxx @@ -592,7 +592,7 @@ ProxyDatabase::Visit(const DatabaseSelection &selection, { // TODO: eliminate the const_cast if (!const_cast(this)->EnsureConnected(error)) - return nullptr; + return false; if (!visit_directory && !visit_playlist && selection.recursive && (ServerSupportsSearchBase(connection) @@ -617,7 +617,7 @@ ProxyDatabase::VisitUniqueTags(const DatabaseSelection &selection, { // TODO: eliminate the const_cast if (!const_cast(this)->EnsureConnected(error)) - return nullptr; + return false; enum mpd_tag_type tag_type2 = Convert(tag_type); if (tag_type2 == MPD_TAG_COUNT) { @@ -657,7 +657,7 @@ ProxyDatabase::GetStats(const DatabaseSelection &selection, // TODO: eliminate the const_cast if (!const_cast(this)->EnsureConnected(error)) - return nullptr; + return false; struct mpd_stats *stats2 = mpd_run_stats(connection); diff --git a/src/output/ShoutOutputPlugin.cxx b/src/output/ShoutOutputPlugin.cxx index 19f2b61cd..abef8d0b7 100644 --- a/src/output/ShoutOutputPlugin.cxx +++ b/src/output/ShoutOutputPlugin.cxx @@ -114,7 +114,7 @@ ShoutOutput::Configure(const config_param ¶m, Error &error) if (!audio_format.IsFullyDefined()) { error.Set(config_domain, "Need full audio format specification"); - return nullptr; + return false; } const char *host = require_block_string(param, "host"); -- cgit v1.2.3 From 34180f1745605e6dd1e5b56bda9090b27a626db7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 26 Dec 2014 13:54:33 +0100 Subject: doc/user: add libicu-dev to Debian build dependencies --- doc/user.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user.xml b/doc/user.xml index bc43a4167..a313e4e1d 100644 --- a/doc/user.xml +++ b/doc/user.xml @@ -110,7 +110,7 @@ apt-get install g++ automake autoconf \ libsystemd-daemon-dev libwrap0-dev \ libcppunit-dev xmlto \ libboost-dev \ - libglib2.0-dev + libglib2.0-dev libicu-dev -- cgit v1.2.3 From b295024574325a8f08137c812460d069e433f227 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 26 Dec 2014 13:56:26 +0100 Subject: doc/user: add more Debian build dependencies --- doc/user.xml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/user.xml b/doc/user.xml index a313e4e1d..718731d3c 100644 --- a/doc/user.xml +++ b/doc/user.xml @@ -98,13 +98,15 @@ apt-get install g++ automake autoconf \ libsidplay2-dev libsidutils-dev libresid-builder-dev \ libavcodec-dev libavformat-dev \ libmp3lame-dev \ - libsamplerate0-dev \ + libsamplerate0-dev libsoxr-dev \ libbz2-dev libcdio-paranoia-dev libiso9660-dev libmms-dev \ libzzip-dev \ - libcurl4-gnutls-dev libyajl-dev \ + libcurl4-gnutls-dev libyajl-dev libexpat-dev \ libasound2-dev libao-dev libjack-jackd2-dev libopenal-dev \ libpulse-dev libroar-dev libshout3-dev \ libmpdclient-dev \ + libnfs-dev libsmbclient-dev \ + libupnp-dev \ libavahi-client-dev \ libsqlite3-dev \ libsystemd-daemon-dev libwrap0-dev \ -- cgit v1.2.3 From 5b84c99d793bf9b78cf28b462593775c32a3ce83 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 26 Dec 2014 14:00:50 +0100 Subject: doc/user: remove autoconf/automake from Debian build dependencies --- doc/user.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/user.xml b/doc/user.xml index 718731d3c..a0bd861e8 100644 --- a/doc/user.xml +++ b/doc/user.xml @@ -89,7 +89,7 @@ cd mpd-version -apt-get install g++ automake autoconf \ +apt-get install g++ \ libmad0-dev libmpg123-dev libid3tag0-dev \ libflac-dev libvorbis-dev libopus-dev \ libadplug-dev libaudiofile-dev libsndfile1-dev libfaad-dev \ -- cgit v1.2.3 From 9f7fd1fbfb0e351d42657b1094c34b0f2233ef6c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 26 Dec 2014 14:29:26 +0100 Subject: db/lazy, input/mms: add "override" keywords Fixes -Winconsistent-missing-override (clang 3.6). --- src/db/plugins/LazyDatabase.hxx | 2 +- src/db/plugins/upnp/UpnpDatabasePlugin.cxx | 6 ++++-- src/input/plugins/MmsInputPlugin.cxx | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/db/plugins/LazyDatabase.hxx b/src/db/plugins/LazyDatabase.hxx index ae1b961d0..38b3fdc2a 100644 --- a/src/db/plugins/LazyDatabase.hxx +++ b/src/db/plugins/LazyDatabase.hxx @@ -43,7 +43,7 @@ public: virtual const LightSong *GetSong(const char *uri_utf8, Error &error) const override; - virtual void ReturnSong(const LightSong *song) const; + void ReturnSong(const LightSong *song) const override; virtual bool Visit(const DatabaseSelection &selection, VisitDirectory visit_directory, diff --git a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx index 21ddb8790..9970cdcf3 100644 --- a/src/db/plugins/upnp/UpnpDatabasePlugin.cxx +++ b/src/db/plugins/upnp/UpnpDatabasePlugin.cxx @@ -85,7 +85,7 @@ public: virtual void Close() override; virtual const LightSong *GetSong(const char *uri_utf8, Error &error) const override; - virtual void ReturnSong(const LightSong *song) const; + void ReturnSong(const LightSong *song) const override; virtual bool Visit(const DatabaseSelection &selection, VisitDirectory visit_directory, @@ -101,7 +101,9 @@ public: virtual bool GetStats(const DatabaseSelection &selection, DatabaseStats &stats, Error &error) const override; - virtual time_t GetUpdateStamp() const {return 0;} + time_t GetUpdateStamp() const override { + return 0; + } protected: bool Configure(const config_param ¶m, Error &error); diff --git a/src/input/plugins/MmsInputPlugin.cxx b/src/input/plugins/MmsInputPlugin.cxx index df291bc84..d01cff3b3 100644 --- a/src/input/plugins/MmsInputPlugin.cxx +++ b/src/input/plugins/MmsInputPlugin.cxx @@ -43,7 +43,7 @@ protected: virtual size_t ThreadRead(void *ptr, size_t size, Error &error) override; - virtual void Close() { + void Close() override { mmsx_close(mms); } }; -- cgit v1.2.3 From 95f84afd338a9333b2fcf05dc171ce1dad6fbe7c Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 26 Dec 2014 14:28:01 +0100 Subject: fs/Traits, ...: work around -Wtautological-pointer-compare New in clang 3.6. --- src/Idle.cxx | 3 +++ src/SongLoader.cxx | 3 +++ src/db/plugins/simple/SimpleDatabasePlugin.cxx | 5 ++++- src/fs/Traits.hxx | 16 ++++++++++++++++ src/lib/icu/Collate.cxx | 6 ++++++ 5 files changed, 32 insertions(+), 1 deletion(-) diff --git a/src/Idle.cxx b/src/Idle.cxx index 8fe672200..0b66065de 100644 --- a/src/Idle.cxx +++ b/src/Idle.cxx @@ -76,7 +76,10 @@ idle_get_names(void) unsigned idle_parse_name(const char *name) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(name != nullptr); +#endif for (unsigned i = 0; idle_names[i] != nullptr; ++i) if (StringEqualsCaseASCII(name, idle_names[i])) diff --git a/src/SongLoader.cxx b/src/SongLoader.cxx index c766a16a9..43e57e93b 100644 --- a/src/SongLoader.cxx +++ b/src/SongLoader.cxx @@ -77,7 +77,10 @@ SongLoader::LoadFile(const char *path_utf8, Error &error) const DetachedSong * SongLoader::LoadSong(const char *uri_utf8, Error &error) const { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(uri_utf8 != nullptr); +#endif if (memcmp(uri_utf8, "file:///", 8) == 0) /* absolute path */ diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.cxx b/src/db/plugins/simple/SimpleDatabasePlugin.cxx index 7b1886f1c..a0472462a 100644 --- a/src/db/plugins/simple/SimpleDatabasePlugin.cxx +++ b/src/db/plugins/simple/SimpleDatabasePlugin.cxx @@ -435,9 +435,12 @@ SimpleDatabase::Save(Error &error) bool SimpleDatabase::Mount(const char *uri, Database *db, Error &error) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(uri != nullptr); - assert(*uri != 0); assert(db != nullptr); +#endif + assert(*uri != 0); ScopeDatabaseLock protect; diff --git a/src/fs/Traits.hxx b/src/fs/Traits.hxx index 77317e1ee..1af8f8672 100644 --- a/src/fs/Traits.hxx +++ b/src/fs/Traits.hxx @@ -57,7 +57,11 @@ struct PathTraitsFS { gcc_pure gcc_nonnull_all static const_pointer FindLastSeparator(const_pointer p) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(p != nullptr); +#endif + #ifdef WIN32 const_pointer pos = p + GetLength(p); while (p != pos && !IsSeparator(*pos)) @@ -77,7 +81,11 @@ struct PathTraitsFS { gcc_pure gcc_nonnull_all static bool IsAbsolute(const_pointer p) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(p != nullptr); +#endif + #ifdef WIN32 if (IsDrive(p) && IsSeparator(p[2])) return true; @@ -147,7 +155,11 @@ struct PathTraitsUTF8 { gcc_pure gcc_nonnull_all static const_pointer FindLastSeparator(const_pointer p) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(p != nullptr); +#endif + return strrchr(p, SEPARATOR); } @@ -160,7 +172,11 @@ struct PathTraitsUTF8 { gcc_pure gcc_nonnull_all static bool IsAbsolute(const_pointer p) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(p != nullptr); +#endif + #ifdef WIN32 if (IsDrive(p) && IsSeparator(p[2])) return true; diff --git a/src/lib/icu/Collate.cxx b/src/lib/icu/Collate.cxx index b8560a4d8..17b536b37 100644 --- a/src/lib/icu/Collate.cxx +++ b/src/lib/icu/Collate.cxx @@ -121,8 +121,11 @@ gcc_pure int IcuCollate(const char *a, const char *b) { +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(a != nullptr); assert(b != nullptr); +#endif #ifdef HAVE_ICU assert(collator != nullptr); @@ -159,7 +162,10 @@ IcuCaseFold(const char *src) { #ifdef HAVE_ICU assert(collator != nullptr); +#if !CLANG_CHECK_VERSION(3,6) + /* disabled on clang due to -Wtautological-pointer-compare */ assert(src != nullptr); +#endif const auto u = UCharFromUTF8(src); if (u.IsNull()) -- cgit v1.2.3 From 163597ef6939e4250afafe12f821aa732b1fc2b7 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 26 Dec 2014 14:31:00 +0100 Subject: db/simple: fix implicit nullptr/bool conversion Return false on error, not nullptr. --- src/db/plugins/simple/SimpleDatabasePlugin.cxx | 6 +++--- src/pcm/FormatConverter.cxx | 2 +- src/storage/plugins/NfsStorage.cxx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/db/plugins/simple/SimpleDatabasePlugin.cxx b/src/db/plugins/simple/SimpleDatabasePlugin.cxx index a0472462a..d6ad5e91f 100644 --- a/src/db/plugins/simple/SimpleDatabasePlugin.cxx +++ b/src/db/plugins/simple/SimpleDatabasePlugin.cxx @@ -448,13 +448,13 @@ SimpleDatabase::Mount(const char *uri, Database *db, Error &error) if (r.uri == nullptr) { error.Format(db_domain, DB_CONFLICT, "Already exists: %s", uri); - return nullptr; + return false; } if (strchr(r.uri, '/') != nullptr) { error.Format(db_domain, DB_NOT_FOUND, "Parent not found: %s", uri); - return nullptr; + return false; } Directory *mnt = r.directory->CreateChild(r.uri); @@ -481,7 +481,7 @@ SimpleDatabase::Mount(const char *local_uri, const char *storage_uri, if (cache_path.IsNull()) { error.Format(db_domain, DB_NOT_FOUND, "No 'cache_directory' configured"); - return nullptr; + return false; } std::string name(storage_uri); diff --git a/src/pcm/FormatConverter.cxx b/src/pcm/FormatConverter.cxx index b058b32f5..8874e1b3c 100644 --- a/src/pcm/FormatConverter.cxx +++ b/src/pcm/FormatConverter.cxx @@ -44,7 +44,7 @@ PcmFormatConverter::Open(SampleFormat _src_format, SampleFormat _dest_format, "PCM conversion from %s to %s is not implemented", sample_format_to_string(_src_format), sample_format_to_string(_dest_format)); - return nullptr; + return false; case SampleFormat::S16: case SampleFormat::S24_P32: diff --git a/src/storage/plugins/NfsStorage.cxx b/src/storage/plugins/NfsStorage.cxx index 823d662c5..324b40b6f 100644 --- a/src/storage/plugins/NfsStorage.cxx +++ b/src/storage/plugins/NfsStorage.cxx @@ -288,7 +288,7 @@ NfsStorage::GetInfo(const char *uri_utf8, gcc_unused bool follow, return false; if (!WaitConnected(error)) - return nullptr; + return false; NfsGetInfoOperation operation(*connection, path.c_str(), info); return operation.Run(error); -- cgit v1.2.3