From 1dcb24224820a46f2eb813b62d152f38caad6335 Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <github@naumov.de> Date: Tue, 10 Sep 2019 20:11:28 +0200 Subject: [PATCH] clang-tidy; readability-braces-around-statements. --- .../DataExplorer/DataView/DiagramView/DiagramList.cpp | 2 ++ Applications/FileIO/GocadIO/GocadAsciiReader.cpp | 2 ++ Applications/Utils/FileConverter/GocadTSurfaceReader.cpp | 6 ++++++ Applications/Utils/FileConverter/Mesh2Shape.cpp | 2 ++ .../Utils/MeshGeoTools/createIntermediateRasters.cpp | 8 ++++++++ MaterialLib/Fluid/FluidType/FluidType.cpp | 6 ++++++ ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp | 2 ++ 7 files changed, 28 insertions(+) diff --git a/Applications/DataExplorer/DataView/DiagramView/DiagramList.cpp b/Applications/DataExplorer/DataView/DiagramView/DiagramList.cpp index fe747dc0bcb..fad4cbaef2d 100644 --- a/Applications/DataExplorer/DataView/DiagramView/DiagramList.cpp +++ b/Applications/DataExplorer/DataView/DiagramView/DiagramList.cpp @@ -34,7 +34,9 @@ float DiagramList::calcMinXValue() _coords.begin(), _coords.end(), [](auto const& c0, auto const& c1) { return c0.first < c1.first; }); if (min != _coords.end()) + { return min->first; + } return std::numeric_limits<float>::max(); } diff --git a/Applications/FileIO/GocadIO/GocadAsciiReader.cpp b/Applications/FileIO/GocadIO/GocadAsciiReader.cpp index 447745b7900..cecdd4db378 100644 --- a/Applications/FileIO/GocadIO/GocadAsciiReader.cpp +++ b/Applications/FileIO/GocadIO/GocadAsciiReader.cpp @@ -537,7 +537,9 @@ MeshLib::Mesh* createMesh(std::ifstream& in, DataType type, return_val = parser(in, nodes, elems, node_id_map, mesh_prop); if (return_val) + { return new MeshLib::Mesh(mesh_name, nodes, elems, mesh_prop); + } ERR("Error parsing %s %s.", dataType2ShortString(type).c_str(), mesh_name.c_str()); clearData(nodes, elems); diff --git a/Applications/Utils/FileConverter/GocadTSurfaceReader.cpp b/Applications/Utils/FileConverter/GocadTSurfaceReader.cpp index 0aa14a89fed..710ab57b6a9 100644 --- a/Applications/Utils/FileConverter/GocadTSurfaceReader.cpp +++ b/Applications/Utils/FileConverter/GocadTSurfaceReader.cpp @@ -74,9 +74,13 @@ int main(int argc, char* argv[]) FileIO::Gocad::DataType t(FileIO::Gocad::DataType::ALL); if (export_lines_arg.isSet()) + { t = FileIO::Gocad::DataType::PLINE; + } if (export_surfaces_arg.isSet()) + { t = FileIO::Gocad::DataType::TSURF; + } std::vector<std::unique_ptr<MeshLib::Mesh>> meshes; if (!FileIO::Gocad::GocadAsciiReader::readFile(file_name, meshes, t)) { @@ -90,7 +94,9 @@ int main(int argc, char* argv[]) for (auto& mesh : meshes) { if (mesh == nullptr) + { continue; + } INFO("Writing mesh \"%s\"", mesh->getName().c_str()); int data_mode = (write_binary) ? 2 : 0; bool compressed = (write_binary); diff --git a/Applications/Utils/FileConverter/Mesh2Shape.cpp b/Applications/Utils/FileConverter/Mesh2Shape.cpp index 8fda2f7fccf..8abff7ec43a 100644 --- a/Applications/Utils/FileConverter/Mesh2Shape.cpp +++ b/Applications/Utils/FileConverter/Mesh2Shape.cpp @@ -46,6 +46,8 @@ int main(int argc, char* argv[]) std::unique_ptr<MeshLib::Mesh> const mesh( MeshLib::IO::readMeshFromFile(file_name)); if (FileIO::SHPInterface::write2dMeshToSHP(output_arg.getValue(), *mesh)) + { return EXIT_SUCCESS; + } return EXIT_FAILURE; } diff --git a/Applications/Utils/MeshGeoTools/createIntermediateRasters.cpp b/Applications/Utils/MeshGeoTools/createIntermediateRasters.cpp index 4d78b426d6f..7f58c41846e 100644 --- a/Applications/Utils/MeshGeoTools/createIntermediateRasters.cpp +++ b/Applications/Utils/MeshGeoTools/createIntermediateRasters.cpp @@ -56,7 +56,9 @@ int main(int argc, char* argv[]) FileIO::AsciiRasterInterface::readRaster(input2_arg.getValue())); if (dem1 == nullptr || dem2 == nullptr) + { return 1; + } GeoLib::RasterHeader const& h1 = dem1->getHeader(); GeoLib::RasterHeader const& h2 = dem2->getHeader(); @@ -89,7 +91,9 @@ int main(int argc, char* argv[]) } if (errors_found) + { return 2; + } std::size_t const n = number_arg.getValue(); std::vector<std::vector<double>> raster; @@ -111,7 +115,9 @@ int main(int argc, char* argv[]) if (*it1 == h1.no_data || *it2 == h2.no_data) { for (std::size_t i = 0; i < n; ++i) + { raster[i].push_back(h1.no_data); + } } else { @@ -119,7 +125,9 @@ int main(int argc, char* argv[]) double const max = std::max(*it1, *it2); double const step = (max - min) / static_cast<double>(n + 1); for (std::size_t i = 0; i < n; ++i) + { raster[i].push_back(min + ((i+1) * step)); + } } it2++; } diff --git a/MaterialLib/Fluid/FluidType/FluidType.cpp b/MaterialLib/Fluid/FluidType/FluidType.cpp index 2faf9aa7828..2279f2c4321 100644 --- a/MaterialLib/Fluid/FluidType/FluidType.cpp +++ b/MaterialLib/Fluid/FluidType/FluidType.cpp @@ -17,11 +17,17 @@ namespace FluidType Fluid_Type strToFluidType(std::string const& s) { if (s == "incompressible_fluid") + { return Fluid_Type::INCOMPRESSIBLE_FLUID; + } if (s == "compressible_fluid") + { return Fluid_Type::COMPRESSIBLE_FLUID; + } if (s == "ideal_gas") + { return Fluid_Type::IDEAL_GAS; + } OGS_FATAL("This fluid type is unavailable. The available types are \n" "incompressible_fluid, compressible_fluid and ideal_gas.\n"); } diff --git a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp index 444684c2458..125fc0ca4a1 100644 --- a/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp +++ b/ProcessLib/ThermoMechanics/ThermoMechanicsProcess.cpp @@ -433,7 +433,9 @@ void ThermoMechanicsProcess<DisplacementDim>::postTimestepConcreteProcess( int const process_id) { if (process_id != _process_data.mechanics_process_id) + { return; + } DBUG("PostTimestep ThermoMechanicsProcess."); -- GitLab