Fixed warnings in Timidity++ code emitted by XCode, except one which cannot be eliminatet without compromising the code.

This commit is contained in:
Christoph Oelckers 2018-02-23 09:07:42 +01:00
parent 6618656e7c
commit aae832386f
6 changed files with 23 additions and 33 deletions

View file

@ -40,6 +40,7 @@ protected:
public: public:
virtual ~FSoundFontReader() {}
virtual FileReader *OpenMainConfigFile() = 0; // this is special because it needs to be synthesized for .sf files and set some restrictions for patch sets virtual FileReader *OpenMainConfigFile() = 0; // this is special because it needs to be synthesized for .sf files and set some restrictions for patch sets
virtual FileReader *OpenFile(const char *name) = 0; virtual FileReader *OpenFile(const char *name) = 0;
std::pair<FileReader *, FString> LookupFile(const char *name); std::pair<FileReader *, FString> LookupFile(const char *name);
@ -96,7 +97,6 @@ class FLumpPatchSetReader : public FSoundFontReader
public: public:
FLumpPatchSetReader(const char *filename); FLumpPatchSetReader(const char *filename);
~FLumpPatchSetReader();
virtual FileReader *OpenMainConfigFile() override; virtual FileReader *OpenMainConfigFile() override;
virtual FileReader *OpenFile(const char *name) override; virtual FileReader *OpenFile(const char *name) override;
virtual FString basePath() const override virtual FString basePath() const override
@ -120,7 +120,6 @@ class FPatchSetReader : public FSoundFontReader
public: public:
FPatchSetReader(); FPatchSetReader();
FPatchSetReader(const char *filename); FPatchSetReader(const char *filename);
~FPatchSetReader();
virtual FileReader *OpenMainConfigFile() override; virtual FileReader *OpenMainConfigFile() override;
virtual FileReader *OpenFile(const char *name) override; virtual FileReader *OpenFile(const char *name) override;
virtual FString basePath() const override virtual FString basePath() const override

View file

@ -2467,8 +2467,6 @@ void Player::make_drum_effect(int ch)
struct DrumParts *drum; struct DrumParts *drum;
struct DrumPartEffect *de; struct DrumPartEffect *de;
if (channel[ch].drums == NULL) {return;}
if (channel[ch].drum_effect_flag == 0) { if (channel[ch].drum_effect_flag == 0) {
free_drum_effect(ch); free_drum_effect(ch);
memset(note_table, 0, sizeof(int8_t) * 128); memset(note_table, 0, sizeof(int8_t) * 128);
@ -4489,8 +4487,7 @@ void Player::update_rpn_map(int ch, int addr, int update_now)
} else } else
channel[ch].drums[note]->pan_random = 0; channel[ch].drums[note]->pan_random = 0;
channel[ch].drums[note]->drum_panning = val; channel[ch].drums[note]->drum_panning = val;
if (update_now && adjust_panning_immediately if (update_now && adjust_panning_immediately && ! channel[ch].pan_random)
&& ! channel[ch].pan_random)
adjust_drum_panning(ch, note); adjust_drum_panning(ch, note);
break; break;
case NRPN_ADDR_1D00: /* Reverb Send Level of Drum */ case NRPN_ADDR_1D00: /* Reverb Send Level of Drum */
@ -6123,7 +6120,7 @@ void Player::send_long_event(const uint8_t *sysexbuffer, int exlen)
MidiEvent evm[260]; MidiEvent evm[260];
SysexConvert sc; SysexConvert sc;
if ((sysexbuffer[0] != '\xf0') && (sysexbuffer[0] != '\xf7')) return; if ((sysexbuffer[0] != 0xf0) && (sysexbuffer[0] != 0xf7)) return;
if (sc.parse_sysex_event(sysexbuffer + 1, exlen - 1, &ev, instruments)) if (sc.parse_sysex_event(sysexbuffer + 1, exlen - 1, &ev, instruments))
{ {
@ -6141,7 +6138,7 @@ void Player::send_long_event(const uint8_t *sysexbuffer, int exlen)
} }
play_event(&ev); play_event(&ev);
} }
if (ne = sc.parse_sysex_event_multi(sysexbuffer + 1, exlen - 1, evm, instruments)) if ((ne = sc.parse_sysex_event_multi(sysexbuffer + 1, exlen - 1, evm, instruments)))
{ {
for (i = 0; i < ne; i++) for (i = 0; i < ne; i++)
{ {
@ -6152,4 +6149,4 @@ void Player::send_long_event(const uint8_t *sysexbuffer, int exlen)
} }

View file

@ -64,11 +64,11 @@ class Recache
struct cache_hash *cache[128]; struct cache_hash *cache[128];
}; };
CNote channel_note_table[MAX_CHANNELS] = { 0 }; CNote channel_note_table[MAX_CHANNELS];
sample_t *cache_data = NULL; sample_t *cache_data;
splen_t cache_data_len = 0; splen_t cache_data_len;
struct cache_hash *cache_hash_table[HASH_TABLE_SIZE] = { 0 }; struct cache_hash *cache_hash_table[HASH_TABLE_SIZE];
MBlockList hash_entry_pool = { nullptr, 0 }; MBlockList hash_entry_pool;
void free_cache_data(void); void free_cache_data(void);
@ -82,6 +82,7 @@ public:
Recache(Player *p) Recache(Player *p)
{ {
memset(this, 0, sizeof(*this));
player = p; player = p;
resamp_cache_reset(); resamp_cache_reset();
} }

