Merge branch 'v0.22.x'

This commit is contained in:
Max Kellermann 2021-05-26 11:57:41 +02:00
commit d2bd12822f
9 changed files with 92 additions and 39 deletions

2
NEWS
View File

@ -15,6 +15,8 @@ ver 0.23 (not yet released)
* new build-time dependency: libfmt * new build-time dependency: libfmt
ver 0.22.9 (not yet released) ver 0.22.9 (not yet released)
* Windows
- fix build failure with SQLite
ver 0.22.8 (2021/05/22) ver 0.22.8 (2021/05/22)
* fix crash bug in "albumart" command (0.22.7 regression) * fix crash bug in "albumart" command (0.22.7 regression)

View File

@ -55,7 +55,7 @@ and unpack it (or `clone the git repository
In any case, you need: In any case, you need:
* a C++17 compiler (e.g. GCC 8 or clang 5) * a C++17 compiler (e.g. GCC 8 or clang 7)
* `Meson 0.49.0 <http://mesonbuild.com/>`__ and `Ninja * `Meson 0.49.0 <http://mesonbuild.com/>`__ and `Ninja
<https://ninja-build.org/>`__ <https://ninja-build.org/>`__
* Boost 1.58 * Boost 1.58

View File

@ -24,8 +24,8 @@ c_compiler = meson.get_compiler('c')
if compiler.get_id() == 'gcc' and compiler.version().version_compare('<8') if compiler.get_id() == 'gcc' and compiler.version().version_compare('<8')
warning('Your GCC version is too old. You need at least version 8.') warning('Your GCC version is too old. You need at least version 8.')
elif compiler.get_id() == 'clang' and compiler.version().version_compare('<5') elif compiler.get_id() == 'clang' and compiler.version().version_compare('<7')
warning('Your clang version is too old. You need at least version 5.') warning('Your clang version is too old. You need at least version 7.')
endif endif
version_conf = configuration_data() version_conf = configuration_data()
@ -42,57 +42,64 @@ common_cppflags = [
'-D_GNU_SOURCE', '-D_GNU_SOURCE',
] ]
common_cflags = [ test_global_common_flags = [
] '-fvisibility=hidden',
common_cxxflags = [
] ]
test_common_flags = [ test_common_flags = [
'-Wvla', '-Wvla',
'-Wdouble-promotion', '-Wdouble-promotion',
'-fvisibility=hidden',
'-ffast-math', '-ffast-math',
'-ftree-vectorize', '-ftree-vectorize',
] ]
test_global_cxxflags = test_global_common_flags + [
]
test_global_cflags = test_global_common_flags + [
]
test_cxxflags = test_common_flags + [ test_cxxflags = test_common_flags + [
'-fno-threadsafe-statics', '-fno-threadsafe-statics',
'-fmerge-all-constants', '-fmerge-all-constants',
'-Wmissing-declarations',
'-Wshadow',
'-Wpointer-arith',
'-Wcast-qual', '-Wcast-qual',
'-Wwrite-strings', '-Wcomma-subscript',
'-Wsign-compare',
'-Wcomma',
'-Wextra-semi', '-Wextra-semi',
'-Wmismatched-tags',
'-Wmissing-declarations',
'-Woverloaded-virtual',
'-Wshadow',
'-Wsign-promo',
'-Wunused',
'-Wvolatile',
'-Wvirtual-inheritance',
'-Wwrite-strings',
# a vtable without a dtor is just fine
'-Wno-non-virtual-dtor',
# clang specific warning options:
'-Wcomma',
'-Wheader-hygiene', '-Wheader-hygiene',
'-Winconsistent-missing-destructor-override', '-Winconsistent-missing-destructor-override',
'-Wunreachable-code-break', '-Wunreachable-code-aggressive',
'-Wunused',
'-Wused-but-marked-unused', '-Wused-but-marked-unused',
'-Wno-non-virtual-dtor',
] ]
if compiler.get_id() == 'clang' if compiler.get_id() != 'gcc' or compiler.version().version_compare('>=9')
# Workaround for clang bug # The GCC 8 implementation of this flag is buggy: it complains even
# https://bugs.llvm.org/show_bug.cgi?id=32611 # if "final" is present, which implies "override".
test_cxxflags += '-funwind-tables' test_cxxflags += '-Wsuggest-override'
endif endif
test_cflags = test_common_flags + [ test_cflags = test_common_flags + [
'-Wcast-qual',
'-Wmissing-prototypes', '-Wmissing-prototypes',
'-Wshadow', '-Wshadow',
'-Wpointer-arith',
'-Wstrict-prototypes', '-Wstrict-prototypes',
'-Wcast-qual',
'-Wwrite-strings', '-Wwrite-strings',
'-pedantic',
] ]
test_ldflags = [ test_ldflags = [
@ -104,11 +111,11 @@ test_ldflags = [
] ]
if get_option('buildtype') != 'debug' if get_option('buildtype') != 'debug'
test_cxxflags += [ test_global_cxxflags += [
'-ffunction-sections', '-ffunction-sections',
'-fdata-sections', '-fdata-sections',
] ]
test_cflags += [ test_global_cflags += [
'-ffunction-sections', '-ffunction-sections',
'-fdata-sections', '-fdata-sections',
] ]
@ -127,9 +134,11 @@ if get_option('fuzzer')
add_global_link_arguments(fuzzer_flags, language: 'cpp') add_global_link_arguments(fuzzer_flags, language: 'cpp')
endif endif
add_global_arguments(common_cxxflags + compiler.get_supported_arguments(test_cxxflags), language: 'cpp') add_global_arguments(compiler.get_supported_arguments(test_global_cxxflags), language: 'cpp')
add_global_arguments(common_cflags + c_compiler.get_supported_arguments(test_cflags), language: 'c') add_global_arguments(c_compiler.get_supported_arguments(test_global_cflags), language: 'c')
add_global_link_arguments(compiler.get_supported_link_arguments(test_ldflags), language: 'cpp') add_project_arguments(compiler.get_supported_arguments(test_cxxflags), language: 'cpp')
add_project_arguments(c_compiler.get_supported_arguments(test_cflags), language: 'c')
add_project_link_arguments(compiler.get_supported_link_arguments(test_ldflags), language: 'cpp')
is_linux = host_machine.system() == 'linux' is_linux = host_machine.system() == 'linux'
is_android = get_option('android_ndk') != '' is_android = get_option('android_ndk') != ''

View File

@ -889,8 +889,6 @@ inline bool
MadDecoder::HandleCurrentFrame() noexcept MadDecoder::HandleCurrentFrame() noexcept
{ {
switch (mute_frame) { switch (mute_frame) {
DecoderCommand cmd;
case MadDecoderMuteFrame::SKIP: case MadDecoderMuteFrame::SKIP:
mute_frame = MadDecoderMuteFrame::NONE; mute_frame = MadDecoderMuteFrame::NONE;
break; break;
@ -899,8 +897,8 @@ MadDecoder::HandleCurrentFrame() noexcept
mute_frame = MadDecoderMuteFrame::NONE; mute_frame = MadDecoderMuteFrame::NONE;
UpdateTimerNextFrame(); UpdateTimerNextFrame();
break; break;
case MadDecoderMuteFrame::NONE: case MadDecoderMuteFrame::NONE: {
cmd = SynthAndSubmit(); const auto cmd = SynthAndSubmit();
UpdateTimerNextFrame(); UpdateTimerNextFrame();
if (cmd == DecoderCommand::SEEK) { if (cmd == DecoderCommand::SEEK) {
assert(input_stream.IsSeekable()); assert(input_stream.IsSeekable());
@ -922,6 +920,7 @@ MadDecoder::HandleCurrentFrame() noexcept
} else if (cmd != DecoderCommand::NONE) } else if (cmd != DecoderCommand::NONE)
return false; return false;
} }
}
return true; return true;
} }

View File

@ -1,5 +1,7 @@
if enable_database if enable_database
sqlite_dep = dependency('sqlite3', version: '>= 3.7.3', required: get_option('sqlite')) sqlite_dep = dependency('sqlite3', version: '>= 3.7.3',
fallback: ['sqlite3', 'sqlite3_dep'],
required: get_option('sqlite'))
else else
sqlite_dep = dependency('', required: false) sqlite_dep = dependency('', required: false)
endif endif
@ -21,4 +23,7 @@ sqlite = static_library(
sqlite_dep = declare_dependency( sqlite_dep = declare_dependency(
link_with: sqlite, link_with: sqlite,
dependencies: [
sqlite_dep,
],
) )

View File

@ -21,6 +21,7 @@
#include "Sticker.hxx" #include "Sticker.hxx"
#include "lib/sqlite/Util.hxx" #include "lib/sqlite/Util.hxx"
#include "fs/Path.hxx" #include "fs/Path.hxx"
#include "fs/NarrowPath.hxx"
#include "Idle.hxx" #include "Idle.hxx"
#include "util/StringCompare.hxx" #include "util/StringCompare.hxx"
#include "util/ScopeExit.hxx" #include "util/ScopeExit.hxx"
@ -82,7 +83,7 @@ static const char sticker_sql_create[] =
""; "";
StickerDatabase::StickerDatabase(Path path) StickerDatabase::StickerDatabase(Path path)
:db(path.c_str()) :db(NarrowPath(path))
{ {
assert(!path.IsNull()); assert(!path.IsNull());

View File

@ -89,13 +89,13 @@ public:
:event(_loop, BIND_THIS_METHOD(OnTimeout)), :event(_loop, BIND_THIS_METHOD(OnTimeout)),
callback(_callback), userdata(_userdata) { callback(_callback), userdata(_userdata) {
if (tv != nullptr) if (tv != nullptr)
event.Schedule(ToSteadyClockDuration(*tv)); Schedule(*tv);
} }
static void TimeoutUpdate(AvahiTimeout *t, static void TimeoutUpdate(AvahiTimeout *t,
const struct timeval *tv) noexcept { const struct timeval *tv) noexcept {
if (tv != nullptr) if (tv != nullptr)
t->event.Schedule(ToSteadyClockDuration(*tv)); t->Schedule(*tv);
else else
t->event.Cancel(); t->event.Cancel();
} }
@ -105,6 +105,30 @@ public:
} }
private: private:
[[gnu::pure]]
Event::Duration AbsoluteToDuration(const struct timeval &tv) noexcept {
if (tv.tv_sec == 0)
/* schedule immediately */
return {};
struct timeval now;
if (gettimeofday(&now, nullptr) < 0)
/* shouldn't ever fail, but if it does, do
something reasonable */
return std::chrono::seconds(1);
auto d = ToSteadyClockDuration(tv)
- ToSteadyClockDuration(now);
if (d.count() < 0)
return {};
return d;
}
void Schedule(const struct timeval &tv) noexcept {
event.Schedule(AbsoluteToDuration(tv));
}
void OnTimeout() noexcept { void OnTimeout() noexcept {
callback(this, userdata); callback(this, userdata);
} }

View File

@ -2,3 +2,4 @@
/fmt-*/ /fmt-*/
/googletest-*/ /googletest-*/
/sqlite-*/

12
subprojects/sqlite3.wrap Normal file
View File

@ -0,0 +1,12 @@
[wrap-file]
directory = sqlite-amalgamation-3340100
source_url = https://www.sqlite.org/2021/sqlite-amalgamation-3340100.zip
source_filename = sqlite-amalgamation-3340100.zip
source_hash = e0b1c0345fe4338b936e17da8e1bd88366cd210e576834546977f040c12a8f68
patch_url = https://wrapdb.mesonbuild.com/v1/projects/sqlite3/3.34.1/1/get_zip
patch_filename = sqlite3-3.34.1-1-wrap.zip
patch_hash = cba9e47bdb4c02f88fadaae8deab357218d32562c6b86ce7ba0c72f107044360
[provide]
sqlite3 = sqlite3_dep