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.
This commit is contained in:
Max Kellermann
2008-09-07 13:53:55 +02:00
parent 5609a1fcd0
commit dc8b64fdef
12 changed files with 121 additions and 110 deletions

View File

@@ -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;
}