View file

@ -1284,7 +1284,7 @@ void Reverb::do_ch_freeverb(int32_t *buf, int32_t count, InfoFreeverb *rev)
return; return;
} }
for (k = 0; k < count; k++) for (k = 0; k < count; k+=2)
{ {
input = reverb_effect_buffer[k] + reverb_effect_buffer[k + 1]; input = reverb_effect_buffer[k] + reverb_effect_buffer[k + 1];
outl = outr = reverb_effect_buffer[k] = reverb_effect_buffer[k + 1] = 0; outl = outr = reverb_effect_buffer[k] = reverb_effect_buffer[k + 1] = 0;
@ -1303,7 +1303,6 @@ void Reverb::do_ch_freeverb(int32_t *buf, int32_t count, InfoFreeverb *rev)
} }
buf[k] += imuldiv24(outl, rev->wet1i) + imuldiv24(outr, rev->wet2i); buf[k] += imuldiv24(outl, rev->wet1i) + imuldiv24(outr, rev->wet2i);
buf[k + 1] += imuldiv24(outr, rev->wet1i) + imuldiv24(outl, rev->wet2i); buf[k + 1] += imuldiv24(outr, rev->wet1i) + imuldiv24(outl, rev->wet2i);
++k;
} }
} }
@ -1500,7 +1499,7 @@ void Reverb::do_ch_plate_reverb(int32_t *buf, int32_t count, InfoPlateReverb *in
return; return;
} }
for (i = 0; i < count; i++) for (i = 0; i < count; i+=2)
{ {
outr = outl = 0; outr = outl = 0;
x = (reverb_effect_buffer[i] + reverb_effect_buffer[i + 1]) >> 1; x = (reverb_effect_buffer[i] + reverb_effect_buffer[i + 1]) >> 1;
@ -1573,8 +1572,6 @@ void Reverb::do_ch_plate_reverb(int32_t *buf, int32_t count, InfoPlateReverb *in
buf[i] += outl; buf[i] += outl;
buf[i + 1] += outr; buf[i + 1] += outr;
++i;
} }
info->t1 = t1, info->t1d = t1d; info->t1 = t1, info->t1d = t1d;
} }
@ -2266,7 +2263,7 @@ void Reverb::do_overdrive1(int32_t *buf, int32_t count, EffectList *ef)
} else if(count == MAGIC_FREE_EFFECT_INFO) { } else if(count == MAGIC_FREE_EFFECT_INFO) {
return; return;
} }
for(i = 0; i < count; i++) { for(i = 0; i < count; i+=2) {
input = (buf[i] + buf[i + 1]) >> 1; input = (buf[i] + buf[i + 1]) >> 1;
/* amp simulation */ /* amp simulation */
(this->*do_amp_sim)(&input, asdi); (this->*do_amp_sim)(&input, asdi);
@ -2281,7 +2278,6 @@ void Reverb::do_overdrive1(int32_t *buf, int32_t count, EffectList *ef)
input = imuldiv24(high + input, leveli); input = imuldiv24(high + input, leveli);
buf[i] = do_left_panning(input, pan); buf[i] = do_left_panning(input, pan);
buf[i + 1] = do_right_panning(input, pan); buf[i + 1] = do_right_panning(input, pan);
++i;
} }
} }
@ -2317,7 +2313,7 @@ void Reverb::do_distortion1(int32_t *buf, int32_t count, EffectList *ef)
} else if(count == MAGIC_FREE_EFFECT_INFO) { } else if(count == MAGIC_FREE_EFFECT_INFO) {
return; return;
} }
for(i = 0; i < count; i++) { for(i = 0; i < count; i+=2) {
input = (buf[i] + buf[i + 1]) >> 1; input = (buf[i] + buf[i + 1]) >> 1;
/* amp simulation */ /* amp simulation */
(this->*do_amp_sim)(&input, asdi); (this->*do_amp_sim)(&input, asdi);
@ -2332,7 +2328,6 @@ void Reverb::do_distortion1(int32_t *buf, int32_t count, EffectList *ef)
input = imuldiv24(high + input, leveli); input = imuldiv24(high + input, leveli);
buf[i] = do_left_panning(input, pan); buf[i] = do_left_panning(input, pan);
buf[i + 1] = do_right_panning(input, pan); buf[i + 1] = do_right_panning(input, pan);
++i;
} }
} }
@ -2504,7 +2499,7 @@ void Reverb::do_hexa_chorus(int32_t *buf, int32_t count, EffectList *ef)
spt5 = index - pdelay5 - (f5 >> 8); /* integral part of delay */ spt5 = index - pdelay5 - (f5 >> 8); /* integral part of delay */
if(spt5 < 0) {spt5 += size;} if(spt5 < 0) {spt5 += size;}
for(i = 0; i < count; i++) { for(i = 0; i < count; i+=2) {
v0 = ebuf[spt0], v1 = ebuf[spt1], v2 = ebuf[spt2], v0 = ebuf[spt0], v1 = ebuf[spt1], v2 = ebuf[spt2],
v3 = ebuf[spt3], v4 = ebuf[spt4], v5 = ebuf[spt5]; v3 = ebuf[spt3], v4 = ebuf[spt4], v5 = ebuf[spt5];
@ -2556,7 +2551,6 @@ void Reverb::do_hexa_chorus(int32_t *buf, int32_t count, EffectList *ef)
+ do_right_panning(hist4, pan4) + do_right_panning(hist5, pan5) + do_right_panning(hist4, pan4) + do_right_panning(hist5, pan5)
+ imuldiv24(buf[i + 1], dryi); + imuldiv24(buf[i + 1], dryi);
++i;
} }
buf0->size = size, buf0->index = index; buf0->size = size, buf0->index = index;
info->spt0 = spt0, info->spt1 = spt1, info->spt2 = spt2, info->spt0 = spt0, info->spt1 = spt1, info->spt2 = spt2,
@ -4434,4 +4428,4 @@ void Reverb::init_effect_status(int play_system_mode)
} }
///////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////
} }

