diff --git a/src/mpdclient.c b/src/mpdclient.c
index e55c1362482ece91917b22875f9dc9f671c339d3..359a765119f8045d877d48a6bedce252ced4a39d 100644 (file)
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
mpd_command_list_begin(connection, false);
- if (mpd_connection_cmp_server_version(connection, 0, 16, 0) >= 0) {
- if (current < length - 1)
- mpd_send_delete_range(connection, current + 1, length);
- if (current > 0)
- mpd_send_delete_range(connection, 0, current);
- } else
- while (--length >= 0)
- if (length != current)
- mpd_send_delete(connection, length);
+ if (current < length - 1)
+ mpd_send_delete_range(connection, current + 1, length);
+ if (current > 0)
+ mpd_send_delete_range(connection, 0, current);
mpd_command_list_end(connection);
return true;
}
-/**
- * Fallback for mpdclient_cmd_delete_range() on MPD older than 0.16.
- * It emulates the "delete range" command with a list of simple
- * "delete" commands.
- */
-static bool
-mpdclient_cmd_delete_range_fallback(struct mpdclient *c,
- unsigned start, unsigned end)
-{
- struct mpd_connection *connection = mpdclient_get_connection(c);
- if (connection == NULL)
- return false;
-
- if (!mpd_command_list_begin(connection, false))
- return mpdclient_handle_error(c);
-
- for (; start < end; --end)
- mpd_send_delete(connection, start);
-
- if (!mpd_command_list_end(connection) ||
- !mpd_response_finish(connection))
- return mpdclient_handle_error(c);
-
- return true;
-}
-
bool
mpdclient_cmd_delete_range(struct mpdclient *c, unsigned start, unsigned end)
{
if (connection == NULL)
return false;
- if (mpd_connection_cmp_server_version(connection, 0, 16, 0) < 0)
- return mpdclient_cmd_delete_range_fallback(c, start, end);
-
- /* MPD 0.16 supports "delete" with a range argument */
-
/* send the delete command to mpd; at the same time, get the
new status (to verify the playlist id) */