compiler fixes

* DStarRepeater/DStarRepeaterApp.cpp

    suggest explicit braces to avoid ambiguous ‘else’

 * Common/AudioCallback.h
 * Common/SoundCardController.cpp
 * Common/SoundCardController.h
 * Common/SoundCardReaderWriter.cpp

    comparison between signed and unsigned integer expressions

    backport from MMDVM-UDRC "Fix signed integer issues with compiler"
    by mcdermj

    fix issue #4
pull/6/head
Christoph Kottke 8 years ago
parent 1a6b2cb31f
commit ca7afe11bf

@ -19,7 +19,7 @@
class IAudioCallback {
public:
virtual void readCallback(const wxFloat32* input, unsigned int nSamples, int id) = 0;
virtual void writeCallback(wxFloat32* output, unsigned int& nSamples, int id) = 0;
virtual void writeCallback(wxFloat32* output, int& nSamples, int id) = 0;
private:
};

@ -591,7 +591,7 @@ void CSoundCardController::readCallback(const wxFloat32* input, unsigned int n,
#endif
}
void CSoundCardController::writeCallback(wxFloat32* output, unsigned int& n, int id)
void CSoundCardController::writeCallback(wxFloat32* output, int& n, int id)
{
if (n == 0U)
return;

@ -52,7 +52,7 @@ public:
virtual bool writeData(const unsigned char* data, unsigned int length, bool end);
virtual void readCallback(const wxFloat32* input, unsigned int n, int id);
virtual void writeCallback(wxFloat32* output, unsigned int& n, int id);
virtual void writeCallback(wxFloat32* output, int& n, int id);
private:
CSoundCardReaderWriter m_sound;

@ -730,25 +730,25 @@ void* CSoundCardWriter::Entry()
wxLogMessage(wxT("Starting ALSA writer thread"));
while (!m_killed) {
unsigned int nSamples = 2U * m_blockSize;
int nSamples = 2U * m_blockSize;
m_callback->writeCallback(m_buffer, nSamples, m_id);
if (nSamples == 0U) {
Sleep(5UL);
} else {
if (m_channels == 1U) {
for (unsigned int n = 0U; n < nSamples; n++)
for (int n = 0U; n < nSamples; n++)
m_samples[n] = short(m_buffer[n] * 32767.0F);
} else {
unsigned int i = 0U;
for (unsigned int n = 0U; n < nSamples; n++) {
int i = 0U;
for (int n = 0U; n < nSamples; n++) {
short sample = short(m_buffer[n] * 32767.0F);
m_samples[i++] = sample;
m_samples[i++] = sample; // Same value to both channels
}
}
unsigned int offset = 0U;
int offset = 0U;
snd_pcm_sframes_t ret;
while ((ret = ::snd_pcm_writei(m_handle, m_samples + offset, nSamples - offset)) != (nSamples - offset)) {
if (ret < 0) {
@ -759,7 +759,7 @@ void* CSoundCardWriter::Entry()
::snd_pcm_recover(m_handle, ret, 1);
} else {
offset += (unsigned int)ret;
offset += ret;
}
}
}

@ -503,13 +503,15 @@ void CDStarRepeaterApp::createThread()
wxLogInfo("Split, local: %s:%u, timeout: %u ms", localAddress.c_str(), localPort, timeout);
for (unsigned int i = 0U; i < transmitterNames.GetCount(); i++) {
wxString name = transmitterNames.Item(i);
if (!name.IsEmpty())
if (!name.IsEmpty()) {
wxLogInfo("\tTX %u name: %s", i + 1U, name.c_str());
}
}
for (unsigned int i = 0U; i < receiverNames.GetCount(); i++) {
wxString name = receiverNames.Item(i);
if (!name.IsEmpty())
if (!name.IsEmpty()) {
wxLogInfo("\tRX %u name: %s", i + 1U, name.c_str());
}
}
modem = new CSplitController(localAddress, localPort, transmitterNames, receiverNames, timeout);
} else if (modemType.IsSameAs("Icom Access Point/Terminal Mode")) {

Loading…
Cancel
Save

Powered by TurnKey Linux.