aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-06 15:28:31 +0200
committerMax Kellermann <max@duempel.org>2008-09-06 15:28:31 +0200
commit35c0b84f0897508b1f2fb82d1fc096164621b2bb (patch)
treec9a129da91fca3808adb586de8eecf392defb486
parentd38d2bc3533dcfb661a3cbb8bd6cd9574c31ab69 (diff)
downloadmpd-35c0b84f0897508b1f2fb82d1fc096164621b2bb.tar.gz
mpd-35c0b84f0897508b1f2fb82d1fc096164621b2bb.tar.xz
mpd-35c0b84f0897508b1f2fb82d1fc096164621b2bb.zip
dbUtils, playlist, directory: pass constant pointers
The usual bunch of const pointer conversions.
-rw-r--r--src/dbUtils.c19
-rw-r--r--src/dbUtils.h18
-rw-r--r--src/directory.c4
-rw-r--r--src/directory.h4
-rw-r--r--src/playlist.c14
-rw-r--r--src/playlist.h16
6 files changed, 38 insertions, 37 deletions
diff --git a/src/dbUtils.c b/src/dbUtils.c
index 1c758476d..26e727377 100644
--- a/src/dbUtils.c
+++ b/src/dbUtils.c
@@ -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;
diff --git a/src/dbUtils.h b/src/dbUtils.h
index f2237eab7..89b69bfc3 100644
--- a/src/dbUtils.h
+++ b/src/dbUtils.h
@@ -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);
diff --git a/src/directory.c b/src/directory.c
index 5375d8dd1..55ae560cc 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -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);
}
diff --git a/src/directory.h b/src/directory.h
index acb173fc0..00b902510 100644
--- a/src/directory.h
+++ b/src/directory.h
@@ -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);
diff --git a/src/playlist.c b/src/playlist.c
index 3b7c9d664..f128af1b6 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -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;
diff --git a/src/playlist.h b/src/playlist.h
index 1249a8d5f..33b3bb2b6 100644
--- a/src/playlist.h
+++ b/src/playlist.h
@@ -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);