Base: PR6497 move return statement to new line

This commit is contained in:
Chris Hennes
2022-03-29 12:34:34 -05:00
parent 5df3dbae6f
commit b5c72abee4
10 changed files with 110 additions and 55 deletions

View File

@@ -409,7 +409,8 @@ int *ConsoleSingleton::GetLogLevel(const char *tag, bool create) {
if (!tag) tag = "";
if (_logLevels.find(tag) != _logLevels.end())
return &_logLevels[tag];
if (!create) return nullptr;
if (!create)
return nullptr;
int &ret = _logLevels[tag];
ret = -1;
return &ret;

View File

@@ -377,7 +377,8 @@ bool FileInfo::isFile () const
// If we can open it must be an existing file, otherwise we assume it
// is a directory (which doesn't need to be true for any cases)
std::ifstream str(FileName.c_str(), std::ios::in | std::ios::binary);
if (!str) return false;
if (!str)
return false;
str.close();
return true;
}
@@ -551,7 +552,8 @@ bool FileInfo::createDirectories() const
bool FileInfo::deleteDirectory() const
{
if (isDir() == false ) return false;
if (isDir() == false )
return false;
#if defined (FC_OS_WIN32)
std::wstring wstr = toStdWString();
return _wrmdir(wstr.c_str()) == 0;
@@ -564,7 +566,8 @@ bool FileInfo::deleteDirectory() const
bool FileInfo::deleteDirectoryRecursive() const
{
if (isDir() == false ) return false;
if (isDir() == false )
return false;
std::vector<Base::FileInfo> List = getDirectoryContent();
for (std::vector<Base::FileInfo>::iterator It = List.begin();It!=List.end();++It) {

View File

@@ -61,7 +61,8 @@ Py::Vector::Vector (const Base::Vector3f& v)
Py::Vector& Py::Vector::operator= (PyObject* rhsp)
{
if(ptr() == rhsp) return *this;
if(ptr() == rhsp)
return *this;
set (rhsp, false);
return *this;
}

View File

@@ -511,7 +511,8 @@ void InterpreterSingleton::addType(PyTypeObject* Type,PyObject* Module, const ch
// NOTE: To finish the initialization of our own type objects we must
// call PyType_Ready, otherwise we run into a segmentation fault, later on.
// This function is responsible for adding inherited slots from a type's base class.
if (PyType_Ready(Type) < 0) return;
if (PyType_Ready(Type) < 0)
return;
union PyType_Object pyType = {Type};
PyModule_AddObject(Module, Name, pyType.o);
}

View File

@@ -539,7 +539,8 @@ void Matrix_gauss(Matrix a, Matrix b)
}
indxr[i] = irow;
indxc[i] = icol;
if (a[4*icol+icol] == 0.0) return;
if (a[4*icol+icol] == 0.0)
return;
pivinv = 1.0/a[4*icol+icol];
a[4*icol+icol] = 1.0;
for (l = 0; l < 4; l++)

View File

@@ -413,7 +413,8 @@ bool ParameterGrp::GetBool(const char* Name, bool bPreset) const
// check if Element in group
DOMElement *pcElem = FindElement(_pGroupNode,"FCBool",Name);
// if not return preset
if (!pcElem) return bPreset;
if (!pcElem)
return bPreset;
// if yes check the value and return
if (strcmp(StrX(pcElem->getAttribute(XStr("Value").unicodeForm())).c_str(),"1"))
return false;
@@ -480,7 +481,8 @@ long ParameterGrp::GetInt(const char* Name, long lPreset) const
// check if Element in group
DOMElement *pcElem = FindElement(_pGroupNode,"FCInt",Name);
// if not return preset
if (!pcElem) return lPreset;
if (!pcElem)
return lPreset;
// if yes check the value and return
return atol (StrX(pcElem->getAttribute(XStr("Value").unicodeForm())).c_str());
}
@@ -541,7 +543,8 @@ unsigned long ParameterGrp::GetUnsigned(const char* Name, unsigned long lPreset)
// check if Element in group
DOMElement *pcElem = FindElement(_pGroupNode,"FCUInt",Name);
// if not return preset
if (!pcElem) return lPreset;
if (!pcElem)
return lPreset;
// if yes check the value and return
return strtoul (StrX(pcElem->getAttribute(XStr("Value").unicodeForm())).c_str(),nullptr,10);
}
@@ -602,7 +605,8 @@ double ParameterGrp::GetFloat(const char* Name, double dPreset) const
// check if Element in group
DOMElement *pcElem = FindElement(_pGroupNode,"FCFloat",Name);
// if not return preset
if (!pcElem) return dPreset;
if (!pcElem)
return dPreset;
// if yes check the value and return
return atof (StrX(pcElem->getAttribute(XStr("Value").unicodeForm())).c_str());
}

