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(-) (limited to 'src') 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(-) (limited to 'src') 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(-) (limited to 'src') 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(+) (limited to 'src') 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(-) (limited to 'src') 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(-) (limited to 'src') 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. --- 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 +++ 10 files changed, 51 insertions(+) (limited to 'src') 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(-) (limited to 'src') 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(-) (limited to 'src') 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