Commit 89015145 authored by Max Kellermann's avatar Max Kellermann

Playlist, Song: clarify parameter encoding

parent 21fe376d
...@@ -116,13 +116,13 @@ handle_lsinfo(Client *client, int argc, char *argv[]) ...@@ -116,13 +116,13 @@ handle_lsinfo(Client *client, int argc, char *argv[])
if (strncmp(uri, "file:///", 8) == 0) { if (strncmp(uri, "file:///", 8) == 0) {
/* print information about an arbitrary local file */ /* print information about an arbitrary local file */
const char *path = uri + 7; const char *path_utf8 = uri + 7;
GError *error = NULL; GError *error = NULL;
if (!client_allow_file(client, path, &error)) if (!client_allow_file(client, path_utf8, &error))
return print_error(client, error); return print_error(client, error);
struct song *song = song_file_load(path, NULL); struct song *song = song_file_load(path_utf8, NULL);
if (song == NULL) { if (song == NULL) {
command_error(client, ACK_ERROR_NO_EXIST, command_error(client, ACK_ERROR_NO_EXIST,
"No such file"); "No such file");
......
...@@ -43,9 +43,9 @@ struct Partition { ...@@ -43,9 +43,9 @@ struct Partition {
playlist.Clear(pc); playlist.Clear(pc);
} }
enum playlist_result AppendFile(const char *path_fs, enum playlist_result AppendFile(const char *path_utf8,
unsigned *added_id=nullptr) { unsigned *added_id=nullptr) {
return playlist.AppendFile(pc, path_fs, added_id); return playlist.AppendFile(pc, path_utf8, added_id);
} }
enum playlist_result AppendURI(const char *uri_utf8, enum playlist_result AppendURI(const char *uri_utf8,
......
...@@ -144,7 +144,7 @@ public: ...@@ -144,7 +144,7 @@ public:
* Note: the caller is responsible for checking permissions. * Note: the caller is responsible for checking permissions.
*/ */
enum playlist_result AppendFile(player_control &pc, enum playlist_result AppendFile(player_control &pc,
const char *path_fs, const char *path_utf8,
unsigned *added_id=nullptr); unsigned *added_id=nullptr);
enum playlist_result AppendURI(player_control &pc, enum playlist_result AppendURI(player_control &pc,
......
...@@ -59,9 +59,9 @@ playlist::Clear(player_control &pc) ...@@ -59,9 +59,9 @@ playlist::Clear(player_control &pc)
enum playlist_result enum playlist_result
playlist::AppendFile(struct player_control &pc, playlist::AppendFile(struct player_control &pc,
const char *path_fs, unsigned *added_id) const char *path_utf8, unsigned *added_id)
{ {
struct song *song = song_file_load(path_fs, NULL); struct song *song = song_file_load(path_utf8, NULL);
if (song == NULL) if (song == NULL)
return PLAYLIST_RESULT_NO_SUCH_SONG; return PLAYLIST_RESULT_NO_SUCH_SONG;
......
...@@ -45,16 +45,16 @@ extern "C" { ...@@ -45,16 +45,16 @@ extern "C" {
#include <stdio.h> #include <stdio.h>
struct song * struct song *
song_file_load(const char *path, Directory *parent) song_file_load(const char *path_utf8, Directory *parent)
{ {
struct song *song; struct song *song;
bool ret; bool ret;
assert((parent == NULL) == g_path_is_absolute(path)); assert((parent == NULL) == g_path_is_absolute(path_utf8));
assert(!uri_has_scheme(path)); assert(!uri_has_scheme(path_utf8));
assert(strchr(path, '\n') == NULL); assert(strchr(path_utf8, '\n') == NULL);
song = song_file_new(path, parent); song = song_file_new(path_utf8, parent);
//in archive ? //in archive ?
if (parent != NULL && parent->device == DEVICE_INARCHIVE) { if (parent != NULL && parent->device == DEVICE_INARCHIVE) {
......
...@@ -76,7 +76,7 @@ song_remote_new(const char *uri); ...@@ -76,7 +76,7 @@ song_remote_new(const char *uri);
/** allocate a new song with a local file name */ /** allocate a new song with a local file name */
struct song * struct song *
song_file_new(const char *path, struct Directory *parent); song_file_new(const char *path_utf8, struct Directory *parent);
/** /**
* allocate a new song structure with a local file name and attempt to * allocate a new song structure with a local file name and attempt to
...@@ -84,7 +84,7 @@ song_file_new(const char *path, struct Directory *parent); ...@@ -84,7 +84,7 @@ song_file_new(const char *path, struct Directory *parent);
* data, NULL is returned. * data, NULL is returned.
*/ */
struct song * struct song *
song_file_load(const char *path, struct Directory *parent); song_file_load(const char *path_utf8, struct Directory *parent);
/** /**
* Replaces the URI of a song object. The given song object is * Replaces the URI of a song object. The given song object is
......
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