From 59b578f1559b284cb6c74e86e3997bb7cacf79e0 Mon Sep 17 00:00:00 2001 From: Henry Weller Date: Sun, 17 Jan 2016 18:56:28 +0000 Subject: [PATCH] Provide consistency in assignment operators Always return void to avoid various bugs associated with automatic type conversion. Resolves request http://openfoam.org/mantisbt/view.php?id=1973 --- .../indexedVertex/indexedVertex.H | 4 +- .../Lists/PackedList/PackedBoolList.C | 7 +- .../Lists/PackedList/PackedBoolList.H | 12 +- .../Lists/PackedList/PackedBoolListI.H | 22 +--- .../containers/Lists/PackedList/PackedList.C | 12 +- .../containers/Lists/PackedList/PackedList.H | 16 +-- .../containers/Lists/PackedList/PackedListI.H | 33 +++--- .../containers/Lists/PtrList/PtrList.C | 5 +- .../containers/Lists/PtrList/PtrList.H | 3 +- src/OpenFOAM/primitives/bools/Switch/Switch.H | 8 +- src/OpenFOAM/primitives/complex/complex.H | 6 +- src/OpenFOAM/primitives/complex/complexI.H | 8 +- .../primitives/nullObject/nullObject.H | 8 +- .../primitives/strings/fileName/fileName.C | 111 ++++-------------- .../primitives/strings/fileName/fileName.H | 56 +++++++-- .../primitives/strings/keyType/keyType.H | 10 +- .../primitives/strings/keyType/keyTypeI.H | 14 +-- src/OpenFOAM/primitives/strings/word/word.H | 10 +- src/OpenFOAM/primitives/strings/word/wordI.H | 14 +-- .../primitives/strings/wordRe/wordRe.H | 14 +-- .../primitives/strings/wordRe/wordReI.H | 20 ++-- .../RAS/buoyantKEpsilon/buoyantKEpsilon.H | 4 +- .../RAS/LamBremhorstKE/LamBremhorstKE.H | 4 +- .../phaseCompressible/LES/Niceno/NicenoKEqn.H | 4 +- .../LES/SmagorinskyZhang/SmagorinskyZhang.H | 4 +- .../LES/continuousGasKEqn/continuousGasKEqn.H | 4 +- .../RAS/LaheyKEpsilon/LaheyKEpsilon.H | 4 +- .../continuousGasKEpsilon.H | 4 +- .../RAS/kOmegaSSTSato/kOmegaSSTSato.H | 4 +- .../RAS/mixtureKEpsilon/mixtureKEpsilon.H | 2 +- .../DeardorffDiffStress/DeardorffDiffStress.H | 2 +- .../LES/LESeddyViscosity/LESeddyViscosity.H | 2 +- .../LES/Smagorinsky/Smagorinsky.H | 4 +- .../SpalartAllmarasDDES/SpalartAllmarasDDES.H | 4 +- .../SpalartAllmarasDES/SpalartAllmarasDES.H | 4 +- .../SpalartAllmarasIDDES.H | 4 +- .../turbulenceModels/LES/WALE/WALE.H | 4 +- .../LES/dynamicKEqn/dynamicKEqn.H | 4 +- .../LES/dynamicLagrangian/dynamicLagrangian.H | 4 +- .../turbulenceModels/LES/kEqn/kEqn.H | 4 +- .../turbulenceModels/RAS/LRR/LRR.H | 2 +- .../RAS/LaunderSharmaKE/LaunderSharmaKE.H | 2 +- .../RAS/RNGkEpsilon/RNGkEpsilon.H | 2 +- .../turbulenceModels/RAS/SSG/SSG.H | 2 +- .../RAS/SpalartAllmaras/SpalartAllmaras.H | 2 +- .../turbulenceModels/RAS/kEpsilon/kEpsilon.H | 2 +- .../RAS/kOmegaSST/kOmegaSST.H | 2 +- .../RAS/kOmegaSSTSAS/kOmegaSSTSAS.H | 4 +- .../const/constAnIsoSolidTransport.H | 7 +- .../const/constAnIsoSolidTransportI.H | 5 +- .../transport/const/constIsoSolidTransport.H | 7 +- .../transport/const/constIsoSolidTransportI.H | 4 +- .../exponential/exponentialSolidTransport.H | 7 +- .../exponential/exponentialSolidTransportI.H | 4 +- .../polynomial/polynomialSolidTransport.H | 7 +- .../polynomial/polynomialSolidTransportI.H | 5 +- .../equationOfState/Boussinesq/Boussinesq.H | 7 +- .../equationOfState/Boussinesq/BoussinesqI.H | 6 +- .../icoPolynomial/icoPolynomial.H | 2 +- .../icoPolynomial/icoPolynomialI.H | 5 +- .../incompressiblePerfectGas.H | 7 +- .../incompressiblePerfectGasI.H | 7 +- .../thermo/hPolynomial/hPolynomialThermo.H | 4 +- .../thermo/hPolynomial/hPolynomialThermoI.H | 7 +- .../specie/transport/const/constTransport.H | 4 +- .../specie/transport/const/constTransportI.H | 4 +- .../polynomial/polynomialTransport.H | 4 +- .../polynomial/polynomialTransportI.H | 5 +- .../sutherland/sutherlandTransport.H | 4 +- .../sutherland/sutherlandTransportI.H | 5 +- 70 files changed, 245 insertions(+), 353 deletions(-) diff --git a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.H b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.H index 32ed1d2447..3cbc6acbc8 100644 --- a/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.H +++ b/applications/utilities/mesh/generation/foamyMesh/conformalVoronoiMesh/conformalVoronoiMesh/indexedVertex/indexedVertex.H @@ -258,7 +258,7 @@ public: //- Fix the vertex so that it can't be moved inline bool& fixed(); - inline indexedVertex& operator=(const indexedVertex& rhs) + inline void operator=(const indexedVertex& rhs) { Vb::operator=(rhs); @@ -268,8 +268,6 @@ public: this->alignment_ = rhs.alignment(); this->targetCellSize_ = rhs.targetCellSize(); this->vertexFixed_ = rhs.fixed(); - - return *this; } inline bool operator==(const indexedVertex& rhs) const diff --git a/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.C b/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.C index 69cdf15e74..791d53cc59 100644 --- a/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.C +++ b/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -286,8 +286,7 @@ Foam::Xfer Foam::PackedBoolList::used() const // * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * * // -Foam::PackedBoolList& -Foam::PackedBoolList::operator=(const Foam::UList& lst) +void Foam::PackedBoolList::operator=(const Foam::UList& lst) { this->setSize(lst.size()); @@ -296,8 +295,6 @@ Foam::PackedBoolList::operator=(const Foam::UList& lst) { set(elemI, lst[elemI]); } - - return *this; } diff --git a/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.H b/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.H index 904d6f1644..37620f97f8 100644 --- a/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.H +++ b/src/OpenFOAM/containers/Lists/PackedList/PackedBoolList.H @@ -191,24 +191,24 @@ public: // Member Operators //- Assignment of all entries to the given value. - inline PackedBoolList& operator=(const bool val); + inline void operator=(const bool val); //- Assignment operator. - inline PackedBoolList& operator=(const PackedBoolList&); + inline void operator=(const PackedBoolList&); //- Assignment operator. - inline PackedBoolList& operator=(const PackedList<1>&); + inline void operator=(const PackedList<1>&); //- Assignment operator. - PackedBoolList& operator=(const Foam::UList&); + void operator=(const Foam::UList&); //- Assignment operator, // using the labels as indices to indicate which bits are set - inline PackedBoolList& operator=(const labelUList& indices); + inline void operator=(const labelUList& indices); //- Assignment operator, // using the labels as indices to indicate which bits are set - inline PackedBoolList& operator=(const UIndirectList