Fix unitialised variables bug.

This commit is contained in:
Jonathan Naylor 2019-04-10 20:15:16 +01:00
parent 4dd460fb6c
commit e46638a089

View File

@ -33,7 +33,10 @@ m_rxFrequency(0U),
m_latitude(0.0F), m_latitude(0.0F),
m_longitude(0.0F), m_longitude(0.0F),
m_height(0), m_height(0),
m_desc() m_desc(),
m_mobileGPSAddress(),
m_mobileGPSPort(0U),
m_socket(NULL)
{ {
assert(!callsign.empty()); assert(!callsign.empty());
assert(!password.empty()); assert(!password.empty());
@ -230,9 +233,9 @@ void CAPRSWriter::sendIdFrameMobile()
if (pLatitude == NULL || pLongitude == NULL || pAltitude == NULL) if (pLatitude == NULL || pLongitude == NULL || pAltitude == NULL)
return; return;
float rawLatitude = ::atof(pLatitude); float rawLatitude = float(::atof(pLatitude));
float rawLongitude = ::atof(pLongitude); float rawLongitude = float(::atof(pLongitude));
float rawAltitude = ::atof(pAltitude); float rawAltitude = float(::atof(pAltitude));
char desc[200U]; char desc[200U];
if (m_txFrequency != 0U) { if (m_txFrequency != 0U) {
@ -286,8 +289,8 @@ void CAPRSWriter::sendIdFrameMobile()
lon, (rawLongitude < 0.0F) ? 'W' : 'E'); lon, (rawLongitude < 0.0F) ? 'W' : 'E');
if (pBearing != NULL && pVelocity != NULL) { if (pBearing != NULL && pVelocity != NULL) {
float rawBearing = ::atof(pBearing); float rawBearing = float(::atof(pBearing));
float rawVelocity = ::atof(pVelocity); float rawVelocity = float(::atof(pVelocity));
::sprintf(output + ::strlen(output), "%03.0f/%03.0f", rawBearing, rawVelocity * 0.539957F); ::sprintf(output + ::strlen(output), "%03.0f/%03.0f", rawBearing, rawVelocity * 0.539957F);
} }