mapper: allocate playlist path from heap

Don't pass a static buffer to map_spl_utf8_to_fs().
This commit is contained in:
Max Kellermann
2009-01-01 19:17:44 +01:00
parent 886ed1b225
commit 80fa9183e4
4 changed files with 60 additions and 47 deletions

View File

@@ -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;
}