OSDN Git Service

Fixed the compile warnings with the recent gcc.
authorTakashi Iwai <tiwai@suse.de>
Tue, 17 Feb 2004 16:02:20 +0000 (16:02 +0000)
committerTakashi Iwai <tiwai@suse.de>
Tue, 17 Feb 2004 16:02:20 +0000 (16:02 +0000)
28 files changed:
ChangeLog
interface/alsaseq_c.c
interface/gtk_i.c
interface/ncurs_c.c
interface/soundspec.c
interface/tk_c.c
interface/x_wrdwindow.c
libunimod/mloader.c
timidity/aiff_a.c
timidity/alsa_a.c
timidity/common.c
timidity/effect.c
timidity/freq.c
timidity/instrum.c
timidity/jack_a.c
timidity/mfi.c
timidity/mix.c
timidity/mod2midi.c
timidity/oss_a.c
timidity/playmidi.c
timidity/rcp.c
timidity/readmidi.c
timidity/resample.c
timidity/reverb.c
timidity/smplfile.c
timidity/tables.c
timidity/timidity.c
timidity/vorbis_a.c

index 8f8a81d..90f6dc3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2004-02-17  Takashi Iwai <tiwai@suse.de>
+
+       * interface/alsaseq_c.c,gtk_i.c,ncurs_c.c,soundspec.c,tk_c.c,
+         x_wrdwindow.c, libunimod/mloader.c, timidity/aiff_a.c,alsa_a.c,
+         common.c,effect.c,freq.c,instrum.c,jack_a.c,mfi.c,mix.c,
+         mod2midi.c,oss_a.c,playmidi.c,rcp.c,readmidi.c,resample.c,
+         reverb.c,smplfile.c,tables.c,timidity.c,vorbis_a.c:
+         Fix compile warnings with the recent gcc.
+
 2004-02-17  Kouji 'kekyo' Suzuki <k@kekyo.net>
 
        * configs/msc7-project.zip:
index 69c16fe..8ab5845 100644 (file)
@@ -64,6 +64,8 @@
 #include "timer.h"
 
 
+void readmidi_read_init(void);
+
 #define MAX_PORTS      16
 
 #define TICKTIME_HZ    100
