diff --git a/src/db/DatabasePrint.cxx b/src/db/DatabasePrint.cxx index b830c3d25..dd981bfc4 100644 --- a/src/db/DatabasePrint.cxx +++ b/src/db/DatabasePrint.cxx @@ -200,8 +200,7 @@ db_selection_print(Response &r, Partition &partition, : VisitPlaylist(); if (sort == TAG_NUM_OF_ITEM_TYPES) { - if (window.start > 0 || - window.end < (unsigned)std::numeric_limits::max()) + if (!window.IsAll()) s = [s, window, &i](const LightSong &song){ const bool in_window = i >= window.start && i < window.end; ++i; diff --git a/src/protocol/RangeArg.hxx b/src/protocol/RangeArg.hxx index e6a8de8ff..796c25959 100644 --- a/src/protocol/RangeArg.hxx +++ b/src/protocol/RangeArg.hxx @@ -30,6 +30,18 @@ struct RangeArg { static constexpr RangeArg All() { return { 0, std::numeric_limits::max() }; } + + constexpr bool operator==(RangeArg other) const noexcept { + return start == other.start && end == other.end; + } + + constexpr bool operator!=(RangeArg other) const noexcept { + return !(*this == other); + } + + constexpr bool IsAll() const noexcept { + return *this == All(); + } }; #endif