playlist: eliminate unused fd parameters
Again, remove file descriptor parameters, which are not actually used. These functions can also be converted to return void.
This commit is contained in:
parent
3db333b5a4
commit
cff923b9d8
@ -268,10 +268,11 @@ static int handlePlayId(int fd, mpd_unused int *permission,
|
|||||||
return playPlaylistById(fd, id, 0);
|
return playPlaylistById(fd, id, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handleStop(int fd, mpd_unused int *permission,
|
static int handleStop(mpd_unused int fd, mpd_unused int *permission,
|
||||||
mpd_unused int argc, mpd_unused char *argv[])
|
mpd_unused int argc, mpd_unused char *argv[])
|
||||||
{
|
{
|
||||||
return stopPlaylist(fd);
|
stopPlaylist();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handleCurrentSong(int fd, mpd_unused int *permission,
|
static int handleCurrentSong(int fd, mpd_unused int *permission,
|
||||||
@ -441,10 +442,11 @@ static int handleShuffle(int fd, mpd_unused int *permission,
|
|||||||
return shufflePlaylist(fd);
|
return shufflePlaylist(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handleClear(int fd, mpd_unused int *permission,
|
static int handleClear(mpd_unused int fd, mpd_unused int *permission,
|
||||||
mpd_unused int argc, mpd_unused char *argv[])
|
mpd_unused int argc, mpd_unused char *argv[])
|
||||||
{
|
{
|
||||||
return clearPlaylist(fd);
|
clearPlaylist();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handleSave(int fd, mpd_unused int *permission,
|
static int handleSave(int fd, mpd_unused int *permission,
|
||||||
@ -716,16 +718,18 @@ static int handleUpdate(int fd, mpd_unused int *permission,
|
|||||||
return updateInit(fd, NULL);
|
return updateInit(fd, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handleNext(int fd, mpd_unused int *permission,
|
static int handleNext(mpd_unused int fd, mpd_unused int *permission,
|
||||||
mpd_unused int argc, mpd_unused char *argv[])
|
mpd_unused int argc, mpd_unused char *argv[])
|
||||||
{
|
{
|
||||||
return nextSongInPlaylist(fd);
|
nextSongInPlaylist();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handlePrevious(int fd, mpd_unused int *permission,
|
static int handlePrevious(mpd_unused int fd, mpd_unused int *permission,
|
||||||
mpd_unused int argc, mpd_unused char *argv[])
|
mpd_unused int argc, mpd_unused char *argv[])
|
||||||
{
|
{
|
||||||
return previousSongInPlaylist(fd);
|
previousSongInPlaylist();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handleListAll(int fd, mpd_unused int *permission,
|
static int handleListAll(int fd, mpd_unused int *permission,
|
||||||
|
@ -68,7 +68,7 @@ static int playlist_noGoToNext;
|
|||||||
int playlist_saveAbsolutePaths = DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS;
|
int playlist_saveAbsolutePaths = DEFAULT_PLAYLIST_SAVE_ABSOLUTE_PATHS;
|
||||||
|
|
||||||
static void swapOrder(int a, int b);
|
static void swapOrder(int a, int b);
|
||||||
static int playPlaylistOrderNumber(int fd, int orderNum);
|
static void playPlaylistOrderNumber(int orderNum);
|
||||||
static void randomizeOrder(int start, int end);
|
static void randomizeOrder(int start, int end);
|
||||||
|
|
||||||
static void incrPlaylistVersion(void)
|
static void incrPlaylistVersion(void)
|
||||||
@ -193,12 +193,11 @@ void finishPlaylist(void)
|
|||||||
playlist.positionToId = NULL;
|
playlist.positionToId = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int clearPlaylist(int fd)
|
void clearPlaylist(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (stopPlaylist(fd) < 0)
|
stopPlaylist();
|
||||||
return -1;
|
|
||||||
|
|
||||||
for (i = 0; i < playlist.length; i++) {
|
for (i = 0; i < playlist.length; i++) {
|
||||||
if (playlist.songs[i]->type == SONG_TYPE_URL) {
|
if (playlist.songs[i]->type == SONG_TYPE_URL) {
|
||||||
@ -211,8 +210,6 @@ int clearPlaylist(int fd)
|
|||||||
playlist.current = -1;
|
playlist.current = -1;
|
||||||
|
|
||||||
incrPlaylistVersion();
|
incrPlaylistVersion();
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int clearStoredPlaylist(int fd, char *utf8file)
|
int clearStoredPlaylist(int fd, char *utf8file)
|
||||||
@ -828,7 +825,7 @@ void deleteASongFromPlaylist(Song * song)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int stopPlaylist(mpd_unused int fd)
|
void stopPlaylist(void)
|
||||||
{
|
{
|
||||||
DEBUG("playlist: stop\n");
|
DEBUG("playlist: stop\n");
|
||||||
playerWait();
|
playerWait();
|
||||||
@ -837,10 +834,9 @@ int stopPlaylist(mpd_unused int fd)
|
|||||||
playlist_noGoToNext = 0;
|
playlist_noGoToNext = 0;
|
||||||
if (playlist.random)
|
if (playlist.random)
|
||||||
randomizeOrder(0, playlist.length - 1);
|
randomizeOrder(0, playlist.length - 1);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int playPlaylistOrderNumber(mpd_unused int fd, int orderNum)
|
static void playPlaylistOrderNumber(int orderNum)
|
||||||
{
|
{
|
||||||
char path_max_tmp[MPD_PATH_MAX];
|
char path_max_tmp[MPD_PATH_MAX];
|
||||||
|
|
||||||
@ -857,8 +853,6 @@ static int playPlaylistOrderNumber(mpd_unused int fd, int orderNum)
|
|||||||
|
|
||||||
playerPlay(playlist.songs[playlist.order[orderNum]]);
|
playerPlay(playlist.songs[playlist.order[orderNum]]);
|
||||||
playlist.current = orderNum;
|
playlist.current = orderNum;
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int playPlaylist(int fd, int song, int stopOnError)
|
int playPlaylist(int fd, int song, int stopOnError)
|
||||||
@ -903,7 +897,8 @@ int playPlaylist(int fd, int song, int stopOnError)
|
|||||||
playlist_stopOnError = stopOnError;
|
playlist_stopOnError = stopOnError;
|
||||||
playlist_errorCount = 0;
|
playlist_errorCount = 0;
|
||||||
|
|
||||||
return playPlaylistOrderNumber(fd, i);
|
playPlaylistOrderNumber(i);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int playPlaylistById(int fd, int id, int stopOnError)
|
int playPlaylistById(int fd, int id, int stopOnError)
|
||||||
@ -957,39 +952,39 @@ void syncPlayerAndPlaylist(void)
|
|||||||
syncCurrentPlayerDecodeMetadata();
|
syncCurrentPlayerDecodeMetadata();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int currentSongInPlaylist(int fd)
|
static void currentSongInPlaylist(void)
|
||||||
{
|
{
|
||||||
if (playlist_state != PLAYLIST_STATE_PLAY)
|
if (playlist_state != PLAYLIST_STATE_PLAY)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
playlist_stopOnError = 0;
|
playlist_stopOnError = 0;
|
||||||
|
|
||||||
syncPlaylistWithQueue(0);
|
syncPlaylistWithQueue(0);
|
||||||
|
|
||||||
if (playlist.current >= 0 && playlist.current < playlist.length) {
|
if (playlist.current >= 0 && playlist.current < playlist.length)
|
||||||
return playPlaylistOrderNumber(fd, playlist.current);
|
playPlaylistOrderNumber(playlist.current);
|
||||||
} else
|
else
|
||||||
return stopPlaylist(fd);
|
stopPlaylist();
|
||||||
}
|
}
|
||||||
|
|
||||||
int nextSongInPlaylist(int fd)
|
void nextSongInPlaylist(void)
|
||||||
{
|
{
|
||||||
if (playlist_state != PLAYLIST_STATE_PLAY)
|
if (playlist_state != PLAYLIST_STATE_PLAY)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
syncPlaylistWithQueue(0);
|
syncPlaylistWithQueue(0);
|
||||||
|
|
||||||
playlist_stopOnError = 0;
|
playlist_stopOnError = 0;
|
||||||
|
|
||||||
if (playlist.current < playlist.length - 1) {
|
if (playlist.current < playlist.length - 1) {
|
||||||
return playPlaylistOrderNumber(fd, playlist.current + 1);
|
playPlaylistOrderNumber(playlist.current + 1);
|
||||||
} else if (playlist.length && playlist.repeat) {
|
} else if (playlist.length && playlist.repeat) {
|
||||||
if (playlist.random)
|
if (playlist.random)
|
||||||
randomizeOrder(0, playlist.length - 1);
|
randomizeOrder(0, playlist.length - 1);
|
||||||
return playPlaylistOrderNumber(fd, 0);
|
playPlaylistOrderNumber(0);
|
||||||
} else {
|
} else {
|
||||||
incrPlaylistCurrent();
|
incrPlaylistCurrent();
|
||||||
return stopPlaylist(fd);
|
stopPlaylist();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1008,11 +1003,11 @@ void playPlaylistIfPlayerStopped(void)
|
|||||||
|| error == PLAYER_ERROR_AUDIO
|
|| error == PLAYER_ERROR_AUDIO
|
||||||
|| error == PLAYER_ERROR_SYSTEM
|
|| error == PLAYER_ERROR_SYSTEM
|
||||||
|| playlist_errorCount >= playlist.length)) {
|
|| playlist_errorCount >= playlist.length)) {
|
||||||
stopPlaylist(STDERR_FILENO);
|
stopPlaylist();
|
||||||
} else if (playlist_noGoToNext)
|
} else if (playlist_noGoToNext)
|
||||||
currentSongInPlaylist(STDERR_FILENO);
|
currentSongInPlaylist();
|
||||||
else
|
else
|
||||||
nextSongInPlaylist(STDERR_FILENO);
|
nextSongInPlaylist();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1227,7 +1222,7 @@ int setPlaylistRandomStatus(int fd, int status)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int previousSongInPlaylist(int fd)
|
void previousSongInPlaylist(void)
|
||||||
{
|
{
|
||||||
static time_t lastTime;
|
static time_t lastTime;
|
||||||
time_t diff = time(NULL) - lastTime;
|
time_t diff = time(NULL) - lastTime;
|
||||||
@ -1235,20 +1230,19 @@ int previousSongInPlaylist(int fd)
|
|||||||
lastTime += diff;
|
lastTime += diff;
|
||||||
|
|
||||||
if (playlist_state != PLAYLIST_STATE_PLAY)
|
if (playlist_state != PLAYLIST_STATE_PLAY)
|
||||||
return 0;
|
return;
|
||||||
|
|
||||||
syncPlaylistWithQueue(0);
|
syncPlaylistWithQueue(0);
|
||||||
|
|
||||||
if (diff && getPlayerElapsedTime() > PLAYLIST_PREV_UNLESS_ELAPSED) {
|
if (diff && getPlayerElapsedTime() > PLAYLIST_PREV_UNLESS_ELAPSED) {
|
||||||
return playPlaylistOrderNumber(fd, playlist.current);
|
playPlaylistOrderNumber(playlist.current);
|
||||||
} else {
|
} else {
|
||||||
if (playlist.current > 0) {
|
if (playlist.current > 0) {
|
||||||
return playPlaylistOrderNumber(fd,
|
playPlaylistOrderNumber(playlist.current - 1);
|
||||||
playlist.current - 1);
|
|
||||||
} else if (playlist.repeat) {
|
} else if (playlist.repeat) {
|
||||||
return playPlaylistOrderNumber(fd, playlist.length - 1);
|
playPlaylistOrderNumber(playlist.length - 1);
|
||||||
} else {
|
} else {
|
||||||
return playPlaylistOrderNumber(fd, playlist.current);
|
playPlaylistOrderNumber(playlist.current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1388,12 +1382,11 @@ int seekSongInPlaylist(int fd, int song, float seek_time)
|
|||||||
if (playlist_state == PLAYLIST_STATE_PLAY) {
|
if (playlist_state == PLAYLIST_STATE_PLAY) {
|
||||||
if (playlist.queued >= 0)
|
if (playlist.queued >= 0)
|
||||||
clearPlayerQueueLocked();
|
clearPlayerQueueLocked();
|
||||||
} else if (playPlaylistOrderNumber(fd, i) < 0)
|
} else
|
||||||
return -1;
|
playPlaylistOrderNumber(i);
|
||||||
|
|
||||||
if (playlist.current != i) {
|
if (playlist.current != i) {
|
||||||
if (playPlaylistOrderNumber(fd, i) < 0)
|
playPlaylistOrderNumber(i);
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return playerSeek(fd, playlist.songs[playlist.order[i]], seek_time);
|
return playerSeek(fd, playlist.songs[playlist.order[i]], seek_time);
|
||||||
|
@ -51,7 +51,7 @@ void readPlaylistState(FILE *);
|
|||||||
|
|
||||||
void savePlaylistState(FILE *);
|
void savePlaylistState(FILE *);
|
||||||
|
|
||||||
int clearPlaylist(int fd);
|
void clearPlaylist(void);
|
||||||
|
|
||||||
int clearStoredPlaylist(int fd, char *utf8file);
|
int clearStoredPlaylist(int fd, char *utf8file);
|
||||||
|
|
||||||
@ -71,17 +71,17 @@ int playlistInfo(int fd, int song);
|
|||||||
|
|
||||||
int playlistId(int fd, int song);
|
int playlistId(int fd, int song);
|
||||||
|
|
||||||
int stopPlaylist(int fd);
|
void stopPlaylist(void);
|
||||||
|
|
||||||
int playPlaylist(int fd, int song, int stopOnError);
|
int playPlaylist(int fd, int song, int stopOnError);
|
||||||
|
|
||||||
int playPlaylistById(int fd, int song, int stopOnError);
|
int playPlaylistById(int fd, int song, int stopOnError);
|
||||||
|
|
||||||
int nextSongInPlaylist(int fd);
|
void nextSongInPlaylist(void);
|
||||||
|
|
||||||
void syncPlayerAndPlaylist(void);
|
void syncPlayerAndPlaylist(void);
|
||||||
|
|
||||||
int previousSongInPlaylist(int fd);
|
void previousSongInPlaylist(void);
|
||||||
|
|
||||||
int shufflePlaylist(int fd);
|
int shufflePlaylist(int fd);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user