View file

@ -257,9 +257,7 @@ int Instruments::chunkid(char *id)
{"ICMT", ICMT_ID}, {"ICMT", ICMT_ID},
}; };
int i; for (unsigned i = 0; i < sizeof(idlist) / sizeof(idlist[0]); i++) {
for (i = 0; i < sizeof(idlist) / sizeof(idlist[0]); i++) {
if (strncmp(id, idlist[i].str, 4) == 0) if (strncmp(id, idlist[i].str, 4) == 0)
return idlist[i].id; return idlist[i].id;
} }
@ -720,4 +718,4 @@ void Instruments::correct_samples(SFInfo *sf)
} }
} }
} }
} }

View file

@ -752,7 +752,7 @@ int Instruments::import_aiff_load(char *sample_file, Instrument *inst)
if (compressed) if (compressed)
{ {
READ_LONG_BE(compressionType); READ_LONG_BE(compressionType);
if (compressionType != BE_LONG(0x4E4F4E45) /* NONE */) if (compressionType != (uint32_t)BE_LONG(0x4E4F4E45) /* NONE */)
{ {
char compressionName[256]; char compressionName[256];
uint8_t compressionNameLength; uint8_t compressionNameLength;
@ -789,9 +789,10 @@ int Instruments::read_AIFFSoundDataChunk(struct timidity_file *tf, AIFFSoundData
if (mode == 0) /* read both information and data */ if (mode == 0) /* read both information and data */
return read_AIFFSoundData(tf, sound->inst, sound->common); return read_AIFFSoundData(tf, sound->inst, sound->common);
/* read information only */ /* read information only */
if ((sound->position = tf_tell(tf)) == -1) auto pos = tf_tell(tf);
if (pos == -1)
goto fail; goto fail;
sound->position += offset; sound->position = pos + offset;
csize -= 8; csize -= 8;
if (tf_seek(tf, csize, SEEK_CUR) == -1) if (tf_seek(tf, csize, SEEK_CUR) == -1)
goto fail; goto fail;