aboutsummaryrefslogtreecommitdiff
path: root/src/mapper.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-01-01 19:17:44 +0100
committerMax Kellermann <max@duempel.org>2009-01-01 19:17:44 +0100
commit80fa9183e4d30643b1e089d9b96f36a4b266276e (patch)
treeefaa0e4579cb5b7fc6da6610f3485072f384c609 /src/mapper.c
parent886ed1b225d50e5e6c220e11b5800f45d36a5d37 (diff)
mapper: allocate playlist path from heap
Don't pass a static buffer to map_spl_utf8_to_fs().
Diffstat (limited to 'src/mapper.c')
-rw-r--r--src/mapper.c21
1 files changed, 9 insertions, 12 deletions
diff --git a/src/mapper.c b/src/mapper.c
index 291816e6..3777b7c6 100644
--- a/src/mapper.c
+++ b/src/mapper.c
@@ -164,23 +164,20 @@ map_fs_to_utf8(const char *path_fs, char *buffer)
return fs_charset_to_utf8(buffer, path_fs);
}
-static char *rpp2app_r(char *dst, const char *rel_path)
-{
- pfx_dir(dst, rel_path, strlen(rel_path),
- playlist_dir, playlist_dir_length);
- return dst;
-}
-
const char *
map_spl_path(void)
{
return playlist_dir;
}
-const char *
-map_spl_utf8_to_fs(const char *name, char *buffer)
+char *
+map_spl_utf8_to_fs(const char *name)
{
- rpp2app_r(buffer, utf8_to_fs_charset(buffer, name));
- g_strlcat(buffer, "." PLAYLIST_FILE_SUFFIX, MPD_PATH_MAX);
- return buffer;
+ char *filename = g_strconcat(name, "." PLAYLIST_FILE_SUFFIX, NULL);
+ char *path;
+
+ path = g_build_filename(playlist_dir, filename, NULL);
+ g_free(filename);
+
+ return path;
}