diff options
-rw-r--r-- | src/charset.cpp | 12 | ||||
-rw-r--r-- | src/charset.h | 4 | ||||
-rw-r--r-- | src/libmpdclient.h | 32 | ||||
-rw-r--r-- | src/song.cpp | 2 | ||||
-rw-r--r-- | src/str_pool.c | 8 | ||||
-rw-r--r-- | src/str_pool.h | 6 |
6 files changed, 32 insertions, 32 deletions
diff --git a/src/charset.cpp b/src/charset.cpp index af3e4a59..f3ab8bbf 100644 --- a/src/charset.cpp +++ b/src/charset.cpp @@ -55,7 +55,7 @@ namespace return false; } - void charset_convert(const char *from, const char *to, char *&inbuf, size_t len = 0) + void charset_convert(const char *from, const char *to, const char *&inbuf, size_t len = 0) { if (!inbuf || !from || !to) return; @@ -70,7 +70,7 @@ namespace size_t buflen = len*6+1; char *outbuf = new char[buflen]; char *outstart = outbuf; - char *instart = inbuf; + const char *instart = inbuf; if (iconv(cd, const_cast<ICONV_CONST char **>(&inbuf), &len, &outbuf, &buflen) == size_t(-1)) { @@ -90,7 +90,7 @@ void utf_to_locale(std::string &s) { if (s.empty() || Config.system_encoding.empty() || !has_non_ascii_chars(s)) return; - char *tmp = str_pool_get(s.c_str()); + const char *tmp = str_pool_get(s.c_str()); charset_convert("utf-8", Config.system_encoding.c_str(), tmp, s.length()); s = tmp; str_pool_put(tmp); @@ -107,7 +107,7 @@ void locale_to_utf(std::string &s) { if (s.empty() || Config.system_encoding.empty() || !has_non_ascii_chars(s)) return; - char *tmp = str_pool_get(s.c_str()); + const char *tmp = str_pool_get(s.c_str()); charset_convert(Config.system_encoding.c_str(), "utf-8", tmp, s.length()); s = tmp; str_pool_put(tmp); @@ -120,14 +120,14 @@ std::string locale_to_utf_cpy(const std::string &s) return result; } -void str_pool_utf_to_locale(char *&s) +void str_pool_utf_to_locale(const char *&s) { if (!s || Config.system_encoding.empty() || !has_non_ascii_chars(s)) return; charset_convert("utf-8", Config.system_encoding.c_str(), s); } -void str_pool_locale_to_utf(char *&s) +void str_pool_locale_to_utf(const char *&s) { if (!s || Config.system_encoding.empty() || !has_non_ascii_chars(s)) return; diff --git a/src/charset.h b/src/charset.h index 3f195d41..5c875355 100644 --- a/src/charset.h +++ b/src/charset.h @@ -35,8 +35,8 @@ void locale_to_utf(std::string &); std::string utf_to_locale_cpy(const std::string &s); std::string locale_to_utf_cpy(const std::string &s); -void str_pool_utf_to_locale(char *&); -void str_pool_locale_to_utf(char *&); +void str_pool_utf_to_locale(const char *&); +void str_pool_locale_to_utf(const char *&); #else diff --git a/src/libmpdclient.h b/src/libmpdclient.h index 9e805c3d..b2a26048 100644 --- a/src/libmpdclient.h +++ b/src/libmpdclient.h @@ -98,8 +98,8 @@ extern char * mpdTagItemKeys[MPD_TAG_NUM_OF_ITEM_TYPES]; /* internal stuff don't touch this struct */ typedef struct _mpd_ReturnElement { - char * name; - char * value; + const char * name; + const char * value; } mpd_ReturnElement; /* mpd_Connection @@ -261,32 +261,32 @@ void mpd_freeSearchStats(mpd_SearchStats * stats); */ typedef struct _mpd_Song { /* filename of song */ - char * file; + const char * file; /* artist, maybe NULL if there is no tag */ - char * artist; + const char * artist; /* title, maybe NULL if there is no tag */ - char * title; + const char * title; /* album, maybe NULL if there is no tag */ - char * album; + const char * album; /* track, maybe NULL if there is no tag */ - char * track; + const char * track; /* name, maybe NULL if there is no tag; it's the name of the current * song, f.e. the icyName of the stream */ - char * name; + const char * name; /* date */ - char *date; + const char *date; /* added by qball */ /* Genre */ - char *genre; + const char *genre; /* Composer */ - char *composer; + const char *composer; /* Performer */ - char *performer; + const char *performer; /* Disc */ - char *disc; + const char *disc; /* Comment */ - char *comment; + const char *comment; /* length of song in seconds, check that it is not MPD_SONG_NO_TIME */ int time; @@ -324,7 +324,7 @@ mpd_Song * mpd_songDup(mpd_Song * song); * used to store info fro directory (right now that just the path) */ typedef struct _mpd_Directory { - char * path; + const char * path; } mpd_Directory; /* mpd_newDirectory @@ -350,7 +350,7 @@ mpd_Directory * mpd_directoryDup(mpd_Directory * directory); * stores info about playlist file returned by lsinfo */ typedef struct _mpd_PlaylistFile { - char * path; + const char * path; } mpd_PlaylistFile; /* mpd_newPlaylistFile diff --git a/src/song.cpp b/src/song.cpp index 00686a0c..4f7ab90e 100644 --- a/src/song.cpp +++ b/src/song.cpp @@ -494,7 +494,7 @@ void MPD::Song::SetHashAndSlash() { if (!itsSong->file) return; - char *tmp = strrchr(itsSong->file, '/'); + const char *tmp = strrchr(itsSong->file, '/'); itsSlash = tmp && *(tmp-1) != '/' /* no http:// */ ? tmp-itsSong->file : std::string::npos; itsHash = calc_hash(itsSong->file); } diff --git a/src/str_pool.c b/src/str_pool.c index 6c19130b..e258a849 100644 --- a/src/str_pool.c +++ b/src/str_pool.c @@ -65,7 +65,7 @@ static struct slot *slot_alloc(struct slot *next, const char *value) return slot; } -char *str_pool_get(const char *value) +const char *str_pool_get(const char *value) { struct slot **slot_p, *slot; @@ -83,7 +83,7 @@ char *str_pool_get(const char *value) return slot->value; } -char *str_pool_dup(const char *value) +const char *str_pool_dup(const char *value) { struct slot *slot = value_to_slot(value); @@ -91,7 +91,7 @@ char *str_pool_dup(const char *value) if (slot->ref < 0xff) { ++slot->ref; - return (char *) value; + return value; } else { /* the reference counter overflows above 0xff; duplicate the value, and start with 1 */ @@ -103,7 +103,7 @@ char *str_pool_dup(const char *value) } } -void str_pool_put(char *value) +void str_pool_put(const char *value) { struct slot **slot_p, *slot; diff --git a/src/str_pool.h b/src/str_pool.h index 91e96aed..c21b70f7 100644 --- a/src/str_pool.h +++ b/src/str_pool.h @@ -25,11 +25,11 @@ extern "C" { unsigned calc_hash(const char *p); -char *str_pool_get(const char *value); +const char *str_pool_get(const char *value); -char *str_pool_dup(const char *value); +const char *str_pool_dup(const char *value); -void str_pool_put(char *value); +void str_pool_put(const char *value); #ifdef __cplusplus } |