aboutsummaryrefslogtreecommitdiffstats
path: root/src/mapper.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/mapper.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/mapper.c b/src/mapper.c
index 6b0a7a449..bd19af615 100644
--- a/src/mapper.c
+++ b/src/mapper.c
@@ -108,11 +108,11 @@ map_directory_fs(const struct directory *directory)
return map_uri_fs(dirname);
}
-const char *
-map_directory_child_fs(const struct directory *directory, const char *name,
- char *buffer)
+char *
+map_directory_child_fs(const struct directory *directory, const char *name)
{
- char *parent_fs;
+ char buffer[MPD_PATH_MAX];
+ char *parent_fs, *path;
/* check for invalid or unauthorized base names */
if (*name == 0 || strchr(name, '/') != NULL ||
@@ -124,21 +124,22 @@ map_directory_child_fs(const struct directory *directory, const char *name,
return NULL;
name = utf8_to_fs_charset(buffer, name);
- pfx_dir(buffer, name, strlen(name),
- parent_fs, strlen(parent_fs));
+ path = g_build_filename(parent_fs, name, NULL);
g_free(parent_fs);
- return buffer;
+ return path;
}
-const char *
-map_song_fs(const struct song *song, char *buffer)
+char *
+map_song_fs(const struct song *song)
{
+ char buffer[MPD_PATH_MAX];
+
assert(song_is_file(song));
if (song_in_database(song))
- return map_directory_child_fs(song->parent, song->url, buffer);
+ return map_directory_child_fs(song->parent, song->url);
else
- return utf8_to_fs_charset(buffer, song->url);
+ return g_strdup(utf8_to_fs_charset(buffer, song->url));
}
const char *