Fixed some issues with MinGW gcc, e.g. added some includes, removed nullptr, changed some initializer lists (prevents warnings)

This commit is contained in:
Klaus Basan
2013-04-29 00:15:32 +02:00
parent 33e775e108
commit 7c7ca2dfae
15 changed files with 32 additions and 24 deletions

View File

@@ -17,7 +17,7 @@ namespace BlackCore
/*
* Constructor
*/
CInterpolator::CInterpolator() : m_state_begin(nullptr), m_state_end(nullptr)
CInterpolator::CInterpolator() : m_state_begin(0), m_state_end(0)
{
m_time.start();
}
@@ -42,7 +42,7 @@ void CInterpolator::initialize() {}
CCoordinateNed CInterpolator::pushUpdate(const CCoordinateGeodetic &pos, const CSpeed &groundSpeed, const CHeading &heading, const CAngle &pitch, const CAngle &bank)
{
CCoordinateNed velocityNED;
if (m_state_begin == nullptr)
if (m_state_begin == 0)
{
m_state_begin = new TPlaneState();
m_state_begin->position = CCoordinateTransformation::toEcef(pos);
@@ -62,7 +62,7 @@ CCoordinateNed CInterpolator::pushUpdate(const CCoordinateGeodetic &pos, const C
}
stateNow(m_state_begin);
if (m_state_end == nullptr) m_state_end = new TPlaneState();
if (m_state_end == 0) m_state_end = new TPlaneState();
m_state_end->reset();
m_state_end->timestamp = m_time.elapsed();

View File

@@ -6,6 +6,7 @@
#ifndef BLACKMISC_AVIOCOMUNIT_H
#define BLACKMISC_AVIOCOMUNIT_H
#include "blackmisc/aviomodulator.h"
#include <stdexcept>
namespace BlackMisc
{

View File

@@ -60,7 +60,7 @@ protected:
*/
void setFrequencyActiveKHz(double frequencyKHz)
{
this->m_frequencyActive = CFrequency(frequencyKHz, CFrequencyUnit::kHz());
this->m_frequencyActive = BlackMisc::PhysicalQuantities::CFrequency(frequencyKHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::kHz());
}
/*!
@@ -69,7 +69,7 @@ protected:
*/
void setFrequencyStandbyKHz(double frequencyKHz)
{
this->m_frequencyStandby = CFrequency(frequencyKHz, CFrequencyUnit::kHz());
this->m_frequencyStandby = BlackMisc::PhysicalQuantities::CFrequency(frequencyKHz, BlackMisc::PhysicalQuantities::CFrequencyUnit::kHz());
}
/*!

View File

@@ -6,6 +6,7 @@
#ifndef BLACKMISC_AVIOTRANSPONDER_H
#define BLACKMISC_AVIOTRANSPONDER_H
#include "blackmisc/aviobase.h"
#include <stdexcept>
namespace BlackMisc
{

View File

@@ -41,7 +41,7 @@ public:
/*!
* \brief Default constructor
*/
CCoordinateNed() : CVector3DBase(), m_hasReferencePosition(false) {}
CCoordinateNed() : CVector3DBase(), m_referencePosition(), m_hasReferencePosition(false) {}
/*!
* \brief Constructor with reference position
@@ -71,7 +71,7 @@ public:
* \param otherNed
*/
CCoordinateNed(const CCoordinateNed &otherNed) :
CVector3DBase(otherNed) , m_hasReferencePosition(otherNed.m_hasReferencePosition), m_referencePosition(otherNed.m_referencePosition) {}
CVector3DBase(otherNed), m_referencePosition(otherNed.m_referencePosition), m_hasReferencePosition(otherNed.m_hasReferencePosition) {}
/*!
* \brief Constructor by math vector

View File

@@ -44,8 +44,7 @@ namespace BlackMisc
*/
struct SLogInformation
{
SLogInformation() : m_logType(CLog::eOff), m_threadId(0), m_line(-1), m_sourceFile(NULL), m_methodName(NULL) {}
SLogInformation() : m_dateTime(), m_logType(CLog::eOff), m_applicationName(), m_threadId(0), m_sourceFile(NULL), m_line(-1), m_methodName(NULL) {}
QDateTime m_dateTime;
TLogType m_logType;
QString m_applicationName;

View File

@@ -73,4 +73,4 @@ namespace BlackMisc
} // BlackMisc
#endif LOGMESSAGE_H// LOGMESSAGE_H
#endif // guard

View File

@@ -5,6 +5,7 @@
#include "blackmisc/mathematics.h"
#include <algorithm> // std::max
#include <cmath>
namespace BlackMisc
{
@@ -14,7 +15,7 @@ namespace Math
/*
* Hypotenuse
*/
qreal CMath::hypot(qreal x, qreal y)
double CMath::hypot(double x, double y)
{
x = abs(x);
y = abs(y);
@@ -27,7 +28,7 @@ qreal CMath::hypot(qreal x, qreal y)
/*
* Real part of cubic root
*/
qreal CMath::cubicRootReal(qreal x)
double CMath::cubicRootReal(double x)
{
double result;
result = std::pow(std::abs(x), (double)1 / 3);

View File

@@ -62,7 +62,7 @@ CMatrix1x3 CMatrix3x3::getRow(int row) const
{
bool valid = row >= 0 && row <= 3;
Q_ASSERT_X(valid, "getRow", "invalid row");
if (!valid) throw new std::range_error("invalid row");
if (!valid) throw std::range_error("invalid row");
return CMatrix1x3(this->getElement(row, 0), this->getElement(row, 1), this->getElement(row, 2));
}

View File

@@ -7,6 +7,7 @@
#define BLACKMISC_POSMATRIX3X3_H
#include "blackmisc/mathmatrix1x3.h"
#include "blackmisc/mathmatrix3x1.h"
#include <stdexcept>
namespace BlackMisc
{

View File

@@ -14,7 +14,6 @@ namespace PhysicalQuantities
{
/*!
* \brief Physical unit angle (radians, degrees)
* \author KWB
*/
class CAngle : public CPhysicalQuantity<CAngleUnit, CAngle>
{
@@ -23,34 +22,40 @@ public:
* \brief Default constructor
*/
CAngle() : CPhysicalQuantity(0, CAngleUnit::rad(), CAngleUnit::rad()) {}
/*!
* \brief Copy constructor
*/
CAngle(const CAngle &angle) : CPhysicalQuantity(angle) {}
/*!
* \brief Init by int value
* \param value
* \param unit
*/
CAngle(qint32 value, const CAngleUnit &unit): CPhysicalQuantity(value, unit, CAngleUnit::rad()) {}
/*!
* \brief Init by double value
* \param value
* \param unit
*/
CAngle(double value, const CAngleUnit &unit): CPhysicalQuantity(value, unit, CAngleUnit::rad()) {}
/*!
* \brief Virtual destructor
*/
virtual ~CAngle() {}
/*!
* \brief Convenience method PI
* \return
*/
const static double pi()
static double pi()
{
return M_PI;
return double(M_PI);
}
/*!
* \brief Value as factor of PI (e.g. 0.5PI)
* \return

View File

@@ -255,7 +255,7 @@ protected:
*/
CMeasurementUnit(const QString &name, const QString &unitName, const QString &type, bool isSiUnit, bool isSiBaseUnit, double conversionFactorToSI = 1,
const CMeasurementPrefix &multiplier = CMeasurementPrefix::None(), qint32 displayDigits = 2,
double epsilon = 1E-10, UnitConverter toSiConverter = nullptr, UnitConverter fromSiConverter = nullptr);
double epsilon = 1E-10, UnitConverter toSiConverter = 0, UnitConverter fromSiConverter = 0);
/*!
* \brief Copy constructor

View File

@@ -92,6 +92,6 @@ public:
return f;
}
};
} //namespace
} // namespace
#endif // BLACKMISC_PQCONSTANTS_H
} // namespace
#endif // guard

View File

@@ -1,4 +1,4 @@
/* Copyright (C) 2013 VATSIM Community
/* Copyright (C) 2013 VATSIM Community / contributors
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

View File

@@ -139,7 +139,7 @@ private:
*/
CAngleUnit(const QString &name, const QString &unitName, bool isSiUnit, double conversionFactorToSI = 1.0,
const CMeasurementPrefix &multiplier = CMeasurementPrefix::One(), qint32 displayDigits = 2,
double epsilon = 1E-9, UnitConverter converterToSi = nullptr, UnitConverter converterFromSi = nullptr) :
double epsilon = 1E-9, UnitConverter converterToSi = 0, UnitConverter converterFromSi = 0) :
CMeasurementUnit(name, unitName, "angle", isSiUnit, false, conversionFactorToSI,
multiplier, displayDigits, epsilon, converterToSi, converterFromSi)
{
@@ -472,14 +472,14 @@ protected:
* \param value
* \return
*/
virtual double CTemperatureUnit::conversionToSiConversionUnit(double value) const;
virtual double conversionToSiConversionUnit(double value) const;
/*!
* \brief Convert from SI conversion unit, specific for temperature
* \param value
* \return
*/
virtual double CTemperatureUnit::conversionFromSiConversionUnit(double value) const;
virtual double conversionFromSiConversionUnit(double value) const;
public:
/*!
@@ -491,7 +491,7 @@ public:
/*!
* Assigment operator
*/
CTemperatureUnit &CTemperatureUnit::operator =(const CTemperatureUnit &otherUnit)
CTemperatureUnit &operator =(const CTemperatureUnit &otherUnit)
{
if (this == &otherUnit) return *this; // Same object? Yes, so skip assignment, and just return *this
CMeasurementUnit::operator = (otherUnit);