aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJ. Alexander Treuman <jat@spatialrift.net>2007-01-08 03:28:36 +0000
committerJ. Alexander Treuman <jat@spatialrift.net>2007-01-08 03:28:36 +0000
commit90b4af03410cb151225853c458546abe6d696f1c (patch)
treeb6fb4ad4bf8cffb9bfa2dc2a8e3c6bc01f1ec494 /src
parentbcb493cfd3e838695e19b675f919112e81506c45 (diff)
downloadmpd-90b4af03410cb151225853c458546abe6d696f1c.tar.gz
mpd-90b4af03410cb151225853c458546abe6d696f1c.tar.xz
mpd-90b4af03410cb151225853c458546abe6d696f1c.zip
Moving pathConvCharset to charConv.c so it can be reused for localization.
git-svn-id: https://svn.musicpd.org/mpd/trunk@5226 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/charConv.c7
-rw-r--r--src/charConv.h2
-rw-r--r--src/path.c11
3 files changed, 11 insertions, 9 deletions
diff --git a/src/charConv.c b/src/charConv.c
index 8e614f3a0..8e8a9ce95 100644
--- a/src/charConv.c
+++ b/src/charConv.c
@@ -150,6 +150,13 @@ char *convStrDup(char *string)
return NULL;
}
+char *convCharset(char *to, char *from, char *str, char *ret)
+{
+ if (ret)
+ free(ret);
+ return setCharSetConversion(to, from) ? NULL : convStrDup(str);
+}
+
static void closeCharSetConversion(void)
{
if (char_conv_to) {
diff --git a/src/charConv.h b/src/charConv.h
index d3d0fa70d..f2d619469 100644
--- a/src/charConv.h
+++ b/src/charConv.h
@@ -25,4 +25,6 @@ int setCharSetConversion(char *to, char *from);
char *convStrDup(char *string);
+char *convCharset(char *to, char *from, char *str, char *ret);
+
#endif
diff --git a/src/path.c b/src/path.c
index 721cb345b..35836ea46 100644
--- a/src/path.c
+++ b/src/path.c
@@ -36,18 +36,11 @@ const char *musicDir;
static const char *playlistDir;
static char *fsCharset = NULL;
-static char *pathConvCharset(char *to, char *from, char *str, char *ret)
-{
- if (ret)
- free(ret);
- return setCharSetConversion(to, from) ? NULL : convStrDup(str);
-}
-
char *fsCharsetToUtf8(char *str)
{
static char *ret = NULL;
- ret = pathConvCharset("UTF-8", fsCharset, str, ret);
+ ret = convCharset("UTF-8", fsCharset, str, ret);
if (ret && !validUtf8String(ret)) {
free(ret);
@@ -61,7 +54,7 @@ char *utf8ToFsCharset(char *str)
{
static char *ret = NULL;
- ret = pathConvCharset(fsCharset, "UTF-8", str, ret);
+ ret = convCharset(fsCharset, "UTF-8", str, ret);
if (!ret)
ret = xstrdup(str);