playlist: pass const playlist pointers

Pass constant playlist objects to functions which do not modify it.
This commit is contained in:
Max Kellermann 2009-02-04 22:08:39 +01:00
parent 080dd095a5
commit cbea8a2a00
2 changed files with 12 additions and 15 deletions

View File

@ -247,13 +247,13 @@ playPlaylistIfPlayerStopped(struct playlist *playlist)
} }
bool bool
getPlaylistRepeatStatus(struct playlist *playlist) getPlaylistRepeatStatus(const struct playlist *playlist)
{ {
return playlist->queue.repeat; return playlist->queue.repeat;
} }
bool bool
getPlaylistRandomStatus(struct playlist *playlist) getPlaylistRandomStatus(const struct playlist *playlist)
{ {
return playlist->queue.random; return playlist->queue.random;
} }
@ -323,7 +323,7 @@ void setPlaylistRandomStatus(struct playlist *playlist, bool status)
idle_add(IDLE_OPTIONS); idle_add(IDLE_OPTIONS);
} }
int getPlaylistCurrentSong(struct playlist *playlist) int getPlaylistCurrentSong(const struct playlist *playlist)
{ {
if (playlist->current >= 0) if (playlist->current >= 0)
return queue_order_to_position(&playlist->queue, return queue_order_to_position(&playlist->queue,
@ -333,19 +333,19 @@ int getPlaylistCurrentSong(struct playlist *playlist)
} }
unsigned long unsigned long
getPlaylistVersion(struct playlist *playlist) getPlaylistVersion(const struct playlist *playlist)
{ {
return playlist->queue.version; return playlist->queue.version;
} }
int int
getPlaylistLength(struct playlist *playlist) getPlaylistLength(const struct playlist *playlist)
{ {
return queue_length(&playlist->queue); return queue_length(&playlist->queue);
} }
unsigned unsigned
getPlaylistSongId(struct playlist *playlist, unsigned song) getPlaylistSongId(const struct playlist *playlist, unsigned song)
{ {
return queue_position_to_id(&playlist->queue, song); return queue_position_to_id(&playlist->queue, song);
} }

View File

@ -153,9 +153,6 @@ void previousSongInPlaylist(struct playlist *playlist);
void shufflePlaylist(struct playlist *playlist); void shufflePlaylist(struct playlist *playlist);
enum playlist_result
savePlaylist(struct playlist *playlist, const char *utf8file);
void void
deleteASongFromPlaylist(struct playlist *playlist, const struct song *song); deleteASongFromPlaylist(struct playlist *playlist, const struct song *song);
@ -172,24 +169,24 @@ enum playlist_result
swapSongsInPlaylistById(struct playlist *playlist, unsigned id1, unsigned id2); swapSongsInPlaylistById(struct playlist *playlist, unsigned id1, unsigned id2);
bool bool
getPlaylistRepeatStatus(struct playlist *playlist); getPlaylistRepeatStatus(const struct playlist *playlist);
void setPlaylistRepeatStatus(struct playlist *playlist, bool status); void setPlaylistRepeatStatus(struct playlist *playlist, bool status);
bool bool
getPlaylistRandomStatus(struct playlist *playlist); getPlaylistRandomStatus(const struct playlist *playlist);
void setPlaylistRandomStatus(struct playlist *playlist, bool status); void setPlaylistRandomStatus(struct playlist *playlist, bool status);
int getPlaylistCurrentSong(struct playlist *playlist); int getPlaylistCurrentSong(const struct playlist *playlist);
unsigned unsigned
getPlaylistSongId(struct playlist *playlist, unsigned song); getPlaylistSongId(const struct playlist *playlist, unsigned song);
int getPlaylistLength(struct playlist *playlist); int getPlaylistLength(const struct playlist *playlist);
unsigned long unsigned long
getPlaylistVersion(struct playlist *playlist); getPlaylistVersion(const struct playlist *playlist);
enum playlist_result enum playlist_result
seekSongInPlaylist(struct playlist *playlist, unsigned song, float seek_time); seekSongInPlaylist(struct playlist *playlist, unsigned song, float seek_time);