diff --git a/include/mpd/search.h b/include/mpd/search.h index 8f55e28..fcddb2b 100644 --- a/include/mpd/search.h +++ b/include/mpd/search.h @@ -278,6 +278,7 @@ mpd_search_add_sort_tag(struct mpd_connection *connection, * @param connection a #mpd_connection * @param start the start offset (including) * @param end the end offset (not including) + * value "UINT_MAX" makes the end of the range open * @return true on success, false on error * * @since libmpdclient 2.10 diff --git a/src/search.c b/src/search.c index 0449ad4..d706208 100644 --- a/src/search.c +++ b/src/search.c @@ -9,6 +9,7 @@ #include "iso8601.h" #include +#include #include #include #include @@ -348,7 +349,12 @@ mpd_search_add_window(struct mpd_connection *connection, if (dest == NULL) return false; - snprintf(dest, size, " window %u:%u", start, end); + if (end == UINT_MAX) + /* the special value -1 means "open end" */ + snprintf(dest, size, " window %u:", start); + else + snprintf(dest, size, " window %u:%u", start, end); + return true; }