diff --git a/src/ign.cc b/src/ign.cc index 43e39b2b9..b3aca2517 100644 --- a/src/ign.cc +++ b/src/ign.cc @@ -288,7 +288,6 @@ extern "C" SDFORMAT_VISIBLE int cmdInertialStats( if (!errors.empty()) { std::cerr << errors << std::endl; - return -1; } if (root.WorldCount() > 0) @@ -348,7 +347,7 @@ extern "C" SDFORMAT_VISIBLE int cmdInertialStats( ss << totalInertial.Moi(); std::string s; - auto maxLength = 0u; + size_t maxLength = 0u; std::vector moiVector; while ( std::getline(ss, s, ' ' ) ) { @@ -361,10 +360,10 @@ extern "C" SDFORMAT_VISIBLE int cmdInertialStats( for (int i = 0; i < 9; i++) { - int spacePadding = maxLength - moiVector[i].size(); + size_t spacePadding = maxLength - moiVector[i].size(); // Print the matrix element std::cout << moiVector[i]; - for (int j = 0; j < spacePadding; j++) + for (size_t j = 0; j < spacePadding; j++) { std::cout << " "; } diff --git a/src/ign_TEST.cc b/src/ign_TEST.cc index 2376a4cf2..9963647e6 100644 --- a/src/ign_TEST.cc +++ b/src/ign_TEST.cc @@ -1839,7 +1839,21 @@ TEST(inertial_stats, IGN_UTILS_TEST_DISABLED_ON_WIN32(SDF)) } expectedOutput = - "Error Code 18: Msg: A link named link has invalid inertia.\n\n"; + "Error Code 18: Msg: A link named link has invalid inertia.\n\n" + "Inertial statistics for model: model\n" + "---\n" + "Total mass of the model: 0\n" + "---\n" + "Centre of mass in model frame: \n" + "X: 0\n" + "Y: 0\n" + "Z: 0\n" + "---\n" + "Moment of inertia matrix: \n" + "0 0 0 \n" + "0 0 0 \n" + "0 0 0 \n" + "---\n"; // Check an invalid SDF file by passing the absolute path {