View File

@@ -430,7 +430,8 @@ double num_change(char* yytext,char dez_delim,char grp_delim)
else
temp[i++] = *c;
// check buffer overflow
if (i>39) return 0.0;
if (i>39)
return 0.0;
}
temp[i] = '\0';

View File

@@ -242,7 +242,8 @@ DWORD64
static void MyStrCpy(char* szDest, size_t nMaxDestSize, const char* szSrc)
{
if (nMaxDestSize <= 0) return;
if (nMaxDestSize <= 0)
return;
if (strlen(szSrc) < nMaxDestSize)
{
strcpy_s(szDest, nMaxDestSize, szSrc);

View File

@@ -145,7 +145,8 @@ bool BoundBox2d::Intersect(const Polygon2d &rclPoly) const
return true; /***** RETURN INTERSECTION *********/
// test intersections of bound-lines
if (rclPoly.GetCtVectors() < 3) return false;
if (rclPoly.GetCtVectors() < 3)
return false;
for (i = 0; i < rclPoly.GetCtVectors(); i++)
{
if (i == rclPoly.GetCtVectors() - 1)
@@ -288,7 +289,8 @@ static short _CalcTorsion (double *pfLine, double fX, double fY)
// Abort at line points within a quadrant
// Abort at non-intersecting line points
if (abs (sQuad[0] - sQuad[1]) <= 1) return 0;
if (abs (sQuad[0] - sQuad[1]) <= 1)
return 0;
// Both points to the left of ulX
if (abs (sQuad[0] - sQuad[1]) == 3)
@@ -317,7 +319,8 @@ bool Polygon2d::Contains (const Vector2d &rclV) const
short sTorsion = 0;
// Error check
if (GetCtVectors() < 3) return false;
if (GetCtVectors() < 3)
return false;
// for all polygon lines
for (i = 0; i < GetCtVectors(); i++)

View File

@@ -426,45 +426,84 @@ QString Unit::getString() const
QString Unit::getTypeString() const
{
if(*this == Unit::Length ) return QString::fromLatin1("Length");
if(*this == Unit::Area ) return QString::fromLatin1("Area");
if(*this == Unit::Volume ) return QString::fromLatin1("Volume");
if(*this == Unit::Mass ) return QString::fromLatin1("Mass");
if(*this == Unit::Angle ) return QString::fromLatin1("Angle");
if(*this == Unit::Density ) return QString::fromLatin1("Density");
if(*this == Unit::TimeSpan ) return QString::fromLatin1("TimeSpan");
if(*this == Unit::Frequency ) return QString::fromLatin1("Frequency");
if(*this == Unit::Velocity ) return QString::fromLatin1("Velocity");
if(*this == Unit::Acceleration ) return QString::fromLatin1("Acceleration");
if(*this == Unit::Temperature ) return QString::fromLatin1("Temperature");
if(*this == Unit::ElectricCurrent ) return QString::fromLatin1("ElectricCurrent");
if(*this == Unit::ElectricPotential ) return QString::fromLatin1("ElectricPotential");
if(*this == Unit::ElectricCharge ) return QString::fromLatin1("ElectricCharge");
if(*this == Unit::MagneticFieldStrength ) return QString::fromLatin1("MagneticFieldStrength");
if(*this == Unit::MagneticFlux ) return QString::fromLatin1("MagneticFlux");
if(*this == Unit::MagneticFluxDensity ) return QString::fromLatin1("MagneticFluxDensity");
if(*this == Unit::ElectricalCapacitance ) return QString::fromLatin1("ElectricalCapacitance");
if(*this == Unit::ElectricalInductance ) return QString::fromLatin1("ElectricalInductance");
if(*this == Unit::ElectricalConductance ) return QString::fromLatin1("ElectricalConductance");
if(*this == Unit::ElectricalResistance ) return QString::fromLatin1("ElectricalResistance");
if(*this == Unit::ElectricalConductivity ) return QString::fromLatin1("ElectricalConductivity");
if(*this == Unit::AmountOfSubstance ) return QString::fromLatin1("AmountOfSubstance");
if(*this == Unit::LuminousIntensity ) return QString::fromLatin1("LuminousIntensity");
if(*this == Unit::Pressure ) return QString::fromLatin1("Pressure");
if(*this == Unit::Force ) return QString::fromLatin1("Force");
if(*this == Unit::Work ) return QString::fromLatin1("Work");
if(*this == Unit::Power ) return QString::fromLatin1("Power");
if(*this == Unit::Stiffness ) return QString::fromLatin1("Stiffness");
if(*this == Unit::SpecificEnergy ) return QString::fromLatin1("SpecificEnergy");
if(*this == Unit::ThermalConductivity ) return QString::fromLatin1("ThermalConductivity");
if(*this == Unit::ThermalExpansionCoefficient ) return QString::fromLatin1("ThermalExpansionCoefficient");
if(*this == Unit::VolumetricThermalExpansionCoefficient ) return QString::fromLatin1("VolumetricThermalExpansionCoefficient");
if(*this == Unit::SpecificHeat ) return QString::fromLatin1("SpecificHeat");
if(*this == Unit::ThermalTransferCoefficient ) return QString::fromLatin1("ThermalTransferCoefficient");
if(*this == Unit::HeatFlux ) return QString::fromLatin1("HeatFlux");
if(*this == Unit::DynamicViscosity ) return QString::fromLatin1("DynamicViscosity");
if(*this == Unit::KinematicViscosity ) return QString::fromLatin1("KinematicViscosity");
if(*this == Unit::VacuumPermittivity ) return QString::fromLatin1("VacuumPermittivity");
if(*this == Unit::Length )
return QString::fromLatin1("Length");
if(*this == Unit::Area )
return QString::fromLatin1("Area");
if(*this == Unit::Volume )
return QString::fromLatin1("Volume");
if(*this == Unit::Mass )
return QString::fromLatin1("Mass");
if(*this == Unit::Angle )
return QString::fromLatin1("Angle");
if(*this == Unit::Density )
return QString::fromLatin1("Density");
if(*this == Unit::TimeSpan )
return QString::fromLatin1("TimeSpan");
if(*this == Unit::Frequency )
return QString::fromLatin1("Frequency");
if(*this == Unit::Velocity )
return QString::fromLatin1("Velocity");
if(*this == Unit::Acceleration )
return QString::fromLatin1("Acceleration");
if(*this == Unit::Temperature )
return QString::fromLatin1("Temperature");
if(*this == Unit::ElectricCurrent )
return QString::fromLatin1("ElectricCurrent");
if(*this == Unit::ElectricPotential )
return QString::fromLatin1("ElectricPotential");
if(*this == Unit::ElectricCharge )
return QString::fromLatin1("ElectricCharge");
if(*this == Unit::MagneticFieldStrength )
return QString::fromLatin1("MagneticFieldStrength");
if(*this == Unit::MagneticFlux )
return QString::fromLatin1("MagneticFlux");
if(*this == Unit::MagneticFluxDensity )
return QString::fromLatin1("MagneticFluxDensity");
if(*this == Unit::ElectricalCapacitance )
return QString::fromLatin1("ElectricalCapacitance");
if(*this == Unit::ElectricalInductance )
return QString::fromLatin1("ElectricalInductance");
if(*this == Unit::ElectricalConductance )
return QString::fromLatin1("ElectricalConductance");
if(*this == Unit::ElectricalResistance )
return QString::fromLatin1("ElectricalResistance");
if(*this == Unit::ElectricalConductivity )
return QString::fromLatin1("ElectricalConductivity");
if(*this == Unit::AmountOfSubstance )
return QString::fromLatin1("AmountOfSubstance");
if(*this == Unit::LuminousIntensity )
return QString::fromLatin1("LuminousIntensity");
if(*this == Unit::Pressure )
return QString::fromLatin1("Pressure");
if(*this == Unit::Force )
return QString::fromLatin1("Force");
if(*this == Unit::Work )
return QString::fromLatin1("Work");
if(*this == Unit::Power )
return QString::fromLatin1("Power");
if(*this == Unit::Stiffness )
return QString::fromLatin1("Stiffness");
if(*this == Unit::SpecificEnergy )
return QString::fromLatin1("SpecificEnergy");
if(*this == Unit::ThermalConductivity )
return QString::fromLatin1("ThermalConductivity");
if(*this == Unit::ThermalExpansionCoefficient )
return QString::fromLatin1("ThermalExpansionCoefficient");
if(*this == Unit::VolumetricThermalExpansionCoefficient )
return QString::fromLatin1("VolumetricThermalExpansionCoefficient");
if(*this == Unit::SpecificHeat )
return QString::fromLatin1("SpecificHeat");
if(*this == Unit::ThermalTransferCoefficient )
return QString::fromLatin1("ThermalTransferCoefficient");
if(*this == Unit::HeatFlux )
return QString::fromLatin1("HeatFlux");
if(*this == Unit::DynamicViscosity )
return QString::fromLatin1("DynamicViscosity");
if(*this == Unit::KinematicViscosity )
return QString::fromLatin1("KinematicViscosity");
if(*this == Unit::VacuumPermittivity )
return QString::fromLatin1("VacuumPermittivity");
return QString();