Compare commits
31 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f33d2fb2e7 | ||
|
|
a9eec35aff | ||
|
|
8534f2d1e2 | ||
|
|
00740fb23b | ||
|
|
37e9010887 | ||
|
|
4bd2c75056 | ||
|
|
b9ed850b98 | ||
|
|
11cea17496 | ||
|
|
163597ef69 | ||
|
|
95f84afd33 | ||
|
|
9f7fd1fbfb | ||
|
|
940cab8620 | ||
|
|
5b84c99d79 | ||
|
|
b295024574 | ||
|
|
34180f1745 | ||
|
|
665031467a | ||
|
|
df33171107 | ||
|
|
53f4044890 | ||
|
|
a5049136ff | ||
|
|
705b3c6b63 | ||
|
|
6b4ac66962 | ||
|
|
0964b06240 | ||
|
|
92eeca3ba7 | ||
|
|
2a86554ac4 | ||
|
|
805caa30ce | ||
|
|
a56949e9fa | ||
|
|
43da4c0eca | ||
|
|
b9c7771830 | ||
|
|
35db88affe | ||
|
|
e38faca455 | ||
|
|
0255e8710c |
13
NEWS
13
NEWS
@@ -1,3 +1,13 @@
|
|||||||
|
ver 0.19.8 (2015/01/14)
|
||||||
|
* input
|
||||||
|
- curl: fix bug after rewinding from end-of-file
|
||||||
|
- mms: reduce delay at the beginning of playback
|
||||||
|
* decoder
|
||||||
|
- dsdiff, dsf: allow ID3 tags larger than 4 kB
|
||||||
|
- ffmpeg: support interleaved floating point
|
||||||
|
* fix clang 3.6 warnings
|
||||||
|
* fix build failure on NetBSD
|
||||||
|
|
||||||
ver 0.19.7 (2014/12/17)
|
ver 0.19.7 (2014/12/17)
|
||||||
* input
|
* input
|
||||||
- nfs: fix crash while canceling a failing file open operation
|
- nfs: fix crash while canceling a failing file open operation
|
||||||
@@ -161,6 +171,9 @@ ver 0.19 (2014/10/10)
|
|||||||
* install systemd unit for socket activation
|
* install systemd unit for socket activation
|
||||||
* Android port
|
* Android port
|
||||||
|
|
||||||
|
ver 0.18.22 (2014/01/14)
|
||||||
|
* fix clang 3.6 warnings
|
||||||
|
|
||||||
ver 0.18.21 (2014/12/17)
|
ver 0.18.21 (2014/12/17)
|
||||||
* playlist
|
* playlist
|
||||||
- embcue: fix filename suffix detection
|
- embcue: fix filename suffix detection
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="org.musicpd"
|
package="org.musicpd"
|
||||||
android:installLocation="auto"
|
android:installLocation="auto"
|
||||||
android:versionCode="10"
|
android:versionCode="12"
|
||||||
android:versionName="0.19.6">
|
android:versionName="0.19.8">
|
||||||
|
|
||||||
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="17"/>
|
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="17"/>
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ if not os.path.isdir(ndk_path):
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
# the path to the MPD sources
|
# the path to the MPD sources
|
||||||
mpd_path = os.path.dirname(os.path.dirname(sys.argv[0]))
|
mpd_path = os.path.dirname(os.path.dirname(sys.argv[0])) or '.'
|
||||||
|
|
||||||
# output directories
|
# output directories
|
||||||
lib_path = os.path.abspath('lib')
|
lib_path = os.path.abspath('lib')
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
AC_PREREQ(2.60)
|
AC_PREREQ(2.60)
|
||||||
|
|
||||||
AC_INIT(mpd, 0.19.7, musicpd-dev-team@lists.sourceforge.net)
|
AC_INIT(mpd, 0.19.8, musicpd-dev-team@lists.sourceforge.net)
|
||||||
|
|
||||||
VERSION_MAJOR=0
|
VERSION_MAJOR=0
|
||||||
VERSION_MINOR=19
|
VERSION_MINOR=19
|
||||||
VERSION_REVISION=7
|
VERSION_REVISION=8
|
||||||
VERSION_EXTRA=0
|
VERSION_EXTRA=0
|
||||||
|
|
||||||
AC_CONFIG_SRCDIR([src/Main.cxx])
|
AC_CONFIG_SRCDIR([src/Main.cxx])
|
||||||
|
|||||||
10
doc/user.xml
10
doc/user.xml
@@ -89,7 +89,7 @@ cd mpd-version</programlisting>
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<programlisting>
|
<programlisting>
|
||||||
apt-get install g++ automake autoconf \
|
apt-get install g++ \
|
||||||
libmad0-dev libmpg123-dev libid3tag0-dev \
|
libmad0-dev libmpg123-dev libid3tag0-dev \
|
||||||
libflac-dev libvorbis-dev libopus-dev \
|
libflac-dev libvorbis-dev libopus-dev \
|
||||||
libadplug-dev libaudiofile-dev libsndfile1-dev libfaad-dev \
|
libadplug-dev libaudiofile-dev libsndfile1-dev libfaad-dev \
|
||||||
@@ -98,19 +98,21 @@ apt-get install g++ automake autoconf \
|
|||||||
libsidplay2-dev libsidutils-dev libresid-builder-dev \
|
libsidplay2-dev libsidutils-dev libresid-builder-dev \
|
||||||
libavcodec-dev libavformat-dev \
|
libavcodec-dev libavformat-dev \
|
||||||
libmp3lame-dev \
|
libmp3lame-dev \
|
||||||
libsamplerate0-dev \
|
libsamplerate0-dev libsoxr-dev \
|
||||||
libbz2-dev libcdio-paranoia-dev libiso9660-dev libmms-dev \
|
libbz2-dev libcdio-paranoia-dev libiso9660-dev libmms-dev \
|
||||||
libzzip-dev \
|
libzzip-dev \
|
||||||
libcurl4-gnutls-dev libyajl-dev \
|
libcurl4-gnutls-dev libyajl-dev libexpat-dev \
|
||||||
libasound2-dev libao-dev libjack-jackd2-dev libopenal-dev \
|
libasound2-dev libao-dev libjack-jackd2-dev libopenal-dev \
|
||||||
libpulse-dev libroar-dev libshout3-dev \
|
libpulse-dev libroar-dev libshout3-dev \
|
||||||
libmpdclient-dev \
|
libmpdclient-dev \
|
||||||
|
libnfs-dev libsmbclient-dev \
|
||||||
|
libupnp-dev \
|
||||||
libavahi-client-dev \
|
libavahi-client-dev \
|
||||||
libsqlite3-dev \
|
libsqlite3-dev \
|
||||||
libsystemd-daemon-dev libwrap0-dev \
|
libsystemd-daemon-dev libwrap0-dev \
|
||||||
libcppunit-dev xmlto \
|
libcppunit-dev xmlto \
|
||||||
libboost-dev \
|
libboost-dev \
|
||||||
libglib2.0-dev
|
libglib2.0-dev libicu-dev
|
||||||
</programlisting>
|
</programlisting>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
|
|||||||
@@ -20,33 +20,45 @@
|
|||||||
#ifndef COMPILER_H
|
#ifndef COMPILER_H
|
||||||
#define COMPILER_H
|
#define COMPILER_H
|
||||||
|
|
||||||
#define GCC_CHECK_VERSION(major, minor) \
|
#define GCC_MAKE_VERSION(major, minor, patchlevel) ((major) * 10000 + (minor) * 100 + patchlevel)
|
||||||
(defined(__GNUC__) && \
|
|
||||||
(__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))))
|
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define GCC_VERSION (__GNUC__ * 10000 \
|
#define GCC_VERSION GCC_MAKE_VERSION(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__)
|
||||||
+ __GNUC_MINOR__ * 100 \
|
|
||||||
+ __GNUC_PATCHLEVEL__)
|
|
||||||
#else
|
#else
|
||||||
#define GCC_VERSION 0
|
#define GCC_VERSION 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#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__
|
#ifdef __clang__
|
||||||
# define CLANG_VERSION (__clang_major__ * 10000 \
|
# define CLANG_VERSION GCC_MAKE_VERSION(__clang_major__, __clang_minor__, __clang_patchlevel__)
|
||||||
+ __clang_minor__ * 100 \
|
|
||||||
+ __clang_patchlevel__)
|
|
||||||
# if __clang_major__ < 3
|
# if __clang_major__ < 3
|
||||||
# error Sorry, your clang version is too old. You need at least version 3.1.
|
# error Sorry, your clang version is too old. You need at least version 3.1.
|
||||||
# endif
|
# endif
|
||||||
#elif defined(__GNUC__)
|
#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.
|
# error Sorry, your gcc version is too old. You need at least version 4.6.
|
||||||
# endif
|
# endif
|
||||||
#else
|
#else
|
||||||
# warning Untested compiler. Use at your own risk!
|
# warning Untested compiler. Use at your own risk!
|
||||||
#endif
|
#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)
|
#if GCC_CHECK_VERSION(4,0)
|
||||||
|
|
||||||
/* GCC 4.x */
|
/* GCC 4.x */
|
||||||
@@ -141,7 +153,7 @@
|
|||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
|
|
||||||
/* support for C++11 "override" was added in gcc 4.7 */
|
/* 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 override
|
||||||
#define final
|
#define final
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -76,7 +76,10 @@ idle_get_names(void)
|
|||||||
unsigned
|
unsigned
|
||||||
idle_parse_name(const char *name)
|
idle_parse_name(const char *name)
|
||||||
{
|
{
|
||||||
|
#if !CLANG_CHECK_VERSION(3,6)
|
||||||
|
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||||
assert(name != nullptr);
|
assert(name != nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
for (unsigned i = 0; idle_names[i] != nullptr; ++i)
|
for (unsigned i = 0; idle_names[i] != nullptr; ++i)
|
||||||
if (StringEqualsCaseASCII(name, idle_names[i]))
|
if (StringEqualsCaseASCII(name, idle_names[i]))
|
||||||
|
|||||||
@@ -77,7 +77,10 @@ SongFilter::Item::Item(unsigned _tag, time_t _time)
|
|||||||
bool
|
bool
|
||||||
SongFilter::Item::StringMatch(const char *s) const
|
SongFilter::Item::StringMatch(const char *s) const
|
||||||
{
|
{
|
||||||
|
#if !CLANG_CHECK_VERSION(3,6)
|
||||||
|
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||||
assert(s != nullptr);
|
assert(s != nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (fold_case) {
|
if (fold_case) {
|
||||||
const std::string folded = IcuCaseFold(s);
|
const std::string folded = IcuCaseFold(s);
|
||||||
|
|||||||
@@ -77,7 +77,10 @@ SongLoader::LoadFile(const char *path_utf8, Error &error) const
|
|||||||
DetachedSong *
|
DetachedSong *
|
||||||
SongLoader::LoadSong(const char *uri_utf8, Error &error) const
|
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);
|
assert(uri_utf8 != nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (memcmp(uri_utf8, "file:///", 8) == 0)
|
if (memcmp(uri_utf8, "file:///", 8) == 0)
|
||||||
/* absolute path */
|
/* absolute path */
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ public:
|
|||||||
|
|
||||||
virtual const LightSong *GetSong(const char *uri_utf8,
|
virtual const LightSong *GetSong(const char *uri_utf8,
|
||||||
Error &error) const override;
|
Error &error) const override;
|
||||||
virtual void ReturnSong(const LightSong *song) const;
|
void ReturnSong(const LightSong *song) const override;
|
||||||
|
|
||||||
virtual bool Visit(const DatabaseSelection &selection,
|
virtual bool Visit(const DatabaseSelection &selection,
|
||||||
VisitDirectory visit_directory,
|
VisitDirectory visit_directory,
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public:
|
|||||||
virtual void Close() override;
|
virtual void Close() override;
|
||||||
virtual const LightSong *GetSong(const char *uri_utf8,
|
virtual const LightSong *GetSong(const char *uri_utf8,
|
||||||
Error &error) const override;
|
Error &error) const override;
|
||||||
virtual void ReturnSong(const LightSong *song) const;
|
void ReturnSong(const LightSong *song) const override;
|
||||||
|
|
||||||
virtual bool Visit(const DatabaseSelection &selection,
|
virtual bool Visit(const DatabaseSelection &selection,
|
||||||
VisitDirectory visit_directory,
|
VisitDirectory visit_directory,
|
||||||
@@ -731,7 +731,7 @@ ProxyDatabase::Visit(const DatabaseSelection &selection,
|
|||||||
{
|
{
|
||||||
// TODO: eliminate the const_cast
|
// TODO: eliminate the const_cast
|
||||||
if (!const_cast<ProxyDatabase *>(this)->EnsureConnected(error))
|
if (!const_cast<ProxyDatabase *>(this)->EnsureConnected(error))
|
||||||
return nullptr;
|
return false;
|
||||||
|
|
||||||
if (!visit_directory && !visit_playlist && selection.recursive &&
|
if (!visit_directory && !visit_playlist && selection.recursive &&
|
||||||
(ServerSupportsSearchBase(connection)
|
(ServerSupportsSearchBase(connection)
|
||||||
@@ -757,7 +757,7 @@ ProxyDatabase::VisitUniqueTags(const DatabaseSelection &selection,
|
|||||||
{
|
{
|
||||||
// TODO: eliminate the const_cast
|
// TODO: eliminate the const_cast
|
||||||
if (!const_cast<ProxyDatabase *>(this)->EnsureConnected(error))
|
if (!const_cast<ProxyDatabase *>(this)->EnsureConnected(error))
|
||||||
return nullptr;
|
return false;
|
||||||
|
|
||||||
enum mpd_tag_type tag_type2 = Convert(tag_type);
|
enum mpd_tag_type tag_type2 = Convert(tag_type);
|
||||||
if (tag_type2 == MPD_TAG_COUNT) {
|
if (tag_type2 == MPD_TAG_COUNT) {
|
||||||
@@ -810,7 +810,7 @@ ProxyDatabase::GetStats(const DatabaseSelection &selection,
|
|||||||
|
|
||||||
// TODO: eliminate the const_cast
|
// TODO: eliminate the const_cast
|
||||||
if (!const_cast<ProxyDatabase *>(this)->EnsureConnected(error))
|
if (!const_cast<ProxyDatabase *>(this)->EnsureConnected(error))
|
||||||
return nullptr;
|
return false;
|
||||||
|
|
||||||
struct mpd_stats *stats2 =
|
struct mpd_stats *stats2 =
|
||||||
mpd_run_stats(connection);
|
mpd_run_stats(connection);
|
||||||
|
|||||||
@@ -435,9 +435,12 @@ SimpleDatabase::Save(Error &error)
|
|||||||
bool
|
bool
|
||||||
SimpleDatabase::Mount(const char *uri, Database *db, Error &error)
|
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 != nullptr);
|
||||||
assert(*uri != 0);
|
|
||||||
assert(db != nullptr);
|
assert(db != nullptr);
|
||||||
|
#endif
|
||||||
|
assert(*uri != 0);
|
||||||
|
|
||||||
ScopeDatabaseLock protect;
|
ScopeDatabaseLock protect;
|
||||||
|
|
||||||
@@ -445,13 +448,13 @@ SimpleDatabase::Mount(const char *uri, Database *db, Error &error)
|
|||||||
if (r.uri == nullptr) {
|
if (r.uri == nullptr) {
|
||||||
error.Format(db_domain, DB_CONFLICT,
|
error.Format(db_domain, DB_CONFLICT,
|
||||||
"Already exists: %s", uri);
|
"Already exists: %s", uri);
|
||||||
return nullptr;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strchr(r.uri, '/') != nullptr) {
|
if (strchr(r.uri, '/') != nullptr) {
|
||||||
error.Format(db_domain, DB_NOT_FOUND,
|
error.Format(db_domain, DB_NOT_FOUND,
|
||||||
"Parent not found: %s", uri);
|
"Parent not found: %s", uri);
|
||||||
return nullptr;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Directory *mnt = r.directory->CreateChild(r.uri);
|
Directory *mnt = r.directory->CreateChild(r.uri);
|
||||||
@@ -478,7 +481,7 @@ SimpleDatabase::Mount(const char *local_uri, const char *storage_uri,
|
|||||||
if (cache_path.IsNull()) {
|
if (cache_path.IsNull()) {
|
||||||
error.Format(db_domain, DB_NOT_FOUND,
|
error.Format(db_domain, DB_NOT_FOUND,
|
||||||
"No 'cache_directory' configured");
|
"No 'cache_directory' configured");
|
||||||
return nullptr;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string name(storage_uri);
|
std::string name(storage_uri);
|
||||||
|
|||||||
@@ -110,9 +110,9 @@ public:
|
|||||||
virtual bool Open(Error &error) override;
|
virtual bool Open(Error &error) override;
|
||||||
virtual void Close() override;
|
virtual void Close() override;
|
||||||
|
|
||||||
virtual const LightSong *GetSong(const char *uri_utf8,
|
const LightSong *GetSong(const char *uri_utf8,
|
||||||
Error &error) const override;
|
Error &error) const override;
|
||||||
virtual void ReturnSong(const LightSong *song) const;
|
void ReturnSong(const LightSong *song) const override;
|
||||||
|
|
||||||
virtual bool Visit(const DatabaseSelection &selection,
|
virtual bool Visit(const DatabaseSelection &selection,
|
||||||
VisitDirectory visit_directory,
|
VisitDirectory visit_directory,
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ public:
|
|||||||
virtual void Close() override;
|
virtual void Close() override;
|
||||||
virtual const LightSong *GetSong(const char *uri_utf8,
|
virtual const LightSong *GetSong(const char *uri_utf8,
|
||||||
Error &error) const override;
|
Error &error) const override;
|
||||||
virtual void ReturnSong(const LightSong *song) const;
|
void ReturnSong(const LightSong *song) const override;
|
||||||
|
|
||||||
virtual bool Visit(const DatabaseSelection &selection,
|
virtual bool Visit(const DatabaseSelection &selection,
|
||||||
VisitDirectory visit_directory,
|
VisitDirectory visit_directory,
|
||||||
@@ -101,7 +101,9 @@ public:
|
|||||||
virtual bool GetStats(const DatabaseSelection &selection,
|
virtual bool GetStats(const DatabaseSelection &selection,
|
||||||
DatabaseStats &stats,
|
DatabaseStats &stats,
|
||||||
Error &error) const override;
|
Error &error) const override;
|
||||||
virtual time_t GetUpdateStamp() const {return 0;}
|
time_t GetUpdateStamp() const override {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool Configure(const config_param ¶m, Error &error);
|
bool Configure(const config_param ¶m, Error &error);
|
||||||
|
|||||||
@@ -26,7 +26,10 @@
|
|||||||
bool
|
bool
|
||||||
DecoderPlugin::SupportsSuffix(const char *suffix) const
|
DecoderPlugin::SupportsSuffix(const char *suffix) const
|
||||||
{
|
{
|
||||||
|
#if !CLANG_CHECK_VERSION(3,6)
|
||||||
|
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||||
assert(suffix != nullptr);
|
assert(suffix != nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
return suffixes != nullptr && string_array_contains(suffixes, suffix);
|
return suffixes != nullptr && string_array_contains(suffixes, suffix);
|
||||||
|
|
||||||
@@ -35,7 +38,10 @@ DecoderPlugin::SupportsSuffix(const char *suffix) const
|
|||||||
bool
|
bool
|
||||||
DecoderPlugin::SupportsMimeType(const char *mime_type) const
|
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);
|
assert(mime_type != nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
return mime_types != nullptr &&
|
return mime_types != nullptr &&
|
||||||
string_array_contains(mime_types, mime_type);
|
string_array_contains(mime_types, mime_type);
|
||||||
|
|||||||
@@ -29,8 +29,10 @@
|
|||||||
#include "input/InputStream.hxx"
|
#include "input/InputStream.hxx"
|
||||||
#include "tag/TagId3.hxx"
|
#include "tag/TagId3.hxx"
|
||||||
#include "util/Error.hxx"
|
#include "util/Error.hxx"
|
||||||
|
#include "util/Alloc.hxx"
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
#ifdef HAVE_ID3TAG
|
#ifdef HAVE_ID3TAG
|
||||||
#include <id3tag.h>
|
#include <id3tag.h>
|
||||||
@@ -123,22 +125,27 @@ dsdlib_tag_id3(InputStream &is,
|
|||||||
|
|
||||||
const id3_length_t count = size - offset;
|
const id3_length_t count = size - offset;
|
||||||
|
|
||||||
/* Check and limit id3 tag size to prevent a stack overflow */
|
if (count < 10 || count > 256*1024)
|
||||||
id3_byte_t dsdid3[4096];
|
|
||||||
if (count == 0 || count > sizeof(dsdid3))
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!decoder_read_full(nullptr, is, dsdid3, count))
|
id3_byte_t *const id3_buf = static_cast<id3_byte_t*>(xalloc(count));
|
||||||
return;
|
|
||||||
|
|
||||||
struct id3_tag *id3_tag = id3_tag_parse(dsdid3, count);
|
if (!decoder_read_full(nullptr, is, id3_buf, count)) {
|
||||||
if (id3_tag == nullptr)
|
free(id3_buf);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct id3_tag *id3_tag = id3_tag_parse(id3_buf, count);
|
||||||
|
if (id3_tag == nullptr) {
|
||||||
|
free(id3_buf);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
scan_id3_tag(id3_tag, handler, handler_ctx);
|
scan_id3_tag(id3_tag, handler, handler_ctx);
|
||||||
|
|
||||||
id3_tag_delete(id3_tag);
|
id3_tag_delete(id3_tag);
|
||||||
|
|
||||||
|
free(id3_buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -374,6 +374,7 @@ ffmpeg_sample_format(enum AVSampleFormat sample_fmt)
|
|||||||
case AV_SAMPLE_FMT_S32P:
|
case AV_SAMPLE_FMT_S32P:
|
||||||
return SampleFormat::S32;
|
return SampleFormat::S32;
|
||||||
|
|
||||||
|
case AV_SAMPLE_FMT_FLT:
|
||||||
case AV_SAMPLE_FMT_FLTP:
|
case AV_SAMPLE_FMT_FLTP:
|
||||||
return SampleFormat::FLOAT;
|
return SampleFormat::FLOAT;
|
||||||
|
|
||||||
|
|||||||
@@ -53,10 +53,11 @@ public:
|
|||||||
children.emplace_back(name, filter);
|
children.emplace_back(name, filter);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual AudioFormat Open(AudioFormat &af, Error &error) override;
|
/* virtual methods from class Filter */
|
||||||
virtual void Close();
|
AudioFormat Open(AudioFormat &af, Error &error) override;
|
||||||
virtual ConstBuffer<void> FilterPCM(ConstBuffer<void> src,
|
void Close() override;
|
||||||
Error &error);
|
ConstBuffer<void> FilterPCM(ConstBuffer<void> src,
|
||||||
|
Error &error) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -34,10 +34,11 @@ class NormalizeFilter final : public Filter {
|
|||||||
PcmBuffer buffer;
|
PcmBuffer buffer;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual AudioFormat Open(AudioFormat &af, Error &error) override;
|
/* virtual methods from class Filter */
|
||||||
virtual void Close();
|
AudioFormat Open(AudioFormat &af, Error &error) override;
|
||||||
virtual ConstBuffer<void> FilterPCM(ConstBuffer<void> src,
|
void Close() override;
|
||||||
Error &error) override;
|
ConstBuffer<void> FilterPCM(ConstBuffer<void> src,
|
||||||
|
Error &error) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
static Filter *
|
static Filter *
|
||||||
|
|||||||
@@ -112,10 +112,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
void Update();
|
void Update();
|
||||||
|
|
||||||
virtual AudioFormat Open(AudioFormat &af, Error &error) override;
|
/* virtual methods from class Filter */
|
||||||
virtual void Close();
|
AudioFormat Open(AudioFormat &af, Error &error) override;
|
||||||
virtual ConstBuffer<void> FilterPCM(ConstBuffer<void> src,
|
void Close() override;
|
||||||
Error &error) override;
|
ConstBuffer<void> FilterPCM(ConstBuffer<void> src,
|
||||||
|
Error &error) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
@@ -120,10 +120,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool Configure(const config_param ¶m, Error &error);
|
bool Configure(const config_param ¶m, Error &error);
|
||||||
|
|
||||||
virtual AudioFormat Open(AudioFormat &af, Error &error) override;
|
/* virtual methods from class Filter */
|
||||||
virtual void Close();
|
AudioFormat Open(AudioFormat &af, Error &error) override;
|
||||||
virtual ConstBuffer<void> FilterPCM(ConstBuffer<void> src,
|
void Close() override;
|
||||||
Error &error) override;
|
ConstBuffer<void> FilterPCM(ConstBuffer<void> src,
|
||||||
|
Error &error) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
|||||||
@@ -43,10 +43,11 @@ public:
|
|||||||
pv.SetVolume(_volume);
|
pv.SetVolume(_volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual AudioFormat Open(AudioFormat &af, Error &error) override;
|
/* virtual methods from class Filter */
|
||||||
virtual void Close();
|
AudioFormat Open(AudioFormat &af, Error &error) override;
|
||||||
virtual ConstBuffer<void> FilterPCM(ConstBuffer<void> src,
|
void Close() override;
|
||||||
Error &error) override;
|
ConstBuffer<void> FilterPCM(ConstBuffer<void> src,
|
||||||
|
Error &error) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
static constexpr Domain volume_domain("pcm_volume");
|
static constexpr Domain volume_domain("pcm_volume");
|
||||||
|
|||||||
@@ -103,7 +103,10 @@ static inline void FixSeparators(std::string &s)
|
|||||||
std::string
|
std::string
|
||||||
PathToUTF8(const char *path_fs)
|
PathToUTF8(const char *path_fs)
|
||||||
{
|
{
|
||||||
|
#if !CLANG_CHECK_VERSION(3,6)
|
||||||
|
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||||
assert(path_fs != nullptr);
|
assert(path_fs != nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_GLIB
|
#ifdef HAVE_GLIB
|
||||||
if (fs_charset.empty()) {
|
if (fs_charset.empty()) {
|
||||||
@@ -144,7 +147,10 @@ PathToUTF8(const char *path_fs)
|
|||||||
char *
|
char *
|
||||||
PathFromUTF8(const char *path_utf8)
|
PathFromUTF8(const char *path_utf8)
|
||||||
{
|
{
|
||||||
|
#if !CLANG_CHECK_VERSION(3,6)
|
||||||
|
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||||
assert(path_utf8 != nullptr);
|
assert(path_utf8 != nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (fs_charset.empty())
|
if (fs_charset.empty())
|
||||||
return g_strdup(path_utf8);
|
return g_strdup(path_utf8);
|
||||||
|
|||||||
@@ -52,7 +52,10 @@ template<typename Traits>
|
|||||||
typename Traits::const_pointer
|
typename Traits::const_pointer
|
||||||
GetBasePathImpl(typename Traits::const_pointer p)
|
GetBasePathImpl(typename Traits::const_pointer p)
|
||||||
{
|
{
|
||||||
|
#if !CLANG_CHECK_VERSION(3,6)
|
||||||
|
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||||
assert(p != nullptr);
|
assert(p != nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
typename Traits::const_pointer sep = Traits::FindLastSeparator(p);
|
typename Traits::const_pointer sep = Traits::FindLastSeparator(p);
|
||||||
return sep != nullptr
|
return sep != nullptr
|
||||||
@@ -64,7 +67,10 @@ template<typename Traits>
|
|||||||
typename Traits::string
|
typename Traits::string
|
||||||
GetParentPathImpl(typename Traits::const_pointer p)
|
GetParentPathImpl(typename Traits::const_pointer p)
|
||||||
{
|
{
|
||||||
|
#if !CLANG_CHECK_VERSION(3,6)
|
||||||
|
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||||
assert(p != nullptr);
|
assert(p != nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
typename Traits::const_pointer sep = Traits::FindLastSeparator(p);
|
typename Traits::const_pointer sep = Traits::FindLastSeparator(p);
|
||||||
if (sep == nullptr)
|
if (sep == nullptr)
|
||||||
|
|||||||
@@ -57,7 +57,11 @@ struct PathTraitsFS {
|
|||||||
|
|
||||||
gcc_pure gcc_nonnull_all
|
gcc_pure gcc_nonnull_all
|
||||||
static const_pointer FindLastSeparator(const_pointer p) {
|
static const_pointer FindLastSeparator(const_pointer p) {
|
||||||
|
#if !CLANG_CHECK_VERSION(3,6)
|
||||||
|
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||||
assert(p != nullptr);
|
assert(p != nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
const_pointer pos = p + GetLength(p);
|
const_pointer pos = p + GetLength(p);
|
||||||
while (p != pos && !IsSeparator(*pos))
|
while (p != pos && !IsSeparator(*pos))
|
||||||
@@ -77,7 +81,11 @@ struct PathTraitsFS {
|
|||||||
|
|
||||||
gcc_pure gcc_nonnull_all
|
gcc_pure gcc_nonnull_all
|
||||||
static bool IsAbsolute(const_pointer p) {
|
static bool IsAbsolute(const_pointer p) {
|
||||||
|
#if !CLANG_CHECK_VERSION(3,6)
|
||||||
|
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||||
assert(p != nullptr);
|
assert(p != nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (IsDrive(p) && IsSeparator(p[2]))
|
if (IsDrive(p) && IsSeparator(p[2]))
|
||||||
return true;
|
return true;
|
||||||
@@ -147,7 +155,11 @@ struct PathTraitsUTF8 {
|
|||||||
|
|
||||||
gcc_pure gcc_nonnull_all
|
gcc_pure gcc_nonnull_all
|
||||||
static const_pointer FindLastSeparator(const_pointer p) {
|
static const_pointer FindLastSeparator(const_pointer p) {
|
||||||
|
#if !CLANG_CHECK_VERSION(3,6)
|
||||||
|
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||||
assert(p != nullptr);
|
assert(p != nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
return strrchr(p, SEPARATOR);
|
return strrchr(p, SEPARATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +172,11 @@ struct PathTraitsUTF8 {
|
|||||||
|
|
||||||
gcc_pure gcc_nonnull_all
|
gcc_pure gcc_nonnull_all
|
||||||
static bool IsAbsolute(const_pointer p) {
|
static bool IsAbsolute(const_pointer p) {
|
||||||
|
#if !CLANG_CHECK_VERSION(3,6)
|
||||||
|
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||||
assert(p != nullptr);
|
assert(p != nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
if (IsDrive(p) && IsSeparator(p[2]))
|
if (IsDrive(p) && IsSeparator(p[2]))
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -160,6 +160,11 @@ AsyncInputStream::SeekDone()
|
|||||||
assert(io_thread_inside());
|
assert(io_thread_inside());
|
||||||
assert(IsSeekPending());
|
assert(IsSeekPending());
|
||||||
|
|
||||||
|
/* we may have reached end-of-file previously, and the
|
||||||
|
connection may have been closed already; however after
|
||||||
|
seeking successfully, the connection must be alive again */
|
||||||
|
open = true;
|
||||||
|
|
||||||
seek_state = SeekState::NONE;
|
seek_state = SeekState::NONE;
|
||||||
cond.broadcast();
|
cond.broadcast();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,7 +122,10 @@ InputStream::IsAvailable()
|
|||||||
size_t
|
size_t
|
||||||
InputStream::LockRead(void *ptr, size_t _size, Error &error)
|
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);
|
assert(ptr != nullptr);
|
||||||
|
#endif
|
||||||
assert(_size > 0);
|
assert(_size > 0);
|
||||||
|
|
||||||
const ScopeLock protect(mutex);
|
const ScopeLock protect(mutex);
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ protected:
|
|||||||
virtual size_t ThreadRead(void *ptr, size_t size,
|
virtual size_t ThreadRead(void *ptr, size_t size,
|
||||||
Error &error) override;
|
Error &error) override;
|
||||||
|
|
||||||
virtual void Close() {
|
void Close() override {
|
||||||
mmsx_close(mms);
|
mmsx_close(mms);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -92,6 +92,13 @@ input_mms_open(const char *url,
|
|||||||
size_t
|
size_t
|
||||||
MmsInputStream::ThreadRead(void *ptr, size_t read_size, Error &error)
|
MmsInputStream::ThreadRead(void *ptr, size_t read_size, Error &error)
|
||||||
{
|
{
|
||||||
|
/* unfortunately, mmsx_read() blocks until the whole buffer
|
||||||
|
has been filled; to avoid big latencies, limit the size of
|
||||||
|
each chunk we read to a reasonable size */
|
||||||
|
constexpr size_t MAX_CHUNK = 16384;
|
||||||
|
if (read_size > MAX_CHUNK)
|
||||||
|
read_size = MAX_CHUNK;
|
||||||
|
|
||||||
int nbytes = mmsx_read(nullptr, mms, (char *)ptr, read_size);
|
int nbytes = mmsx_read(nullptr, mms, (char *)ptr, read_size);
|
||||||
if (nbytes <= 0) {
|
if (nbytes <= 0) {
|
||||||
if (nbytes < 0)
|
if (nbytes < 0)
|
||||||
|
|||||||
@@ -121,8 +121,11 @@ gcc_pure
|
|||||||
int
|
int
|
||||||
IcuCollate(const char *a, const char *b)
|
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(a != nullptr);
|
||||||
assert(b != nullptr);
|
assert(b != nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_ICU
|
#ifdef HAVE_ICU
|
||||||
assert(collator != nullptr);
|
assert(collator != nullptr);
|
||||||
@@ -159,7 +162,10 @@ IcuCaseFold(const char *src)
|
|||||||
{
|
{
|
||||||
#ifdef HAVE_ICU
|
#ifdef HAVE_ICU
|
||||||
assert(collator != nullptr);
|
assert(collator != nullptr);
|
||||||
|
#if !CLANG_CHECK_VERSION(3,6)
|
||||||
|
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||||
assert(src != nullptr);
|
assert(src != nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
const auto u = UCharFromUTF8(src);
|
const auto u = UCharFromUTF8(src);
|
||||||
if (u.IsNull())
|
if (u.IsNull())
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ ShoutOutput::Configure(const config_param ¶m, Error &error)
|
|||||||
if (!audio_format.IsFullyDefined()) {
|
if (!audio_format.IsFullyDefined()) {
|
||||||
error.Set(config_domain,
|
error.Set(config_domain,
|
||||||
"Need full audio format specification");
|
"Need full audio format specification");
|
||||||
return nullptr;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *host = require_block_string(param, "host");
|
const char *host = require_block_string(param, "host");
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ PcmFormatConverter::Open(SampleFormat _src_format, SampleFormat _dest_format,
|
|||||||
"PCM conversion from %s to %s is not implemented",
|
"PCM conversion from %s to %s is not implemented",
|
||||||
sample_format_to_string(_src_format),
|
sample_format_to_string(_src_format),
|
||||||
sample_format_to_string(_dest_format));
|
sample_format_to_string(_dest_format));
|
||||||
return nullptr;
|
return false;
|
||||||
|
|
||||||
case SampleFormat::S16:
|
case SampleFormat::S16:
|
||||||
case SampleFormat::S24_P32:
|
case SampleFormat::S24_P32:
|
||||||
|
|||||||
@@ -288,7 +288,7 @@ NfsStorage::GetInfo(const char *uri_utf8, gcc_unused bool follow,
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!WaitConnected(error))
|
if (!WaitConnected(error))
|
||||||
return nullptr;
|
return false;
|
||||||
|
|
||||||
NfsGetInfoOperation operation(*connection, path.c_str(), info);
|
NfsGetInfoOperation operation(*connection, path.c_str(), info);
|
||||||
return operation.Run(error);
|
return operation.Run(error);
|
||||||
|
|||||||
@@ -182,7 +182,10 @@ TagBuilder::Complement(const Tag &other)
|
|||||||
inline void
|
inline void
|
||||||
TagBuilder::AddItemInternal(TagType type, const char *value, size_t length)
|
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);
|
assert(value != nullptr);
|
||||||
|
#endif
|
||||||
assert(length > 0);
|
assert(length > 0);
|
||||||
|
|
||||||
auto f = FixTagString(value, length);
|
auto f = FixTagString(value, length);
|
||||||
@@ -203,7 +206,10 @@ TagBuilder::AddItemInternal(TagType type, const char *value, size_t length)
|
|||||||
void
|
void
|
||||||
TagBuilder::AddItem(TagType type, const char *value, size_t length)
|
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);
|
assert(value != nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (length == 0 || ignore_tag_items[type])
|
if (length == 0 || ignore_tag_items[type])
|
||||||
return;
|
return;
|
||||||
@@ -214,7 +220,10 @@ TagBuilder::AddItem(TagType type, const char *value, size_t length)
|
|||||||
void
|
void
|
||||||
TagBuilder::AddItem(TagType type, const char *value)
|
TagBuilder::AddItem(TagType type, const char *value)
|
||||||
{
|
{
|
||||||
|
#if !CLANG_CHECK_VERSION(3,6)
|
||||||
|
/* disabled on clang due to -Wtautological-pointer-compare */
|
||||||
assert(value != nullptr);
|
assert(value != nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
AddItem(type, value, strlen(value));
|
AddItem(type, value, strlen(value));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,17 +20,25 @@
|
|||||||
#ifndef MPD_THREAD_NAME_HXX
|
#ifndef MPD_THREAD_NAME_HXX
|
||||||
#define MPD_THREAD_NAME_HXX
|
#define MPD_THREAD_NAME_HXX
|
||||||
|
|
||||||
#ifdef HAVE_PTHREAD_SETNAME_NP
|
#if defined(HAVE_PTHREAD_SETNAME_NP) && !defined(__NetBSD__)
|
||||||
#include <pthread.h>
|
# define HAVE_THREAD_NAME
|
||||||
#include <stdio.h>
|
# include <pthread.h>
|
||||||
|
# include <stdio.h>
|
||||||
#elif defined(HAVE_PRCTL)
|
#elif defined(HAVE_PRCTL)
|
||||||
#include <sys/prctl.h>
|
# include <sys/prctl.h>
|
||||||
|
# ifdef PR_SET_NAME
|
||||||
|
# define HAVE_THREAD_NAME
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
SetThreadName(const char *name)
|
SetThreadName(const char *name)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_PTHREAD_SETNAME_NP
|
#if defined(HAVE_PTHREAD_SETNAME_NP) && !defined(__NetBSD__)
|
||||||
|
/* not using pthread_setname_np() on NetBSD because it
|
||||||
|
requires a non-const pointer argument, which we don't have
|
||||||
|
here */
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
pthread_setname_np(name);
|
pthread_setname_np(name);
|
||||||
#else
|
#else
|
||||||
@@ -47,7 +55,7 @@ template<typename... Args>
|
|||||||
static inline void
|
static inline void
|
||||||
FormatThreadName(const char *fmt, gcc_unused Args&&... args)
|
FormatThreadName(const char *fmt, gcc_unused Args&&... args)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_PTHREAD_SETNAME_NP
|
#ifdef HAVE_THREAD_NAME
|
||||||
char buffer[16];
|
char buffer[16];
|
||||||
snprintf(buffer, sizeof(buffer), fmt, args...);
|
snprintf(buffer, sizeof(buffer), fmt, args...);
|
||||||
SetThreadName(buffer);
|
SetThreadName(buffer);
|
||||||
|
|||||||
@@ -43,24 +43,30 @@ gcc_pure gcc_nonnull_all
|
|||||||
static inline bool
|
static inline bool
|
||||||
StringEqualsCaseASCII(const char *a, const char *b)
|
StringEqualsCaseASCII(const char *a, const char *b)
|
||||||
{
|
{
|
||||||
assert(a != nullptr);
|
#if !CLANG_CHECK_VERSION(3,6)
|
||||||
assert(b != nullptr);
|
/* 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
|
/* note: strcasecmp() depends on the locale, but for ASCII-only
|
||||||
strings, it's safe to use */
|
strings, it's safe to use */
|
||||||
return strcasecmp(a, b) == 0;
|
return strcasecmp(a, b) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
gcc_pure gcc_nonnull_all
|
gcc_pure gcc_nonnull_all
|
||||||
static inline bool
|
static inline bool
|
||||||
StringEqualsCaseASCII(const char *a, const char *b, size_t n)
|
StringEqualsCaseASCII(const char *a, const char *b, size_t n)
|
||||||
{
|
{
|
||||||
assert(a != nullptr);
|
#if !CLANG_CHECK_VERSION(3,6)
|
||||||
assert(b != nullptr);
|
/* 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
|
/* note: strcasecmp() depends on the locale, but for ASCII-only
|
||||||
strings, it's safe to use */
|
strings, it's safe to use */
|
||||||
return strncasecmp(a, b, n) == 0;
|
return strncasecmp(a, b, n) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
#include <new>
|
#include <new>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#if !defined(__clang__) && __GNUC__ && !GCC_CHECK_VERSION(4,8)
|
#if GCC_OLDER_THAN(4,8)
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@
|
|||||||
*/
|
*/
|
||||||
template<class T>
|
template<class T>
|
||||||
class Manual {
|
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 */
|
/* no alignas() on gcc < 4.8: apply worst-case fallback */
|
||||||
__attribute__((aligned(8)))
|
__attribute__((aligned(8)))
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -140,8 +140,11 @@ uri_remove_auth(const char *uri)
|
|||||||
bool
|
bool
|
||||||
uri_is_child(const char *parent, const char *child)
|
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(parent != nullptr);
|
||||||
assert(child != nullptr);
|
assert(child != nullptr);
|
||||||
|
#endif
|
||||||
|
|
||||||
const size_t parent_length = strlen(parent);
|
const size_t parent_length = strlen(parent);
|
||||||
return memcmp(parent, child, parent_length) == 0 &&
|
return memcmp(parent, child, parent_length) == 0 &&
|
||||||
|
|||||||
Reference in New Issue
Block a user