From 6768e3cdaa8bec81f95ec82bc534e7f5e5a5ccf8 Mon Sep 17 00:00:00 2001 From: Andrzej Rybczak Date: Thu, 12 Mar 2009 18:29:13 +0100 Subject: [PATCH] change char * to const char * in libmpdclient where appropriate to avoid casts --- src/libmpdclient.c | 8 ++++---- src/libmpdclient.h | 8 ++++---- src/mpdpp.cpp | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/libmpdclient.c b/src/libmpdclient.c index 1096400c..ba211ae9 100644 --- a/src/libmpdclient.c +++ b/src/libmpdclient.c @@ -1649,7 +1649,7 @@ void mpd_sendSeekIdCommand(mpd_Connection * connection, int id, int time) { free(string); } -void mpd_sendUpdateCommand(mpd_Connection * connection, char * path) { +void mpd_sendUpdateCommand(mpd_Connection * connection, const char * path) { char * sPath = mpd_sanitizeArg(path); int len = strlen("update")+2+strlen(sPath)+3; char *string = malloc(len); @@ -1997,7 +1997,7 @@ void mpd_commitSearch(mpd_Connection *connection) * List the content, with full metadata, of a stored playlist. * */ -void mpd_sendListPlaylistInfoCommand(mpd_Connection *connection, char *path) +void mpd_sendListPlaylistInfoCommand(mpd_Connection *connection, const char *path) { char *arg = mpd_sanitizeArg(path); int len = strlen("listplaylistinfo")+2+strlen(arg)+3; @@ -2038,7 +2038,7 @@ void mpd_sendPlaylistClearCommand(mpd_Connection *connection, char *path) } void mpd_sendPlaylistAddCommand(mpd_Connection *connection, - char *playlist, char *path) + const char *playlist, const char *path) { char *sPlaylist = mpd_sanitizeArg(playlist); char *sPath = mpd_sanitizeArg(path); @@ -2052,7 +2052,7 @@ void mpd_sendPlaylistAddCommand(mpd_Connection *connection, } void mpd_sendPlaylistMoveCommand(mpd_Connection *connection, - char *playlist, int from, int to) + const char *playlist, int from, int to) { char *sPlaylist = mpd_sanitizeArg(playlist); int len = strlen("playlistmove")+ diff --git a/src/libmpdclient.h b/src/libmpdclient.h index 19035e0a..73828a21 100644 --- a/src/libmpdclient.h +++ b/src/libmpdclient.h @@ -527,7 +527,7 @@ void mpd_sendVolumeCommand(mpd_Connection * connection, int volumeChange); void mpd_sendCrossfadeCommand(mpd_Connection * connection, int seconds); -void mpd_sendUpdateCommand(mpd_Connection * connection, char * path); +void mpd_sendUpdateCommand(mpd_Connection * connection, const char * path); /* returns the update job id, call this after a update command*/ int mpd_getUpdateId(mpd_Connection * connection); @@ -605,7 +605,7 @@ char *mpd_getNextTagType(mpd_Connection * connection); * List the content, with full metadata, of a stored playlist. * */ -void mpd_sendListPlaylistInfoCommand(mpd_Connection *connection, char *path); +void mpd_sendListPlaylistInfoCommand(mpd_Connection *connection, const char *path); /** * @param connection a MpdConnection @@ -667,10 +667,10 @@ void mpd_startStatsSearch(mpd_Connection *connection); void mpd_sendPlaylistClearCommand(mpd_Connection *connection, char *path); void mpd_sendPlaylistAddCommand(mpd_Connection *connection, - char *playlist, char *path); + const char *playlist, const char *path); void mpd_sendPlaylistMoveCommand(mpd_Connection *connection, - char *playlist, int from, int to); + const char *playlist, int from, int to); void mpd_sendPlaylistDeleteCommand(mpd_Connection *connection, const char *playlist, int pos); diff --git a/src/mpdpp.cpp b/src/mpdpp.cpp index ff31a376..41c8d0c3 100644 --- a/src/mpdpp.cpp +++ b/src/mpdpp.cpp @@ -207,7 +207,7 @@ void Connection::UpdateDirectory(const string &path) const { if (isConnected) { - mpd_sendUpdateCommand(itsConnection, (char *) path.c_str()); + mpd_sendUpdateCommand(itsConnection, path.c_str()); mpd_finishCommand(itsConnection); } } @@ -348,7 +348,7 @@ void Connection::AddToPlaylist(const string &path, const string &file) const { if (isConnected) { - mpd_sendPlaylistAddCommand(itsConnection, (char *) path.c_str(), (char *) file.c_str()); + mpd_sendPlaylistAddCommand(itsConnection, path.c_str(), file.c_str()); if (!isCommandsListEnabled) mpd_finishCommand(itsConnection); } @@ -358,7 +358,7 @@ void Connection::Move(const string &path, int from, int to) const { if (isConnected) { - mpd_sendPlaylistMoveCommand(itsConnection, (char *) path.c_str(), from, to); + mpd_sendPlaylistMoveCommand(itsConnection, path.c_str(), from, to); if (!isCommandsListEnabled) mpd_finishCommand(itsConnection); } @@ -447,7 +447,7 @@ void Connection::GetPlaylistContent(const string &path, SongList &v) const { if (isConnected) { - mpd_sendListPlaylistInfoCommand(itsConnection, (char *) path.c_str()); + mpd_sendListPlaylistInfoCommand(itsConnection, path.c_str()); mpd_InfoEntity *item = NULL; while ((item = mpd_getNextInfoEntity(itsConnection)) != NULL) {