util/{ASCII,UriUtil}, ...: work around -Wtautological-pointer-compare
New in clang 3.6.
This commit is contained in:
parent
a5049136ff
commit
53f4044890
1
NEWS
1
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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 =
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 &&
|
||||
|
|
Loading…
Reference in New Issue