dbUtils, playlist, directory: pass constant pointers

The usual bunch of const pointer conversions.
This commit is contained in:
Max Kellermann 2008-09-06 15:28:31 +02:00
parent d38d2bc353
commit 35c0b84f08
6 changed files with 38 additions and 37 deletions

View File

@ -80,7 +80,8 @@ static int searchInDirectory(int fd, Song * song, void *data)
return 0;
}
int searchForSongsIn(int fd, char *name, int numItems, LocateTagItem * items)
int searchForSongsIn(int fd, const char *name, int numItems,
LocateTagItem * items)
{
int ret;
int i;
@ -118,7 +119,7 @@ static int findInDirectory(int fd, Song * song, void *data)
return 0;
}
int findSongsIn(int fd, char *name, int numItems, LocateTagItem * items)
int findSongsIn(int fd, const char *name, int numItems, LocateTagItem * items)
{
LocateTagItemArray array;
@ -148,7 +149,7 @@ static int searchStatsInDirectory(mpd_unused int fd, Song * song, void *data)
return 0;
}
int searchStatsForSongsIn(int fd, char *name, int numItems,
int searchStatsForSongsIn(int fd, const char *name, int numItems,
LocateTagItem * items)
{
SearchStats stats;
@ -166,7 +167,7 @@ int searchStatsForSongsIn(int fd, char *name, int numItems,
return ret;
}
int printAllIn(int fd, char *name)
int printAllIn(int fd, const char *name)
{
return traverseAllIn(fd, name, printSongInDirectory,
printDirectoryInDirectory, NULL);
@ -185,12 +186,12 @@ static int directoryAddSongToStoredPlaylist(int fd, Song *song, void *data)
return 0;
}
int addAllIn(int fd, char *name)
int addAllIn(int fd, const char *name)
{
return traverseAllIn(fd, name, directoryAddSongToPlaylist, NULL, NULL);
}
int addAllInToStoredPlaylist(int fd, char *name, char *utf8file)
int addAllInToStoredPlaylist(int fd, const char *name, const char *utf8file)
{
return traverseAllIn(fd, name, directoryAddSongToStoredPlaylist, NULL,
(void *)utf8file);
@ -211,13 +212,13 @@ static int sumSongTime(mpd_unused int fd, Song * song, void *data)
return 0;
}
int printInfoForAllIn(int fd, char *name)
int printInfoForAllIn(int fd, const char *name)
{
return traverseAllIn(fd, name, directoryPrintSongInfo,
printDirectoryInDirectory, NULL);
}
int countSongsIn(int fd, char *name)
int countSongsIn(int fd, const char *name)
{
int count = 0;
void *ptr = (void *)&count;
@ -227,7 +228,7 @@ int countSongsIn(int fd, char *name)
return count;
}
unsigned long sumSongTimesIn(int fd, char *name)
unsigned long sumSongTimesIn(int fd, const char *name)
{
unsigned long dbPlayTime = 0;
void *ptr = (void *)&dbPlayTime;

View File

@ -21,25 +21,25 @@
#include "locate.h"
int printAllIn(int fd, char *name);
int printAllIn(int fd, const char *name);
int addAllIn(int fd, char *name);
int addAllIn(int fd, const char *name);
int addAllInToStoredPlaylist(int fd, char *name, char *utf8file);
int addAllInToStoredPlaylist(int fd, const char *name, const char *utf8file);
int printInfoForAllIn(int fd, char *name);
int printInfoForAllIn(int fd, const char *name);
int searchForSongsIn(int fd, char *name, int numItems,
int searchForSongsIn(int fd, const char *name, int numItems,
LocateTagItem * items);
int findSongsIn(int fd, char *name, int numItems, LocateTagItem * items);
int findSongsIn(int fd, const char *name, int numItems, LocateTagItem * items);
int searchStatsForSongsIn(int fd, char *name, int numItems,
int searchStatsForSongsIn(int fd, const char *name, int numItems,
LocateTagItem * items);
int countSongsIn(int fd, char *name);
int countSongsIn(int fd, const char *name);
unsigned long sumSongTimesIn(int fd, char *name);
unsigned long sumSongTimesIn(int fd, const char *name);
int listAllUniqueTags(int fd, int type, int numConditiionals,
LocateTagItem * conditionals);

View File

@ -1219,7 +1219,7 @@ static int traverseAllInSubDirectory(int fd, Directory * directory,
return errFlag;
}
int traverseAllIn(int fd, char *name,
int traverseAllIn(int fd, const char *name,
int (*forEachSong) (int, Song *, void *),
int (*forEachDir) (int, Directory *, void *), void *data)
{
@ -1303,7 +1303,7 @@ static Song *getSongDetails(const char *file, const char **shortnameRet,
return (Song *) song;
}
Song *getSongFromDB(char *file)
Song *getSongFromDB(const char *file)
{
return getSongDetails(file, NULL, NULL);
}

View File

@ -60,11 +60,11 @@ int readDirectoryDB(void);
void updateMp3Directory(void);
Song *getSongFromDB(char *file);
Song *getSongFromDB(const char *file);
time_t getDbModTime(void);
int traverseAllIn(int fd, char *name,
int traverseAllIn(int fd, const char *name,
int (*forEachSong) (int, Song *, void *),
int (*forEachDir) (int, Directory *, void *), void *data);

View File

@ -211,7 +211,7 @@ void clearPlaylist(void)
incrPlaylistVersion();
}
int clearStoredPlaylist(int fd, char *utf8file)
int clearStoredPlaylist(int fd, const char *utf8file)
{
return removeAllFromStoredPlaylistByPath(fd, utf8file);
}
@ -561,7 +561,7 @@ static void clearPlayerQueue(void)
playerQueueUnlock();
}
int addToPlaylist(int fd, char *url, int *added_id)
int addToPlaylist(int fd, const char *url, int *added_id)
{
Song *song;
@ -579,7 +579,7 @@ int addToPlaylist(int fd, char *url, int *added_id)
return addSongToPlaylist(fd, song, added_id);
}
int addToStoredPlaylist(int fd, char *url, char *utf8file)
int addToStoredPlaylist(int fd, const char *url, const char *utf8file)
{
Song *song;
@ -1270,7 +1270,7 @@ int shufflePlaylist(mpd_unused int fd)
return 0;
}
int deletePlaylist(int fd, char *utf8file)
int deletePlaylist(int fd, const char *utf8file)
{
char path_max_tmp[MPD_PATH_MAX];
@ -1291,7 +1291,7 @@ int deletePlaylist(int fd, char *utf8file)
return 0;
}
int savePlaylist(int fd, char *utf8file)
int savePlaylist(int fd, const char *utf8file)
{
FILE *fp;
int i;
@ -1400,7 +1400,7 @@ int getPlaylistSongId(int song)
return playlist.positionToId[song];
}
int PlaylistInfo(int fd, char *utf8file, int detail)
int PlaylistInfo(int fd, const char *utf8file, int detail)
{
ListNode *node;
List *list;
@ -1432,7 +1432,7 @@ int PlaylistInfo(int fd, char *utf8file, int detail)
return 0;
}
int loadPlaylist(int fd, char *utf8file)
int loadPlaylist(int fd, const char *utf8file)
{
ListNode *node;
List *list;

View File

@ -53,11 +53,11 @@ void savePlaylistState(FILE *);
void clearPlaylist(void);
int clearStoredPlaylist(int fd, char *utf8file);
int clearStoredPlaylist(int fd, const char *utf8file);
int addToPlaylist(int fd, char *file, int *added_id);
int addToPlaylist(int fd, const char *file, int *added_id);
int addToStoredPlaylist(int fd, char *file, char *utf8file);
int addToStoredPlaylist(int fd, const char *file, const char *utf8file);
int addSongToPlaylist(int fd, Song * song, int *added_id);
@ -85,11 +85,11 @@ void previousSongInPlaylist(void);
int shufflePlaylist(int fd);
int savePlaylist(int fd, char *utf8file);
int savePlaylist(int fd, const char *utf8file);
int deletePlaylist(int fd, char *utf8file);
int deletePlaylist(int fd, const char *utf8file);
int deletePlaylistById(int fd, char *utf8file);
int deletePlaylistById(int fd, const char *utf8file);
void deleteASongFromPlaylist(Song * song);
@ -101,7 +101,7 @@ int swapSongsInPlaylist(int fd, int song1, int song2);
int swapSongsInPlaylistById(int fd, int id1, int id2);
int loadPlaylist(int fd, char *utf8file);
int loadPlaylist(int fd, const char *utf8file);
int getPlaylistRepeatStatus(void);
@ -131,7 +131,7 @@ int playlistChanges(int fd, mpd_uint32 version);
int playlistChangesPosId(int fd, mpd_uint32 version);
int PlaylistInfo(int fd, char *utf8file, int detail);
int PlaylistInfo(int fd, const char *utf8file, int detail);
void searchForSongsInPlaylist(int fd, int numItems, LocateTagItem * items);