aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-06 15:28:31 +0200
committerEric Wong <normalperson@yhbt.net>2008-09-09 00:46:46 -0700
commit57b17b7e6585fc9dfdaee10e31441e39354a4422 (patch)
treec1583afbe8bd5c07ebe704d2519fbd519606a915
parentdccdfce721ffe730de2f55a67ecd1acfcb19bb0a (diff)
downloadmpd-57b17b7e6585fc9dfdaee10e31441e39354a4422.tar.gz
mpd-57b17b7e6585fc9dfdaee10e31441e39354a4422.tar.xz
mpd-57b17b7e6585fc9dfdaee10e31441e39354a4422.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 d39c9908c..8c499ec7e 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 33a862ddd..32db02a9b 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 89b4fdd99..629742aa3 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -238,7 +238,7 @@ void clearPlaylist(void)
incrPlaylistVersion();
}
-int clearStoredPlaylist(int fd, char *utf8file)
+int clearStoredPlaylist(int fd, const char *utf8file)
{
return removeAllFromStoredPlaylistByPath(fd, utf8file);
}
@@ -597,7 +597,7 @@ static int clear_queue(void)
return playlist.queued;
}
-int addToPlaylist(int fd, char *url, int *added_id)
+int addToPlaylist(int fd, const char *url, int *added_id)
{
Song *song;
@@ -615,7 +615,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;
@@ -1311,7 +1311,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];
@@ -1332,7 +1332,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;
@@ -1445,7 +1445,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;
@@ -1477,7 +1477,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 629bfa057..c144d4ab4 100644
--- a/src/playlist.h
+++ b/src/playlist.h
@@ -38,11 +38,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);
@@ -76,11 +76,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);
@@ -92,7 +92,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);
@@ -120,7 +120,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);