Permalink
Browse files

Namespace cleanup: prefix track with ds_

  • Loading branch information...
1 parent 284a225 commit ef808b4864cab9a12f9bc8b5236a226680102f04 @SimonKagstrom committed Mar 13, 2011
@@ -24,7 +24,7 @@ typedef struct ds_playlist ds_playlist_t;
typedef struct link ds_link_t;
typedef struct search_result ds_search_t;
typedef struct despotify_session ds_session_t;
-typedef struct track ds_track_t;
+typedef struct ds_track ds_track_t;
typedef struct user_info ds_user_info_t;
#define BOOL2VALUE(exp) exp ? Qtrue : Qfalse
@@ -227,7 +227,7 @@ void sess_search(const char *query)
}
// Start playback.
-void sess_play(struct track *t)
+void sess_play(struct ds_track *t)
{
if (g_session.state != SESS_ONLINE) {
log_append("Not connected");
@@ -42,7 +42,7 @@ void sess_username(const char *username);
void sess_password(const char *password);
void sess_search(const char *query);
-void sess_play(struct track *t);
+void sess_play(struct ds_track *t);
void sess_stop();
void sess_pause();
@@ -47,7 +47,7 @@ void tracklist_draw(ui_t *ui)
return;
if (g_res->playlist->num_tracks) {
- struct track *t = g_res->playlist->tracks;
+ struct ds_track *t = g_res->playlist->tracks;
// Scroll offset.
int offset = DSFY_MIN(DSFY_MAX(g_pos - (g_availy / 2), 0),
@@ -100,7 +100,7 @@ int tracklist_keypress(wint_t ch, bool code)
if (!g_res || !g_res->playlist->num_tracks)
return ch;
- struct track *t;
+ struct ds_track *t;
switch (ch) {
case KEY_ENTER:
@@ -88,7 +88,7 @@ enum
/* Forward declarations */
static void init_list(GtkWidget *list);
-static void add_to_list(GtkWidget *list, const gchar* str1, const gchar* str2, struct track *tracks);
+static void add_to_list(GtkWidget *list, const gchar* str1, const gchar* str2, struct ds_track *tracks);
void on_changed(GtkWidget *widget, AppData * appdata);
void tb_close_cb(GtkToolButton * widget, AppData * view);
void tb_find_cb(GtkToolButton * widget, AppData * view);
@@ -266,7 +266,7 @@ init_list(GtkWidget *list)
* Adds a (track) item to a list
*/
static void
-add_to_list(GtkWidget *list, const gchar* col1str, const gchar* col2str, struct track *track)
+add_to_list(GtkWidget *list, const gchar* col1str, const gchar* col2str, struct ds_track *track)
{
GtkListStore *store;
GtkTreeIter iter;
@@ -288,7 +288,7 @@ void on_changed(GtkWidget *widget, AppData * appdata)
GtkTreeModel *model;
char *artist;
char *title;
- struct track *track;
+ struct ds_track *track;
if (gtk_tree_selection_get_selected(
@@ -367,8 +367,8 @@ void do_search(gchar* find_text, AppData* appdata) {
else {
appdata->searchlist = appdata->search->playlist;
int i=1;
- struct track* t = appdata->searchlist->tracks;
- struct track* t_last;
+ struct ds_track* t = appdata->searchlist->tracks;
+ struct ds_track* t_last;
for (; t; t = t->next) {
printf("%2d: %s (%d:%02d), ptr: %d\n", i++, t->title,
t->length / 60000, t->length % 60000 / 1000, (int)t);
@@ -143,15 +143,15 @@ void print_list_of_lists(struct ds_playlist* rootlist)
}
}
-void print_tracks(struct track* head)
+void print_tracks(struct ds_track* head)
{
if (!head) {
wrapper_wprintf(L" <empty playlist>\n");
return;
}
int count = 1;
- for (struct track* t = head; t; t = t->next) {
+ for (struct ds_track* t = head; t; t = t->next) {
if (t->has_meta_data) {
wrapper_wprintf(L"%3d: %-40s %2d:%02d ", count++, t->title,
t->length / 60000, t->length % 60000 / 1000);
@@ -164,7 +164,7 @@ void print_tracks(struct track* head)
}
}
-void print_track_full(struct track* t)
+void print_track_full(struct ds_track* t)
{
if(t->has_meta_data) {
wrapper_wprintf(L"\nTitle: %s\nAlbum: %s\nArtist(s): ",
@@ -406,7 +406,7 @@ void command_loop(struct despotify_session* ds)
}
/* find the requested track */
- struct track* t = lastlist->tracks;
+ struct ds_track* t = lastlist->tracks;
for (int i=1; i<num; i++)
t = t->next;
@@ -434,7 +434,7 @@ void command_loop(struct despotify_session* ds)
}
/* find the requested track */
- struct track* t = lastlist->tracks;
+ struct ds_track* t = lastlist->tracks;
for (int i=1; i<num; i++)
t = t->next;
@@ -466,7 +466,7 @@ void command_loop(struct despotify_session* ds)
}
/* find the requested track */
- struct track* t = lastlist->tracks;
+ struct ds_track* t = lastlist->tracks;
for (int i=1; i<num; i++)
t = t->next;
@@ -502,7 +502,7 @@ void command_loop(struct despotify_session* ds)
struct artist_browse* ar;
struct ds_playlist* pls;
struct search_result* s;
- struct track* t;
+ struct ds_track* t;
switch(link->type) {
case LINK_TYPE_ALBUM:
@@ -569,7 +569,7 @@ void command_loop(struct despotify_session* ds)
}
/* find the requested artist */
- struct track* t = lastlist->tracks;
+ struct ds_track* t = lastlist->tracks;
for (int i=1; i<num; i++)
t = t->next;
struct artist_browse* a = despotify_get_artist(ds, t->artist->id);
@@ -608,7 +608,7 @@ void command_loop(struct despotify_session* ds)
}
/* find the requested album */
- struct track* t = lastlist->tracks;
+ struct ds_track* t = lastlist->tracks;
for (int i=1; i<num; i++)
t = t->next;
@@ -641,7 +641,7 @@ void command_loop(struct despotify_session* ds)
}
/* skip to track <num>, else play next */
- struct track* t;
+ struct ds_track* t;
if (buf[4]) {
int listoffset = atoi(buf + 5);
t = lastlist->tracks;
@@ -709,7 +709,7 @@ void callback(struct despotify_session* ds, int signal, void* data, void* callba
switch (signal) {
case DESPOTIFY_NEW_TRACK: {
- struct track* t = data;
+ struct ds_track* t = data;
wrapper_wprintf(L"New track: %s / %s (%d:%02d) %d kbit/s\n",
t->title, t->artist->name,
t->length / 60000, t->length % 60000 / 1000,
@@ -770,7 +770,7 @@ int main(int argc, char** argv)
#if 0
{
- struct track* t = despotify_get_track(ds, "d1b264bb6bcd46be852ceba8ac5e6582");
+ struct ds_track* t = despotify_get_track(ds, "d1b264bb6bcd46be852ceba8ac5e6582");
despotify_play(ds, t, false);
thread_play();
View
@@ -248,7 +248,7 @@ static int despotify_aes_callback(CHANNEL* ch,
{
if (ch->state == CHANNEL_DATA) {
struct despotify_session* ds = ch->private;
- struct track* t = ds->track;
+ struct ds_track* t = ds->track;
if (t->key)
DSFYfree(t->key);
@@ -269,8 +269,8 @@ static int despotify_aes_callback(CHANNEL* ch,
/* Add SND_CMD_START to buffer chain,
with a copy of the track struct */
- struct track* copy = malloc(sizeof(struct track));
- memcpy(copy, ds->track, sizeof(struct track));
+ struct ds_track* copy = malloc(sizeof(struct ds_track));
+ memcpy(copy, ds->track, sizeof(struct ds_track));
snd_ioctl(ds, SND_CMD_START, copy, 0);
}
@@ -406,7 +406,7 @@ int despotify_snd_read_stream(struct despotify_session* ds)
return 0;
}
-bool despotify_is_track_restricted(struct track* track, const char* country)
+bool despotify_is_track_restricted(struct ds_track* track, const char* country)
{
bool allowed = true;
bool forbidden = false;
@@ -421,7 +421,7 @@ bool despotify_is_track_restricted(struct track* track, const char* country)
}
bool despotify_play(struct despotify_session* ds,
- struct track* t, bool play_as_list)
+ struct ds_track* t, bool play_as_list)
{
if (ds->fifo) {
snd_stop(ds);
@@ -487,7 +487,7 @@ bool despotify_stop(struct despotify_session* ds)
return true;
}
-struct track *despotify_get_current_track(struct despotify_session *ds) {
+struct ds_track *despotify_get_current_track(struct despotify_session *ds) {
if (ds->track)
return ds->track;
return NULL;
@@ -708,7 +708,7 @@ struct search_result* despotify_search(struct despotify_session* ds,
/* Add tracks */
if (!ds->playlist->tracks)
- ds->playlist->tracks = calloc(1, sizeof(struct track));
+ ds->playlist->tracks = calloc(1, sizeof(struct ds_track));
struct buf* b = despotify_inflate(ds->response->ptr, ds->response->len);
if (b) {
@@ -760,12 +760,12 @@ struct search_result* despotify_search_more(struct despotify_session *ds,
struct buf* b = despotify_inflate(ds->response->ptr, ds->response->len);
if (b) {
/* append at end of list */
- struct track *t;
+ struct ds_track *t;
for (t = search->tracks; t; t = t->next)
if (!t->next)
break;
- t = t->next = calloc(1, sizeof(struct track));
+ t = t->next = calloc(1, sizeof(struct ds_track));
ds->playlist->num_tracks += xml_parse_tracklist(t, b->ptr, b->len,
false, ds->high_bitrate);
@@ -797,7 +797,7 @@ static bool despotify_load_tracks(struct despotify_session *ds, bool cache_do_st
if (!pl->num_tracks)
return true;
- struct track* t = pl->tracks;
+ struct ds_track* t = pl->tracks;
/* construct an array of 16-byte track ids */
char* tracklist = malloc(MAX_BROWSE_REQ * 16);
@@ -810,7 +810,7 @@ static bool despotify_load_tracks(struct despotify_session *ds, bool cache_do_st
for (int totcount=0; totcount < pl->num_tracks; totcount += count) {
ds->response = buf_new();
- struct track* firsttrack = t;
+ struct ds_track* firsttrack = t;
for (count = 0; t && count < MAX_BROWSE_REQ; t = t->next, count++)
hex_ascii_to_bytes(t->track_id, tracklist + count * 16, 16);
@@ -873,11 +873,11 @@ static bool despotify_load_tracks(struct despotify_session *ds, bool cache_do_st
if (track_count < pl->num_tracks) {
for (t = pl->tracks; t; t = t->next) {
if (!t->has_meta_data) {
- struct track* tt;
+ struct ds_track* tt;
for (tt = pl->tracks; tt; tt = tt->next) {
if (tt->has_meta_data &&
!strncmp(tt->track_id, t->track_id, sizeof tt->track_id)) {
- struct track* next = t->next;
+ struct ds_track* next = t->next;
*t = *tt;
t->next = next;
@@ -1349,7 +1349,7 @@ void despotify_free_album_browse(struct album_browse* a)
xml_free_album_browse(a);
}
-struct track* despotify_get_tracks(struct despotify_session* ds, char* track_ids[], int num_tracks)
+struct ds_track* despotify_get_tracks(struct despotify_session* ds, char* track_ids[], int num_tracks)
{
if (num_tracks > MAX_BROWSE_REQ) {
ds->last_error = "Too many ids in track browse request";
@@ -1358,7 +1358,7 @@ struct track* despotify_get_tracks(struct despotify_session* ds, char* track_ids
/* construct an array of 16-byte track ids */
char* tracklist = malloc(num_tracks * 16);
- struct track* first = calloc(1, sizeof(struct track));
+ struct ds_track* first = calloc(1, sizeof(struct ds_track));
ds->response = buf_new();
for (int i = 0; i < num_tracks; i++)
@@ -1389,7 +1389,7 @@ struct track* despotify_get_tracks(struct despotify_session* ds, char* track_ids
buf_free(ds->response);
free(tracklist);
- struct track* t;
+ struct ds_track* t;
for(t = first; t; t = t->next) {
t->geo_restricted = despotify_is_track_restricted(t, ds->user_info->country);
if(t->geo_restricted)
@@ -1399,15 +1399,15 @@ struct track* despotify_get_tracks(struct despotify_session* ds, char* track_ids
return first;
}
-struct track* despotify_get_track(struct despotify_session* ds, char* track_id)
+struct ds_track* despotify_get_track(struct despotify_session* ds, char* track_id)
{
char* track_ids[1];
track_ids[0] = track_id;
return despotify_get_tracks(ds, track_ids, 1);
}
-void despotify_free_track(struct track* t)
+void despotify_free_track(struct ds_track* t)
{
xml_free_track(t);
}
@@ -1568,7 +1568,7 @@ struct ds_playlist* despotify_link_get_playlist(struct despotify_session* ds, st
return playlist;
}
-struct track* despotify_link_get_track(struct despotify_session* ds, struct link* link)
+struct ds_track* despotify_link_get_track(struct despotify_session* ds, struct link* link)
{
char buf[33];
@@ -1626,7 +1626,7 @@ char* despotify_search_to_uri(struct search_result* search, char* dest)
}
-char* despotify_track_to_uri(struct track* track, char* dest)
+char* despotify_track_to_uri(struct ds_track* track, char* dest)
{
char uri[23];
Oops, something went wrong.

0 comments on commit ef808b4

Please sign in to comment.