summaryrefslogtreecommitdiff
path: root/src/db
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2018-09-02 07:49:27 +0200
committerMax Kellermann <max@musicpd.org>2018-09-02 08:17:22 +0200
commit993f8d6a5e4e2fc8a205e853e5f724143fbac788 (patch)
tree897a4a3e7bbdb9c7aa3bc4d26c16a4eaa75cbd44 /src/db
parent68f824a18640f7e582175a3e3a0b7d3fc60f207c (diff)
db/Print: pass RangeArg to db_selection_print()
Diffstat (limited to 'src/db')
-rw-r--r--src/db/DatabasePrint.cxx21
-rw-r--r--src/db/DatabasePrint.hxx3
2 files changed, 13 insertions, 11 deletions
diff --git a/src/db/DatabasePrint.cxx b/src/db/DatabasePrint.cxx
index 0bda1fb75..b830c3d25 100644
--- a/src/db/DatabasePrint.cxx
+++ b/src/db/DatabasePrint.cxx
@@ -24,6 +24,7 @@
#include "TimePrint.hxx"
#include "TagPrint.hxx"
#include "client/Response.hxx"
+#include "protocol/RangeArg.hxx"
#include "Partition.hxx"
#include "song/DetachedSong.hxx"
#include "song/Filter.hxx"
@@ -180,7 +181,7 @@ db_selection_print(Response &r, Partition &partition,
const DatabaseSelection &selection,
bool full, bool base,
TagType sort, bool descending,
- unsigned window_start, unsigned window_end)
+ RangeArg window)
{
const Database &db = partition.GetDatabaseOrThrow();
@@ -199,10 +200,10 @@ 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<int>::max())
- s = [s, window_start, window_end, &i](const LightSong &song){
- const bool in_window = i >= window_start && i < window_end;
+ if (window.start > 0 ||
+ window.end < (unsigned)std::numeric_limits<int>::max())
+ s = [s, window, &i](const LightSong &song){
+ const bool in_window = i >= window.start && i < window.end;
++i;
if (in_window)
s(song);
@@ -242,15 +243,15 @@ db_selection_print(Response &r, Partition &partition,
b.GetTag());
});
- if (window_end < songs.size())
- songs.erase(std::next(songs.begin(), window_end),
+ if (window.end < songs.size())
+ songs.erase(std::next(songs.begin(), window.end),
songs.end());
- if (window_start >= songs.size())
+ if (window.start >= songs.size())
return;
songs.erase(songs.begin(),
- std::next(songs.begin(), window_start));
+ std::next(songs.begin(), window.start));
for (const auto &song : songs)
s((LightSong)song);
@@ -264,7 +265,7 @@ db_selection_print(Response &r, Partition &partition,
{
db_selection_print(r, partition, selection, full, base,
TAG_NUM_OF_ITEM_TYPES, false,
- 0, std::numeric_limits<int>::max());
+ RangeArg::All());
}
static void
diff --git a/src/db/DatabasePrint.hxx b/src/db/DatabasePrint.hxx
index c3fb1545d..1a553545a 100644
--- a/src/db/DatabasePrint.hxx
+++ b/src/db/DatabasePrint.hxx
@@ -26,6 +26,7 @@ enum TagType : uint8_t;
class TagMask;
class SongFilter;
struct DatabaseSelection;
+struct RangeArg;
struct Partition;
class Response;
@@ -47,7 +48,7 @@ db_selection_print(Response &r, Partition &partition,
const DatabaseSelection &selection,
bool full, bool base,
TagType sort, bool descending,
- unsigned window_start, unsigned window_end);
+ RangeArg window);
void
PrintSongUris(Response &r, Partition &partition,