diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-03-21 21:32:23 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-03-21 21:32:23 +0000 |
commit | 4c1eb9225d5a741e1234d48eb38a8df3da908259 (patch) | |
tree | 28d8821623d6f9cce26f316e18342f2c08250785 /src/path.c | |
parent | b72f591641e9d311e813fb8e2ece643cc6562e56 (diff) | |
download | mpd-4c1eb9225d5a741e1234d48eb38a8df3da908259.tar.gz mpd-4c1eb9225d5a741e1234d48eb38a8df3da908259.tar.xz mpd-4c1eb9225d5a741e1234d48eb38a8df3da908259.zip |
add aac_decode.[ch] and start working on it
also, if locale is C or POSIX, set fs charset to iso-8859-1
git-svn-id: https://svn.musicpd.org/mpd/trunk@347 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r-- | src/path.c | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/src/path.c b/src/path.c index 5a73baa86..e209b671d 100644 --- a/src/path.c +++ b/src/path.c @@ -87,40 +87,52 @@ char * getFsCharset() { } void initPaths() { -#ifdef HAVE_LOCALE -#ifdef HAVE_LANGINFO - char * originalLocale; -#endif -#endif char * charset = NULL; + char * originalLocale; if(getConf()[CONF_FS_CHARSET]) { charset = strdup(getConf()[CONF_FS_CHARSET]); } #ifdef HAVE_LOCALE #ifdef HAVE_LANGINFO - else if((originalLocale = setlocale(LC_CTYPE,""))) { + else if((originalLocale = setlocale(LC_CTYPE,NULL))) { char * temp; + char * currentLocale; + originalLocale = strdup(originalLocale); - if((temp = nl_langinfo(CODESET))) { - charset = strdup(temp); + if(!(currentLocale = setlocale(LC_CTYPE,""))) { + ERROR("problems setting current locale with " + "setlocale()\n"); } - else ERROR("problems getting charset for locale\n"); - if(!setlocale(LC_CTYPE,originalLocale)) { - ERROR("problems resetting locale with setlocale()\n"); + else { + if(strcmp(currentLocale,"C")==0 || + strcmp(currentLocale,"POSIX")==0) + { + ERROR("current locale is \"%s\"\n", + currentLocale); + } + else if((temp = nl_langinfo(CODESET))) { + charset = strdup(temp); + } + else ERROR("problems getting charset for locale\n"); + if(!setlocale(LC_CTYPE,originalLocale)) { + ERROR("problems resetting locale with setlocale()\n"); + } } + + free(originalLocale); } + else ERROR("problems getting locale with setlocale()\n"); #endif #endif - else ERROR("problems getting locale with setlocale()\n"); if(charset) { setFsCharset(charset); free(charset); } else { - ERROR("setting filesystem charset to UTF-8\n"); - setFsCharset("UTF-8"); + ERROR("setting filesystem charset to ISO-8859-1\n"); + setFsCharset("ISO-8859-1"); } } |