From 6fbdc721d972d8c1f823acd5473a3dce8836d5fa Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 5 Feb 2008 10:17:33 +0000 Subject: fix -Wconst warnings [ew: cleaned up the dirty union hack a bit] Signed-off-by: Eric Wong git-svn-id: https://svn.musicpd.org/mpd/trunk@7180 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/path.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src/path.c') diff --git a/src/path.c b/src/path.c index 258363036..6aaff84cf 100644 --- a/src/path.c +++ b/src/path.c @@ -38,24 +38,25 @@ static size_t music_dir_len; static size_t playlist_dir_len; static char *fsCharset; -static char *path_conv_charset(char *dest, char *to, char *from, char *str) +static char *path_conv_charset(char *dest, const char *to, + const char *from, const char *str) { return setCharSetConversion(to, from) ? NULL : char_conv_str(dest, str); } -char *fs_charset_to_utf8(char *dst, char *str) +char *fs_charset_to_utf8(char *dst, const char *str) { char *ret = path_conv_charset(dst, "UTF-8", fsCharset, str); return (ret && !validUtf8String(ret)) ? NULL : ret; } -char *utf8_to_fs_charset(char *dst, char *str) +char *utf8_to_fs_charset(char *dst, const char *str) { char *ret = path_conv_charset(dst, fsCharset, "UTF-8", str); return ret ? ret : strcpy(dst, str); } -void setFsCharset(char *charset) +void setFsCharset(const char *charset) { int error = 0; @@ -86,7 +87,7 @@ void setFsCharset(char *charset) } } -char *getFsCharset(void) +const char *getFsCharset(void) { return fsCharset; } @@ -243,7 +244,7 @@ char *parent_path(char *path_max_tmp, const char *path) return path_max_tmp; } -char *sanitizePathDup(char *path) +char *sanitizePathDup(const char *path) { int len = strlen(path) + 1; char *ret = xmalloc(len); @@ -285,7 +286,7 @@ char *sanitizePathDup(char *path) void utf8_to_fs_playlist_path(char *path_max_tmp, const char *utf8path) { - utf8_to_fs_charset(path_max_tmp, (char *)utf8path); + utf8_to_fs_charset(path_max_tmp, utf8path); rpp2app_r(path_max_tmp, path_max_tmp); strncat(path_max_tmp, "." PLAYLIST_FILE_SUFFIX, MPD_PATH_MAX - 1); } -- cgit v1.2.3