From fa519319f3c31f7ca63740c953c35dd4dc9e4b4a Mon Sep 17 00:00:00 2001 From: Alexey Yakovenko Date: Sun, 3 Jan 2010 18:34:13 +0100 Subject: compiler warning cleanup --- cdumb.c | 6 +++--- cgme.c | 2 ++ conf.c | 1 - configure.ac | 3 ++- junklib.c | 8 ++++---- playlist.c | 4 ++-- plugins/alsa/alsa.c | 19 +------------------ plugins/cdda/cdda.c | 14 -------------- plugins/flac/flac.c | 6 ++++-- plugins/gtkui/callbacks.c | 10 +++++----- plugins/gtkui/gtkplaylist.c | 1 - plugins/lastfm/lastfm.c | 2 +- plugins/mpgmad/mpgmad.c | 23 +++++++++++++---------- plugins/sndfile/sndfile.c | 2 +- plugins/vfs_curl/vfs_curl.c | 11 ++++++----- plugins/vorbis/vorbis.c | 2 +- session.c | 2 ++ streamer.c | 8 +++----- 18 files changed, 50 insertions(+), 74 deletions(-) diff --git a/cdumb.c b/cdumb.c index d01f4441..549063ad 100644 --- a/cdumb.c +++ b/cdumb.c @@ -193,7 +193,7 @@ static DUH * open_module(const char *fname, const char *ext, int *start_order, i *is_it = 0; *is_dos = 1; - char ptr[2000]; + uint8_t ptr[2000]; DB_FILE *fp = deadbeef->fopen (fname); if (!fp) { return NULL; @@ -722,9 +722,9 @@ static const char *convstr (const char* str, int sz) { } const char *enc = "iso8859-1"; +#if 0 int latin = 0; int rus = 0; -#if 0 for (int i = 0; i < sz; i++) { if ((str[i] >= 'A' && str[i] <= 'Z') || str[i] >= 'a' && str[i] <= 'z') { @@ -750,7 +750,7 @@ static const char *convstr (const char* str, int sz) { char *pin = (char*)str; char *pout = out; memset (out, 0, sizeof (out)); - size_t res = iconv (cd, &pin, &inbytesleft, &pout, &outbytesleft); + /*size_t res = */iconv (cd, &pin, &inbytesleft, &pout, &outbytesleft); iconv_close (cd); } return out; diff --git a/cgme.c b/cgme.c index 18c51ae4..26e2e027 100644 --- a/cgme.c +++ b/cgme.c @@ -184,6 +184,7 @@ static const char * exts[]= "ay","gbs","gym","hes","kss","nsf","nsfe","sap","spc","vgm","vgz",NULL }; +#if 0 static int cgme_numvoices (void) { if (!emu) { @@ -200,6 +201,7 @@ cgme_mutevoice (int voice, int mute) { gme_mute_voices (emu, cgme_voicemask); } } +#endif // define plugin interface static DB_decoder_t plugin = { diff --git a/conf.c b/conf.c index ae3b760f..34026763 100644 --- a/conf.c +++ b/conf.c @@ -35,7 +35,6 @@ conf_load (void) { return -1; } int line = 0; - DB_conf_item_t *tail = NULL; while (fgets (str, 1024, fp) != NULL) { line++; if (str[0] == '#' || str[0] <= 0x20) { diff --git a/configure.ac b/configure.ac index ef425eb7..eb34044b 100644 --- a/configure.ac +++ b/configure.ac @@ -35,7 +35,8 @@ esac test "x$prefix" = xNONE && prefix=$ac_default_prefix -INSANE_CFLAGS="-Wcomment -Wchar-subscripts -Wunused-function -Wunused-variable -Wunused-value -Wuninitialized -Wfloat-equal -Wundef -Wtype-limits -Wbad-function-cast -Wcast-qual -Wwrite-strings" +INSANE_CFLAGS="-Wcomment -Wchar-subscripts -Wunused-function -Wunused-value -Wuninitialized -Wtype-limits -Wbad-function-cast" + CFLAGS="$CFLAGS $INSANE_CFLAGS -D_GNU_SOURCE -DLIBDIR=\\\"$libdir\\\" -DPREFIX=\\\"$prefix\\\"" PKG_CHECK_MODULES(DEPS, samplerate) diff --git a/junklib.c b/junklib.c index f952a7bf..41c21399 100644 --- a/junklib.c +++ b/junklib.c @@ -301,7 +301,7 @@ convstr_id3v2_2to3 (const unsigned char* str, int sz) { char *pin = (char*)str; char *pout = out; memset (out, 0, sizeof (out)); - size_t res = iconv (cd, &pin, &inbytesleft, &pout, &outbytesleft); + /*size_t res = */iconv (cd, &pin, &inbytesleft, &pout, &outbytesleft); iconv_close (cd); ret = out; } @@ -355,7 +355,7 @@ convstr_id3v2_4 (const unsigned char* str, int sz) { char *pin = (char*)str; char *pout = out; memset (out, 0, sizeof (out)); - size_t res = iconv (cd, &pin, &inbytesleft, &pout, &outbytesleft); + /*size_t res = */iconv (cd, &pin, &inbytesleft, &pout, &outbytesleft); iconv_close (cd); ret = out; } @@ -408,7 +408,7 @@ convstr_id3v1 (const char* str, int sz) { char *pin = (char*)str; char *pout = out; memset (out, 0, sizeof (out)); - size_t res = iconv (cd, &pin, &inbytesleft, &pout, &outbytesleft); + /*size_t res = */iconv (cd, &pin, &inbytesleft, &pout, &outbytesleft); iconv_close (cd); } return out; @@ -447,7 +447,7 @@ junk_read_id3v1 (playItem_t *it, DB_FILE *fp) { char comment[31]; uint8_t genreid; uint8_t tracknum; - const char *genre; + const char *genre = NULL; memset (title, 0, 31); memset (artist, 0, 31); memset (album, 0, 31); diff --git a/playlist.c b/playlist.c index f424ec20..40b43c0d 100644 --- a/playlist.c +++ b/playlist.c @@ -1078,7 +1078,7 @@ pl_randomsong (void) { if (!cnt) { return -1; } - int r = (float)rand () / RAND_MAX * cnt; + int r = rand () / (float)RAND_MAX * cnt; streamer_set_nextsong (r, 1); return 0; } @@ -1638,7 +1638,6 @@ pl_format_duration (playItem_t *it, const char *ret, char *dur, int size) { int pl_format_title (playItem_t *it, char *s, int size, int id, const char *fmt) { char dur[50]; - char ftrk[50]; const char *artist = NULL; const char *album = NULL; const char *track = NULL; @@ -1679,6 +1678,7 @@ pl_format_title (playItem_t *it, char *s, int size, int id, const char *fmt) { track = pl_get_meta_cached (it, "track", track, ""); text = track; #if 0 // kept for tracing purposes + char ftrk[50]; if (isdigit (track[0])) { snprintf (ftrk, sizeof (ftrk), "%03d (%s)", atoi (track), track); text = ftrk; diff --git a/plugins/alsa/alsa.c b/plugins/alsa/alsa.c index 9be03fe8..2a5b9b2c 100644 --- a/plugins/alsa/alsa.c +++ b/plugins/alsa/alsa.c @@ -60,12 +60,6 @@ palsa_play (void); static int palsa_stop (void); -static int -palsa_isstopped (void); - -static int -palsa_ispaused (void); - static int palsa_pause (void); @@ -372,17 +366,6 @@ palsa_stop (void) { return 0; } -int -palsa_isstopped (void) { - return (state == 0); -} - -int -palsa_ispaused (void) { - // return pause state - return (state == 2); -} - int palsa_pause (void) { if (state == 0 || !audio) { @@ -559,7 +542,7 @@ palsa_configchanged (DB_event_t *ev, uintptr_t data) { void palsa_enum_soundcards (void (*callback)(const char *name, const char *desc, void *), void *userdata) { void **hints, **n; - char *name, *descr, *descr1, *io; + char *name, *descr, *io; const char *filter = "Output"; if (snd_device_name_hint(-1, "pcm", &hints) < 0) return; diff --git a/plugins/cdda/cdda.c b/plugins/cdda/cdda.c index 63b3edde..6137e37e 100644 --- a/plugins/cdda/cdda.c +++ b/plugins/cdda/cdda.c @@ -66,16 +66,6 @@ min (int a, int b) { return a < b ? a : b; } -static char* -trim (char* s) -{ - char *h, *t; - - for ( h = s; *h == ' ' || *h == '\t'; h++ ); - for ( t = s + strlen(s); *t == ' ' || *t == '\t'; *t = 0, t-- ); - return h; -} - static int cda_init (DB_playItem_t *it) { // trace ("CDA: initing %s\n", it->fname); @@ -122,7 +112,6 @@ cda_init (DB_playItem_t *it) { int cda_read_int16 (char *bytes, int size) { - int initsize = size; int extrasize = 0; if (tail_len > 0) @@ -298,7 +287,6 @@ cddb_thread (void *items_i) { struct cddb_thread_params *params = (struct cddb_thread_params*)items_i; DB_playItem_t **items = params->items; - DB_playItem_t *item; trace ("calling resolve_disc\n"); deadbeef->mutex_lock (mutex); @@ -349,10 +337,8 @@ static DB_playItem_t * cda_insert (DB_playItem_t *after, const char *fname) { // trace ("CDA insert: %s\n", fname); - int all = 0; int track_nr; DB_playItem_t *res; - CdIo_t *cdio; //we need its local inst const char* shortname = strrchr (fname, '/'); if (shortname) { diff --git a/plugins/flac/flac.c b/plugins/flac/flac.c index 75a8faf9..d3424831 100644 --- a/plugins/flac/flac.c +++ b/plugins/flac/flac.c @@ -69,6 +69,9 @@ FLAC__StreamDecoderReadStatus flac_read_cb (const FLAC__StreamDecoder *decoder, FLAC__StreamDecoderSeekStatus flac_seek_cb (const FLAC__StreamDecoder *decoder, FLAC__uint64 absolute_byte_offset, void *client_data) { cue_cb_data_t *cb = (cue_cb_data_t *)client_data; int r = deadbeef->fseek (cb->file, absolute_byte_offset, SEEK_SET); + if (r) { + return FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM; + } return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE; } @@ -100,7 +103,7 @@ cflac_write_callback (const FLAC__StreamDecoder *decoder, const FLAC__Frame *fra } int bitrate = -1; float sec = ((float)frame->header.blocksize / frame->header.sample_rate); - if (cb->bytesread != 0 && sec != 0) { + if (cb->bytesread != 0 && sec > 0) { bitrate = cb->bytesread / sec * 8; } cb->bytesread = 0; @@ -293,7 +296,6 @@ cflac_read_int16 (char *bytes, int size) { } } int initsize = size; - int nbytes_in = 0; do { if (remaining) { int s = size * 2; diff --git a/plugins/gtkui/callbacks.c b/plugins/gtkui/callbacks.c index e860a92f..e302169a 100644 --- a/plugins/gtkui/callbacks.c +++ b/plugins/gtkui/callbacks.c @@ -464,7 +464,7 @@ on_add_folders_activate (GtkMenuItem *menuitem, } if (response == GTK_RESPONSE_OK) { - gchar *folder = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dlg)); + //gchar *folder = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dlg)); GSList *lst = gtk_file_chooser_get_filenames (GTK_FILE_CHOOSER (dlg)); gtk_widget_destroy (dlg); if (lst) { @@ -858,7 +858,7 @@ on_playlist_load_activate (GtkMenuItem *menuitem, gchar *fname = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dlg)); gtk_widget_destroy (dlg); if (fname) { - int res = deadbeef->pl_load (fname); + /*int res = */deadbeef->pl_load (fname); g_free (fname); gtkplaylist_t *ps = &main_playlist; gtkpl_setup_scrollbar (ps); @@ -925,7 +925,7 @@ on_playlist_save_activate (GtkMenuItem *menuitem, save_playlist_as (); } else { - int res = deadbeef->pl_save (last_playlist_save_name); + /*int res = */deadbeef->pl_save (last_playlist_save_name); } } @@ -1578,9 +1578,9 @@ on_preferences_activate (GtkMenuItem *menuitem, // list of plugins GtkTreeView *tree = GTK_TREE_VIEW (lookup_widget (w, "pref_pluginlist")); - GtkCellRenderer *rend_toggle = gtk_cell_renderer_toggle_new (); GtkCellRenderer *rend_text = gtk_cell_renderer_text_new (); #if 0 + GtkCellRenderer *rend_toggle = gtk_cell_renderer_toggle_new (); GtkListStore *store = gtk_list_store_new (3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_BOOLEAN); g_signal_connect ((gpointer)rend_toggle, "toggled", G_CALLBACK (on_plugin_active_toggled), @@ -2095,7 +2095,7 @@ plugin_configure (GtkWidget *parentwin, DB_plugin_t *p) { nrows++; gtk_table_resize (GTK_TABLE (tbl), nrows, 2); GtkWidget *label; - GtkWidget *prop; + GtkWidget *prop = NULL; GtkWidget *cont = NULL; label = gtk_label_new (labeltext); if (!strcmp (type, "entry") || !strcmp (type, "password")) { diff --git a/plugins/gtkui/gtkplaylist.c b/plugins/gtkui/gtkplaylist.c index 7dd65dcb..6b303c8a 100644 --- a/plugins/gtkui/gtkplaylist.c +++ b/plugins/gtkui/gtkplaylist.c @@ -898,7 +898,6 @@ main_refresh (void) { int gtkpl_keypress (gtkplaylist_t *ps, int keyval, int state) { - GtkWidget *range = ps->scrollbar; int prev = deadbeef->pl_get_cursor (ps->iterator); int cursor = prev; if (keyval == GDK_Down) { diff --git a/plugins/lastfm/lastfm.c b/plugins/lastfm/lastfm.c index 53814817..3a8de2c0 100644 --- a/plugins/lastfm/lastfm.c +++ b/plugins/lastfm/lastfm.c @@ -57,7 +57,7 @@ lastfm_load (DB_functions_t *api) { #define MAX_REPLY 4096 static char lfm_reply[MAX_REPLY]; -static char lfm_reply_sz; +static int lfm_reply_sz; static char lfm_err[CURL_ERROR_SIZE]; static char lfm_nowplaying[2048]; // packet for nowplaying, or "" diff --git a/plugins/mpgmad/mpgmad.c b/plugins/mpgmad/mpgmad.c index 1fe58a9a..9bef2bc8 100644 --- a/plugins/mpgmad/mpgmad.c +++ b/plugins/mpgmad/mpgmad.c @@ -178,7 +178,7 @@ cmp3_scan_stream (buffer_t *buffer, int sample) { for (;;) { uint32_t hdr; uint8_t sync; - size_t pos = deadbeef->ftell (buffer->file); + //size_t pos = deadbeef->ftell (buffer->file); if (deadbeef->fread (&sync, 1, 1, buffer->file) != 1) { break; // eof } @@ -399,11 +399,13 @@ cmp3_scan_stream (buffer_t *buffer, int sample) { deadbeef->fread (&lpf, 1, 1, buffer->file); //3 floats: replay gain deadbeef->fread (buf, 1, 4, buffer->file); - float rg_peaksignalamp = extract_f32 (buf); + // float rg_peaksignalamp = extract_f32 (buf); deadbeef->fread (buf, 1, 2, buffer->file); - uint16_t rg_radio = extract_i16 (buf); + // uint16_t rg_radio = extract_i16 (buf); + deadbeef->fread (buf, 1, 2, buffer->file); - uint16_t rg_audiophile = extract_i16 (buf); + // uint16_t rg_audiophile = extract_i16 (buf); + // skip deadbeef->fseek (buffer->file, 2, SEEK_CUR); deadbeef->fread (buf, 1, 3, buffer->file); @@ -418,7 +420,8 @@ cmp3_scan_stream (buffer_t *buffer, int sample) { deadbeef->fseek (buffer->file, 2, SEEK_CUR); // musiclen deadbeef->fread (buf, 1, 4, buffer->file); - uint32_t musiclen = extract_i32 (buf); +// uint32_t musiclen = extract_i32 (buf); + trace ("lpf: %d, peaksignalamp: %f, radiogain: %d, audiophile: %d, startdelay: %d, enddelay: %d, mp3gain: %d, musiclen: %d\n", lpf, rg_peaksignalamp, rg_radio, rg_audiophile, startdelay, enddelay, mp3gain, musiclen); // skip crc //deadbeef->fseek (buffer->file, 4, SEEK_CUR); @@ -732,7 +735,7 @@ cmp3_stream_frame (void) { } int size = READBUFFER - buffer.remaining; int bytesread = 0; - char *bytes = buffer.input + buffer.remaining; + uint8_t *bytes = buffer.input + buffer.remaining; bytesread = deadbeef->fread (bytes, 1, size, buffer.file); if (!bytesread) { // add guard @@ -977,7 +980,7 @@ cmp3_insert (DB_playItem_t *after, const char *fname) { return NULL; } - const char *ftype; + const char *ftype = NULL; if (buffer.version == 1) { switch (buffer.layer) { case 1: @@ -1022,9 +1025,9 @@ cmp3_insert (DB_playItem_t *after, const char *fname) { it->fname = strdup (fname); deadbeef->rewind (fp); - int apeerr = deadbeef->junk_read_ape (it, fp); - int v2err = deadbeef->junk_read_id3v2 (it, fp); - int v1err = deadbeef->junk_read_id3v1 (it, fp); + /*int apeerr = */deadbeef->junk_read_ape (it, fp); + /*int v2err = */deadbeef->junk_read_id3v2 (it, fp); + /*int v1err = */deadbeef->junk_read_id3v1 (it, fp); deadbeef->pl_add_meta (it, "title", NULL); deadbeef->pl_set_item_duration (it, buffer.duration); it->filetype = ftype; diff --git a/plugins/sndfile/sndfile.c b/plugins/sndfile/sndfile.c index 4af7b108..99f717cc 100644 --- a/plugins/sndfile/sndfile.c +++ b/plugins/sndfile/sndfile.c @@ -113,7 +113,7 @@ sndfile_init (DB_playItem_t *it) { } // hack bitrate float sec = (float)(sfctx.endsample-sfctx.startsample) / inf.samplerate; - if (sec != 0) { + if (sec > 0) { sfctx.bitrate = fsize / sec * 8 / 1000; } else { diff --git a/plugins/vfs_curl/vfs_curl.c b/plugins/vfs_curl/vfs_curl.c index 6e1611f2..3185df67 100644 --- a/plugins/vfs_curl/vfs_curl.c +++ b/plugins/vfs_curl/vfs_curl.c @@ -273,7 +273,6 @@ http_content_header_handler (void *ptr, size_t size, size_t nmemb, void *stream) trace ("http_content_header_handler\n"); assert (stream); HTTP_FILE *fp = (HTTP_FILE *)stream; - const uint8_t c_type_str[] ="Content-Type:"; const uint8_t *p = ptr; const uint8_t *end = p + size*nmemb; uint8_t key[256]; @@ -314,10 +313,10 @@ http_content_header_handler (void *ptr, size_t size, size_t nmemb, void *stream) return size * nmemb; } -static size_t -http_curl_write_abort (void *ptr, size_t size, size_t nmemb, void *stream) { - return 0; -} +//static size_t +//http_curl_write_abort (void *ptr, size_t size, size_t nmemb, void *stream) { +// return 0; +//} static int http_curl_control (void *stream, double dltotal, double dlnow, double ultotal, double ulnow) { @@ -679,6 +678,7 @@ http_get_content_name (DB_FILE *stream) { return fp->content_name; } +#if 0 static const char * http_get_content_genre (DB_FILE *stream) { trace ("http_get_content_genre\n"); @@ -699,6 +699,7 @@ http_get_content_genre (DB_FILE *stream) { } return fp->content_genre; } +#endif static void http_stop (DB_FILE *stream) { diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c index 8973ed25..1eb3f002 100644 --- a/plugins/vorbis/vorbis.c +++ b/plugins/vorbis/vorbis.c @@ -57,7 +57,7 @@ cvorbis_fread (void *ptr, size_t size, size_t nmemb, void *datasource) { static int cvorbis_fseek (void *datasource, ogg_int64_t offset, int whence) { DB_FILE *f = (DB_FILE *)datasource; - return deadbeef->fseek (datasource, offset, whence); + return deadbeef->fseek (f, offset, whence); } static int diff --git a/session.c b/session.c index 09f11e74..58ecb6d7 100644 --- a/session.c +++ b/session.c @@ -39,6 +39,7 @@ void session_reset (void) { } +#if 0 static int write_i16_be (uint16_t val, FILE *fp) { uint8_t b; @@ -74,6 +75,7 @@ write_i32_be (uint32_t val, FILE *fp) { } return 4; } +#endif static int read_i16_be (uint16_t *pval, FILE *fp) { diff --git a/streamer.c b/streamer.c index 5bafc2cf..c6756d7f 100644 --- a/streamer.c +++ b/streamer.c @@ -690,7 +690,6 @@ streamer_read_async (char *bytes, int size) { int samplerate = decoder->info.samplerate; if (decoder->info.samplerate == p_get_rate ()) { // samplerate match - int i; if (decoder->info.channels == 2) { bytesread = decoder->read_int16 (bytes, size); apply_replay_gain_int16 (&str_streaming_song, bytes, size); @@ -704,7 +703,7 @@ streamer_read_async (char *bytes, int size) { codec_unlock (); } } - else if (src_is_valid_ratio ((double)p_get_rate ()/samplerate)) { + else if (src_is_valid_ratio (p_get_rate ()/(double)samplerate)) { // read and do SRC int nsamples = size/4; nsamples = nsamples * samplerate / p_get_rate () * 2; @@ -730,7 +729,6 @@ streamer_read_async (char *bytes, int size) { codec_unlock (); // recalculate nsamples according to how many bytes we've got if (nbytes != 0) { - int i; if (!decoder->read_float32) { nsamples = bytesread / (samplesize * nchannels) + codecleft; // convert to float @@ -770,7 +768,7 @@ streamer_read_async (char *bytes, int size) { srcdata.data_out = g_srcbuffer; srcdata.input_frames = nsamples; srcdata.output_frames = size/4; - srcdata.src_ratio = (double)p_get_rate ()/samplerate; + srcdata.src_ratio = p_get_rate ()/(double)samplerate; srcdata.end_of_input = 0; // src_set_ratio (src, srcdata.src_ratio); src_process (src, &srcdata); @@ -787,7 +785,7 @@ streamer_read_async (char *bytes, int size) { memmove (g_fbuffer, &g_fbuffer[srcdata.input_frames_used*2], codecleft * 8); } else { - fprintf (stderr, "invalid ratio! %d / %d = %f", p_get_rate (), samplerate, (float)p_get_rate ()/samplerate); + fprintf (stderr, "invalid ratio! %d / %d = %f", p_get_rate (), samplerate, p_get_rate ()/(float)samplerate); } } else { -- cgit v1.2.3