Commit 1d385190 authored by Max Kellermann's avatar Max Kellermann

path: removed pathcpy_trunc()

There was only one user of pathcpy_trunc(), which can be eliminated.
parent 49260e6d
...@@ -39,11 +39,8 @@ static void decodeStart(void) ...@@ -39,11 +39,8 @@ static void decodeStart(void)
if (song_is_file(song)) if (song_is_file(song))
map_song_fs(song, path_max_fs); map_song_fs(song, path_max_fs);
else { else
char path_max_utf8[MPD_PATH_MAX]; song_get_url(song, path_max_fs);
song_get_url(song, path_max_utf8);
pathcpy_trunc(path_max_fs, path_max_utf8);
}
dc.current_song = dc.next_song; /* NEED LOCK */ dc.current_song = dc.next_song; /* NEED LOCK */
if (openInputStream(&inStream, path_max_fs) < 0) { if (openInputStream(&inStream, path_max_fs) < 0) {
......
...@@ -189,19 +189,6 @@ char *rpp2app_r(char *dst, const char *rel_path) ...@@ -189,19 +189,6 @@ char *rpp2app_r(char *dst, const char *rel_path)
return dst; return dst;
} }
/* 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 */
void pathcpy_trunc(char *dest, const char *src)
{
size_t len = strlen(src);
if (mpd_unlikely(len >= MPD_PATH_MAX))
len = MPD_PATH_MAX - 1;
memcpy(dest, src, len);
dest[len] = '\0';
}
char *sanitizePathDup(const char *path) char *sanitizePathDup(const char *path)
{ {
int len = strlen(path) + 1; int len = strlen(path) + 1;
......
...@@ -61,12 +61,6 @@ char *rpp2app_r(char *dst, const char *rel_path); ...@@ -61,12 +61,6 @@ char *rpp2app_r(char *dst, const char *rel_path);
/* strips extra "///" and leading "/" and trailing "/" */ /* strips extra "///" and leading "/" and trailing "/" */
char *sanitizePathDup(const char *path); char *sanitizePathDup(const 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 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. * converts a path passed from a client into an absolute FS path.
* paths passed by clients do NOT have file suffixes in them * paths passed by clients do NOT have file suffixes in them
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment