From 079548617d3c321dd4051709c3a31717fd80238d Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 15 Sep 2008 13:27:32 +0200 Subject: [PATCH] fix unused parameter warnings Add the "unused" attribute to all function parameters which are indeed going to be ignored. --- src/main.c | 11 +++++------ src/screen_clock.c | 10 ++++++---- src/screen_file.c | 20 ++++++++++++-------- src/screen_help.c | 11 ++++++----- src/screen_keydef.c | 11 ++++++----- src/screen_lyrics.c | 9 +++++---- src/screen_play.c | 19 ++++++++++--------- src/screen_search.c | 15 +++++++++------ 8 files changed, 59 insertions(+), 47 deletions(-) diff --git a/src/main.c b/src/main.c index 7350a50..b16cab8 100644 --- a/src/main.c +++ b/src/main.c @@ -29,6 +29,7 @@ #include "screen.h" #include "screen_utils.h" #include "strfsong.h" +#include "gcc.h" #include #include @@ -55,12 +56,10 @@ error_msg(const gchar *msg) } static void -error_callback(mpdclient_t *c, gint error, const gchar *msg) +error_callback(mpd_unused mpdclient_t *c, gint error, const gchar *msg) { - gint code = GET_ACK_ERROR_CODE(error); - error = error & 0xFF; - D("Error [%d:%d]> \"%s\"\n", error, code, msg); + D("Error [%d:%d]> \"%s\"\n", error, GET_ACK_ERROR_CODE(error), msg); switch (error) { case MPD_ERROR_CONNPORT: case MPD_ERROR_NORESPONSE: @@ -126,7 +125,7 @@ exit_and_cleanup(void) } static void -catch_sigint( int sig ) +catch_sigint(mpd_unused int sig) { printf("\n%s\n", _("Exiting...")); exit(EXIT_SUCCESS); @@ -134,7 +133,7 @@ catch_sigint( int sig ) static void -catch_sigcont( int sig ) +catch_sigcont(mpd_unused int sig) { D("catch_sigcont()\n"); #ifdef ENABLE_RAW_MODE diff --git a/src/screen_clock.c b/src/screen_clock.c index a929532..995be67 100644 --- a/src/screen_clock.c +++ b/src/screen_clock.c @@ -14,6 +14,7 @@ #include "command.h" #include "screen.h" #include "screen_utils.h" +#include "gcc.h" #include #include @@ -133,7 +134,7 @@ clock_exit(void) } static void -clock_open(screen_t *screen, mpdclient_t *c) +clock_open(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c) { int j; @@ -148,13 +149,13 @@ clock_close(void) } static const char * -clock_title(char *str, size_t size) +clock_title(mpd_unused char *str, mpd_unused size_t size) { return _("Clock"); } static void -clock_update(screen_t *screen, mpdclient_t *c) +clock_update(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c) { time_t now; struct tm *tm; @@ -234,7 +235,8 @@ clock_paint(screen_t *screen, mpdclient_t *c) } static int -clock_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) +clock_cmd(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c, + mpd_unused command_t cmd) { return 0; } diff --git a/src/screen_file.c b/src/screen_file.c index c00ccba..c480961 100644 --- a/src/screen_file.c +++ b/src/screen_file.c @@ -29,6 +29,7 @@ #include "screen_utils.h" #include "screen_browse.h" #include "screen_play.h" +#include "gcc.h" #include #include @@ -114,7 +115,8 @@ sync_highlights(mpdclient_t *c, mpdclient_filelist_t *fl) /* the db have changed -> update the filelist */ static void -file_changed_callback(mpdclient_t *c, int event, gpointer data) +file_changed_callback(mpdclient_t *c, mpd_unused int event, + mpd_unused gpointer data) { D("screen_file.c> filelist_callback() [%d]\n", event); filelist = mpdclient_filelist_update(c, filelist); @@ -194,8 +196,8 @@ browse_lw_callback(unsigned idx, int *highlight, void *data) /* chdir */ static int -change_directory(screen_t *screen, mpdclient_t *c, filelist_entry_t *entry, - const char *new_path) +change_directory(mpd_unused screen_t *screen, mpdclient_t *c, + filelist_entry_t *entry, const char *new_path) { mpd_InfoEntity *entity = NULL; gchar *path = NULL; @@ -240,7 +242,8 @@ change_directory(screen_t *screen, mpdclient_t *c, filelist_entry_t *entry, } static int -load_playlist(screen_t *screen, mpdclient_t *c, filelist_entry_t *entry) +load_playlist(mpd_unused screen_t *screen, mpdclient_t *c, + filelist_entry_t *entry) { mpd_InfoEntity *entity = entry->entity; mpd_PlaylistFile *plf = entity->info.playlistFile; @@ -313,7 +316,8 @@ handle_delete(screen_t *screen, mpdclient_t *c) } static int -enqueue_and_play(screen_t *screen, mpdclient_t *c, filelist_entry_t *entry) +enqueue_and_play(mpd_unused screen_t *screen, mpdclient_t *c, + filelist_entry_t *entry) { int idx; mpd_InfoEntity *entity = entry->entity; @@ -483,7 +487,7 @@ browse_handle_select(screen_t *screen, int browse_handle_select_all (screen_t *screen, mpdclient_t *c, - list_window_t *local_lw, + mpd_unused list_window_t *local_lw, mpdclient_filelist_t *fl) { filelist_entry_t *entry; @@ -578,7 +582,7 @@ browse_exit(void) } static void -browse_open(screen_t *screen, mpdclient_t *c) +browse_open(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c) { if( filelist == NULL ) { filelist = mpdclient_filelist_get(c, ""); @@ -615,7 +619,7 @@ browse_title(char *str, size_t size) } static void -browse_paint(screen_t *screen, mpdclient_t *c) +browse_paint(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c) { lw->clear = 1; diff --git a/src/screen_help.c b/src/screen_help.c index 681bc6c..d225b3d 100644 --- a/src/screen_help.c +++ b/src/screen_help.c @@ -24,6 +24,7 @@ #include "command.h" #include "screen.h" #include "screen_utils.h" +#include "gcc.h" #include #include @@ -147,7 +148,7 @@ static list_window_t *lw = NULL; static const char * -list_callback(unsigned idx, int *highlight, void *data) +list_callback(unsigned idx, int *highlight, mpd_unused void *data) { static char buf[512]; @@ -212,13 +213,13 @@ help_exit(void) static const char * -help_title(char *str, size_t size) +help_title(mpd_unused char *str, mpd_unused size_t size) { return _("Help"); } static void -help_paint(screen_t *screen, mpdclient_t *c) +help_paint(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c) { lw->clear = 1; list_window_paint(lw, list_callback, NULL); @@ -226,7 +227,7 @@ help_paint(screen_t *screen, mpdclient_t *c) } static void -help_update(screen_t *screen, mpdclient_t *c) +help_update(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c) { if (lw->repaint) { list_window_paint(lw, list_callback, NULL); @@ -237,7 +238,7 @@ help_update(screen_t *screen, mpdclient_t *c) static int -help_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) +help_cmd(screen_t *screen, mpd_unused mpdclient_t *c, command_t cmd) { lw->repaint=1; lw->clear=1; diff --git a/src/screen_keydef.c b/src/screen_keydef.c index 54a2349..44c84ca 100644 --- a/src/screen_keydef.c +++ b/src/screen_keydef.c @@ -28,6 +28,7 @@ #include "command.h" #include "screen.h" #include "screen_utils.h" +#include "gcc.h" #include #include @@ -183,7 +184,7 @@ assign_new_key(WINDOW *w, int cmd_index, int key_index) } static const char * -list_callback(unsigned idx, int *highlight, void *data) +list_callback(unsigned idx, int *highlight, mpd_unused void *data) { static char buf[BUFSIZE]; @@ -241,7 +242,7 @@ keydef_exit(void) } static void -keydef_open(screen_t *screen, mpdclient_t *c) +keydef_open(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c) { if( cmds == NULL ) { @@ -286,7 +287,7 @@ keydef_title(char *str, size_t size) } static void -keydef_paint(screen_t *screen, mpdclient_t *c) +keydef_paint(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c) { lw->clear = 1; list_window_paint(lw, list_callback, NULL); @@ -294,7 +295,7 @@ keydef_paint(screen_t *screen, mpdclient_t *c) } static void -keydef_update(screen_t *screen, mpdclient_t *c) +keydef_update(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c) { if( lw->repaint ) { @@ -305,7 +306,7 @@ keydef_update(screen_t *screen, mpdclient_t *c) } static int -keydef_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) +keydef_cmd(screen_t *screen, mpd_unused mpdclient_t *c, command_t cmd) { int length = LIST_LENGTH(); diff --git a/src/screen_lyrics.c b/src/screen_lyrics.c index fb45fd4..5932969 100644 --- a/src/screen_lyrics.c +++ b/src/screen_lyrics.c @@ -31,6 +31,7 @@ #include "easy_download.h" #include "strfsong.h" #include "src_lyrics.h" +#include "gcc.h" #define _GNU_SOURCE #include @@ -152,7 +153,7 @@ static gpointer get_lyr(void *c) } static const char * -list_callback(unsigned idx, int *highlight, void *data) +list_callback(unsigned idx, int *highlight, mpd_unused void *data) { static char buf[512]; @@ -205,7 +206,7 @@ lyrics_exit(void) static const char * -lyrics_title(char *str, size_t size) +lyrics_title(mpd_unused char *str, mpd_unused size_t size) { static GString *msg; if (msg == NULL) @@ -244,7 +245,7 @@ lyrics_title(char *str, size_t size) } static void -lyrics_paint(screen_t *screen, mpdclient_t *c) +lyrics_paint(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c) { lw->clear = 1; list_window_paint(lw, list_callback, NULL); @@ -253,7 +254,7 @@ lyrics_paint(screen_t *screen, mpdclient_t *c) static void -lyrics_update(screen_t *screen, mpdclient_t *c) +lyrics_update(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c) { if( lw->repaint ) { list_window_paint(lw, list_callback, NULL); diff --git a/src/screen_play.c b/src/screen_play.c index 6b68568..2f9e6eb 100644 --- a/src/screen_play.c +++ b/src/screen_play.c @@ -31,6 +31,7 @@ #include "screen.h" #include "screen_utils.h" #include "screen_play.h" +#include "gcc.h" #include #include @@ -92,7 +93,7 @@ list_callback(unsigned idx, int *highlight, void *data) } static int -center_playing_item(screen_t *screen, mpdclient_t *c) +center_playing_item(mpdclient_t *c) { unsigned length = c->playlist.length; unsigned offset = lw->selected - lw->start; @@ -123,7 +124,7 @@ center_playing_item(screen_t *screen, mpdclient_t *c) } static void -save_pre_completion_cb(GCompletion *gcmp, gchar *line, void *data) +save_pre_completion_cb(GCompletion *gcmp, mpd_unused gchar *line, void *data) { completion_callback_data_t *tmp = (completion_callback_data_t *)data; GList **list = tmp->list; @@ -137,8 +138,8 @@ save_pre_completion_cb(GCompletion *gcmp, gchar *line, void *data) } static void -save_post_completion_cb(GCompletion *gcmp, gchar *line, GList *items, - void *data) +save_post_completion_cb(mpd_unused GCompletion *gcmp, mpd_unused gchar *line, + GList *items, void *data) { completion_callback_data_t *tmp = (completion_callback_data_t *)data; screen_t *screen = tmp->screen; @@ -336,7 +337,7 @@ play_init(WINDOW *w, int cols, int rows) } static void -play_open(screen_t *screen, mpdclient_t *c) +play_open(mpd_unused screen_t *screen, mpdclient_t *c) { static gboolean install_cb = TRUE; @@ -371,7 +372,7 @@ play_title(char *str, size_t size) } static void -play_paint(screen_t *screen, mpdclient_t *c) +play_paint(mpd_unused screen_t *screen, mpdclient_t *c) { lw->clear = 1; @@ -395,7 +396,7 @@ play_update(screen_t *screen, mpdclient_t *c) static int prev_song_id = 0; if( c->song && prev_song_id != c->song->id ) { - center_playing_item(screen, c); + center_playing_item(c); prev_song_id = c->song->id; } } @@ -417,7 +418,7 @@ play_update(screen_t *screen, mpdclient_t *c) #ifdef HAVE_GETMOUSE static int -handle_mouse_event(screen_t *screen, mpdclient_t *c) +handle_mouse_event(mpd_unused screen_t *screen, mpdclient_t *c) { int row; unsigned selected; @@ -473,7 +474,7 @@ play_cmd(screen_t *screen, mpdclient_t *c, command_t cmd) screen->painted = 0; lw->clear = 1; lw->repaint = 1; - center_playing_item(screen, c); + center_playing_item(c); return 1; case CMD_LIST_MOVE_UP: mpdclient_cmd_move(c, lw->selected, lw->selected-1); diff --git a/src/screen_search.c b/src/screen_search.c index 2161b79..9ec189d 100644 --- a/src/screen_search.c +++ b/src/screen_search.c @@ -31,6 +31,7 @@ #include "utils.h" #include "screen_utils.h" #include "screen_browse.h" +#include "gcc.h" #include #include @@ -116,7 +117,8 @@ static gboolean advanced_search_mode = FALSE; /* search info */ static const char * -lw_search_help_callback(unsigned idx, int *highlight, void *data) +lw_search_help_callback(unsigned idx, mpd_unused int *highlight, + mpd_unused void *data) { unsigned text_rows; static const char *text[] = { @@ -143,7 +145,7 @@ lw_search_help_callback(unsigned idx, int *highlight, void *data) /* the playlist have been updated -> fix highlights */ static void -playlist_changed_callback(mpdclient_t *c, int event, gpointer data) +playlist_changed_callback(mpdclient_t *c, int event, mpd_unused gpointer data) { if( filelist==NULL ) return; @@ -174,7 +176,8 @@ search_check_mode(void) } static void -search_clear(screen_t *screen, mpdclient_t *c, gboolean clear_pattern) +search_clear(mpd_unused screen_t *screen, mpdclient_t *c, + gboolean clear_pattern) { if( filelist ) { @@ -190,7 +193,7 @@ 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, +filelist_search(mpdclient_t *c, mpd_unused int exact_match, int table, gchar *local_pattern) { mpdclient_filelist_t *list, *list2; @@ -380,7 +383,7 @@ quit(void) } static void -open(screen_t *screen, mpdclient_t *c) +open(mpd_unused screen_t *screen, mpd_unused mpdclient_t *c) { // if( pattern==NULL ) // search_new(screen, c); @@ -403,7 +406,7 @@ close(void) } static void -paint(screen_t *screen, mpdclient_t *c) +paint(mpd_unused screen_t *screen, mpdclient_t *c) { lw->clear = 1; -- 2.30.2