aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-10-13 18:01:06 +0200
committerMax Kellermann <max@duempel.org>2009-10-13 18:01:06 +0200
commitf7ce4f6239ded6681713bc9e8d281712106e6f25 (patch)
tree1078ee0df1551a0e27bae71022c39a54affd07b6 /src
parent28442cce9fa4a91c38d87c4a61b6ff6af4f97a67 (diff)
downloadmpd-f7ce4f6239ded6681713bc9e8d281712106e6f25.tar.gz
mpd-f7ce4f6239ded6681713bc9e8d281712106e6f25.tar.xz
mpd-f7ce4f6239ded6681713bc9e8d281712106e6f25.zip
song: renamed attribute "url" to "uri"
Diffstat (limited to '')
-rw-r--r--src/command.c2
-rw-r--r--src/dbUtils.c4
-rw-r--r--src/mapper.c4
-rw-r--r--src/player_thread.c8
-rw-r--r--src/song.c24
-rw-r--r--src/song.h6
-rw-r--r--src/song_print.c10
-rw-r--r--src/song_print.h2
-rw-r--r--src/song_save.c13
-rw-r--r--src/song_update.c4
-rw-r--r--src/songvec.c8
-rw-r--r--src/songvec.h2
12 files changed, 43 insertions, 44 deletions
diff --git a/src/command.c b/src/command.c
index cbc77edc1..1829f360a 100644
--- a/src/command.c
+++ b/src/command.c
@@ -1559,7 +1559,7 @@ sticker_song_find_print_cb(struct song *song, const char *value,
{
struct sticker_song_find_data *data = user_data;
- song_print_url(data->client, song);
+ song_print_uri(data->client, song);
sticker_print_value(data->client, data->name, value);
}
diff --git a/src/dbUtils.c b/src/dbUtils.c
index 88122649e..9978daa43 100644
--- a/src/dbUtils.c
+++ b/src/dbUtils.c
@@ -59,7 +59,7 @@ static int
printSongInDirectory(struct song *song, G_GNUC_UNUSED void *data)
{
struct client *client = data;
- song_print_url(client, song);
+ song_print_uri(client, song);
return 0;
}
@@ -258,7 +258,7 @@ visitTag(struct client *client, struct strset *set,
struct tag *tag = song->tag;
if (tagType == LOCATE_TAG_FILE_TYPE) {
- song_print_url(client, song);
+ song_print_uri(client, song);
return;
}
diff --git a/src/mapper.c b/src/mapper.c
index 9a122d068..71127f51c 100644
--- a/src/mapper.c
+++ b/src/mapper.c
@@ -159,9 +159,9 @@ map_song_fs(const struct song *song)
assert(song_is_file(song));
if (song_in_database(song))
- return map_directory_child_fs(song->parent, song->url);
+ return map_directory_child_fs(song->parent, song->uri);
else
- return utf8_to_fs_charset(song->url);
+ return utf8_to_fs_charset(song->uri);
}
char *
diff --git a/src/player_thread.c b/src/player_thread.c
index 6777d5d61..885cd2ce1 100644
--- a/src/player_thread.c
+++ b/src/player_thread.c
@@ -136,7 +136,7 @@ player_wait_for_decoder(struct player *player)
dc_command_wait(&pc.notify);
if (decoder_lock_has_failed()) {
- assert(dc.next_song == NULL || dc.next_song->url != NULL);
+ assert(dc.next_song == NULL || dc.next_song->uri != NULL);
pc.errored_song = dc.next_song;
pc.error = PLAYER_ERROR_FILE;
pc.next_song = NULL;
@@ -177,7 +177,7 @@ player_check_decoder_startup(struct player *player)
if (decoder_has_failed()) {
/* the decoder failed */
- assert(dc.next_song == NULL || dc.next_song->url != NULL);
+ assert(dc.next_song == NULL || dc.next_song->uri != NULL);
decoder_unlock();
@@ -209,7 +209,7 @@ player_check_decoder_startup(struct player *player)
"while playing \"%s\"", uri);
g_free(uri);
- assert(dc.next_song == NULL || dc.next_song->url != NULL);
+ assert(dc.next_song == NULL || dc.next_song->uri != NULL);
pc.errored_song = dc.next_song;
pc.error = PLAYER_ERROR_AUDIO;
@@ -375,7 +375,7 @@ static void player_process_command(struct player *player)
} else {
/* the audio device has failed - rollback to
pause mode */
- assert(dc.next_song == NULL || dc.next_song->url != NULL);
+ assert(dc.next_song == NULL || dc.next_song->uri != NULL);
pc.errored_song = dc.next_song;
pc.error = PLAYER_ERROR_AUDIO;
diff --git a/src/song.c b/src/song.c
index e96041f72..942beb5d7 100644
--- a/src/song.c
+++ b/src/song.c
@@ -27,18 +27,18 @@
#include <assert.h>
static struct song *
-song_alloc(const char *url, struct directory *parent)
+song_alloc(const char *uri, struct directory *parent)
{
- size_t urllen;
+ size_t uri_length;
struct song *song;
- assert(url);
- urllen = strlen(url);
- assert(urllen);
- song = g_malloc(sizeof(*song) - sizeof(song->url) + urllen + 1);
+ assert(uri);
+ uri_length = strlen(uri);
+ assert(uri_length);
+ song = g_malloc(sizeof(*song) - sizeof(song->uri) + uri_length + 1);
song->tag = NULL;
- memcpy(song->url, url, urllen + 1);
+ memcpy(song->uri, uri, uri_length + 1);
song->parent = parent;
song->mtime = 0;
@@ -46,9 +46,9 @@ song_alloc(const char *url, struct directory *parent)
}
struct song *
-song_remote_new(const char *url)
+song_remote_new(const char *uri)
{
- return song_alloc(url, NULL);
+ return song_alloc(uri, NULL);
}
struct song *
@@ -71,11 +71,11 @@ char *
song_get_uri(const struct song *song)
{
assert(song != NULL);
- assert(*song->url);
+ assert(*song->uri);
if (!song_in_database(song) || directory_is_root(song->parent))
- return g_strdup(song->url);
+ return g_strdup(song->uri);
else
return g_strconcat(directory_get_path(song->parent),
- "/", song->url, NULL);
+ "/", song->uri, NULL);
}
diff --git a/src/song.h b/src/song.h
index 3044e910f..bfa33e23d 100644
--- a/src/song.h
+++ b/src/song.h
@@ -34,12 +34,12 @@ struct song {
struct tag *tag;
struct directory *parent;
time_t mtime;
- char url[sizeof(int)];
+ char uri[sizeof(int)];
};
/** allocate a new song with a remote URL */
struct song *
-song_remote_new(const char *url);
+song_remote_new(const char *uri);
/** allocate a new song with a local file name */
struct song *
@@ -81,7 +81,7 @@ song_in_database(const struct song *song)
static inline bool
song_is_file(const struct song *song)
{
- return song_in_database(song) || song->url[0] == '/';
+ return song_in_database(song) || song->uri[0] == '/';
}
#endif
diff --git a/src/song_print.c b/src/song_print.c
index 2c4da6cb0..3420b0d34 100644
--- a/src/song_print.c
+++ b/src/song_print.c
@@ -26,18 +26,18 @@
#include "uri.h"
void
-song_print_url(struct client *client, struct song *song)
+song_print_uri(struct client *client, struct song *song)
{
if (song_in_database(song) && !directory_is_root(song->parent)) {
client_printf(client, "%s%s/%s\n", SONG_FILE,
- directory_get_path(song->parent), song->url);
+ directory_get_path(song->parent), song->uri);
} else {
char *allocated;
const char *uri;
- uri = allocated = uri_remove_auth(song->url);
+ uri = allocated = uri_remove_auth(song->uri);
if (uri == NULL)
- uri = song->url;
+ uri = song->uri;
client_printf(client, "%s%s\n", SONG_FILE, uri);
@@ -48,7 +48,7 @@ song_print_url(struct client *client, struct song *song)
int
song_print_info(struct client *client, struct song *song)
{
- song_print_url(client, song);
+ song_print_uri(client, song);
if (song->mtime > 0) {
#ifndef G_OS_WIN32
diff --git a/src/song_print.h b/src/song_print.h
index 291fd81c8..c16bc7387 100644
--- a/src/song_print.h
+++ b/src/song_print.h
@@ -30,6 +30,6 @@ song_print_info(struct client *client, struct song *song);
int songvec_print(struct client *client, const struct songvec *sv);
void
-song_print_url(struct client *client, struct song *song);
+song_print_uri(struct client *client, struct song *song);
#endif
diff --git a/src/song_save.c b/src/song_save.c
index 3e54ce222..b18057201 100644
--- a/src/song_save.c
+++ b/src/song_save.c
@@ -41,14 +41,13 @@ song_save_quark(void)
}
static void
-song_save_url(FILE *fp, struct song *song)
+song_save_uri(FILE *fp, struct song *song)
{
if (song->parent != NULL && song->parent->path != NULL)
fprintf(fp, SONG_FILE "%s/%s\n",
- directory_get_path(song->parent), song->url);
+ directory_get_path(song->parent), song->uri);
else
- fprintf(fp, SONG_FILE "%s\n",
- song->url);
+ fprintf(fp, SONG_FILE "%s\n", song->uri);
}
static int
@@ -56,9 +55,9 @@ song_save(struct song *song, void *data)
{
FILE *fp = data;
- fprintf(fp, SONG_KEY "%s\n", song->url);
+ fprintf(fp, SONG_KEY "%s\n", song->uri);
- song_save_url(fp, song);
+ song_save_uri(fp, song);
if (song->tag != NULL)
tag_save(fp, song->tag);
@@ -78,7 +77,7 @@ void songvec_save(FILE *fp, struct songvec *sv)
static void
commit_song(struct songvec *sv, struct song *newsong)
{
- struct song *existing = songvec_find(sv, newsong->url);
+ struct song *existing = songvec_find(sv, newsong->uri);
if (!existing) {
songvec_add(sv, newsong);
diff --git a/src/song_update.c b/src/song_update.c
index 77b447e47..4c1c69da2 100644
--- a/src/song_update.c
+++ b/src/song_update.c
@@ -103,7 +103,7 @@ song_file_update(struct song *song)
/* check if there's a suffix and a plugin */
- suffix = uri_get_suffix(song->url);
+ suffix = uri_get_suffix(song->uri);
if (suffix == NULL)
return false;
@@ -152,7 +152,7 @@ song_file_update_inarchive(struct song *song)
/* check if there's a suffix and a plugin */
- suffix = uri_get_suffix(song->url);
+ suffix = uri_get_suffix(song->uri);
if (suffix == NULL)
return false;
diff --git a/src/songvec.c b/src/songvec.c
index d78c44ca0..4160f14bc 100644
--- a/src/songvec.c
+++ b/src/songvec.c
@@ -79,7 +79,7 @@ static int songvec_cmp(const void *s1, const void *s2)
return ret;
/* still no difference? compare file name */
- return g_utf8_collate(a->url, b->url);
+ return g_utf8_collate(a->uri, b->uri);
}
static size_t sv_size(const struct songvec *sv)
@@ -108,14 +108,14 @@ void songvec_sort(struct songvec *sv)
}
struct song *
-songvec_find(const struct songvec *sv, const char *url)
+songvec_find(const struct songvec *sv, const char *uri)
{
int i;
struct song *ret = NULL;
g_mutex_lock(nr_lock);
for (i = sv->nr; --i >= 0; ) {
- if (strcmp(sv->base[i]->url, url))
+ if (strcmp(sv->base[i]->uri, uri))
continue;
ret = sv->base[i];
break;
@@ -182,7 +182,7 @@ songvec_for_each(const struct songvec *sv,
struct song *song = sv->base[i];
assert(song);
- assert(*song->url);
+ assert(*song->uri);
prev_nr = sv->nr;
g_mutex_unlock(nr_lock); /* fn() may block */
diff --git a/src/songvec.h b/src/songvec.h
index 0fd207ed0..1d07dd6e9 100644
--- a/src/songvec.h
+++ b/src/songvec.h
@@ -34,7 +34,7 @@ void songvec_deinit(void);
void songvec_sort(struct songvec *sv);
struct song *
-songvec_find(const struct songvec *sv, const char *url);
+songvec_find(const struct songvec *sv, const char *uri);
int
songvec_delete(struct songvec *sv, const struct song *del);