ls: removed isValidRemoteUtf8Url()
The function didn't do anything useful, it was just several lines obfuscating that it was only forwarding isRemoteUrl()'s return value.
This commit is contained in:
parent
3d4fb9a9a6
commit
3287726736
40
src/ls.c
40
src/ls.c
|
@ -44,46 +44,6 @@ int printRemoteUrlHandlers(struct client *client)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int isValidRemoteUtf8Url(const char *utf8url)
|
|
||||||
{
|
|
||||||
int ret = 0;
|
|
||||||
const char *temp;
|
|
||||||
|
|
||||||
switch (isRemoteUrl(utf8url)) {
|
|
||||||
case 1:
|
|
||||||
ret = 1;
|
|
||||||
temp = utf8url;
|
|
||||||
while (*temp) {
|
|
||||||
if ((*temp >= 'a' && *temp <= 'z') ||
|
|
||||||
(*temp >= 'A' && *temp <= 'Z') ||
|
|
||||||
(*temp >= '0' && *temp <= '9') ||
|
|
||||||
*temp == '$' ||
|
|
||||||
*temp == '-' ||
|
|
||||||
*temp == '.' ||
|
|
||||||
*temp == '+' ||
|
|
||||||
*temp == '!' ||
|
|
||||||
*temp == '*' ||
|
|
||||||
*temp == '\'' ||
|
|
||||||
*temp == '(' ||
|
|
||||||
*temp == ')' ||
|
|
||||||
*temp == ',' ||
|
|
||||||
*temp == '%' ||
|
|
||||||
*temp == '/' ||
|
|
||||||
*temp == ':' ||
|
|
||||||
*temp == '?' ||
|
|
||||||
*temp == ';' || *temp == '&' || *temp == '=') {
|
|
||||||
} else {
|
|
||||||
ret = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
temp++;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int isRemoteUrl(const char *url)
|
int isRemoteUrl(const char *url)
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
2
src/ls.h
2
src/ls.h
|
@ -26,8 +26,6 @@ struct client;
|
||||||
|
|
||||||
const char *getSuffix(const char *utf8file);
|
const char *getSuffix(const char *utf8file);
|
||||||
|
|
||||||
int isValidRemoteUtf8Url(const char *utf8url);
|
|
||||||
|
|
||||||
int isRemoteUrl(const char *url);
|
int isRemoteUrl(const char *url);
|
||||||
|
|
||||||
const struct decoder_plugin *
|
const struct decoder_plugin *
|
||||||
|
|
|
@ -537,7 +537,7 @@ song_by_url(const char *url)
|
||||||
if (song != NULL)
|
if (song != NULL)
|
||||||
return song;
|
return song;
|
||||||
|
|
||||||
if (isValidRemoteUtf8Url(url))
|
if (isRemoteUrl(url))
|
||||||
return song_remote_new(url);
|
return song_remote_new(url);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -46,7 +46,7 @@ playlist_print_uri(FILE *file, const char *uri)
|
||||||
char tmp[MPD_PATH_MAX];
|
char tmp[MPD_PATH_MAX];
|
||||||
const char *s;
|
const char *s;
|
||||||
|
|
||||||
if (playlist_saveAbsolutePaths && !isValidRemoteUtf8Url(uri) &&
|
if (playlist_saveAbsolutePaths && !isRemoteUrl(uri) &&
|
||||||
uri[0] != '/')
|
uri[0] != '/')
|
||||||
s = map_directory_child_fs(db_get_root(), uri, tmp);
|
s = map_directory_child_fs(db_get_root(), uri, tmp);
|
||||||
else
|
else
|
||||||
|
|
|
@ -156,7 +156,7 @@ spl_load(const char *utf8path)
|
||||||
if (*s == PLAYLIST_COMMENT)
|
if (*s == PLAYLIST_COMMENT)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!isValidRemoteUtf8Url(s)) {
|
if (!isRemoteUrl(s)) {
|
||||||
struct song *song;
|
struct song *song;
|
||||||
|
|
||||||
path_utf8 = map_fs_to_utf8(s, path_max_tmp);
|
path_utf8 = map_fs_to_utf8(s, path_max_tmp);
|
||||||
|
@ -360,7 +360,7 @@ spl_append_uri(const char *url, const char *utf8file)
|
||||||
if (song)
|
if (song)
|
||||||
return spl_append_song(utf8file, song);
|
return spl_append_song(utf8file, song);
|
||||||
|
|
||||||
if (!isValidRemoteUtf8Url(url))
|
if (!isRemoteUrl(url))
|
||||||
return PLAYLIST_RESULT_NO_SUCH_SONG;
|
return PLAYLIST_RESULT_NO_SUCH_SONG;
|
||||||
|
|
||||||
song = song_remote_new(url);
|
song = song_remote_new(url);
|
||||||
|
|
Loading…
Reference in New Issue