diff options
-rw-r--r-- | src/path.c | 8 | ||||
-rw-r--r-- | src/path.h | 8 | ||||
-rw-r--r-- | src/storedPlaylist.c | 11 |
3 files changed, 15 insertions, 12 deletions
diff --git a/src/path.c b/src/path.c index c02103331..8c7b61cdf 100644 --- a/src/path.c +++ b/src/path.c @@ -22,6 +22,7 @@ #include "conf.h" #include "utf8.h" #include "utils.h" +#include "playlist.h" #include <stdlib.h> #include <string.h> @@ -278,3 +279,10 @@ char *sanitizePathDup(char *path) return xrealloc(ret, len + 1); } + +void utf8_to_fs_playlist_path(char *path_max_tmp, const char *utf8path) +{ + utf8_to_fs_charset(path_max_tmp, (char *)utf8path); + rpp2app_r(path_max_tmp, path_max_tmp); + strncat(path_max_tmp, "." PLAYLIST_FILE_SUFFIX, MPD_PATH_MAX - 1); +} diff --git a/src/path.h b/src/path.h index ef7bc62a0..5a452ca7c 100644 --- a/src/path.h +++ b/src/path.h @@ -75,7 +75,13 @@ char *sanitizePathDup(char *path); /* this is actually like strlcpy (OpenBSD), but we don't actually want to * blindly use it everywhere, only for paths that are OK to truncate (for * error reporting and such. - * dest must be MAXPATHLEN+1 bytes large (which is standard in mpd) */ + * dest must be MPD_PATH_MAX bytes large (which is standard in mpd) */ void pathcpy_trunc(char *dest, const char *src); +/* + * converts a path passed from a client into an absolute FS path. + * paths passed by clients do NOT have file suffixes in them + */ +void utf8_to_fs_playlist_path(char *path_max_tmp, const char *utf8path); + #endif diff --git a/src/storedPlaylist.c b/src/storedPlaylist.c index 089869c40..062a0ad1f 100644 --- a/src/storedPlaylist.c +++ b/src/storedPlaylist.c @@ -52,17 +52,6 @@ static int valid_playlist_name(int err_fd, const char *utf8path) return 1; } -/* - * converts a path passed from a client into an absolute, FS path - * paths passed by clients do NOT have file suffixes in them - */ -static void utf8_to_fs_playlist_path(char *path_max_tmp, const char *utf8path) -{ - utf8_to_fs_charset(path_max_tmp, (char *)utf8path); - rpp2app_r(path_max_tmp, path_max_tmp); - strncat(path_max_tmp, "." PLAYLIST_FILE_SUFFIX, MPD_PATH_MAX - 1); -} - static unsigned int lengthOfStoredPlaylist(StoredPlaylist *sp) { return sp->list->numberOfNodes; |