no warnings

pull/1/head
Tom Early 6 years ago
parent 1c9ee1b8c1
commit cd4df55cc5

@ -42,11 +42,6 @@ CCallsign::CCallsign(const char *sz)
::memcpy(m_Callsign, sz, MIN(strlen(sz), sizeof(m_Callsign))); ::memcpy(m_Callsign, sz, MIN(strlen(sz), sizeof(m_Callsign)));
} }
CCallsign::CCallsign(const CCallsign &callsign)
{
::memcpy(m_Callsign, callsign.m_Callsign, sizeof(m_Callsign));
}
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// status // status
@ -93,7 +88,7 @@ void CCallsign::SetCallsign(const uint8 *buffer, int len)
// set callsign // set callsign
::memset(m_Callsign, ' ', sizeof(m_Callsign)); ::memset(m_Callsign, ' ', sizeof(m_Callsign));
::memcpy(m_Callsign, buffer, MIN(len, sizeof(m_Callsign))); ::memcpy(m_Callsign, buffer, MIN(len, sizeof(m_Callsign)));
for ( int i = 0; i < sizeof(m_Callsign); i++ ) for ( unsigned i = 0; i < sizeof(m_Callsign); i++ )
{ {
if ( m_Callsign[i] == 0 ) if ( m_Callsign[i] == 0 )
{ {
@ -108,7 +103,7 @@ void CCallsign::SetCallsign(const uint8 *buffer, int len)
void CCallsign::PatchCallsign(int off, const uint8 *patch, int len) void CCallsign::PatchCallsign(int off, const uint8 *patch, int len)
{ {
if ( off < sizeof(m_Callsign) ) if ( off < int(sizeof(m_Callsign)) )
{ {
::memcpy(m_Callsign, patch, MIN(len, sizeof(m_Callsign) - off)); ::memcpy(m_Callsign, patch, MIN(len, sizeof(m_Callsign) - off));
} }
@ -125,7 +120,7 @@ void CCallsign::GetCallsign(uint8 *buffer) const
void CCallsign::GetCallsignString(char *sz) const void CCallsign::GetCallsignString(char *sz) const
{ {
int i; unsigned i;
for ( i = 0; (i < sizeof(m_Callsign)) && (m_Callsign[i] != ' '); i++ ) for ( i = 0; (i < sizeof(m_Callsign)) && (m_Callsign[i] != ' '); i++ )
{ {
sz[i] = m_Callsign[i]; sz[i] = m_Callsign[i];
@ -146,7 +141,7 @@ bool CCallsign::HasSameCallsignWithWildcard(const CCallsign &callsign) const
bool same = true; bool same = true;
bool done = false; bool done = false;
for ( int i = 0; (i < sizeof(m_Callsign)) && same && !done; i++ ) for ( unsigned i = 0; (i < sizeof(m_Callsign)) && same && !done; i++ )
{ {
if ( !(done = ((m_Callsign[i] == '*') || (callsign[i] == '*'))) ) if ( !(done = ((m_Callsign[i] == '*') || (callsign[i] == '*'))) )
{ {

@ -40,10 +40,6 @@ public:
// contructors // contructors
CCallsign(); CCallsign();
CCallsign(const char *); CCallsign(const char *);
CCallsign(const CCallsign &);
// destructor
virtual ~CCallsign() {};
// status // status
bool IsValid(void) const; bool IsValid(void) const;

@ -76,9 +76,9 @@ bool CController::Init(void)
m_bStopThread = false; m_bStopThread = false;
// create our socket // create our socket
CIp ip(strchr(straddress, ':') ? AF_INET6 : AF_INET, TRANSCODER_PORT, straddress); CIp ip(strchr(m_addr, ':') ? AF_INET6 : AF_INET, TRANSCODER_PORT, m_addr);
if (! ip.IsSet()) { if (! ip.IsSet()) {
std::cerr << "IP initialization failed for " << straddress << std::endl; std::cerr << "IP initialization failed for " << m_addr << std::endl;
return false; return false;
} }
if (! m_Socket.Open(ip)) if (! m_Socket.Open(ip))
@ -128,7 +128,7 @@ void CController::Task(void)
CStream *Stream; CStream *Stream;
// anything coming in from codec client ? // anything coming in from codec client ?
if ( m_Socket.Receive(Buffer, Ip, 20) != -1 ) if ( m_Socket.Receive(Buffer, Ip, 20) )
{ {
// crack packet // crack packet
if ( IsValidOpenstreamPacket(Buffer, &Callsign, &CodecIn, &CodecOut) ) if ( IsValidOpenstreamPacket(Buffer, &Callsign, &CodecIn, &CodecOut) )

@ -50,10 +50,10 @@ public:
void Unlock(void) { m_Mutex.unlock(); } void Unlock(void) { m_Mutex.unlock(); }
// get // get
const CIp &GetListenIp(void) const { return straddress; } const char *GetListenIp(void) const { return m_addr; }
// set // set
void SetListenIp(const char *str) { straddress = str; } void SetListenIp(const char *str) { memset(m_addr, 0, INET6_ADDRSTRLEN); strncpy(m_addr, str, INET6_ADDRSTRLEN-1); }
// streams management // streams management
CStream *OpenStream(const CCallsign &, const CIp &, uint8, uint8); CStream *OpenStream(const CCallsign &, const CIp &, uint8, uint8);
@ -81,8 +81,8 @@ protected:
protected: protected:
// control socket // control socket
const char *straddress; char m_addr[INET6_ADDRSTRLEN];
CUdpSocket m_Socket; CUdpSocket m_Socket;
// streams // streams
uint16 m_uiLastStreamId; uint16 m_uiLastStreamId;

@ -48,4 +48,3 @@ private:
}; };
#endif //cfirfilter_h #endif //cfirfilter_h

@ -31,6 +31,7 @@
class CSampleBlockProcessor class CSampleBlockProcessor
{ {
public: public:
virtual ~CSampleBlockProcessor() {}
//processing //processing
virtual void ProcessSampleBlock(uint8* voice, int length) = 0; virtual void ProcessSampleBlock(uint8* voice, int length) = 0;
}; };

@ -57,10 +57,11 @@ CSignalProcessor::CSignalProcessor(float gaindB)
CSignalProcessor::~CSignalProcessor() CSignalProcessor::~CSignalProcessor()
{ {
for(int i = 0; i < m_sampleProcessors.size(); i++) for(auto it=m_sampleProcessors.begin(); it!=m_sampleProcessors.end(); it++)
{ {
delete m_sampleProcessors[i]; delete *it;
} }
m_sampleProcessors.clear();
} }
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
@ -70,11 +71,10 @@ void CSignalProcessor::Process(uint8* voice, int length)
{ {
/*float sample; /*float sample;
int j;*/ int j;*/
auto processorsSize = m_sampleProcessors.size();
for(int j = 0; j < processorsSize; j++) for(auto it=m_sampleProcessors.begin(); it!=m_sampleProcessors.end(); it++)
{ {
m_sampleProcessors[j]->ProcessSampleBlock(voice, length); (*it)->ProcessSampleBlock(voice, length);
} }
/*for(int i = 0; i < length; i += 2) /*for(int i = 0; i < length; i += 2)

@ -42,7 +42,7 @@ public:
void Process(uint8* voice, int length); void Process(uint8* voice, int length);
private: private:
std::vector<CSampleBlockProcessor *> m_sampleProcessors; std::list<CSampleBlockProcessor *> m_sampleProcessors;
}; };
#endif /* csignalprocessor_h */ #endif /* csignalprocessor_h */

@ -79,7 +79,7 @@ CVocodecChannel *CUsb3000Interface::GetChannelWithChannelIn(int iCh)
{ {
CVocodecChannel *Channel = NULL; CVocodecChannel *Channel = NULL;
bool done = false; bool done = false;
for ( int i = 0; (i < m_Channels.size()) && !done; i++ ) for ( unsigned i = 0; (i < m_Channels.size()) && !done; i++ )
{ {
if ( iCh == 0 ) if ( iCh == 0 )
{ {
@ -97,7 +97,7 @@ CVocodecChannel *CUsb3000Interface::GetChannelWithChannelOut(int iCh)
{ {
CVocodecChannel *Channel = NULL; CVocodecChannel *Channel = NULL;
bool done = false; bool done = false;
for ( int i = 0; (i < m_Channels.size()) && !done; i++ ) for ( unsigned i = 0; (i < m_Channels.size()) && !done; i++ )
{ {
if ( (m_Channels[i]->GetChannelOut() == iCh) && (m_Channels[i]->IsInterfaceOut(this)) ) if ( (m_Channels[i]->GetChannelOut() == iCh) && (m_Channels[i]->IsInterfaceOut(this)) )
{ {

@ -42,15 +42,14 @@ CUsb3003HRInterface::CUsb3003HRInterface(uint32 uiVid, uint32 uiPid, const char
bool CUsb3003HRInterface::ResetDevice(void) bool CUsb3003HRInterface::ResetDevice(void)
{ {
bool ok = false; bool ok = false;
FT_STATUS ftStatus;
int len; int len;
char rxpacket[100]; char rxpacket[100];
//if the device is a USB-3003, it supports reset via UART break signal //if the device is a USB-3003, it supports reset via UART break signal
//printf("reset via uart break...\n"); //printf("reset via uart break...\n");
ftStatus = FT_SetBreakOn( m_FtdiHandle ); FT_SetBreakOn( m_FtdiHandle );
CTimePoint::TaskSleepFor(10); CTimePoint::TaskSleepFor(10);
ftStatus = FT_SetBreakOff( m_FtdiHandle ); FT_SetBreakOff( m_FtdiHandle );
//CTimePoint::TaskSleepFor(10); //CTimePoint::TaskSleepFor(10);
len = FTDI_read_packet( m_FtdiHandle, rxpacket, sizeof(rxpacket) ); len = FTDI_read_packet( m_FtdiHandle, rxpacket, sizeof(rxpacket) );
@ -63,4 +62,3 @@ bool CUsb3003HRInterface::ResetDevice(void)
// done // done
return ok; return ok;
} }

@ -88,7 +88,7 @@ CVocodecChannel *CUsb3003Interface::GetChannelWithChannelIn(int iCh)
{ {
CVocodecChannel *Channel = NULL; CVocodecChannel *Channel = NULL;
bool done = false; bool done = false;
for ( int i = 0; (i < m_Channels.size()) && !done; i++ ) for ( unsigned i = 0; (i < m_Channels.size()) && !done; i++ )
{ {
if ( iCh == 2 ) if ( iCh == 2 )
{ {
@ -114,7 +114,7 @@ CVocodecChannel *CUsb3003Interface::GetChannelWithChannelOut(int iCh)
{ {
CVocodecChannel *Channel = NULL; CVocodecChannel *Channel = NULL;
bool done = false; bool done = false;
for ( int i = 0; (i < m_Channels.size()) && !done; i++ ) for ( unsigned i = 0; (i < m_Channels.size()) && !done; i++ )
{ {
if ( (m_Channels[i]->GetChannelOut() == iCh) && (m_Channels[i]->IsInterfaceOut(this)) ) if ( (m_Channels[i]->GetChannelOut() == iCh) && (m_Channels[i]->IsInterfaceOut(this)) )
{ {
@ -321,4 +321,3 @@ bool CUsb3003Interface::ConfigureDevice(void)
// done // done
return ok; return ok;
} }

@ -53,14 +53,14 @@ CUsb3xxxInterface::CUsb3xxxInterface(uint32 uiVid, uint32 uiPid, const char *szD
CUsb3xxxInterface::~CUsb3xxxInterface() CUsb3xxxInterface::~CUsb3xxxInterface()
{ {
// delete m_SpeechQueues // delete m_SpeechQueues
for ( int i = 0; i < m_SpeechQueues.size(); i++ ) for ( unsigned i = 0; i < m_SpeechQueues.size(); i++ )
{ {
delete m_SpeechQueues[i]; delete m_SpeechQueues[i];
} }
m_SpeechQueues.clear(); m_SpeechQueues.clear();
// delete m_ChannelQueues // delete m_ChannelQueues
for ( int i = 0; i < m_ChannelQueues.size(); i++ ) for ( unsigned i = 0; i < m_ChannelQueues.size(); i++ )
{ {
delete m_ChannelQueues[i]; delete m_ChannelQueues[i];
} }
@ -184,7 +184,7 @@ void CUsb3xxxInterface::Task(void)
do do
{ {
done = true; done = true;
for ( int i = 0; i < m_Channels.size(); i++) for ( unsigned i = 0; i < m_Channels.size(); i++)
{ {
// get channel // get channel
Channel = m_Channels[i]; Channel = m_Channels[i];
@ -276,7 +276,7 @@ void CUsb3xxxInterface::Task(void)
// if device fifo level is zero (device idle) // if device fifo level is zero (device idle)
// wait that at least 3 packets are in incoming // wait that at least 3 packets are in incoming
// queue before restarting // queue before restarting
if ( ((m_iSpeechFifolLevel+m_iChannelFifolLevel) > 0) || (m_DeviceQueue.size() >= (fifoSize+1)) ) if ( ((m_iSpeechFifolLevel+m_iChannelFifolLevel) > 0) || (m_DeviceQueue.size() >= unsigned(fifoSize+1)) )
{ {
// any packet to send ? // any packet to send ?
if ( m_DeviceQueue.size() > 0 ) if ( m_DeviceQueue.size() > 0 )

@ -49,7 +49,7 @@ CVocodecs::~CVocodecs()
// delete channels // delete channels
m_MutexChannels.lock(); m_MutexChannels.lock();
{ {
for ( int i = 0; i < m_Channels.size(); i++ ) for ( unsigned i = 0; i < m_Channels.size(); i++ )
{ {
delete m_Channels[i]; delete m_Channels[i];
} }
@ -60,7 +60,7 @@ CVocodecs::~CVocodecs()
// delete interfaces // delete interfaces
m_MutexInterfaces.lock(); m_MutexInterfaces.lock();
{ {
for ( int i = 0; i < m_Interfaces.size(); i++ ) for ( unsigned i = 0; i < m_Interfaces.size(); i++ )
{ {
delete m_Interfaces[i]; delete m_Interfaces[i];
} }
@ -69,7 +69,7 @@ CVocodecs::~CVocodecs()
m_MutexInterfaces.unlock(); m_MutexInterfaces.unlock();
// delete ftdi device descriptors // delete ftdi device descriptors
for ( int i = 0; i < m_FtdiDeviceDescrs.size(); i++ ) for ( unsigned i = 0; i < m_FtdiDeviceDescrs.size(); i++ )
{ {
delete m_FtdiDeviceDescrs[i]; delete m_FtdiDeviceDescrs[i];
} }
@ -89,7 +89,7 @@ bool CVocodecs::Init(void)
// and create interfaces for the discovered devices // and create interfaces for the discovered devices
// first handle all even number of channels devices // first handle all even number of channels devices
std::vector<CVocodecChannel *> Multi3003DevicesChs; std::vector<CVocodecChannel *> Multi3003DevicesChs;
for ( int i = 0; i < m_FtdiDeviceDescrs.size(); i++ ) for ( unsigned i = 0; i < m_FtdiDeviceDescrs.size(); i++ )
{ {
CFtdiDeviceDescr *descr = m_FtdiDeviceDescrs[i]; CFtdiDeviceDescr *descr = m_FtdiDeviceDescrs[i];
if ( !descr->IsUsed() && IsEven(descr->GetNbChannels()) ) if ( !descr->IsUsed() && IsEven(descr->GetNbChannels()) )
@ -104,7 +104,7 @@ bool CVocodecs::Init(void)
// they must be handeled in pair, or in pair with another // they must be handeled in pair, or in pair with another
// even number of channels device. // even number of channels device.
std::vector<CVocodecChannel *> PairsOf3000DevicesChs; std::vector<CVocodecChannel *> PairsOf3000DevicesChs;
for ( int i = 0; i < m_FtdiDeviceDescrs.size(); i++ ) for ( unsigned i = 0; i < m_FtdiDeviceDescrs.size(); i++ )
{ {
CFtdiDeviceDescr *descr1 = m_FtdiDeviceDescrs[i]; CFtdiDeviceDescr *descr1 = m_FtdiDeviceDescrs[i];
CFtdiDeviceDescr *descr2 = NULL; CFtdiDeviceDescr *descr2 = NULL;
@ -112,7 +112,7 @@ bool CVocodecs::Init(void)
{ {
// any other single channel device to pair with ? // any other single channel device to pair with ?
bool found = false; bool found = false;
int j = i+1; unsigned j = i+1;
while ( !found && (j < m_FtdiDeviceDescrs.size()) ) while ( !found && (j < m_FtdiDeviceDescrs.size()) )
{ {
descr2 = m_FtdiDeviceDescrs[j]; descr2 = m_FtdiDeviceDescrs[j];
@ -133,7 +133,7 @@ bool CVocodecs::Init(void)
// now we should have only remaining the 3 channels device(s) // now we should have only remaining the 3 channels device(s)
// and possibly an unique single channel device // and possibly an unique single channel device
std::vector<CVocodecChannel *> Single3003DeviceChannels; std::vector<CVocodecChannel *> Single3003DeviceChannels;
for ( int i = 0; i < m_FtdiDeviceDescrs.size(); i++ ) for ( unsigned i = 0; i < m_FtdiDeviceDescrs.size(); i++ )
{ {
CFtdiDeviceDescr *descr1 = m_FtdiDeviceDescrs[i]; CFtdiDeviceDescr *descr1 = m_FtdiDeviceDescrs[i];
CFtdiDeviceDescr *descr2 = NULL; CFtdiDeviceDescr *descr2 = NULL;
@ -141,7 +141,7 @@ bool CVocodecs::Init(void)
{ {
// any other 3 channel device to pair with ? // any other 3 channel device to pair with ?
bool found = false; bool found = false;
int j = i+1; unsigned j = i+1;
while ( !found && (j < m_FtdiDeviceDescrs.size()) ) while ( !found && (j < m_FtdiDeviceDescrs.size()) )
{ {
descr2 = m_FtdiDeviceDescrs[j]; descr2 = m_FtdiDeviceDescrs[j];
@ -162,7 +162,7 @@ bool CVocodecs::Init(void)
// at this point we should have only remaining an unique 3 channels // at this point we should have only remaining an unique 3 channels
// and or a unique single channel // and or a unique single channel
std::vector<CVocodecChannel *> Combined3003And3000DeviceChannels; std::vector<CVocodecChannel *> Combined3003And3000DeviceChannels;
for ( int i = 0; i < m_FtdiDeviceDescrs.size(); i++ ) for ( unsigned i = 0; i < m_FtdiDeviceDescrs.size(); i++ )
{ {
CFtdiDeviceDescr *descr1 = m_FtdiDeviceDescrs[i]; CFtdiDeviceDescr *descr1 = m_FtdiDeviceDescrs[i];
CFtdiDeviceDescr *descr2 = NULL; CFtdiDeviceDescr *descr2 = NULL;
@ -171,7 +171,7 @@ bool CVocodecs::Init(void)
{ {
// any single channel device to pair with ? // any single channel device to pair with ?
bool found = false; bool found = false;
int j = 0; unsigned j = 0;
while ( !found && (j < m_FtdiDeviceDescrs.size()) ) while ( !found && (j < m_FtdiDeviceDescrs.size()) )
{ {
descr2 = m_FtdiDeviceDescrs[j]; descr2 = m_FtdiDeviceDescrs[j];
@ -202,7 +202,7 @@ bool CVocodecs::Init(void)
// for proper load sharing // for proper load sharing
// pairs of 3000 devices first // pairs of 3000 devices first
{ {
for ( int i = 0; i < PairsOf3000DevicesChs.size(); i++ ) for ( unsigned i = 0; i < PairsOf3000DevicesChs.size(); i++ )
{ {
m_Channels.push_back(PairsOf3000DevicesChs.at(i)); m_Channels.push_back(PairsOf3000DevicesChs.at(i));
} }
@ -210,7 +210,7 @@ bool CVocodecs::Init(void)
} }
// next the left-over single 3003 device // next the left-over single 3003 device
{ {
for ( int i = 0; i < Single3003DeviceChannels.size(); i++ ) for ( unsigned i = 0; i < Single3003DeviceChannels.size(); i++ )
{ {
m_Channels.push_back(Single3003DeviceChannels.at(i)); m_Channels.push_back(Single3003DeviceChannels.at(i));
} }
@ -219,10 +219,10 @@ bool CVocodecs::Init(void)
// finally interlace multi-3003 and pairs of 3003 devices which always // finally interlace multi-3003 and pairs of 3003 devices which always
// results to 6 channels per pair of 3003 // results to 6 channels per pair of 3003
{ {
int n = (int)Multi3003DevicesChs.size() / 6; unsigned n = (int)Multi3003DevicesChs.size() / 6;
for ( int i = 0; (i < 6) && (n != 0); i++ ) for ( unsigned i = 0; (i < 6) && (n != 0); i++ )
{ {
for ( int j = 0; j < n; j++ ) for ( unsigned j = 0; j < n; j++ )
{ {
m_Channels.push_back(Multi3003DevicesChs.at((j*6) + i)); m_Channels.push_back(Multi3003DevicesChs.at((j*6) + i));
} }
@ -231,7 +231,7 @@ bool CVocodecs::Init(void)
} }
// and finaly the hybrid combination of 3003 / 3000 // and finaly the hybrid combination of 3003 / 3000
{ {
for ( int i = 0; i < Combined3003And3000DeviceChannels.size(); i++ ) for ( unsigned i = 0; i < Combined3003And3000DeviceChannels.size(); i++ )
{ {
m_Channels.push_back(Combined3003And3000DeviceChannels.at(i)); m_Channels.push_back(Combined3003And3000DeviceChannels.at(i));
} }
@ -262,7 +262,7 @@ bool CVocodecs::DiscoverFtdiDevices(void)
FT_DEVICE_LIST_INFO_NODE *list; FT_DEVICE_LIST_INFO_NODE *list;
// clear vector // clear vector
for ( int i = 0; i < m_FtdiDeviceDescrs.size(); i++ ) for ( unsigned i = 0; i < m_FtdiDeviceDescrs.size(); i++ )
{ {
delete m_FtdiDeviceDescrs[i]; delete m_FtdiDeviceDescrs[i];
} }
@ -314,7 +314,7 @@ CVocodecChannel *CVocodecs::OpenChannel(uint8 uiCodecIn, uint8 uiCodecOut)
// loop on all interface until suitable & available channel found // loop on all interface until suitable & available channel found
m_MutexChannels.lock(); m_MutexChannels.lock();
for ( int i = 0; (i < m_Channels.size()) && !done; i++ ) for ( unsigned i = 0; (i < m_Channels.size()) && !done; i++ )
{ {
if ( !m_Channels[i]->IsOpen() && if ( !m_Channels[i]->IsOpen() &&
(m_Channels[i]->GetCodecIn() == uiCodecIn) && (m_Channels[i]->GetCodecIn() == uiCodecIn) &&

@ -93,8 +93,8 @@ typedef unsigned int uint;
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// macros // macros
#define MIN(a,b) ((a) < (b))?(a):(b) #define MIN(a,b) (int(a) < int(b))?(a):(b)
#define MAX(a,b) ((a) > (b))?(a):(b) #define MAX(a,b) (int(a) > int(b))?(a):(b)
#define MAKEWORD(low, high) ((uint16)(((uint8)(low)) | (((uint16)((uint8)(high))) << 8))) #define MAKEWORD(low, high) ((uint16)(((uint8)(low)) | (((uint16)((uint8)(high))) << 8)))
#define MAKEDWORD(low, high) ((uint32)(((uint16)(low)) | (((uint32)((uint16)(high))) << 16))) #define MAKEDWORD(low, high) ((uint32)(((uint16)(low)) | (((uint32)((uint16)(high))) << 16)))
#define LOBYTE(w) ((uint8)(uint16)(w & 0x00FF)) #define LOBYTE(w) ((uint8)(uint16)(w & 0x00FF))

@ -36,9 +36,9 @@ DATADIR=/var/lib/xlxd
CC=g++ CC=g++
ifdef DEBUG ifdef DEBUG
CFLAGS=-ggdb3 -c -std=c++11 -MMD -MD -c CFLAGS=-ggdb3 -W -c -std=c++11 -MMD -MD -c
else else
CFLAGS=-c -std=c++11 -MMD -MD -c CFLAGS=-c -W -std=c++11 -MMD -MD -c
endif endif
ifdef NOXLX ifdef NOXLX
CFLAGS += -DNO_XLX CFLAGS += -DNO_XLX

@ -43,7 +43,7 @@ CBmPeer::CBmPeer(const CCallsign &callsign, const CIp &ip, const char *modules,
std::cout << "Adding BM peer" << std::endl; std::cout << "Adding BM peer" << std::endl;
// and construct all xlx clients // and construct all xlx clients
for ( int i = 0; i < ::strlen(modules); i++ ) for ( unsigned i = 0; i < ::strlen(modules); i++ )
{ {
// create // create
CBmClient *client = new CBmClient(callsign, ip, modules[i]); CBmClient *client = new CBmClient(callsign, ip, modules[i]);

@ -82,14 +82,6 @@ CCallsign::CCallsign(const char *sz, uint32 dmrid)
} }
} }
CCallsign::CCallsign(const CCallsign &callsign)
{
::memcpy(m_Callsign, callsign.m_Callsign, sizeof(m_Callsign));
::memcpy(m_Suffix, callsign.m_Suffix, sizeof(m_Suffix));
m_Module = callsign.m_Module;
m_uiDmrid = callsign.m_uiDmrid;
}
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// status // status
@ -174,14 +166,14 @@ void CCallsign::SetCallsign(const uint8 *buffer, int len, bool UpdateDmrid)
::memset(m_Callsign, ' ', sizeof(m_Callsign)); ::memset(m_Callsign, ' ', sizeof(m_Callsign));
m_Module = ' '; m_Module = ' ';
::memcpy(m_Callsign, buffer, MIN(len, sizeof(m_Callsign)-1)); ::memcpy(m_Callsign, buffer, MIN(len, sizeof(m_Callsign)-1));
for ( int i = 0; i < sizeof(m_Callsign); i++ ) for ( unsigned i = 0; i < sizeof(m_Callsign); i++ )
{ {
if ( m_Callsign[i] == 0 ) if ( m_Callsign[i] == 0 )
{ {
m_Callsign[i] = ' '; m_Callsign[i] = ' ';
} }
} }
if ( (len >= sizeof(m_Callsign)) && ((char)buffer[sizeof(m_Callsign)-1] != 0) ) if ( (len >= (int)sizeof(m_Callsign)) && ((char)buffer[sizeof(m_Callsign)-1] != 0) )
{ {
m_Module = (char)buffer[sizeof(m_Callsign)-1]; m_Module = (char)buffer[sizeof(m_Callsign)-1];
} }
@ -244,7 +236,7 @@ void CCallsign::SetSuffix(const uint8 *buffer, int len)
void CCallsign::PatchCallsign(int off, const uint8 *patch, int len) void CCallsign::PatchCallsign(int off, const uint8 *patch, int len)
{ {
if ( off < sizeof(m_Callsign) ) if ( off < CALLSIGN_LEN )
{ {
::memcpy(m_Callsign, patch, MIN(len, sizeof(m_Callsign) - off)); ::memcpy(m_Callsign, patch, MIN(len, sizeof(m_Callsign) - off));
} }
@ -265,7 +257,7 @@ void CCallsign::GetCallsign(uint8 *buffer) const
void CCallsign::GetCallsignString(char *sz) const void CCallsign::GetCallsignString(char *sz) const
{ {
int i; unsigned i;
for ( i = 0; (i < sizeof(m_Callsign)) && (m_Callsign[i] != ' '); i++ ) for ( i = 0; (i < sizeof(m_Callsign)) && (m_Callsign[i] != ' '); i++ )
{ {
sz[i] = m_Callsign[i]; sz[i] = m_Callsign[i];
@ -291,7 +283,7 @@ bool CCallsign::HasSameCallsignWithWildcard(const CCallsign &callsign) const
bool same = true; bool same = true;
bool done = false; bool done = false;
for ( int i = 0; (i < sizeof(m_Callsign)) && same && !done; i++ ) for ( unsigned i = 0; (i < sizeof(m_Callsign)) && same && !done; i++ )
{ {
if ( !(done = ((m_Callsign[i] == '*') || (callsign[i] == '*'))) ) if ( !(done = ((m_Callsign[i] == '*') || (callsign[i] == '*'))) )
{ {

@ -41,10 +41,6 @@ public:
// contructors // contructors
CCallsign(); CCallsign();
CCallsign(const char *, uint32 = 0); CCallsign(const char *, uint32 = 0);
CCallsign(const CCallsign &);
// destructor
virtual ~CCallsign() {};
// status // status
bool IsValid(void) const; bool IsValid(void) const;

@ -132,7 +132,7 @@ bool CCallsignListItem::CheckListedModules(char *Modules) const
char list[NB_MODULES_MAX+1]; char list[NB_MODULES_MAX+1];
list[0] = 0; list[0] = 0;
// //
for ( int i = 0; i < ::strlen(Modules); i++ ) for ( unsigned i = 0; i < ::strlen(Modules); i++ )
{ {
if ( HasModuleListed(Modules[i]) ) if ( HasModuleListed(Modules[i]) )
{ {
@ -144,4 +144,3 @@ bool CCallsignListItem::CheckListedModules(char *Modules) const
} }
return listed; return listed;
} }

@ -44,7 +44,7 @@ CDextraPeer::CDextraPeer(const CCallsign &callsign, const CIp &ip, const char *m
std::cout << "Adding DExtra peer" << std::endl; std::cout << "Adding DExtra peer" << std::endl;
// and construct the DExtra clients // and construct the DExtra clients
for ( int i = 0; i < ::strlen(modules); i++ ) for ( unsigned i = 0; i < ::strlen(modules); i++ )
{ {
// create // create
CDextraClient *client = new CDextraClient(callsign, ip, modules[i], version.GetMajor()); CDextraClient *client = new CDextraClient(callsign, ip, modules[i], version.GetMajor());

@ -86,17 +86,6 @@ CDvFramePacket::CDvFramePacket
::memcpy(m_uiDvSync, dmrsync, sizeof(m_uiDvSync)); ::memcpy(m_uiDvSync, dmrsync, sizeof(m_uiDvSync));
} }
// copy constructor
CDvFramePacket::CDvFramePacket(const CDvFramePacket &DvFrame)
: CPacket(DvFrame)
{
::memcpy(m_uiAmbe, DvFrame.m_uiAmbe, sizeof(m_uiAmbe));
::memcpy(m_uiDvData, DvFrame.m_uiDvData, sizeof(m_uiDvData));
::memcpy(m_uiAmbePlus, DvFrame.m_uiAmbePlus, sizeof(m_uiAmbePlus));
::memcpy(m_uiDvSync, DvFrame.m_uiDvSync, sizeof(m_uiDvSync));
}
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// virtual duplication // virtual duplication

@ -57,10 +57,6 @@ public:
CDvFramePacket(const uint8 *, const uint8 *, uint16, uint8, uint8); CDvFramePacket(const uint8 *, const uint8 *, uint16, uint8, uint8);
CDvFramePacket(const uint8 *, uint16, uint8, uint8, uint8); CDvFramePacket(const uint8 *, uint16, uint8, uint8, uint8);
CDvFramePacket(uint16, uint8, const uint8 *, const uint8 *, uint8, uint8, const uint8 *, const uint8 *); CDvFramePacket(uint16, uint8, const uint8 *, const uint8 *, uint8, uint8, const uint8 *, const uint8 *);
CDvFramePacket(const CDvFramePacket &);
// destructor
virtual ~CDvFramePacket() {};
// virtual duplication // virtual duplication
CPacket *Duplicate(void) const; CPacket *Duplicate(void) const;

@ -85,23 +85,6 @@ CDvHeaderPacket::CDvHeaderPacket(const CCallsign &my, const CCallsign &ur, const
m_csMY = my; m_csMY = my;
} }
// copy constructor
CDvHeaderPacket::CDvHeaderPacket(const CDvHeaderPacket &Header)
: CPacket(Header)
{
m_uiFlag1 = Header.m_uiFlag1;
m_uiFlag2 = Header.m_uiFlag2;
m_uiFlag3 = Header.m_uiFlag3;
m_csUR = Header.m_csUR;
m_csRPT1 = Header.m_csRPT1;
m_csRPT2 = Header.m_csRPT2;
m_csMY = Header.m_csMY;
m_uiCrc = Header.m_uiCrc;
}
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// virtual duplication // virtual duplication

@ -64,10 +64,6 @@ public:
CDvHeaderPacket(const struct dstar_header *, uint16, uint8); CDvHeaderPacket(const struct dstar_header *, uint16, uint8);
CDvHeaderPacket(uint32, const CCallsign &, const CCallsign &, const CCallsign &, uint16, uint8, uint8); CDvHeaderPacket(uint32, const CCallsign &, const CCallsign &, const CCallsign &, uint16, uint8, uint8);
CDvHeaderPacket(const CCallsign &, const CCallsign &, const CCallsign &, const CCallsign &, uint16, uint8); CDvHeaderPacket(const CCallsign &, const CCallsign &, const CCallsign &, const CCallsign &, uint16, uint8);
CDvHeaderPacket(const CDvHeaderPacket &);
// destructor
virtual ~CDvHeaderPacket(){};
// virtual duplication // virtual duplication
CPacket *Duplicate(void) const; CPacket *Duplicate(void) const;

@ -74,8 +74,10 @@ void CIp::Initialize(const int family, const uint16_t port, const char *address)
else else
{ {
if (1 > inet_pton(AF_INET, address, &(addr4->sin_addr))) if (1 > inet_pton(AF_INET, address, &(addr4->sin_addr)))
{
std::cerr << "Address Initialization Error: '" << address << "' is not a valdid IPV4 address!" << std::endl; std::cerr << "Address Initialization Error: '" << address << "' is not a valdid IPV4 address!" << std::endl;
is_set = false; is_set = false;
}
} }
} }
} }
@ -92,8 +94,10 @@ void CIp::Initialize(const int family, const uint16_t port, const char *address)
else else
{ {
if (1 > inet_pton(AF_INET6, address, &(addr6->sin6_addr))) if (1 > inet_pton(AF_INET6, address, &(addr6->sin6_addr)))
{
std::cerr << "Address Initialization Error: '" << address << "' is not a valid IPV6 address!" << std::endl; std::cerr << "Address Initialization Error: '" << address << "' is not a valid IPV6 address!" << std::endl;
is_set = false; is_set = false;
}
} }
} }
} }

@ -34,12 +34,6 @@ CNotification::CNotification()
m_iId = NOTIFICATION_NONE; m_iId = NOTIFICATION_NONE;
} }
CNotification::CNotification(const CNotification &Notification)
{
m_iId = Notification.m_iId;
m_Callsign = Notification.m_Callsign;
}
CNotification::CNotification(int iId) CNotification::CNotification(int iId)
{ {
m_iId = iId; m_iId = iId;

@ -46,13 +46,9 @@ class CNotification
public: public:
// constructor // constructor
CNotification(); CNotification();
CNotification(const CNotification &);
CNotification(int); CNotification(int);
CNotification(int, const CCallsign &); CNotification(int, const CCallsign &);
// destructor
~CNotification() {};
// get // get
int GetId(void) const { return m_iId; } int GetId(void) const { return m_iId; }
const CCallsign &GetCallsign(void) const { return m_Callsign; } const CCallsign &GetCallsign(void) const { return m_Callsign; }

@ -577,7 +577,7 @@ CPacketStream *CReflector::GetStream(char module)
bool CReflector::IsStreamOpen(const CDvHeaderPacket *DvHeader) bool CReflector::IsStreamOpen(const CDvHeaderPacket *DvHeader)
{ {
bool open = false; bool open = false;
for ( int i = 0; (i < m_Streams.size()) && !open; i++ ) for ( unsigned i = 0; (i < m_Streams.size()) && !open; i++ )
{ {
open = ( (m_Streams[i].GetStreamId() == DvHeader->GetStreamId()) && open = ( (m_Streams[i].GetStreamId() == DvHeader->GetStreamId()) &&
(m_Streams[i].IsOpen())); (m_Streams[i].IsOpen()));
@ -588,7 +588,7 @@ bool CReflector::IsStreamOpen(const CDvHeaderPacket *DvHeader)
char CReflector::GetStreamModule(CPacketStream *stream) char CReflector::GetStreamModule(CPacketStream *stream)
{ {
char module = ' '; char module = ' ';
for ( int i = 0; (i < m_Streams.size()) && (module == ' '); i++ ) for ( unsigned i = 0; (i < m_Streams.size()) && (module == ' '); i++ )
{ {
if ( &(m_Streams[i]) == stream ) if ( &(m_Streams[i]) == stream )
{ {

@ -42,13 +42,6 @@ CVersion::CVersion(int iMajor, int iMinor, int iRevision)
m_iRevision = iRevision; m_iRevision = iRevision;
} }
CVersion::CVersion(const CVersion &Version)
{
m_iMajor = Version.m_iMajor;
m_iMinor = Version.m_iMinor;
m_iRevision = Version.m_iRevision;
}
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// comparaison // comparaison
@ -84,4 +77,3 @@ bool CVersion::operator ==(const CVersion &Version) const
(Version.m_iMinor == m_iMinor) && (Version.m_iMinor == m_iMinor) &&
(Version.m_iRevision == m_iRevision )) ; (Version.m_iRevision == m_iRevision )) ;
} }

@ -36,10 +36,6 @@ public:
// constructor // constructor
CVersion(); CVersion();
CVersion(int, int, int); CVersion(int, int, int);
CVersion(const CVersion &);
// destructor
virtual ~CVersion() {}
// get // get
int GetMajor(void) const { return m_iMajor; } int GetMajor(void) const { return m_iMajor; }

@ -43,12 +43,3 @@ CWiresxCmd::CWiresxCmd(const CIp &Ip, const CCallsign &Callsign, int iCmd, int i
m_iArg = iArg; m_iArg = iArg;
m_Time.Now(); m_Time.Now();
} }
CWiresxCmd::CWiresxCmd(const CWiresxCmd &Cmd)
{
m_Ip = Cmd.m_Ip;
m_Callsign = Cmd.m_Callsign;
m_iCmd = Cmd.m_iCmd;
m_iArg = Cmd.m_iArg;
m_Time = Cmd.m_Time;
}

@ -50,10 +50,6 @@ public:
// constructor // constructor
CWiresxCmd(); CWiresxCmd();
CWiresxCmd(const CIp &, const CCallsign &, int, int); CWiresxCmd(const CIp &, const CCallsign &, int, int);
CWiresxCmd(const CWiresxCmd &);
// destructor
virtual ~CWiresxCmd() {}
// get // get
const CCallsign &GetCallsign(void) const { return m_Callsign; } const CCallsign &GetCallsign(void) const { return m_Callsign; }

@ -46,7 +46,7 @@ CXlxPeer::CXlxPeer(const CCallsign &callsign, const CIp &ip, const char *modules
//std::cout << "Adding XLX peer with protocol revision " << protrev << std::endl; //std::cout << "Adding XLX peer with protocol revision " << protrev << std::endl;
// and construct all xlx clients // and construct all xlx clients
for ( int i = 0; i < ::strlen(modules); i++ ) for ( unsigned i = 0; i < ::strlen(modules); i++ )
{ {
// create // create
CXlxClient *client = new CXlxClient(callsign, ip, modules[i], protrev); CXlxClient *client = new CXlxClient(callsign, ip, modules[i], protrev);

@ -491,7 +491,7 @@ bool CXlxProtocol::IsValidConnectPacket(const CBuffer &Buffer, CCallsign *callsi
::strcpy(modules, (const char *)&(Buffer.data()[12])); ::strcpy(modules, (const char *)&(Buffer.data()[12]));
valid = callsign->IsValid(); valid = callsign->IsValid();
*version = CVersion(Buffer.data()[9], Buffer.data()[10], Buffer.data()[11]); *version = CVersion(Buffer.data()[9], Buffer.data()[10], Buffer.data()[11]);
for ( int i = 0; i < ::strlen(modules); i++ ) for ( unsigned i = 0; i < ::strlen(modules); i++ )
{ {
valid &= IsLetter(modules[i]); valid &= IsLetter(modules[i]);
} }
@ -519,7 +519,7 @@ bool CXlxProtocol::IsValidAckPacket(const CBuffer &Buffer, CCallsign *callsign,
::strcpy(modules, (const char *)&(Buffer.data()[12])); ::strcpy(modules, (const char *)&(Buffer.data()[12]));
valid = callsign->IsValid(); valid = callsign->IsValid();
*version = CVersion(Buffer.data()[9], Buffer.data()[10], Buffer.data()[11]); *version = CVersion(Buffer.data()[9], Buffer.data()[10], Buffer.data()[11]);
for ( int i = 0; i < ::strlen(modules); i++ ) for ( unsigned i = 0; i < ::strlen(modules); i++ )
{ {
valid &= IsLetter(modules[i]); valid &= IsLetter(modules[i]);
} }

@ -324,7 +324,7 @@ void CYsfProtocol::HandleQueue(void)
{ {
// update local stream cache or send triplet when needed // update local stream cache or send triplet when needed
uint8 sid = packet->GetYsfPacketSubId(); uint8 sid = packet->GetYsfPacketSubId();
if ( (sid >= 0) && (sid <= 4) ) if (sid <= 4)
{ {
//std::cout << (int)sid; //std::cout << (int)sid;
m_StreamsCache[iModId].m_dvFrames[sid] = CDvFramePacket((const CDvFramePacket &)*packet); m_StreamsCache[iModId].m_dvFrames[sid] = CDvFramePacket((const CDvFramePacket &)*packet);

@ -194,8 +194,8 @@ typedef unsigned int uint;
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// macros // macros
#define MIN(a,b) ((a) < (b))?(a):(b) #define MIN(a,b) (int(a) < int(b))?(a):(b)
#define MAX(a,b) ((a) > (b))?(a):(b) #define MAX(a,b) (int(a) > int(b))?(a):(b)
#define MAKEWORD(low, high) ((uint16)(((uint8)(low)) | (((uint16)((uint8)(high))) << 8))) #define MAKEWORD(low, high) ((uint16)(((uint8)(low)) | (((uint16)((uint8)(high))) << 8)))
#define MAKEDWORD(low, high) ((uint32)(((uint16)(low)) | (((uint32)((uint16)(high))) << 16))) #define MAKEDWORD(low, high) ((uint32)(((uint16)(low)) | (((uint32)((uint16)(high))) << 16)))
#define LOBYTE(w) ((uint8)(uint16)(w & 0x00FF)) #define LOBYTE(w) ((uint8)(uint16)(w & 0x00FF))

Loading…
Cancel
Save

Powered by TurnKey Linux.