diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 0017e00b2..ec2ac01b5 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -1,4 +1,11 @@ April 11, 2008 +- Removed some GCC warnings. +- Fixed: MinGW doesn't have _get_pgmptr(), so it couldn't compile i_main.cpp. +- Fixed: MOD_WAVETABLE and MOD_SWSYNTH are not defined by w32api, so MinGW + failed compiling the new MIDI code. +- Fixed: LocalSndInfo and LocalSndSeq in S_Start() need to be const char + pointers, since "" is a constant. +- Fixed: parsecontext.h was missing a newline at the end of the file. - Fixed: Timidity::Channel::mono, rpn, and nrpn were not initialized. In particular, this meant that every channel was almost certainly in mono mode, which can sound pretty bad if the song isn't meant to be played that way. diff --git a/src/parsecontext.h b/src/parsecontext.h index 21fcddf70..020fc7e03 100644 --- a/src/parsecontext.h +++ b/src/parsecontext.h @@ -150,4 +150,4 @@ struct FParseContext }; -#endif \ No newline at end of file +#endif diff --git a/src/s_sound.cpp b/src/s_sound.cpp index 65710560a..2db4688f8 100644 --- a/src/s_sound.cpp +++ b/src/s_sound.cpp @@ -359,8 +359,8 @@ void S_Start () // Check for local sound definitions. Only reload if they differ // from the previous ones. - char *LocalSndInfo; - char *LocalSndSeq; + const char *LocalSndInfo; + const char *LocalSndSeq; // To be certain better check whether level is valid! if (level.info && level.info->soundinfo) diff --git a/src/sound/i_musicinterns.h b/src/sound/i_musicinterns.h index ea84c29df..2a3b24c11 100644 --- a/src/sound/i_musicinterns.h +++ b/src/sound/i_musicinterns.h @@ -89,6 +89,12 @@ typedef BYTE *LPSTR; #define MEVT_EVENTPARM(x) ((x) & 0xffffff) #define MOM_DONE 969 +#else +// w32api does not define these +#ifndef MOD_WAVETABLE +#define MOD_WAVETABLE 6 +#define MOD_SWSYNTH 7 +#endif #endif class MIDIDevice diff --git a/src/sound/music_midi_base.cpp b/src/sound/music_midi_base.cpp index 5313aaa82..d7983a70f 100644 --- a/src/sound/music_midi_base.cpp +++ b/src/sound/music_midi_base.cpp @@ -123,10 +123,8 @@ static void PrintMidiDevice (int id, const char *name, WORD tech, DWORD support) case MOD_SQSYNTH: Printf ("SQSYNTH"); break; case MOD_FMSYNTH: Printf ("FMSYNTH"); break; case MOD_MAPPER: Printf ("MAPPER"); break; -#ifdef MOD_WAVETABLE case MOD_WAVETABLE: Printf ("WAVETABLE"); break; case MOD_SWSYNTH: Printf ("SWSYNTH"); break; -#endif } if (support & MIDICAPS_CACHE) { @@ -154,8 +152,8 @@ CCMD (snd_listmididevices) MMRESULT res; PrintMidiDevice (-3, "Emulated OPL FM Synth", MOD_FMSYNTH, 0); - PrintMidiDevice (-2, "TiMidity++", 0, MOD_WAVETABLE | MOD_SWSYNTH); - PrintMidiDevice (-1, "FMOD", 0, MOD_WAVETABLE | MOD_SWSYNTH); + PrintMidiDevice (-2, "TiMidity++", 0, MOD_SWSYNTH); + PrintMidiDevice (-1, "FMOD", 0, MOD_SWSYNTH); if (nummididevices != 0) { for (id = 0; id < nummididevices; ++id) diff --git a/src/sound/music_midi_midiout.cpp b/src/sound/music_midi_midiout.cpp index 95a797192..71e6899e4 100644 --- a/src/sound/music_midi_midiout.cpp +++ b/src/sound/music_midi_midiout.cpp @@ -784,6 +784,7 @@ void MIDISong2::Precache() BYTE ev, data1, data2, command, channel; int len; + data2 = 0; // Silence, GCC while (track->TrackP < track->MaxTrackP) { ev = track->TrackBegin[track->TrackP++]; diff --git a/src/timidity/instrum.cpp b/src/timidity/instrum.cpp index 6eedac7a5..700ae7b7e 100644 --- a/src/timidity/instrum.cpp +++ b/src/timidity/instrum.cpp @@ -278,6 +278,8 @@ static InstrumentLayer *load_instrument(Renderer *song, const char *name, int fo * THEN, for each sample, see below */ + vlayer_count = 0; // Silence, GCC + if (!memcmp(tmp + 93, "SF2EXT", 6)) { sf2flag = true; @@ -318,7 +320,8 @@ static InstrumentLayer *load_instrument(Renderer *song, const char *name, int fo vlayer_count = 1; } - lastlp = 0; + lastlp = NULL; + headlp = NULL; // Silence, GCC for (vlayer = 0; vlayer < vlayer_count; vlayer++) { @@ -375,6 +378,10 @@ static InstrumentLayer *load_instrument(Renderer *song, const char *name, int fo { sample_count = ip->right_samples; } + else + { + sample_count = 0; + } for (i = 0; i < sample_count; i++) { @@ -453,6 +460,11 @@ fail: { sp = &(ip->right_sample[i]); } + else + { + assert(0); + sp = NULL; + } READ_LONG(sp->data_length); READ_LONG(sp->loop_start); @@ -544,6 +556,9 @@ fail: else { skip(fp, 36); + sample_volume = 0; + sf2delay = 0; + } /* Mark this as a fixed-pitch instrument if such a deed is desired. */ @@ -729,7 +744,7 @@ fail: void convert_sample_data(Sample *sp, const void *data) { /* convert everything to 32-bit floating point data */ - sample_t *newdata; + sample_t *newdata = NULL; switch (sp->modes & (MODES_16BIT | MODES_UNSIGNED)) { @@ -895,7 +910,7 @@ static int fill_bank(Renderer *song, int dr, int b) { cmsg(CMSG_ERROR, VERB_NORMAL, "Couldn't load instrument %s (%s %d, program %d)", - bank->tone[i].name, + bank->tone[i].name.GetChars(), (dr)? "drum set" : "tone bank", b, i); errors++; } diff --git a/src/timidity/instrum_dls.cpp b/src/timidity/instrum_dls.cpp index 9987d05d1..5828b806e 100644 --- a/src/timidity/instrum_dls.cpp +++ b/src/timidity/instrum_dls.cpp @@ -1063,7 +1063,7 @@ void Timidity_FreeDLS(DLS_Data *patches) /* convert timecents to sec */ static double to_msec(int timecent) { - if (timecent == 0x80000000 || timecent == 0) + if (timecent == INT_MIN || timecent == 0) return 0.0; return 1000.0 * pow(2.0, (double)(timecent / 65536) / 1200.0); } @@ -1209,7 +1209,7 @@ InstrumentLayer *load_instrument_dls(Renderer *song, int drum, int bank, int ins { InstrumentLayer *layer; DWORD i; - DLS_Instrument *dls_ins; + DLS_Instrument *dls_ins = NULL; if (song->patches == NULL) return NULL; @@ -1217,16 +1217,16 @@ InstrumentLayer *load_instrument_dls(Renderer *song, int drum, int bank, int ins drum = drum ? 0x80000000 : 0; for (i = 0; i < song->patches->cInstruments; ++i) { dls_ins = &song->patches->instruments[i]; - if ((dls_ins->header->Locale.ulBank & 0x80000000) == drum && - ((dls_ins->header->Locale.ulBank >> 8) & 0xFF) == bank && - dls_ins->header->Locale.ulInstrument == instrument) + if ((dls_ins->header->Locale.ulBank & 0x80000000) == (ULONG)drum && + ((dls_ins->header->Locale.ulBank >> 8) & 0xFF) == (ULONG)bank && + dls_ins->header->Locale.ulInstrument == (ULONG)instrument) break; } if (i == song->patches->cInstruments && !bank) { for (i = 0; i < song->patches->cInstruments; ++i) { dls_ins = &song->patches->instruments[i]; - if ((dls_ins->header->Locale.ulBank & 0x80000000) == drum && - dls_ins->header->Locale.ulInstrument == instrument) + if ((dls_ins->header->Locale.ulBank & 0x80000000) == (ULONG)drum && + dls_ins->header->Locale.ulInstrument == (ULONG)instrument) break; } } diff --git a/src/timidity/playmidi.cpp b/src/timidity/playmidi.cpp index f622019a6..2b6d7ed58 100644 --- a/src/timidity/playmidi.cpp +++ b/src/timidity/playmidi.cpp @@ -28,8 +28,6 @@ #include "timidity.h" -#pragma intrinsic(pow) - namespace Timidity { diff --git a/src/win32/i_main.cpp b/src/win32/i_main.cpp index 67673ed39..b1ccaef8b 100644 --- a/src/win32/i_main.cpp +++ b/src/win32/i_main.cpp @@ -825,10 +825,18 @@ void DoMain (HINSTANCE hInstance) // Figure out what directory the program resides in. char *program; +#ifdef _MSC_VER if (_get_pgmptr(&program) != 0) { I_FatalError("Could not determine program location."); } +#else + char progbuff[1024]; + GetModuleFileName(0, progbuff, sizeof(progbuff)); + progbuff[1023] = '\0'; + program = progbuff; +#endif + progdir = program; program = progdir.LockBuffer(); *(strrchr(program, '\\') + 1) = '\0';