aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/command.c12
-rw-r--r--src/conf.c10
-rw-r--r--src/mpdclient.c26
-rw-r--r--src/screen.c32
-rw-r--r--src/screen_file.c101
-rw-r--r--src/screen_help.c24
-rw-r--r--src/screen_keydef.c28
-rw-r--r--src/screen_lyrics.c14
-rw-r--r--src/screen_play.c12
-rw-r--r--src/screen_search.c33
10 files changed, 148 insertions, 144 deletions
diff --git a/src/command.c b/src/command.c
index 3a5e6794c..23c15b366 100644
--- a/src/command.c
+++ b/src/command.c
@@ -381,16 +381,16 @@ get_key_command_from_name(char *name)
command_t
-find_key_command(int key, command_definition_t *cmds)
+find_key_command(int key, command_definition_t *c)
{
int i;
i=0;
- while (key && cmds && cmds[i].name) {
- if (cmds[i].keys[0] == key ||
- cmds[i].keys[1] == key ||
- cmds[i].keys[2] == key)
- return cmds[i].command;
+ while (key && c && c[i].name) {
+ if (c[i].keys[0] == key ||
+ c[i].keys[1] == key ||
+ c[i].keys[2] == key)
+ return c[i].command;
i++;
}
diff --git a/src/conf.c b/src/conf.c
index e4b6b70c5..5792dd22f 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -596,15 +596,15 @@ int
check_user_conf_dir(void)
{
int retval;
- char *dirname = g_build_filename(g_get_home_dir(), "." PACKAGE, NULL);
+ char *directory = g_build_filename(g_get_home_dir(), "." PACKAGE, NULL);
- if (g_file_test(dirname, G_FILE_TEST_IS_DIR)) {
- g_free(dirname);
+ if (g_file_test(directory, G_FILE_TEST_IS_DIR)) {
+ g_free(directory);
return 0;
}
- retval = mkdir(dirname, 0755);
- g_free(dirname);
+ retval = mkdir(directory, 0755);
+ g_free(directory);
return retval;
}
diff --git a/src/mpdclient.c b/src/mpdclient.c
index ab7857356..0533cad95 100644
--- a/src/mpdclient.c
+++ b/src/mpdclient.c
@@ -203,7 +203,7 @@ gint
mpdclient_connect(mpdclient_t *c,
gchar *host,
gint port,
- gfloat timeout,
+ gfloat _timeout,
gchar *password)
{
gint retval = 0;
@@ -213,7 +213,7 @@ mpdclient_connect(mpdclient_t *c,
mpdclient_disconnect(c);
/* connect to MPD */
- c->connection = mpd_newConnection(host, port, timeout);
+ c->connection = mpd_newConnection(host, port, _timeout);
if( c->connection->error )
return error_cb(c, c->connection->error,
c->connection->errorStr);
@@ -276,10 +276,10 @@ mpdclient_update(mpdclient_t *c)
/****************************************************************************/
gint
-mpdclient_cmd_play(mpdclient_t *c, gint index)
+mpdclient_cmd_play(mpdclient_t *c, gint idx)
{
#ifdef ENABLE_SONG_ID
- mpd_Song *song = playlist_get_song(c, index);
+ mpd_Song *song = playlist_get_song(c, idx);
D("Play id:%d\n", song ? song->id : -1);
if (song)
@@ -287,7 +287,7 @@ mpdclient_cmd_play(mpdclient_t *c, gint index)
else
mpd_sendPlayIdCommand(c->connection, MPD_PLAY_AT_BEGINNING);
#else
- mpd_sendPlayCommand(c->connection, index);
+ mpd_sendPlayCommand(c->connection, idx);
#endif
c->need_update = TRUE;
return mpdclient_finish_command(c);
@@ -436,10 +436,10 @@ mpdclient_cmd_add(mpdclient_t *c, mpd_Song *song)
}
gint
-mpdclient_cmd_delete(mpdclient_t *c, gint index)
+mpdclient_cmd_delete(mpdclient_t *c, gint idx)
{
gint retval = 0;
- mpd_Song *song = playlist_get_song(c, index);
+ mpd_Song *song = playlist_get_song(c, idx);
if( !song )
return -1;
@@ -449,7 +449,7 @@ mpdclient_cmd_delete(mpdclient_t *c, gint index)
D("Delete id:%d\n", song->id);
mpd_sendDeleteIdCommand(c->connection, song->id);
#else
- mpd_sendDeleteCommand(c->connection, index);
+ mpd_sendDeleteCommand(c->connection, idx);
#endif
if( (retval=mpdclient_finish_command(c)) )
return retval;
@@ -785,9 +785,9 @@ mpdclient_playlist_update_changes(mpdclient_t *c)
#endif
mpd_Song *
-playlist_get_song(mpdclient_t *c, gint index)
+playlist_get_song(mpdclient_t *c, gint idx)
{
- return (mpd_Song *) g_list_nth_data(c->playlist.list, index);
+ return (mpd_Song *) g_list_nth_data(c->playlist.list, idx);
}
GList *
@@ -971,12 +971,12 @@ mpdclient_filelist_t *
mpdclient_filelist_search(mpdclient_t *c,
int exact_match,
int table,
- gchar *filter)
+ gchar *_filter)
{
mpdclient_filelist_t *filelist;
- gchar *filter_utf8 = locale_to_utf8(filter);
+ gchar *filter_utf8 = locale_to_utf8(_filter);
- D("mpdclient_filelist_search(%s)\n", filter);
+ D("mpdclient_filelist_search(%s)\n", _filter);
filelist = mpdclient_filelist_search_utf8(c, exact_match, table,
filter_utf8);
g_free(filter_utf8);
diff --git a/src/screen.c b/src/screen.c
index f9fa9b1fb..d952a1fe4 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -255,7 +255,7 @@ paint_top_window2(const char *header, mpdclient_t *c)
}
static void
-paint_top_window(const char *header, mpdclient_t *c, int clear)
+paint_top_window(const char *header, mpdclient_t *c, int full_repaint)
{
static int prev_volume = -1;
static int prev_header_len = -1;
@@ -263,15 +263,15 @@ paint_top_window(const char *header, mpdclient_t *c, int clear)
if (prev_header_len!=my_strlen(header)) {
prev_header_len = my_strlen(header);
- clear = 1;
+ full_repaint = 1;
}
- if (clear) {
+ if (full_repaint) {
wmove(w, 0, 0);
wclrtoeol(w);
}
- if (prev_volume!=c->status->volume || clear)
+ if (prev_volume!=c->status->volume || full_repaint)
paint_top_window2(header, c);
}
@@ -416,12 +416,12 @@ screen_exit(void)
/* close and exit all screens (playlist,browse,help...) */
i=0;
while (screens[i].get_mode_functions) {
- screen_functions_t *mode_fn = screens[i].get_mode_functions();
+ screen_functions_t *sf = screens[i].get_mode_functions();
- if (mode_fn && mode_fn->close)
- mode_fn->close();
- if (mode_fn && mode_fn->exit)
- mode_fn->exit();
+ if (sf && sf->close)
+ sf->close();
+ if (sf && sf->exit)
+ sf->exit();
i++;
}
@@ -480,10 +480,10 @@ screen_resize(void)
/* close and exit all screens (playlist,browse,help...) */
i=0;
while (screens[i].get_mode_functions) {
- screen_functions_t *mode_fn = screens[i].get_mode_functions();
+ screen_functions_t *sf = screens[i].get_mode_functions();
- if (mode_fn && mode_fn->resize)
- mode_fn->resize(screen->main_window.cols, screen->main_window.rows);
+ if (sf && sf->resize)
+ sf->resize(screen->main_window.cols, screen->main_window.rows);
i++;
}
@@ -691,7 +691,7 @@ void
screen_update(mpdclient_t *c)
{
static int repeat = -1;
- static int random = -1;
+ static int random_enabled = -1;
static int crossfade = -1;
static int dbupdate = -1;
list_window_t *lw = NULL;
@@ -702,7 +702,7 @@ screen_update(mpdclient_t *c)
/* print a message if mpd status has changed */
if (repeat < 0) {
repeat = c->status->repeat;
- random = c->status->random;
+ random_enabled = c->status->random;
crossfade = c->status->crossfade;
dbupdate = c->status->updatingDb;
}
@@ -712,7 +712,7 @@ screen_update(mpdclient_t *c)
_("Repeat is on") :
_("Repeat is off"));
- if (random != c->status->random)
+ if (random_enabled != c->status->random)
screen_status_printf(c->status->random ?
_("Random is on") :
_("Random is off"));
@@ -726,7 +726,7 @@ screen_update(mpdclient_t *c)
}
repeat = c->status->repeat;
- random = c->status->random;
+ random_enabled = c->status->random;
crossfade = c->status->crossfade;
dbupdate = c->status->updatingDb;
diff --git a/src/screen_file.c b/src/screen_file.c
index a9dec9475..ab2af0713 100644
--- a/src/screen_file.c
+++ b/src/screen_file.c
@@ -51,9 +51,9 @@ static mpdclient_filelist_t *filelist = NULL;
/* clear the highlight flag for all items in the filelist */
void
-clear_highlights(mpdclient_filelist_t *filelist)
+clear_highlights(mpdclient_filelist_t *fl)
{
- GList *list = g_list_first(filelist->list);
+ GList *list = g_list_first(fl->list);
while( list ) {
filelist_entry_t *entry = list->data;
@@ -65,9 +65,9 @@ clear_highlights(mpdclient_filelist_t *filelist)
/* change the highlight flag for a song */
void
-set_highlight(mpdclient_filelist_t *filelist, mpd_Song *song, int highlight)
+set_highlight(mpdclient_filelist_t *fl, mpd_Song *song, int highlight)
{
- GList *list = g_list_first(filelist->list);
+ GList *list = g_list_first(fl->list);
if( !song )
return;
@@ -92,9 +92,9 @@ set_highlight(mpdclient_filelist_t *filelist, mpd_Song *song, int highlight)
/* sync highlight flags with playlist */
void
-sync_highlights(mpdclient_t *c, mpdclient_filelist_t *filelist)
+sync_highlights(mpdclient_t *c, mpdclient_filelist_t *fl)
{
- GList *list = g_list_first(filelist->list);
+ GList *list = g_list_first(fl->list);
while(list) {
filelist_entry_t *entry = list->data;
@@ -147,15 +147,15 @@ playlist_changed_callback(mpdclient_t *c, int event, gpointer data)
/* list_window callback */
const char *
-browse_lw_callback(int index, int *highlight, void *data)
+browse_lw_callback(int idx, int *highlight, void *data)
{
static char buf[BUFSIZE];
- mpdclient_filelist_t *filelist = (mpdclient_filelist_t *) data;
+ mpdclient_filelist_t *fl = (mpdclient_filelist_t *) data;
filelist_entry_t *entry;
mpd_InfoEntity *entity;
*highlight = 0;
- if( (entry=(filelist_entry_t *)g_list_nth_data(filelist->list,index))==NULL )
+ if( (entry=(filelist_entry_t *)g_list_nth_data(fl->list,idx))==NULL )
return NULL;
entity = entry->entity;
@@ -166,10 +166,10 @@ browse_lw_callback(int index, int *highlight, void *data)
if( entity->type==MPD_INFO_ENTITY_TYPE_DIRECTORY ) {
mpd_Directory *dir = entity->info.directory;
- char *dirname = utf8_to_locale(basename(dir->path));
+ char *directory = utf8_to_locale(basename(dir->path));
- g_snprintf(buf, BUFSIZE, "[%s]", dirname);
- g_free(dirname);
+ g_snprintf(buf, BUFSIZE, "[%s]", directory);
+ g_free(directory);
return buf;
} else if( entity->type==MPD_INFO_ENTITY_TYPE_SONG ) {
mpd_Song *song = entity->info.song;
@@ -315,7 +315,7 @@ handle_delete(screen_t *screen, mpdclient_t *c)
static int
enqueue_and_play(screen_t *screen, mpdclient_t *c, filelist_entry_t *entry)
{
- int index;
+ int idx;
mpd_InfoEntity *entity = entry->entity;
mpd_Song *song = entity->info.song;
@@ -331,23 +331,23 @@ enqueue_and_play(screen_t *screen, mpdclient_t *c, filelist_entry_t *entry)
return -1;
}
- index = playlist_get_index_from_file(c, song->file);
- mpdclient_cmd_play(c, index);
+ idx = playlist_get_index_from_file(c, song->file);
+ mpdclient_cmd_play(c, idx);
return 0;
}
int
browse_handle_enter(screen_t *screen,
mpdclient_t *c,
- list_window_t *lw,
- mpdclient_filelist_t *filelist)
+ list_window_t *local_lw,
+ mpdclient_filelist_t *fl)
{
filelist_entry_t *entry;
mpd_InfoEntity *entity;
- if ( filelist==NULL )
+ if ( fl==NULL )
return -1;
- entry = ( filelist_entry_t *) g_list_nth_data(filelist->list, lw->selected);
+ entry = ( filelist_entry_t *) g_list_nth_data(fl->list, local_lw->selected);
if( entry==NULL )
return -1;
@@ -415,14 +415,15 @@ add_directory(mpdclient_t *c, char *dir)
int
browse_handle_select(screen_t *screen,
mpdclient_t *c,
- list_window_t *lw,
- mpdclient_filelist_t *filelist)
+ list_window_t *local_lw,
+ mpdclient_filelist_t *fl)
{
filelist_entry_t *entry;
- if ( filelist==NULL )
+ if ( fl==NULL )
return -1;
- entry=( filelist_entry_t *) g_list_nth_data(filelist->list, lw->selected);
+ entry=( filelist_entry_t *) g_list_nth_data(fl->list,
+ local_lw->selected);
if( entry==NULL || entry->entity==NULL)
return -1;
@@ -469,10 +470,10 @@ browse_handle_select(screen_t *screen,
mpd_Song *song = entry->entity->info.song;
if( song ) {
- int index = playlist_get_index_from_file(c, song->file);
+ int idx = playlist_get_index_from_file(c, song->file);
- while( (index=playlist_get_index_from_file(c, song->file))>=0 )
- mpdclient_cmd_delete(c, index);
+ while( (idx=playlist_get_index_from_file(c, song->file))>=0 )
+ mpdclient_cmd_delete(c, idx);
}
}
}
@@ -482,18 +483,18 @@ browse_handle_select(screen_t *screen,
int
browse_handle_select_all (screen_t *screen,
mpdclient_t *c,
- list_window_t *lw,
- mpdclient_filelist_t *filelist)
+ list_window_t *local_lw,
+ mpdclient_filelist_t *fl)
{
filelist_entry_t *entry;
- GList *temp = filelist->list;
+ GList *temp = fl->list;
- if ( filelist==NULL )
+ if ( fl==NULL )
return -1;
- for (filelist->list = g_list_first(filelist->list);
- filelist->list;
- filelist->list = g_list_next(filelist->list)) {
- entry=( filelist_entry_t *) filelist->list->data;
+ for (fl->list = g_list_first(fl->list);
+ fl->list;
+ fl->list = g_list_next(fl->list)) {
+ entry=( filelist_entry_t *) fl->list->data;
if( entry==NULL || entry->entity==NULL)
return -1;
@@ -538,10 +539,10 @@ browse_handle_select_all (screen_t *screen,
mpd_Song *song = entry->entity->info.song;
if( song ) {
- int index = playlist_get_index_from_file(c, song->file);
+ int idx = playlist_get_index_from_file(c, song->file);
- while( (index=playlist_get_index_from_file(c, song->file))>=0 )
- mpdclient_cmd_delete(c, index);
+ while( (idx=playlist_get_index_from_file(c, song->file))>=0 )
+ mpdclient_cmd_delete(c, idx);
}
}
}
@@ -549,7 +550,7 @@ browse_handle_select_all (screen_t *screen,
return 0;
}
- filelist->list = temp;
+ fl->list = temp;
return 0;
}
@@ -640,31 +641,31 @@ browse_update(screen_t *screen, mpdclient_t *c)
int
browse_handle_mouse_event(screen_t *screen,
mpdclient_t *c,
- list_window_t *lw,
- mpdclient_filelist_t *filelist)
+ list_window_t *local_lw,
+ mpdclient_filelist_t *fl)
{
int row;
- int prev_selected = lw->selected;
+ int prev_selected = local_lw->selected;
unsigned long bstate;
int length;
- if ( filelist )
- length = filelist->length;
+ if ( fl )
+ length = fl->length;
else
length = 0;
- if( screen_get_mouse_event(c, lw, length, &bstate, &row) )
+ if( screen_get_mouse_event(c, local_lw, length, &bstate, &row) )
return 1;
- lw->selected = lw->start+row;
- list_window_check_selected(lw, length);
+ local_lw->selected = local_lw->start+row;
+ list_window_check_selected(local_lw, length);
if( bstate & BUTTON1_CLICKED ) {
- if( prev_selected == lw->selected )
- browse_handle_enter(screen, c, lw, filelist);
+ if( prev_selected == local_lw->selected )
+ browse_handle_enter(screen, c, local_lw, fl);
} else if( bstate & BUTTON3_CLICKED ) {
- if( prev_selected == lw->selected )
- browse_handle_select(screen, c, lw, filelist);
+ if( prev_selected == local_lw->selected )
+ browse_handle_select(screen, c, local_lw, fl);
}
return 1;
diff --git a/src/screen_help.c b/src/screen_help.c
index b62c61890..2b5dc1f16 100644
--- a/src/screen_help.c
+++ b/src/screen_help.c
@@ -147,7 +147,7 @@ static list_window_t *lw = NULL;
static const char *
-list_callback(int index, int *highlight, void *data)
+list_callback(int idx, int *highlight, void *data)
{
static char buf[512];
@@ -158,12 +158,12 @@ list_callback(int index, int *highlight, void *data)
}
*highlight = 0;
- if (index < help_text_rows) {
- *highlight = help_text[index].highlight > 0;
- if (help_text[index].command == CMD_NONE) {
- if (help_text[index].text)
- g_snprintf(buf, sizeof(buf), " %s", _(help_text[index].text));
- else if (help_text[index].highlight == 2) {
+ if (idx < help_text_rows) {
+ *highlight = help_text[idx].highlight > 0;
+ if (help_text[idx].command == CMD_NONE) {
+ if (help_text[idx].text)
+ g_snprintf(buf, sizeof(buf), " %s", _(help_text[idx].text));
+ else if (help_text[idx].highlight == 2) {
int i;
for (i = 3; i < COLS - 3 && i < sizeof(buf); i++)
@@ -174,16 +174,16 @@ list_callback(int index, int *highlight, void *data)
return buf;
}
- if (help_text[index].text)
+ if (help_text[idx].text)
g_snprintf(buf, sizeof(buf),
"%20s : %s ",
- get_key_names(help_text[index].command, TRUE),
- _(help_text[index].text));
+ get_key_names(help_text[idx].command, TRUE),
+ _(help_text[idx].text));
else
g_snprintf(buf, sizeof(buf),
"%20s : %s ",
- get_key_names(help_text[index].command, TRUE),
- get_key_description(help_text[index].command));
+ get_key_names(help_text[idx].command, TRUE),
+ get_key_description(help_text[idx].command));
return buf;
}
diff --git a/src/screen_keydef.c b/src/screen_keydef.c
index 11c0a4aee..bc37f1af3 100644
--- a/src/screen_keydef.c
+++ b/src/screen_keydef.c
@@ -183,33 +183,33 @@ assign_new_key(WINDOW *w, int cmd_index, int key_index)
}
static const char *
-list_callback(int index, int *highlight, void *data)
+list_callback(int idx, int *highlight, void *data)
{
static char buf[BUFSIZE];
*highlight = 0;
if (subcmd < 0) {
- if (index < command_list_length) {
- if (cmds[index].flags & COMMAND_KEY_CONFLICT)
+ if (idx < command_list_length) {
+ if (cmds[idx].flags & COMMAND_KEY_CONFLICT)
*highlight = 1;
- return cmds[index].name;
- } else if (index == LIST_ITEM_APPLY())
+ return cmds[idx].name;
+ } else if (idx == LIST_ITEM_APPLY())
return LIST_ITEM_APPLY_LABEL;
- else if (index == LIST_ITEM_SAVE())
+ else if (idx == LIST_ITEM_SAVE())
return LIST_ITEM_SAVE_LABEL;
} else {
- if (index == 0)
+ if (idx == 0)
return "[..]";
- index--;
- if (index < MAX_COMMAND_KEYS && cmds[subcmd].keys[index] > 0) {
+ idx--;
+ if (idx < MAX_COMMAND_KEYS && cmds[subcmd].keys[idx] > 0) {
g_snprintf(buf,
BUFSIZE, "%d. %-20s (%d) ",
- index + 1,
- key2str(cmds[subcmd].keys[index]),
- cmds[subcmd].keys[index]);
+ idx + 1,
+ key2str(cmds[subcmd].keys[idx]),
+ cmds[subcmd].keys[idx]);
return buf;
- } else if (index == subcmd_addpos) {
- g_snprintf(buf, BUFSIZE, _("%d. Add new key "), index + 1);
+ } else if (idx == subcmd_addpos) {
+ g_snprintf(buf, BUFSIZE, _("%d. Add new key "), idx + 1);
return buf;
}
}
diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c
index 2dd5e12b7..8943d4f22 100644
--- a/src/screen_lyrics.c
+++ b/src/screen_lyrics.c
@@ -152,14 +152,14 @@ static gpointer get_lyr(void *c)
}
static const char *
-list_callback(int index, int *highlight, void *data)
+list_callback(int idx, int *highlight, void *data)
{
static char buf[512];
//i think i'ts fine to write it into the 1st line...
- if ((index == lyr_text.lines->len && lyr_text.lines->len > 4) ||
+ if ((idx == lyr_text.lines->len && lyr_text.lines->len > 4) ||
((lyr_text.lines->len == 0 || lyr_text.lines->len == 4) &&
- index == 0)) {
+ idx == 0)) {
*highlight=3;
src_lyr* selected = g_array_index(src_lyr_stack, src_lyr*, src_selection);
if (selected != NULL)
@@ -167,14 +167,14 @@ list_callback(int index, int *highlight, void *data)
return "";
}
- if (index < 2 && lyr_text.lines->len > 4)
+ if (idx < 2 && lyr_text.lines->len > 4)
*highlight=3;
- else if(index >= lyr_text.lines->len ||
- (index < 4 && index != 0 && lyr_text.lines->len < 5)) {
+ else if(idx >= lyr_text.lines->len ||
+ (idx < 4 && idx != 0 && lyr_text.lines->len < 5)) {
return "";
}
- get_text_line(&lyr_text, index, buf, 512);
+ get_text_line(&lyr_text, idx, buf, 512);
return buf;
}
diff --git a/src/screen_play.c b/src/screen_play.c
index 736be9271..a1bb369e6 100644
--- a/src/screen_play.c
+++ b/src/screen_play.c
@@ -73,14 +73,14 @@ playlist_changed_callback(mpdclient_t *c, int event, gpointer data)
}
static const char *
-list_callback(int index, int *highlight, void *data)
+list_callback(int idx, int *highlight, void *data)
{
static char songname[MAX_SONG_LENGTH];
mpdclient_t *c = (mpdclient_t *) data;
mpd_Song *song;
*highlight = 0;
- if( (song=playlist_get_song(c, index)) == NULL ) {
+ if( (song=playlist_get_song(c, idx)) == NULL ) {
return NULL;
}
@@ -96,16 +96,16 @@ center_playing_item(screen_t *screen, mpdclient_t *c)
{
int length = c->playlist.length;
int offset = lw->selected - lw->start;
- int index;
+ int idx;
if (!lw || !c->song || length<lw->rows ||
IS_STOPPED(c->status->state))
return 0;
/* try to center the song that are playing */
- index = playlist_get_index(c, c->song);
- D("Autocenter song id:%d pos:%d index:%d\n", c->song->id,c->song->pos,index);
- lw->start = index - (lw->rows / 2);
+ idx = playlist_get_index(c, c->song);
+ D("Autocenter song id:%d pos:%d index:%d\n", c->song->id,c->song->pos,idx);
+ lw->start = idx - (lw->rows / 2);
if (lw->start + lw->rows > length)
lw->start = length - lw->rows;
if (lw->start < 0)
diff --git a/src/screen_search.c b/src/screen_search.c
index 85dc5c74e..982fe34e0 100644
--- a/src/screen_search.c
+++ b/src/screen_search.c
@@ -116,7 +116,7 @@ static gboolean advanced_search_mode = FALSE;
/* search info */
static const char *
-lw_search_help_callback(int index, int *highlight, void *data)
+lw_search_help_callback(int idx, int *highlight, void *data)
{
int text_rows;
static const char *text[] = {
@@ -136,8 +136,8 @@ lw_search_help_callback(int index, int *highlight, void *data)
while (text[text_rows])
text_rows++;
- if (index < text_rows)
- return text[index];
+ if (idx < text_rows)
+ return text[idx];
return NULL;
}
@@ -190,14 +190,17 @@ search_clear(screen_t *screen, mpdclient_t *c, gboolean clear_pattern)
#ifdef FUTURE
static mpdclient_filelist_t *
-filelist_search(mpdclient_t *c, int exact_match, int table, gchar *pattern)
+filelist_search(mpdclient_t *c, int exact_match, int table,
+ gchar *local_pattern)
{
mpdclient_filelist_t *list, *list2;
if( table == SEARCH_ARTIST_TITLE )
{
- list = mpdclient_filelist_search(c, FALSE, MPD_TABLE_ARTIST, pattern);
- list2 = mpdclient_filelist_search(c, FALSE, MPD_TABLE_TITLE, pattern);
+ list = mpdclient_filelist_search(c, FALSE, MPD_TABLE_ARTIST,
+ local_pattern);
+ list2 = mpdclient_filelist_search(c, FALSE, MPD_TABLE_TITLE,
+ local_pattern);
list->length += list2->length;
list->list = g_list_concat(list->list, list2->list);
@@ -206,7 +209,7 @@ filelist_search(mpdclient_t *c, int exact_match, int table, gchar *pattern)
}
else
{
- list = mpdclient_filelist_search(c, FALSE, table, pattern);
+ list = mpdclient_filelist_search(c, FALSE, table, local_pattern);
}
return list;
@@ -224,7 +227,7 @@ search_advanced_query(char *query, mpdclient_t *c)
char **strv;
int table[10];
char *arg[10];
- mpdclient_filelist_t *filelist = NULL;
+ mpdclient_filelist_t *fl = NULL;
advanced_search_mode = FALSE;
if( g_strrstr(query, ":") == NULL )
@@ -294,7 +297,7 @@ search_advanced_query(char *query, mpdclient_t *c)
mpd_commitSearch(c->connection);
- filelist = g_malloc0(sizeof(mpdclient_filelist_t));
+ fl = g_malloc0(sizeof(mpdclient_filelist_t));
mpd_InfoEntity *entity;
@@ -302,21 +305,21 @@ search_advanced_query(char *query, mpdclient_t *c)
filelist_entry_t *entry = g_malloc0(sizeof(filelist_entry_t));
entry->entity = entity;
- filelist->list = g_list_append(filelist->list, (gpointer) entry);
- filelist->length++;
+ fl->list = g_list_append(fl->list, (gpointer) entry);
+ fl->length++;
}
- if (mpdclient_finish_command(c) && filelist)
- filelist = mpdclient_filelist_free(filelist);
+ if (mpdclient_finish_command(c) && fl)
+ fl = mpdclient_filelist_free(fl);
- filelist->updated = TRUE;
+ fl->updated = TRUE;
}
i=0;
while( arg[i] )
g_free(arg[i++]);
- return filelist;
+ return fl;
}
#else
#define search_advanced_query(pattern,c) (NULL)