@@ -144,7 +146,7 @@ static int alsa_create_port(snd_seq_t *seq, int index)
 static void alsa_set_timestamping(struct seq_context *ctxp, int port)
 {
 #if HAVE_SND_SEQ_PORT_INFO_SET_TIMESTAMPING
-       int q;
+       int q = 0;
        snd_seq_port_info_t *pinfo;
 
        if (ctxp->queue < 0) {
@@ -743,8 +745,8 @@ static int do_sequencer(struct seq_context *ctxp)
                if (parse_sysex_event(aevp->data.ext.ptr + 1,
                                 aevp->data.ext.len - 1, &ev))
                        seq_play_event(&ev);
-               if (ne = parse_sysex_event_multi(aevp->data.ext.ptr + 1,
-                               aevp->data.ext.len - 1, evm))
+               if ((ne = parse_sysex_event_multi(aevp->data.ext.ptr + 1,
+                                                 aevp->data.ext.len - 1, evm)) > 0)
                        for (i = 0; i < ne; i++)
                                seq_play_event(&evm[i]);
                break;
index 1768a72..aefb99b 100644 (file)
@@ -209,7 +209,8 @@ file_list_cb(GtkWidget *widget, gint row, gint column,
 static void
 playlist_cb(GtkWidget *widget, guint data)
 {
-    gchar      *pldir, *plpatt;
+    const gchar        *pldir;
+    gchar      *plpatt;
 
     if( ! plfilesel ) {
        plfilesel = gtk_file_selection_new("");
@@ -708,7 +709,6 @@ handle_input(gpointer client_data, gint source, GdkInputCondition ic)
        {
            char filename[255], title[255];
            char *pc;
-           int i;
 
            gtk_pipe_string_read(filename);
 
index bb48673..a04818b 100644 (file)
@@ -1423,7 +1423,7 @@ static void ctl_temper_keysig(int8 tk, int ko)
                lastoffset = ko;
        if (ctl_ncurs_mode != NCURS_MODE_TRACE)
                return;
-       adj = tk + 8 & 0x20, tk = (tk + 8) % 32 - 8;
+       adj = (tk + 8) & 0x20, tk = (tk + 8) % 32 - 8;
        i = tk + ((tk < 8) ? 7 : -6);
        if (ko > 0)
                for (j = 0; j < ko; j++)
index cdaf1d9..2f0032f 100644 (file)
@@ -213,6 +213,7 @@ static long search_near_color(Display *disp, int r, int g, int b)
     return k;
 }
 
+#if 0
 static int highbit(unsigned long ul)
 {
     int i;  unsigned long hb;
@@ -221,6 +222,7 @@ static int highbit(unsigned long ul)
        ;
     return i;
 }
+#endif
 
 static unsigned long AllocRGBColor(
        Display *disp,
index 205eda7..2b746d9 100644 (file)
@@ -880,15 +880,15 @@ static int AppInit(Tcl_Interp *interp)
                return TCL_ERROR;
        }
 
-       Tcl_CreateCommand(interp, "TraceCreate", TraceCreate,
+       Tcl_CreateCommand(interp, "TraceCreate", (Tcl_CmdProc*) TraceCreate,
                          (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
-       Tcl_CreateCommand(interp, "TraceUpdate", TraceUpdate,
+       Tcl_CreateCommand(interp, "TraceUpdate", (Tcl_CmdProc*) TraceUpdate,
                          (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
-       Tcl_CreateCommand(interp, "TraceReset", TraceReset,
+       Tcl_CreateCommand(interp, "TraceReset", (Tcl_CmdProc*) TraceReset,
                          (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
-       Tcl_CreateCommand(interp, "ExitAll", ExitAll,
+       Tcl_CreateCommand(interp, "ExitAll", (Tcl_CmdProc*) ExitAll,
                          (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
-       Tcl_CreateCommand(interp, "TraceUpdate", TraceUpdate,
+       Tcl_CreateCommand(interp, "TraceUpdate", (Tcl_CmdProc*) TraceUpdate,
                          (ClientData)NULL, (Tcl_CmdDeleteProc*)NULL);
        return TCL_OK;
 }
@@ -901,6 +901,7 @@ static int ExitAll(ClientData clientData, Tcl_Interp *interp,
        kill(getppid(), SIGTERM);
        for (;;)
                sleep(1000);
+       return TCL_OK;
 }
 
 /* evaluate Tcl script */
@@ -915,7 +916,7 @@ static char *v_eval(char *fmt, ...)
        return my_interp->result;
 }
 
-static char *v_get2(char *v1, char *v2)
+static const char *v_get2(const char *v1, const char *v2)
 {
        return Tcl_GetVar2(my_interp, v1, v2, 0);
 }
@@ -1112,7 +1113,7 @@ static void update_notes(void)
 static int TraceUpdate(ClientData clientData, Tcl_Interp *interp,
                    int argc, char *argv[])
 {
-       char *playing = v_get2("Stat", "Playing");
+       const char *playing = v_get2("Stat", "Playing");
        if (playing && *playing != '0') {
                if (Panel->reset_panel) {
                        v_eval("TraceReset");
index 025ccbc..f64990c 100644 (file)
@@ -563,7 +563,7 @@ static int RedrawText(Drawable drawable, int x,int y,int width,int height)
            }else if(prevattr&CATTR_BGCOLORED){
              int tcol;
              tcol=(prevattr&CATTR_TXTCOL_MASK)>>CATTR_TXTCOL_MASK_SHIFT;
-             DrawStringFunc=(DrawStringFunc==XDrawString)?DrawReverseString:DrawReverseString16;
+             DrawStringFunc=(DrawStringFunc==XDrawString)?(int(*)())DrawReverseString:(int(*)())DrawReverseString16;
              XSetForeground(mywin.d,mywin.gc,
                             mywin.txtcolor[tcol].pixel);
            }
index 0be90d1..25e8e3f 100644 (file)
@@ -88,7 +88,9 @@ typedef struct ITPACK
   }
 ITPACK;
 
+#ifdef MAX_SAMPLESPACE
 static void SL_HalveSample (SAMPLOAD *);
+#endif
 static void SL_Sample8to16 (SAMPLOAD *);
 static void SL_Sample16to8 (SAMPLOAD *);
 static void SL_SampleSigned (SAMPLOAD *);
@@ -539,6 +541,7 @@ FreeSampleList ()
 }
 
 /* Returns the total amount of memory required by the musiclist queue. */
+#ifdef MAX_SAMPLESPACE
 static ULONG 
 SampleTotal ()
 {
@@ -564,6 +567,7 @@ RealSpeed (SAMPLOAD * s)
 {
   return (s->sample->speed / (s->scalefactor ? s->scalefactor : 1));
 }
+#endif
 
 BOOL 
 SL_LoadSamples (void)
@@ -671,6 +675,7 @@ SL_SampleUnsigned (SAMPLOAD * s)
   s->sample->flags = (s->sample->flags & ~SF_FORMATMASK) | s->outfmt;
 }
 
+#ifdef MAX_SAMPLESPACE
 void 
 SL_HalveSample (SAMPLOAD * s)
 {
@@ -680,6 +685,7 @@ SL_HalveSample (SAMPLOAD * s)
   s->sample->loopstart = s->loopstart / s->scalefactor;
   s->sample->loopend = s->loopend / s->scalefactor;
 }
+#endif
 
 
 CHAR *
index b2a94af..9bf3d6d 100644 (file)
@@ -205,7 +205,7 @@ static int update_header(void)
 static int aiff_output_open(const char *fname)
 {
   int t, compressed;
-  const char *compressionName;
+  const char *compressionName = "";
   char compressionNamePad;
   uint8 compressionNameLength;
 
index e6cf103..863f178 100644 (file)
@@ -120,7 +120,6 @@ static int output_counter;
 #if ALSA_LIB > 5
 static char *alsa_device_name(void)
 {
-  static char name[32];
   if (dpm.name && *dpm.name)
     return dpm.name;
   else
@@ -291,7 +290,7 @@ static int open_output(void)
   int orig_rate = dpm.rate;
   int ret_val = 0;
   int tmp, frags, r, pfds;
-  int buf_time, rate;
+  int rate;
   snd_pcm_hw_params_t *pinfo;
   snd_pcm_sw_params_t *swpinfo;
 
@@ -571,7 +570,6 @@ static int output_data(char *buf, int32 nbytes)
 
 static int acntl(int request, void *arg)
 {
-  int i;
   snd_pcm_status_t *status;
   snd_pcm_sframes_t delay;
 
index a984815..271217e 100644 (file)
@@ -268,7 +268,7 @@ struct timidity_file *try_to_open(char *name, int decompress)
     if(decompress)
     {
        static char *decompressor_list[] = DECOMPRESSOR_LIST, **dec;
-       char tmp[1024], *tmpname;
+       char tmp[1024];
 
        /* Check if it's a compressed file */
        for(dec = decompressor_list; *dec; dec += 2)
@@ -299,7 +299,7 @@ struct timidity_file *try_to_open(char *name, int decompress)
     if(decompress == 2)
     {
        static char *decompressor_list[] = PATCH_CONVERTERS, **dec;
-       char tmp[1024], *tmpname;
+       char tmp[1024];
 
        /* Check if it's a compressed file */
        for(dec = decompressor_list; *dec; dec += 2)
index b70eded..f5e38d7 100644 (file)
@@ -256,7 +256,7 @@ void do_effect(int32 *buf, int32 count)
                do_mono_reverb(buf, count);
        /* for static reverb / chorus level */
        if (opt_reverb_control == 2 || opt_reverb_control == 4
-                       || opt_reverb_control < 0 && ! (opt_reverb_control & 0x80)
+                       || (opt_reverb_control < 0 && ! (opt_reverb_control & 0x80))
                        || opt_chorus_control < 0) {
                set_dry_signal(buf, nsamples);
                /* chorus sounds horrible
@@ -267,7 +267,7 @@ void do_effect(int32 *buf, int32 count)
                        set_ch_chorus(buf, nsamples, -opt_chorus_control);
 #endif
                if (opt_reverb_control == 2 || opt_reverb_control == 4
-                       || opt_reverb_control < 0 && ! (opt_reverb_control & 0x80))
+                       || (opt_reverb_control < 0 && ! (opt_reverb_control & 0x80)))
                        set_ch_reverb(buf, nsamples, reverb_level);
                mix_dry_signal(buf, nsamples);
                        /* chorus sounds horrible
@@ -278,7 +278,7 @@ void do_effect(int32 *buf, int32 count)
                        do_ch_chorus(buf, nsamples);
 #endif
                if (opt_reverb_control == 2 || opt_reverb_control == 4
-                               || opt_reverb_control < 0 && ! (opt_reverb_control & 0x80))
+                               || (opt_reverb_control < 0 && ! (opt_reverb_control & 0x80)))
                        do_ch_reverb(buf, nsamples);
        }
        /* L/R Delay */
index 005d709..f947078 100644 (file)
@@ -166,10 +166,10 @@ float pitch_freq_lb_table[129] = {
    (f)ifth,            rotate back 1,  rotate back 2
 */
 int chord_table[4][3][3] = {
-    0, 4, 7,     -5, 0, 4,     -8, -5, 0,
-    0, 3, 7,     -5, 0, 3,     -9, -5, 0,
-    0, 3, 6,     -6, 0, 3,     -9, -6, 0,
-    0, 5, 7,     -5, 0, 5,     -7, -5, 0
+    {{ 0, 4, 7 },     { -5, 0, 4 },     { -8, -5, 0 }},
+    {{ 0, 3, 7 },     { -5, 0, 3 },     { -9, -5, 0 }},
+    {{ 0, 3, 6 },     { -6, 0, 3 },     { -9, -6, 0 }},
+    {{ 0, 5, 7 },     { -5, 0, 5 },     { -7, -5, 0 }}
 };
 
 
index 2a33c62..ef16597 100644 (file)
@@ -335,10 +335,12 @@ static int32 to_rate(int rate)
                        * 44100 / play_mode->rate * control_ratio) << fast_decay : 0;
 }
 
+#if 0
 static int32 to_control(int control)
 {
        return (int32) (0x2000 / pow(2.0, control / 31.0));
 }
+#endif
 
 static void apply_bank_parameter(Instrument *ip, ToneBankElement *tone)
 {
index 0de96d3..9697731 100644 (file)
@@ -47,6 +47,9 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 #ifndef NO_STRING_H /* for memmove */
 #include <string.h>
@@ -454,7 +457,7 @@ static int write_jack(char *buf, int32 nbytes)
                        ctx->running = 1;
                        nframes -= size1;
                        if (! nframes)
-                               return;
+                               return 0;
                        buf += size1 << ctx->shift;
                        size -= size1;
                }
index 2fa7d09..8170cce 100755 (executable)
@@ -296,7 +296,6 @@ char *get_mfi_file_title(timidity_file *tf)
        int                             length, dataLength, infoLength, dataType;
        uint32                  type;
        uint8                   numTracks;
-       int                             i;
        
        if (tf_read_beint32(&dataLength, tf) != 1
                        || tf_read_beint16(&infoLength, tf) != 1
@@ -430,7 +429,6 @@ static int read_mfi_track(int trackNo, int length, int mfiVersion, int noteType,
                        }
                        else
                                StoreLastNoteInfo(lastNotes, channel, pos, data[2], note, velocity);
-                       silent: ;
                        NOTE_EVENT_DEBUGSTR(channel, note_name[note % 12], note / 12, velocity, data[2]);
                }
                else    /* controls */
index c5acc9f..8803284 100644 (file)
@@ -1550,7 +1550,7 @@ static inline int next_stage(int v)
        offset = vp->sample->envelope_offset[stage];
        rate = vp->sample->envelope_rate[stage];
        if (vp->envelope_volume == offset
-                       || stage > EG_GUS_SUSTAIN && vp->envelope_volume < offset)
+                       || (stage > EG_GUS_SUSTAIN && vp->envelope_volume < offset))
                return recompute_envelope(v);
        ch = vp->channel;
        /* there is some difference between GUS patch and Soundfont at envelope. */
index f4967dd..edd7cde 100644 (file)
@@ -569,7 +569,7 @@ void shrink_huge_sample (Sample *sp)
 
 void load_module_samples (SAMPLE * s, int numsamples, int ntsc)
 {
-    int i, j;
+    int i;
 
     for(i = 1; numsamples--; i++, s++)
     {
index d7a0174..f135296 100644 (file)
@@ -269,8 +269,8 @@ static int output_data(char *buf, int32 nbytes)
        if((n = write(dpm.fd, buf, nbytes)) == -1)
        {
 #if 0
-           if(errno != ???) /* I don't know what error should be ignored.
-                             * ??? := EWOULDBLOCK??
+           if(errno != XXX) /* I don't know what error should be ignored.
+                             * XXX := EWOULDBLOCK??
                              */
            {
                usleep(100000);
index 5c34a31..2a7ae9d 100644 (file)
@@ -1002,9 +1002,10 @@ static void recompute_amp(int v)
         * so that it must be reduced in advance.
         */
        if (! (play_mode->encoding & PE_MONO)
-                       && (opt_reverb_control || opt_chorus_control || opt_delay_control
-                       || opt_eq_control && (eq_status_gs.low_gain != 0x40
-                       || eq_status_gs.high_gain != 0x40) || opt_insertion_effect))
+           && (opt_reverb_control || opt_chorus_control || opt_delay_control
+               || (opt_eq_control && (eq_status_gs.low_gain != 0x40
+                                      || eq_status_gs.high_gain != 0x40))
+               || opt_insertion_effect))
                tempamp *= 1.35f * 0.55f;
        else
                tempamp *= 1.35f;
@@ -2082,9 +2083,9 @@ static double get_play_note_ratio(int ch, int note)
        if ((def_play_note = dbank->tone[note].play_note) == -1)
                return 1.0;
        if (play_note >= def_play_note)
-               return bend_coarse[play_note - def_play_note & 0x7f];
+               return bend_coarse[(play_note - def_play_note) & 0x7f];
        else
-               return 1 / bend_coarse[def_play_note - play_note & 0x7f];
+               return 1 / bend_coarse[(def_play_note - play_note) & 0x7f];
 }
 
 /* Only one instance of a note can be playing on a single channel. */
@@ -2107,13 +2108,14 @@ static int find_voice(MidiEvent *e)
                }
        for (i = 0; i < upper_voices; i++)
                if (voice[i].status != VOICE_FREE && voice[i].channel == ch) {
-                       if (voice[i].note == note && voice[i].status & status_check
-                                       || mono_check
-                                       || altassign && find_altassign(altassign, voice[i].note))
+                       if ((voice[i].note == note && (voice[i].status & status_check))
+                           || mono_check
+                           || (altassign && find_altassign(altassign, voice[i].note)))
                                kill_note(i);
-                       else if (voice[i].note == note && (channel[ch].assign_mode == 0
-                                       || channel[ch].assign_mode == 1
-                                       && voice[i].proximate_flag == 0))
+                       else if (voice[i].note == note &&
+                                (channel[ch].assign_mode == 0
+                                 || (channel[ch].assign_mode == 1
+                                     && voice[i].proximate_flag == 0)))
                                kill_note(i);
                }
        for (i = 0; i < upper_voices; i++)
@@ -2281,7 +2283,6 @@ static void init_voice_portamento(int v)
 static void init_voice_tremolo(int v)
 {
        Voice *vp = &(voice[v]);
-       int ch = vp->channel;
 
   vp->tremolo_delay = vp->sample->tremolo_delay;
   vp->tremolo_phase = 0;
@@ -2433,6 +2434,7 @@ static void set_envelope_time(int ch, int val, int stage)
 }
 
 /*! pseudo Delay Effect without DSP */
+#ifndef USE_DSP_EFFECT
 static void new_delay_voice(int v1, int level)
 {
     int v2, ch = voice[v1].channel;
@@ -2550,6 +2552,8 @@ static void new_chorus_voice(int v1, int level)
      */
     recompute_freq(v2);
 }
+#endif /* !USE_DSP_EFFECT */
+
 
 /* Yet another chorus implementation
  *     by Eric A. Welsh <ewelsh@gpc.wustl.edu>.
@@ -3108,6 +3112,7 @@ int get_chorus_level(int ch)
     return -opt_chorus_control;
 }
 
+#ifndef USE_DSP_EFFECT
 static void make_rvid(void)
 {
     int i, j, lv, maxrv;
@@ -3139,6 +3144,7 @@ static void make_rvid(void)
        }
     }
 }
+#endif /* !USE_DSP_EFFECT */
 
 void free_drum_effect(int ch)
 {
@@ -5234,7 +5240,7 @@ static void seek_forward(int32 until_time)
 
        case ME_TEMPER_KEYSIG:
                current_temper_keysig = (current_event->a + 8) % 32 - 8;
-               temper_adj = (current_event->a + 8 & 0x20) ? 1 : 0;
+               temper_adj = ((current_event->a + 8) & 0x20) ? 1 : 0;
                break;
 
        case ME_TEMPER_TYPE:
@@ -5944,7 +5950,7 @@ static void do_compute_data_midi(int32 count)
        /* are effects valid? / don't supported in mono */
        channel_reverb = (stereo && (opt_reverb_control == 1
                        || opt_reverb_control == 3
-                       || opt_reverb_control < 0 && opt_reverb_control & 0x80));
+                       || (opt_reverb_control < 0 && opt_reverb_control & 0x80)));
        channel_chorus = (stereo && opt_chorus_control);
        channel_delay = (stereo && opt_delay_control > 0);
 
@@ -7253,7 +7259,7 @@ int play_event(MidiEvent *ev)
 
        case ME_TEMPER_KEYSIG:
                current_temper_keysig = (current_event->a + 8) % 32 - 8;
-               temper_adj = (current_event->a + 8 & 0x20) ? 1 : 0;
+               temper_adj = ((current_event->a + 8) & 0x20) ? 1 : 0;
                ctl_mode_event(CTLE_TEMPER_KEYSIG, 1, current_event->a, 0);
                i = current_temper_keysig + ((current_temper_keysig < 8) ? 7 : -9);
                j = 0;
@@ -8202,10 +8208,12 @@ static void set_rx(int ch, int32 rx, int flag)
        else {channel[ch].rx &= ~rx;}
 }
 
+#if 0
 static int32 get_rx(int ch, int32 rx)
 {
        return (channel[ch].rx & rx);
 }
+#endif
 
 static void init_rx_drum(struct DrumParts *p)
 {
index 8745b4e..bbc1a0a 100644 (file)
@@ -459,7 +459,7 @@ static int rcp_parse_sysex_event(int32 at, uint8 *val, int32 len)
        ev.time = at;
        readmidi_add_event(&ev);
     }
-       if (ne = parse_sysex_event_multi(val, len, evm))
+       if ((ne = parse_sysex_event_multi(val, len, evm)) > 0)
                for (i = 0; i < ne; i++) {
                        evm[i].time = at;
                        readmidi_add_event(&evm[i]);
index 77165d5..a4434eb 100644 (file)
@@ -599,7 +599,7 @@ static int set_xg_reverb_type(int msb, int lsb)
            (msb >= 0x14))                      /* NO EFFECT */
        {
                ctl->cmsg(CMSG_INFO,VERB_NOISY,"XG Set Reverb Type (NO EFFECT %d %d)", msb, lsb);
-               return;
+               return -1;
        }
 
        switch(msb)
@@ -653,7 +653,7 @@ static int set_xg_chorus_type(int msb, int lsb)
            (msb >= 0x49))                      /* NO EFFECT */
        {
                ctl->cmsg(CMSG_INFO,VERB_NOISY,"XG Set Chorus Type (NO EFFECT %d %d)", msb, lsb);
-               return;
+               return -1;
        }
 
        switch(msb)
@@ -774,8 +774,10 @@ int parse_sysex_event_multi(uint8 *val, int32 len, MidiEvent *evm)
                case 0x01:      /* Reverb Type LSB */
                    xg_reverb_type_lsb = *body;
                        v = set_xg_reverb_type(xg_reverb_type_msb, xg_reverb_type_lsb);
-                       SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_GS_LSB, p, v, 0x05);
-                       num_events++;
+                       if (v >= 0) {
+                           SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_GS_LSB, p, v, 0x05);
+                           num_events++;
+                       }
                    break;
 
                case 0x20:      /* Chorus Type MSB */
@@ -785,8 +787,10 @@ int parse_sysex_event_multi(uint8 *val, int32 len, MidiEvent *evm)
                case 0x21:      /* Chorus Type LSB */
                    xg_chorus_type_lsb = *body;
                        v = set_xg_chorus_type(xg_chorus_type_msb, xg_chorus_type_lsb);
-                       SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_GS_LSB, p, v, 0x0D);
-                       num_events++;
+                       if (v >= 0) {
+                           SETMIDIEVENT(evm[num_events], 0, ME_SYSEX_GS_LSB, p, v, 0x0D);
+                           num_events++;
+                       }
                    break;
 
                case 0x0C:      /* Reverb Return */
@@ -5189,7 +5193,7 @@ static void insert_note_steps(void)
 {
        MidiEventList *e;
        int32 i, n, at, lasttime, meas, beat;
-       uint8 num, denom, a, b;
+       uint8 num = 0, denom = 1, a, b;
        
        e = evlist;
        for (i = n = 0; i < event_count - 1 && n < 256 - 1; i++, e = e->next)
@@ -5221,7 +5225,7 @@ static void insert_note_steps(void)
                        num = timesig[n].a, denom = timesig[n].b, n++;
                }
                a = meas & 0xff;
-               b = (meas >> 8 & 0x0f) + (beat + 1 << 4);
+               b = ((meas >> 8) & 0x0f) + ((beat + 1) << 4);
                MIDIEVENT(at, ME_NOTE_STEP, 0, a, b);
                if (++beat == num)
                        meas++, beat = 0;
@@ -6144,7 +6148,7 @@ void recompute_delay_status_gs(void)
        p->feedback_ratio = (double)(p->feedback - 64) * (0.763f * 2.0f / 100.0f);
        p->send_reverb_ratio = (double)p->send_reverb * (0.787f / 100.0f);
 
-       if(p->level_left != 0 || p->level_right != 0 && p->type == 0) {
+       if(p->level_left != 0 || (p->level_right != 0 && p->type == 0)) {
                p->type = 1;    /* it needs 3-tap delay effect. */
        }
 
index 5a5bf80..0f1d6e9 100644 (file)
@@ -234,7 +234,7 @@ static int newt_n = 11;
 static int32 newt_old_trunc_x = -1;
 static int newt_grow = -1;
 static int newt_max = 13;
-static double newt_divd[60][60] = {0};
+static double newt_divd[60][60];
 static double newt_recip[60] = { 0, 1, 1.0/2, 1.0/3, 1.0/4, 1.0/5, 1.0/6, 1.0/7,
                        1.0/8, 1.0/9, 1.0/10, 1.0/11, 1.0/12, 1.0/13, 1.0/14,
                        1.0/15, 1.0/16, 1.0/17, 1.0/18, 1.0/19, 1.0/20, 1.0/21,
index d92f6fb..d70d1d8 100644 (file)
@@ -251,6 +251,7 @@ inline int32 do_lfo(lfo *lfo)
        return val;
 }
 
+#if 0
 /*! modulated delay with allpass interpolation (for Chorus Effect,...) */
 static void free_mod_delay(mod_delay *delay)
 {
@@ -274,6 +275,7 @@ static void set_mod_delay(mod_delay *delay, int32 ndelay, int32 depth)
        delay->size = size;
        memset(delay->buf, 0, sizeof(int32) * delay->size);
 }
+#endif
 
 #define do_mod_delay(_stream, _buf, _size, _rindex, _windex, _ndelay, _depth, _lfoval, _hist) \
 { \
@@ -1684,7 +1686,7 @@ void init_reverb(void)
        /* Old non-freeverb must be initialized for mono reverb not to crash */
        if (! (play_mode->encoding & PE_MONO)
                        && (opt_reverb_control == 3 || opt_reverb_control == 4
-                       || opt_reverb_control < 0 && ! (opt_reverb_control & 0x100))) {
+                       || (opt_reverb_control < 0 && ! (opt_reverb_control & 0x100)))) {
                switch(reverb_status.character) {       /* select reverb algorithm */
                case 5: /* Plate Reverb */
                        do_ch_plate_reverb(NULL, MAGIC_INIT_EFFECT_INFO, &(reverb_status.info_plate_reverb));
@@ -1715,11 +1717,11 @@ void do_ch_reverb(int32 *buf, int32 count)
 {
 #ifdef SYS_EFFECT_PRE_LPF
        if ((opt_reverb_control == 3 || opt_reverb_control == 4
-                       || opt_reverb_control < 0 && ! (opt_reverb_control & 0x100)) && reverb_status.pre_lpf)
+                       || (opt_reverb_control < 0 && ! (opt_reverb_control & 0x100))) && reverb_status.pre_lpf)
                do_filter_lowpass1_stereo(reverb_effect_buffer, count, &(reverb_status.lpf));
 #endif /* SYS_EFFECT_PRE_LPF */
        if (opt_reverb_control == 3 || opt_reverb_control == 4
-                       || opt_reverb_control < 0 && ! (opt_reverb_control & 0x100)) {
+                       || (opt_reverb_control < 0 && ! (opt_reverb_control & 0x100))) {
                switch(reverb_status.character) {       /* select reverb algorithm */
                case 5: /* Plate Reverb */
                        do_ch_plate_reverb(buf, count, &(reverb_status.info_plate_reverb));
@@ -1767,7 +1769,7 @@ void do_ch_delay(int32 *buf, int32 count)
 {
 #ifdef SYS_EFFECT_PRE_LPF
        if ((opt_reverb_control == 3 || opt_reverb_control == 4
-                       || opt_reverb_control < 0 && ! (opt_reverb_control & 0x100)) && delay_status.pre_lpf)
+                       || (opt_reverb_control < 0 && ! (opt_reverb_control & 0x100))) && delay_status.pre_lpf)
                do_filter_lowpass1_stereo(delay_effect_buffer, count, &(delay_status.lpf));
 #endif /* SYS_EFFECT_PRE_LPF */
        switch (delay_status.type) {
@@ -2168,7 +2170,7 @@ void do_ch_chorus(int32 *buf, int32 count)
 {
 #ifdef SYS_EFFECT_PRE_LPF
        if ((opt_reverb_control == 3 || opt_reverb_control == 4
-                       || opt_reverb_control < 0 && ! (opt_reverb_control & 0x100)) && chorus_param.chorus_pre_lpf)
+                       || (opt_reverb_control < 0 && ! (opt_reverb_control & 0x100))) && chorus_param.chorus_pre_lpf)
                do_filter_lowpass1_stereo(chorus_effect_buffer, count, &(chorus_param.lpf));
 #endif /* SYS_EFFECT_PRE_LPF */
 
index 5a7bee6..1440642 100755 (executable)
@@ -950,7 +950,7 @@ static int AIFFGetMarkerPosition(int16 id, const AIFFMarkerData *markers, uint32
 
 #define BLOCK_READ_BEGIN(stype, sbyte, fch)    { /* sbyte may sizeof(stype) */ \
                        stype                           data[WAVE_BUF_SIZE / sizeof(stype)];    \
-                       int                                     j, c;   \
+                       int                                     j;      \
                        for(block_frame_count = (sizeof data / sbyte / fch); block_frame_count != 0; block_frame_count >>= 1) { \
                                while(i <= frames - block_frame_count) {        \
                                        READ_WAVE_FRAME(data, sbyte, block_frame_count);        \
@@ -982,6 +982,7 @@ static int read_sample_data(int32 flags, struct timidity_file *tf, int bits, int
                        if (flags & SAMPLE_BIG_ENDIAN) {
                                BLOCK_READ_BEGIN(uint16, 2, channels)
                                {
+                                       int c;
                                        for(c = 0; c < channels; c++, j++)
                                                sdata[c][i] = BE_SHORT(data[j]);
                                }
@@ -989,6 +990,7 @@ static int read_sample_data(int32 flags, struct timidity_file *tf, int bits, int
                        } else {
                                BLOCK_READ_BEGIN(uint16, 2, channels)
                                {
+                                       int c;
                                        for(c = 0; c < channels; c++, j++)
                                                sdata[c][i] = LE_SHORT(data[j]);
                                }
@@ -1017,6 +1019,7 @@ static int read_sample_data(int32 flags, struct timidity_file *tf, int bits, int
                        if (flags & SAMPLE_8BIT_UNSIGNED) {
                                BLOCK_READ_BEGIN(uint8, 1, channels)
                                {
+                                       int c;
                                        for(c = 0; c < channels; c++, j++)
                                                sdata[c][i] = BITS_U8_TO_16(data[j]);
                                }
@@ -1024,6 +1027,7 @@ static int read_sample_data(int32 flags, struct timidity_file *tf, int bits, int
                        } else {
                                BLOCK_READ_BEGIN(uint8, 1, channels)
                                {
+                                       int c;
                                        for(c = 0; c < channels; c++, j++)
                                                sdata[c][i] = BITS_S8_TO_16(data[j]);
                                }
index ed28f01..4cfb4e2 100644 (file)
@@ -492,10 +492,8 @@ int8 *iplookup;
 
 void init_tables(void)
 {
-  int i;
-
 #ifdef LOOKUP_HACK
-  int j,v;
+  int i,j,v;
   mixup = (int32 *)safe_malloc(1<<(7+8+2)); /* Give your cache a workout! */
 
   for (i=0; i<128; i++)
index 7f2e04e..0c36375 100644 (file)
@@ -604,7 +604,7 @@ static float *config_parse_tune(const char *cp, int *num)
        
        /* count num */
        *num = 1, p = cp;
-       while (p = strchr(p, ','))
+       while ((p = strchr(p, ',')) != NULL)
                (*num)++, p++;
        /* alloc */
        tune_list = (float *) safe_malloc((*num) * sizeof(float));
@@ -625,7 +625,7 @@ static int16 *config_parse_int16(const char *cp, int *num)
        
        /* count num */
        *num = 1, p = cp;
-       while (p = strchr(p, ','))
+       while ((p = strchr(p, ',')) != NULL)
                (*num)++, p++;
        /* alloc */
        list = (int16 *) safe_malloc((*num) * sizeof(int16));
@@ -646,7 +646,7 @@ static int **config_parse_envelope(const char *cp, int *num)
        
        /* count num */
        *num = 1, p = cp;
-       while (p = strchr(p, ','))
+       while ((p = strchr(p, ',')) != NULL)
                (*num)++, p++;
        /* alloc */
        env_list = (int **) safe_malloc((*num) * sizeof(int *));
@@ -688,7 +688,7 @@ static Quantity **config_parse_modulation(const char *name, int line, const char
        
        /* count num */
        *num = 1, p = cp;
-       while (p = strchr(p, ','))
+       while ((p = strchr(p, ',')) != NULL)
                (*num)++, p++;
        /* alloc */
        mod_list = (Quantity **) safe_malloc((*num) * sizeof(Quantity *));
@@ -1096,7 +1096,7 @@ MAIN_INTERFACE int read_config_file(char *name, int self)
     ToneBank *bank = NULL;
     int i, j, k, line = 0, words, errcnt = 0;
     static int rcf_count = 0;
-    int dr = 0, bankno = 0, mapid = INST_NO_MAP, origbankno;
+    int dr = 0, bankno = 0, mapid = INST_NO_MAP, origbankno = 0;
     int extension_flag, param_parse_err;
 
     if(rcf_count > 50)
@@ -2740,7 +2740,7 @@ static inline int parse_opt_B(const char *arg)
                        return 1;
        }
        /* bits */
-       if (p = strchr(arg, ',')) {
+       if ((p = strchr(arg, ',')) != NULL) {
                if (set_value(&audio_buffer_bits, atoi(++p), 1, AUDIO_BUFFER_BITS,
                                "Buffer Fragments (bit)"))
                        return 1;
@@ -3016,7 +3016,7 @@ static inline int parse_opt_default_program(const char *arg)
        
        if (set_value(&prog, atoi(arg), 0, 0x7f, "Program number"))
                return 1;
-       if (p = strchr(arg, '/')) {
+       if ((p = strchr(arg, '/')) != NULL) {
                if (set_value(&i, atoi(++p), 1, MAX_CHANNELS, "Program channel"))
                        return 1;
                default_program[i - 1] = prog;
@@ -3036,7 +3036,7 @@ static inline int parse_opt_force_program(const char *arg)
                return 1;
        if (ctl->opened)
                set_default_program(def_prog);
-       if (p = strchr(arg, '/')) {
+       if ((p = strchr(arg, '/')) != NULL) {
                if (set_value(&i, atoi(++p), 1, MAX_CHANNELS, "Program channel"))
                        return 1;
                default_program[i - 1] = SPECIAL_PROGRAM;
@@ -3078,7 +3078,7 @@ static inline int parse_opt_delay(const char *arg)
                effect_lr_mode = 2;
                break;
        }
-       if (p = strchr(arg, ','))
+       if ((p = strchr(arg, ',')) != NULL)
                if ((effect_lr_delay_msec = atoi(++p)) < 0) {
                        effect_lr_delay_msec = 0;
                        effect_lr_mode = -1;
@@ -3104,7 +3104,7 @@ static inline int parse_opt_chorus(const char *arg)
        case '2':
        case 's':       /* surround */
                opt_surround_chorus = (*arg == '2' || *arg == 's') ? 1 : 0;
-               if (p = strchr(arg, ',')) {
+               if ((p = strchr(arg, ',')) != NULL) {
                        if (set_value(&opt_chorus_control, atoi(++p), 0, 0x7f,
                                        "Chorus level"))
                                return 1;
@@ -3155,7 +3155,7 @@ static inline int parse_opt_reverb(const char *arg)
                break;
        case '1':
        case 'n':       /* normal */
-               if (p = strchr(arg, ',')) {
+               if ((p = strchr(arg, ',')) != NULL) {
                        if (set_value(&opt_reverb_control, atoi(++p), 1, 0x7f,
                                        "Reverb level"))
                                return 1;
@@ -3165,7 +3165,7 @@ static inline int parse_opt_reverb(const char *arg)
                break;
        case '2':
        case 'g':       /* global */
-               if (p = strchr(arg, ',')) {
+               if ((p = strchr(arg, ',')) != NULL) {
                        if (set_value(&opt_reverb_control, atoi(++p), 1, 0x7f,
                                        "Reverb level"))
                                return 1;
@@ -3175,7 +3175,7 @@ static inline int parse_opt_reverb(const char *arg)
                break;
        case '3':
        case 'f':       /* freeverb */
-               if (p = strchr(arg, ',')) {
+               if ((p = strchr(arg, ',')) != NULL) {
                        if (set_value(&opt_reverb_control, atoi(++p), 1, 0x7f,
                                        "Reverb level"))
                                return 1;
@@ -3185,7 +3185,7 @@ static inline int parse_opt_reverb(const char *arg)
                break;
        case '4':
        case 'G':       /* global freeverb */
-               if (p = strchr(arg, ',')) {
+               if ((p = strchr(arg, ',')) != NULL) {
                        if (set_value(&opt_reverb_control, atoi(++p), 1, 0x7f,
                                        "Reverb level"))
                                return 1;
@@ -3557,7 +3557,7 @@ static inline int parse_opt_h(const char *arg)
        help_args[0] = timidity_version;
        help_args[1] = program_name;
        help_args[2] = NULL;
-       for (i = 0, j = 0; h = help_list[i]; i++) {
+       for (i = 0, j = 0; (h = help_list[i]) != NULL; i++) {
                if (strchr(h, '%')) {
                        if (*(strchr(h, '%') + 1) != '%')
                                fprintf(fp, h, help_args[j++]);
@@ -3633,7 +3633,7 @@ static inline int parse_opt_h(const char *arg)
 #endif
        fputs(NLS, fp);
        fputs("Available interfaces (-i, --interface option):" NLS, fp);
-       for (cmpp = ctl_list; cmp = *cmpp; cmpp++)
+       for (cmpp = ctl_list; (cmp = *cmpp) != NULL; cmpp++)
 #ifdef IA_DYNAMIC
                if (cmp->id_character != dynamic_interface_id)
                        fprintf(fp, "  -i%c          %s" NLS,
@@ -3646,7 +3646,7 @@ static inline int parse_opt_h(const char *arg)
        fprintf(fp, "Supported dynamic load interfaces (%s):" NLS,
                        dynamic_lib_root);
        memset(mark, 0, sizeof(mark));
-       for (cmpp = ctl_list; cmp = *cmpp; cmpp++)
+       for (cmpp = ctl_list; (cmp = *cmpp) != NULL; cmpp++)
                mark[(int) cmp->id_character] = 1;
        if (dynamic_interface_id != 0)
                mark[(int) dynamic_interface_id] = 0;
@@ -3677,7 +3677,7 @@ static inline int parse_opt_h(const char *arg)
 #endif
        fputs(NLS, fp);
        fputs("Available output modes (-O, --output-mode option):" NLS, fp);
-       for (pmpp = play_mode_list; pmp = *pmpp; pmpp++)
+       for (pmpp = play_mode_list; (pmp = *pmpp) != NULL; pmpp++)
                fprintf(fp, "  -O%c          %s" NLS,
                                pmp->id_character, pmp->id_name);
        fputs(NLS, fp);
@@ -3708,7 +3708,7 @@ static inline int parse_opt_h(const char *arg)
 "  --[no-]output-swab" NLS, fp);
        fputs(NLS, fp);
        fputs("Available WRD interfaces (-W, --wrd option):" NLS, fp);
-       for (wlpp = wrdt_list; wlp = *wlpp; wlpp++)
+       for (wlpp = wrdt_list; (wlp = *wlpp) != NULL; wlpp++)
                fprintf(fp, "  -W%c          %s" NLS, wlp->id, wlp->name);
        fputs(NLS, fp);
        close_pager(fp);
@@ -3783,7 +3783,7 @@ static inline int parse_opt_i(const char *arg)
        ControlMode *cmp, **cmpp;
        int found = 0;
        
-       for (cmpp = ctl_list; cmp = *cmpp; cmpp++) {
+       for (cmpp = ctl_list; (cmp = *cmpp) != NULL; cmpp++) {
                if (cmp->id_character == *arg) {
                        found = 1;
                        ctl = cmp;
@@ -4003,7 +4003,7 @@ static inline int parse_opt_O(const char *arg)
        PlayMode *pmp, **pmpp;
        int found = 0;
        
-       for (pmpp = play_mode_list; pmp = *pmpp; pmpp++)
+       for (pmpp = play_mode_list; (pmp = *pmpp) != NULL; pmpp++)
                if (pmp->id_character == *arg) {
                        found = 1;
                        play_mode = pmp;
@@ -4184,7 +4184,7 @@ static inline int parse_opt_Q(const char *arg)
                return parse_opt_Q1(arg);
        if (set_channel_flag(&quietchannels, atoi(arg), "Quiet channel"))
                return 1;
-       while (p = strchr(p, ','))
+       while ((p = strchr(p, ',')) != NULL)
                if (set_channel_flag(&quietchannels, atoi(++p), "Quiet channel"))
                        return 1;
        return 0;
@@ -4199,7 +4199,7 @@ static inline int parse_opt_Q1(const char *arg)
        if (set_value(&prog, atoi(arg), 0, 7, "Temperament program number"))
                return 1;
        temper_type_mute |= 1 << prog;
-       while (p = strchr(p, ',')) {
+       while ((p = strchr(p, ',')) != NULL) {
                if (set_value(&prog, atoi(++p), 0, 7, "Temperament program number"))
                        return 1;
                temper_type_mute |= 1 << prog;
@@ -4351,7 +4351,7 @@ static inline int parse_opt_W(char *arg)
                put_string_table(&wrd_read_opts, arg + 1, strlen(arg + 1));
                return 0;
        }
-       for (wlpp = wrdt_list; wlp = *wlpp; wlpp++)
+       for (wlpp = wrdt_list; (wlp = *wlpp) != NULL; wlpp++)
                if (wlp->id == *arg) {
                        wrdt = wlp;
                        if (wrdt_open_opts)
index 26be31e..9110656 100644 (file)
@@ -35,7 +35,6 @@
 #include <stdlib.h>
 #include <io.h>
 #include <ctype.h>
-#include <time.h>
 extern int load_ogg_dll(void);
 extern void free_ogg_dll(void);
 extern int load_vorbis_dll(void);
@@ -52,6 +51,7 @@ extern void free_vorbisenc_dll(void);
 #include <string.h>
 #include <stdlib.h>
 #include <ctype.h>
+#include <time.h>
 #elif HAVE_STRINGS_H
 #include <strings.h>
 #endif