FGCom: explicit init some member variables
Fix various places Valgrind identified as read-of-un-inited. Also fix use of frequencies are integers: always use a double type explicitly, which will make MSVC happier.
This commit is contained in:
parent
2084e11d60
commit
a05e5075b2
2 changed files with 13 additions and 11 deletions
|
@ -95,6 +95,8 @@ void FGCom::iaxTextEvent(struct iaxc_ev_text text)
|
||||||
|
|
||||||
FGCom::FGCom()
|
FGCom::FGCom()
|
||||||
{
|
{
|
||||||
|
_maxRange = MAX_RANGE;
|
||||||
|
_minRange = MIN_RANGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -195,7 +197,7 @@ void FGCom::init()
|
||||||
_username = _username_node->getStringValue();
|
_username = _username_node->getStringValue();
|
||||||
_password = _password_node->getStringValue();
|
_password = _password_node->getStringValue();
|
||||||
|
|
||||||
_currentCommFrequency = 0;
|
_currentCommFrequency = 0.0;
|
||||||
|
|
||||||
_maxRange = MAX_RANGE;
|
_maxRange = MAX_RANGE;
|
||||||
_minRange = MIN_RANGE;
|
_minRange = MIN_RANGE;
|
||||||
|
@ -341,7 +343,7 @@ void FGCom::setupCommFrequency(int channel) {
|
||||||
SG_LOG(SG_IO, SG_INFO, "FGCom: disconnect as channel 0 " << _currentCallIdent);
|
SG_LOG(SG_IO, SG_INFO, "FGCom: disconnect as channel 0 " << _currentCallIdent);
|
||||||
_currentCallIdent = -1;
|
_currentCallIdent = -1;
|
||||||
}
|
}
|
||||||
_currentCommFrequency = 0;
|
_currentCommFrequency = 0.0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -376,18 +378,18 @@ void FGCom::setupCommFrequency(int channel) {
|
||||||
_commFrequencyNode->removeChangeListener(this);
|
_commFrequencyNode->removeChangeListener(this);
|
||||||
SG_LOG(SG_IO, SG_INFO, "FGCom: setupCommFrequency invalid channel " << channel);
|
SG_LOG(SG_IO, SG_INFO, "FGCom: setupCommFrequency invalid channel " << channel);
|
||||||
|
|
||||||
_currentCommFrequency = 0;
|
_currentCommFrequency = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FGCom::connectToCommFrequency() {
|
void FGCom::connectToCommFrequency() {
|
||||||
// ensure that the current comm is still in range
|
// ensure that the current comm is still in range
|
||||||
if (_currentCallFrequency && !isInRange(_currentCallFrequency)) {
|
if ((_currentCallFrequency > 0.0) && !isInRange(_currentCallFrequency)) {
|
||||||
SG_LOG(SG_IO, SG_WARN, "FGCom: call out of range of: " << _currentCallFrequency);
|
SG_LOG(SG_IO, SG_WARN, "FGCom: call out of range of: " << _currentCallFrequency);
|
||||||
_currentCallFrequency = 0;
|
_currentCallFrequency = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't connected (and disconnect if already connected) when tuned freq is 0
|
// don't connected (and disconnect if already connected) when tuned freq is 0
|
||||||
if (_currentCommFrequency < 1) {
|
if (_currentCommFrequency < 1.0) {
|
||||||
if (_currentCallIdent != -1) {
|
if (_currentCallIdent != -1) {
|
||||||
iaxc_dump_call_number(_currentCallIdent);
|
iaxc_dump_call_number(_currentCallIdent);
|
||||||
SG_LOG(SG_IO, SG_INFO, "FGCom: disconnect as freq 0: current call " << _currentCallIdent);
|
SG_LOG(SG_IO, SG_INFO, "FGCom: disconnect as freq 0: current call " << _currentCallIdent);
|
||||||
|
|
|
@ -72,14 +72,14 @@ private:
|
||||||
SGPropertyNode_ptr _mpTransmitFrequencyNode; // sim/multiplay/comm-transmit-frequency-mhz
|
SGPropertyNode_ptr _mpTransmitFrequencyNode; // sim/multiplay/comm-transmit-frequency-mhz
|
||||||
SGPropertyNode_ptr _mpTransmitPowerNode; // sim/multiplay/comm-transmit-power-norm
|
SGPropertyNode_ptr _mpTransmitPowerNode; // sim/multiplay/comm-transmit-power-norm
|
||||||
|
|
||||||
double _maxRange;
|
double _maxRange = 0.0;
|
||||||
double _minRange;
|
double _minRange = 0.0;
|
||||||
double _currentCommFrequency;
|
double _currentCommFrequency = 0.0;
|
||||||
double _currentCallFrequency;
|
double _currentCallFrequency = 0.0;
|
||||||
bool _register = true;
|
bool _register = true;
|
||||||
bool _enabled = false;
|
bool _enabled = false;
|
||||||
bool _initialized = false;
|
bool _initialized = false;
|
||||||
int _regId;
|
int _regId = 0;
|
||||||
int _currentCallIdent = -1;
|
int _currentCallIdent = -1;
|
||||||
//int _callComm1;
|
//int _callComm1;
|
||||||
int _listener_active = 0;
|
int _listener_active = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue