aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-07 13:53:55 +0200
committerMax Kellermann <max@duempel.org>2008-09-07 13:53:55 +0200
commitdc8b64fdef1f8bc4499eef3aca17ed336ea3569b (patch)
treeba98b059e544ddecd774bd4c97ce66898cba3be0
parent5609a1fcd09c498fdcdfe0f535052e8d8c3ef05c (diff)
downloadmpd-dc8b64fdef1f8bc4499eef3aca17ed336ea3569b.tar.gz
mpd-dc8b64fdef1f8bc4499eef3aca17ed336ea3569b.tar.xz
mpd-dc8b64fdef1f8bc4499eef3aca17ed336ea3569b.zip
pass "struct client" to dbUtils.c, song.c, tag_print.c
Don't pass the raw file descriptor around. This migration patch is rather large, because all of the sources have inter dependencies - we have to change all of them at the same time.
-rw-r--r--src/command.c32
-rw-r--r--src/dbUtils.c67
-rw-r--r--src/dbUtils.h19
-rw-r--r--src/directory.c13
-rw-r--r--src/directory.h2
-rw-r--r--src/playlist.c35
-rw-r--r--src/playlist.h14
-rw-r--r--src/song.h2
-rw-r--r--src/song_print.c20
-rw-r--r--src/song_print.h6
-rw-r--r--src/tag_print.c16
-rw-r--r--src/tag_print.h5
12 files changed, 121 insertions, 110 deletions
diff --git a/src/command.c b/src/command.c
index 1e4597870..e6fb64a6c 100644
--- a/src/command.c
+++ b/src/command.c
@@ -323,7 +323,7 @@ static int handleUrlHandlers(struct client *client, mpd_unused int *permission,
static int handleTagTypes(struct client *client, mpd_unused int *permission,
mpd_unused int argc, mpd_unused char *argv[])
{
- tag_print_types(client_get_fd(client));
+ tag_print_types(client);
return 0;
}
@@ -368,7 +368,7 @@ static int handleCurrentSong(struct client *client, mpd_unused int *permission,
if (song < 0)
return 0;
- result = playlistInfo(client_get_fd(client), song);
+ result = playlistInfo(client, song);
return print_playlist_result(client, result);
}
@@ -584,7 +584,7 @@ static int handleListPlaylist(struct client *client, mpd_unused int *permission,
{
int ret;
- ret = PlaylistInfo(client_get_fd(client), argv[1], 0);
+ ret = PlaylistInfo(client, argv[1], 0);
if (ret == -1)
command_error(client, ACK_ERROR_NO_EXIST, "No such playlist");
@@ -596,7 +596,7 @@ static int handleListPlaylistInfo(struct client *client, mpd_unused int *permiss
{
int ret;
- ret = PlaylistInfo(client_get_fd(client), argv[1], 1);
+ ret = PlaylistInfo(client, argv[1], 1);
if (ret == -1)
command_error(client, ACK_ERROR_NO_EXIST, "No such playlist");
@@ -611,7 +611,7 @@ static int handleLsInfo(struct client *client, mpd_unused int *permission,
if (argc == 2)
path = argv[1];
- if (printDirectoryInfo(client_get_fd(client), path) < 0) {
+ if (printDirectoryInfo(client, path) < 0) {
command_error(client, ACK_ERROR_NO_EXIST,
"directory not found");
return -1;
@@ -648,7 +648,7 @@ static int handlePlaylistChanges(struct client *client, mpd_unused int *permissi
if (check_uint32(client, &version, argv[1], need_positive) < 0)
return -1;
- return playlistChanges(client_get_fd(client), version);
+ return playlistChanges(client, version);
}
static int handlePlaylistChangesPosId(struct client *client, mpd_unused int *permission,
@@ -670,7 +670,7 @@ static int handlePlaylistInfo(struct client *client, mpd_unused int *permission,
if (argc == 2 && check_int(client, &song, argv[1], need_positive) < 0)
return -1;
- result = playlistInfo(client_get_fd(client), song);
+ result = playlistInfo(client, song);
return print_playlist_result(client, result);
}
@@ -683,7 +683,7 @@ static int handlePlaylistId(struct client *client, mpd_unused int *permission,
if (argc == 2 && check_int(client, &id, argv[1], need_positive) < 0)
return -1;
- result = playlistId(client_get_fd(client), id);
+ result = playlistId(client, id);
return print_playlist_result(client, result);
}
@@ -702,7 +702,7 @@ static int handleFind(struct client *client, mpd_unused int *permission,
return -1;
}
- ret = findSongsIn(client_get_fd(client), NULL, numItems, items);
+ ret = findSongsIn(client, NULL, numItems, items);
if (ret == -1)
command_error(client, ACK_ERROR_NO_EXIST,
"directory or file not found");
@@ -727,7 +727,7 @@ static int handleSearch(struct client *client, mpd_unused int *permission,
return -1;
}
- ret = searchForSongsIn(client_get_fd(client), NULL, numItems, items);
+ ret = searchForSongsIn(client, NULL, numItems, items);
if (ret == -1)
command_error(client, ACK_ERROR_NO_EXIST,
"directory or file not found");
@@ -752,7 +752,7 @@ static int handleCount(struct client *client, mpd_unused int *permission,
return -1;
}
- ret = searchStatsForSongsIn(client_get_fd(client), NULL, numItems, items);
+ ret = searchStatsForSongsIn(client, NULL, numItems, items);
if (ret == -1)
command_error(client, ACK_ERROR_NO_EXIST,
"directory or file not found");
@@ -775,7 +775,7 @@ static int handlePlaylistFind(struct client *client, mpd_unused int *permission,
return -1;
}
- findSongsInPlaylist(client_get_fd(client), numItems, items);
+ findSongsInPlaylist(client, numItems, items);
freeLocateTagItemArray(numItems, items);
@@ -795,7 +795,7 @@ static int handlePlaylistSearch(struct client *client, mpd_unused int *permissio
return -1;
}
- searchForSongsInPlaylist(client_get_fd(client), numItems, items);
+ searchForSongsInPlaylist(client, numItems, items);
freeLocateTagItemArray(numItems, items);
@@ -937,7 +937,7 @@ static int handleListAll(struct client *client, mpd_unused int *permission,
if (argc == 2)
directory = argv[1];
- ret = printAllIn(client_get_fd(client), directory);
+ ret = printAllIn(client, directory);
if (ret == -1)
command_error(client, ACK_ERROR_NO_EXIST,
"directory or file not found");
@@ -1068,7 +1068,7 @@ static int handleList(struct client *client, mpd_unused int *permission,
}
}
- ret = listAllUniqueTags(client_get_fd(client), tagType, numConditionals, conditionals);
+ ret = listAllUniqueTags(client, tagType, numConditionals, conditionals);
if (conditionals)
freeLocateTagItemArray(numConditionals, conditionals);
@@ -1175,7 +1175,7 @@ static int handleListAllInfo(struct client *client, mpd_unused int *permission,
if (argc == 2)
directory = argv[1];
- ret = printInfoForAllIn(client_get_fd(client), directory);
+ ret = printInfoForAllIn(client, directory);
if (ret == -1)
command_error(client, ACK_ERROR_NO_EXIST,
"directory or file not found");
diff --git a/src/dbUtils.c b/src/dbUtils.c
index 4aebaed4b..ba60dc485 100644
--- a/src/dbUtils.c
+++ b/src/dbUtils.c
@@ -19,7 +19,7 @@
#include "dbUtils.h"
#include "directory.h"
-#include "myfprintf.h"
+#include "client.h"
#include "utils.h"
#include "playlist.h"
#include "song.h"
@@ -58,39 +58,38 @@ static int countSongsInDirectory(Directory * directory,
static int printDirectoryInDirectory(Directory * directory, void *data)
{
- int fd = (int)(size_t)data;
+ struct client *client = data;
if (directory->path) {
- fdprintf(fd, "directory: %s\n", getDirectoryPath(directory));
+ client_printf(client, "directory: %s\n", getDirectoryPath(directory));
}
return 0;
}
static int printSongInDirectory(Song * song, mpd_unused void *data)
{
- int fd = (int)(size_t)data;
- printSongUrl(fd, song);
+ struct client *client = data;
+ printSongUrl(client, song);
return 0;
}
struct search_data {
- int fd;
+ struct client *client;
LocateTagItemArray array;
};
static int searchInDirectory(Song * song, void *_data)
{
struct search_data *data = _data;
- int fd = data->fd;
LocateTagItemArray *array = &data->array;
if (strstrSearchTags(song, array->numItems, array->items))
- printSongInfo(fd, song);
+ printSongInfo(data->client, song);
return 0;
}
-int searchForSongsIn(int fd, const char *name, int numItems,
- LocateTagItem * items)
+int searchForSongsIn(struct client *client, const char *name,
+ int numItems, LocateTagItem * items)
{
int ret;
int i;
@@ -103,7 +102,7 @@ int searchForSongsIn(int fd, const char *name, int numItems,
items[i].needle = strDupToUpper(originalNeedles[i]);
}
- data.fd = fd;
+ data.client = client;
data.array.numItems = numItems;
data.array.items = items;
@@ -122,30 +121,30 @@ int searchForSongsIn(int fd, const char *name, int numItems,
static int findInDirectory(Song * song, void *_data)
{
struct search_data *data = _data;
- int fd = data->fd;
LocateTagItemArray *array = &data->array;
if (tagItemsFoundAndMatches(song, array->numItems, array->items))
- printSongInfo(fd, song);
+ printSongInfo(data->client, song);
return 0;
}
-int findSongsIn(int fd, const char *name, int numItems, LocateTagItem * items)
+int findSongsIn(struct client *client, const char *name,
+ int numItems, LocateTagItem * items)
{
struct search_data data;
- data.fd = fd;
+ data.client = client;
data.array.numItems = numItems;
data.array.items = items;
return traverseAllIn(name, findInDirectory, NULL, &data);
}
-static void printSearchStats(int fd, SearchStats *stats)
+static void printSearchStats(struct client *client, SearchStats *stats)
{
- fdprintf(fd, "songs: %i\n", stats->numberOfSongs);
- fdprintf(fd, "playtime: %li\n", stats->playTime);
+ client_printf(client, "songs: %i\n", stats->numberOfSongs);
+ client_printf(client, "playtime: %li\n", stats->playTime);
}
static int searchStatsInDirectory(Song * song, void *data)
@@ -162,8 +161,8 @@ static int searchStatsInDirectory(Song * song, void *data)
return 0;
}
-int searchStatsForSongsIn(int fd, const char *name, int numItems,
- LocateTagItem * items)
+int searchStatsForSongsIn(struct client *client, const char *name,
+ int numItems, LocateTagItem * items)
{
SearchStats stats;
int ret;
@@ -175,15 +174,15 @@ int searchStatsForSongsIn(int fd, const char *name, int numItems,
ret = traverseAllIn(name, searchStatsInDirectory, NULL, &stats);
if (ret == 0)
- printSearchStats(fd, &stats);
+ printSearchStats(client, &stats);
return ret;
}
-int printAllIn(int fd, const char *name)
+int printAllIn(struct client *client, const char *name)
{
return traverseAllIn(name, printSongInDirectory,
- printDirectoryInDirectory, (void*)(size_t)fd);
+ printDirectoryInDirectory, client);
}
static int directoryAddSongToPlaylist(Song * song, mpd_unused void *data)
@@ -221,9 +220,9 @@ int addAllInToStoredPlaylist(const char *name, const char *utf8file)
static int directoryPrintSongInfo(Song * song, void *data)
{
- int fd = (int)(size_t)data;
+ struct client *client = data;
- return printSongInfo(fd, song);
+ return printSongInfo(client, song);
}
static int sumSongTime(Song * song, void *data)
@@ -236,10 +235,10 @@ static int sumSongTime(Song * song, void *data)
return 0;
}
-int printInfoForAllIn(int fd, const char *name)
+int printInfoForAllIn(struct client *client, const char *name)
{
return traverseAllIn(name, directoryPrintSongInfo,
- printDirectoryInDirectory, (void*)(size_t)fd);
+ printDirectoryInDirectory, client);
}
int countSongsIn(const char *name)
@@ -279,13 +278,13 @@ static void freeListCommandItem(ListCommandItem * item)
free(item);
}
-static void visitTag(int fd, Song * song, enum tag_type tagType)
+static void visitTag(struct client *client, Song * song, enum tag_type tagType)
{
int i;
struct tag *tag = song->tag;
if (tagType == LOCATE_TAG_FILE_TYPE) {
- printSongUrl(fd, song);
+ printSongUrl(client, song);
return;
}
@@ -300,7 +299,7 @@ static void visitTag(int fd, Song * song, enum tag_type tagType)
}
struct list_tags_data {
- int fd;
+ struct client *client;
ListCommandItem *item;
};
@@ -311,20 +310,20 @@ static int listUniqueTagsInDirectory(Song * song, void *_data)
if (tagItemsFoundAndMatches(song, item->numConditionals,
item->conditionals)) {
- visitTag(data->fd, song, item->tagType);
+ visitTag(data->client, song, item->tagType);
}
return 0;
}
-int listAllUniqueTags(int fd, int type, int numConditionals,
+int listAllUniqueTags(struct client *client, int type, int numConditionals,
LocateTagItem * conditionals)
{
int ret;
ListCommandItem *item = newListCommandItem(type, numConditionals,
conditionals);
struct list_tags_data data = {
- .fd = fd,
+ .client = client,
.item = item,
};
@@ -336,7 +335,7 @@ int listAllUniqueTags(int fd, int type, int numConditionals,
&data);
if (type >= 0 && type <= TAG_NUM_OF_ITEM_TYPES) {
- printVisitedInTagTracker(fd, type);
+ printVisitedInTagTracker(client_get_fd(client), type);
}
freeListCommandItem(item);
diff --git a/src/dbUtils.h b/src/dbUtils.h
index 592b62e95..2cc7b9f25 100644
--- a/src/dbUtils.h
+++ b/src/dbUtils.h
@@ -21,27 +21,30 @@
#include "locate.h"
-int printAllIn(int fd, const char *name);
+struct client;
+
+int printAllIn(struct client *client, const char *name);
int addAllIn(const char *name);
int addAllInToStoredPlaylist(const char *name, const char *utf8file);
-int printInfoForAllIn(int fd, const char *name);
+int printInfoForAllIn(struct client *client, const char *name);
-int searchForSongsIn(int fd, const char *name, int numItems,
- LocateTagItem * items);
+int searchForSongsIn(struct client *client, const char *name,
+ int numItems, LocateTagItem * items);
-int findSongsIn(int fd, const char *name, int numItems, LocateTagItem * items);
+int findSongsIn(struct client *client, const char *name,
+ int numItems, LocateTagItem * items);
-int searchStatsForSongsIn(int fd, const char *name, int numItems,
- LocateTagItem * items);
+int searchStatsForSongsIn(struct client *client, const char *name,
+ int numItems, LocateTagItem * items);
int countSongsIn(const char *name);
unsigned long sumSongTimesIn(const char *name);
-int listAllUniqueTags(int fd, int type, int numConditiionals,
+int listAllUniqueTags(struct client *client, int type, int numConditiionals,
LocateTagItem * conditionals);
void printSavedMemoryFromFilenames(void);
diff --git a/src/directory.c b/src/directory.c
index 2e3e61f6f..5e1f7473d 100644
--- a/src/directory.c
+++ b/src/directory.c
@@ -29,7 +29,6 @@
#include "stats.h"
#include "utils.h"
#include "volume.h"
-#include "myfprintf.h"
#include "dbUtils.h"
#include "song_print.h"
#include "song_save.h"
@@ -824,30 +823,30 @@ static Directory *getDirectory(const char *name)
return getSubDirectory(mp3rootDirectory, name, &shortname);
}
-static int printDirectoryList(int fd, DirectoryList * directoryList)
+static int printDirectoryList(struct client *client, DirectoryList * directoryList)
{
ListNode *node = directoryList->firstNode;
Directory *directory;
while (node != NULL) {
directory = (Directory *) node->data;
- fdprintf(fd, "%s%s\n", DIRECTORY_DIR,
- getDirectoryPath(directory));
+ client_printf(client, "%s%s\n", DIRECTORY_DIR,
+ getDirectoryPath(directory));
node = node->nextNode;
}
return 0;
}
-int printDirectoryInfo(int fd, const char *name)
+int printDirectoryInfo(struct client *client, const char *name)
{
Directory *directory;
if ((directory = getDirectory(name)) == NULL)
return -1;
- printDirectoryList(fd, directory->subDirectories);
- printSongInfoFromList(fd, directory->songs);
+ printDirectoryList(client, directory->subDirectories);
+ printSongInfoFromList(client, directory->songs);
return 0;
}
diff --git a/src/directory.h b/src/directory.h
index f23372c3b..be191bf5d 100644
--- a/src/directory.h
+++ b/src/directory.h
@@ -55,7 +55,7 @@ void closeMp3Directory(void);
int isRootDirectory(const char *name);
-int printDirectoryInfo(int fd, const char *dirname);
+int printDirectoryInfo(struct client *client, const char *dirname);
int checkDirectoryDB(void);
diff --git a/src/playlist.c b/src/playlist.c
index 54ec74a5a..c512d739b 100644
--- a/src/playlist.c
+++ b/src/playlist.c
@@ -22,6 +22,7 @@
#include "ls.h"
#include "tag.h"
#include "song_print.h"
+#include "client.h"
#include "conf.h"
#include "directory.h"
#include "log.h"
@@ -369,13 +370,13 @@ void readPlaylistState(FILE *fp)
}
}
-static void printPlaylistSongInfo(int fd, int song)
+static void printPlaylistSongInfo(struct client *client, int song)
{
- printSongInfo(fd, playlist.songs[song]);
- fdprintf(fd, "Pos: %i\nId: %i\n", song, playlist.positionToId[song]);
+ printSongInfo(client, playlist.songs[song]);
+ client_printf(client, "Pos: %i\nId: %i\n", song, playlist.positionToId[song]);
}
-int playlistChanges(int fd, mpd_uint32 version)
+int playlistChanges(struct client *client, mpd_uint32 version)
{
int i;
@@ -383,7 +384,7 @@ int playlistChanges(int fd, mpd_uint32 version)
if (version > playlist.version ||
playlist.songMod[i] >= version ||
playlist.songMod[i] == 0) {
- printPlaylistSongInfo(fd, i);
+ printPlaylistSongInfo(client, i);
}
}
@@ -406,7 +407,7 @@ int playlistChangesPosId(int fd, mpd_uint32 version)
return 0;
}
-enum playlist_result playlistInfo(int fd, int song)
+enum playlist_result playlistInfo(struct client *client, int song)
{
int i;
int begin = 0;
@@ -420,7 +421,7 @@ enum playlist_result playlistInfo(int fd, int song)
return PLAYLIST_RESULT_BAD_RANGE;
for (i = begin; i < end; i++)
- printPlaylistSongInfo(fd, i);
+ printPlaylistSongInfo(client, i);
return PLAYLIST_RESULT_SUCCESS;
}
@@ -431,7 +432,7 @@ static int song_id_exists(int id)
playlist.idToPosition[id] != -1;
}
-enum playlist_result playlistId(int fd, int id)
+enum playlist_result playlistId(struct client *client, int id)
{
int i;
int begin = 0;
@@ -446,7 +447,7 @@ enum playlist_result playlistId(int fd, int id)
}
for (i = begin; i < end; i++)
- printPlaylistSongInfo(fd, i);
+ printPlaylistSongInfo(client, i);
return PLAYLIST_RESULT_SUCCESS;
}
@@ -1337,7 +1338,7 @@ int getPlaylistSongId(int song)
return playlist.positionToId[song];
}
-int PlaylistInfo(int fd, const char *utf8file, int detail)
+int PlaylistInfo(struct client *client, const char *utf8file, int detail)
{
ListNode *node;
List *list;
@@ -1353,13 +1354,13 @@ int PlaylistInfo(int fd, const char *utf8file, int detail)
if (detail) {
Song *song = getSongFromDB(temp);
if (song) {
- printSongInfo(fd, song);
+ printSongInfo(client, song);
wrote = 1;
}
}
if (!wrote) {
- fdprintf(fd, SONG_FILE "%s\n", temp);
+ client_printf(client, SONG_FILE "%s\n", temp);
}
node = node->nextNode;
@@ -1403,7 +1404,8 @@ enum playlist_result loadPlaylist(int fd, const char *utf8file)
return PLAYLIST_RESULT_SUCCESS;
}
-void searchForSongsInPlaylist(int fd, int numItems, LocateTagItem * items)
+void searchForSongsInPlaylist(struct client *client,
+ int numItems, LocateTagItem * items)
{
int i;
char **originalNeedles = xmalloc(numItems * sizeof(char *));
@@ -1415,7 +1417,7 @@ void searchForSongsInPlaylist(int fd, int numItems, LocateTagItem * items)
for (i = 0; i < playlist.length; i++) {
if (strstrSearchTags(playlist.songs[i], numItems, items))
- printPlaylistSongInfo(fd, i);
+ printPlaylistSongInfo(client, i);
}
for (i = 0; i < numItems; i++) {
@@ -1426,13 +1428,14 @@ void searchForSongsInPlaylist(int fd, int numItems, LocateTagItem * items)
free(originalNeedles);
}
-void findSongsInPlaylist(int fd, int numItems, LocateTagItem * items)
+void findSongsInPlaylist(struct client *client,
+ int numItems, LocateTagItem * items)
{
int i;
for (i = 0; i < playlist.length; i++) {
if (tagItemsFoundAndMatches(playlist.songs[i], numItems, items))
- printPlaylistSongInfo(fd, i);
+ printPlaylistSongInfo(client, i);
}
}
diff --git a/src/playlist.h b/src/playlist.h
index c013fee9e..4e160cf14 100644
--- a/src/playlist.h
+++ b/src/playlist.h
@@ -79,9 +79,9 @@ enum playlist_result deleteFromPlaylist(int song);
enum playlist_result deleteFromPlaylistById(int song);
-enum playlist_result playlistInfo(int fd, int song);
+enum playlist_result playlistInfo(struct client *client, int song);
-enum playlist_result playlistId(int fd, int song);
+enum playlist_result playlistId(struct client *client, int song);
void stopPlaylist(void);
@@ -137,15 +137,17 @@ enum playlist_result seekSongInPlaylistById(int id, float seek_time);
void playlistVersionChange(void);
-int playlistChanges(int fd, mpd_uint32 version);
+int playlistChanges(struct client *client, mpd_uint32 version);
int playlistChangesPosId(int fd, mpd_uint32 version);
-int PlaylistInfo(int fd, const char *utf8file, int detail);
+int PlaylistInfo(struct client *client, const char *utf8file, int detail);
-void searchForSongsInPlaylist(int fd, int numItems, LocateTagItem * items);
+void searchForSongsInPlaylist(struct client *client,
+ int numItems, LocateTagItem * items);
-void findSongsInPlaylist(int fd, int numItems, LocateTagItem * items);
+void findSongsInPlaylist(struct client *client,
+ int numItems, LocateTagItem * items);
int is_valid_playlist_name(const char *utf8path);
diff --git a/src/song.h b/src/song.h
index 0ea3ec72b..59d372c21 100644
--- a/src/song.h
+++ b/src/song.h
@@ -32,6 +32,8 @@
#define SONG_FILE "file: "
#define SONG_TIME "Time: "
+struct client;
+
typedef struct _Song {
char *url;
mpd_sint8 type;
diff --git a/src/song_print.c b/src/song_print.c
index d7bca662a..77741e768 100644
--- a/src/song_print.c
+++ b/src/song_print.c
@@ -19,34 +19,34 @@
#include "song_print.h"
#include "directory.h"
#include "tag_print.h"
-#include "myfprintf.h"
+#include "client.h"
-void printSongUrl(int fd, Song * song)
+void printSongUrl(struct client *client, Song * song)
{
if (song->parentDir && song->parentDir->path) {
- fdprintf(fd, "%s%s/%s\n", SONG_FILE,
- getDirectoryPath(song->parentDir), song->url);
+ client_printf(client, "%s%s/%s\n", SONG_FILE,
+ getDirectoryPath(song->parentDir), song->url);
} else {
- fdprintf(fd, "%s%s\n", SONG_FILE, song->url);
+ client_printf(client, "%s%s\n", SONG_FILE, song->url);
}
}
-int printSongInfo(int fd, Song * song)
+int printSongInfo(struct client *client, Song * song)
{
- printSongUrl(fd, song);
+ printSongUrl(client, song);
if (song->tag)
- tag_print(fd, song->tag);
+ tag_print(client, song->tag);
return 0;
}
-int printSongInfoFromList(int fd, SongList * list)
+int printSongInfoFromList(struct client *client, SongList * list)
{
ListNode *tempNode = list->firstNode;
while (tempNode != NULL) {
- printSongInfo(fd, (Song *) tempNode->data);
+ printSongInfo(client, (Song *) tempNode->data);
tempNode = tempNode->nextNode;
}
diff --git a/src/song_print.h b/src/song_print.h
index 8a97759bf..bbc034248 100644
--- a/src/song_print.h
+++ b/src/song_print.h
@@ -21,10 +21,10 @@
#include "song.h"
-int printSongInfo(int fd, Song * song);
+int printSongInfo(struct client *client, Song * song);
-int printSongInfoFromList(int fd, SongList * list);
+int printSongInfoFromList(struct client *client, SongList * list);
-void printSongUrl(int fd, Song * song);
+void printSongUrl(struct client *client, Song * song);
#endif
diff --git a/src/tag_print.c b/src/tag_print.c
index c5d50880f..0ed107895 100644
--- a/src/tag_print.c
+++ b/src/tag_print.c
@@ -19,28 +19,30 @@
#include "tag_print.h"
#include "tag.h"
#include "tag_internal.h"
-#include "myfprintf.h"
+#include "client.h"
#include "song.h"
-void tag_print_types(int fd)
+void tag_print_types(struct client *client)
{
int i;
for (i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++) {
if (ignoreTagItems[i] == 0)
- fdprintf(fd, "tagtype: %s\n", mpdTagItemKeys[i]);
+ client_printf(client, "tagtype: %s\n",
+ mpdTagItemKeys[i]);
}
}
-void tag_print(int fd, const struct tag *tag)
+void tag_print(struct client *client, const struct tag *tag)
{
int i;
if (tag->time >= 0)
- fdprintf(fd, SONG_TIME "%i\n", tag->time);
+ client_printf(client, SONG_TIME "%i\n", tag->time);
for (i = 0; i < tag->numOfItems; i++) {
- fdprintf(fd, "%s: %s\n", mpdTagItemKeys[tag->items[i]->type],
- tag->items[i]->value);
+ client_printf(client, "%s: %s\n",
+ mpdTagItemKeys[tag->items[i]->type],
+ tag->items[i]->value);
}
}
diff --git a/src/tag_print.h b/src/tag_print.h
index aa2b2898f..61c9114ac 100644
--- a/src/tag_print.h
+++ b/src/tag_print.h
@@ -20,9 +20,10 @@
#define TAG_PRINT_H
struct tag;
+struct client;
-void tag_print_types(int fd);
+void tag_print_types(struct client *client);
-void tag_print(int fd, const struct tag *tag);
+void tag_print(struct client *client, const struct tag *tag);
#endif