From 702b41781c8d57616265319a83647ef64a9bcc10 Mon Sep 17 00:00:00 2001 From: Florent Lamiraux <florent@laas.fr> Date: Thu, 14 May 2015 17:02:23 +0200 Subject: [PATCH] Fix compilation warnings - homogeneize integer types : int -> std::size_t - explicitely cast when necessary. --- include/hpp/manipulation/graph/graph-component.hh | 6 +++--- src/graph-path-validation.cc | 4 ++-- src/graph/graph-component.cc | 6 +++--- src/graph/statistics.cc | 5 +++-- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/include/hpp/manipulation/graph/graph-component.hh b/include/hpp/manipulation/graph/graph-component.hh index 264d657..a725c12 100644 --- a/include/hpp/manipulation/graph/graph-component.hh +++ b/include/hpp/manipulation/graph/graph-component.hh @@ -49,10 +49,10 @@ namespace hpp { /// Get the component by its ID. The validity of the GraphComponent /// is not checked. - static GraphComponentWkPtr_t get(int id); + static GraphComponentWkPtr_t get(std::size_t id); /// Return the component id. - int id () const; + std::size_t id () const; /// Add core::NumericalConstraint to the component. /// \param passiveDofs see ConfigProjector::addNumericalConstraint @@ -123,7 +123,7 @@ namespace hpp { /// Weak pointer to itself. GraphComponentWkPtr_t wkPtr_; /// ID of the component (index in components vector). - int id_; + std::size_t id_; }; std::ostream& operator<< (std::ostream& os, const GraphComponent& graphComp); diff --git a/src/graph-path-validation.cc b/src/graph-path-validation.cc index 9104c20..94a070e 100644 --- a/src/graph-path-validation.cc +++ b/src/graph-path-validation.cc @@ -54,12 +54,12 @@ namespace hpp { if (reverse) { // TODO: This has never been tested. assert (!reverse && "This has never been tested with reverse path"); - for (int i = path->numberPaths () - 1; i >= 0; i--) { + for (long int i = path->numberPaths () - 1; i >= 0; i--) { // We should stop at the first non valid subpath. if (!impl_validate (path->pathAtRank (i), true, validSubPart)) { PathVectorPtr_t p = PathVector::create (path->outputSize(), path->outputDerivativeSize()); - for (int v = path->numberPaths () - 1; v > i; v--) + for (long int v = path->numberPaths () - 1; v > i; v--) p->appendPath (path->pathAtRank(i)->copy()); // TODO: Make sure this subpart is generated by the steering method. p->appendPath (validSubPart); diff --git a/src/graph/graph-component.cc b/src/graph/graph-component.cc index 2273372..f4ee613 100644 --- a/src/graph/graph-component.cc +++ b/src/graph/graph-component.cc @@ -37,16 +37,16 @@ namespace hpp { name_ = name; } - GraphComponentWkPtr_t GraphComponent::get(int id) + GraphComponentWkPtr_t GraphComponent::get(std::size_t id) { # ifdef HPP_DEBUG - if (id < 0 || id >= (int)components.size()) + if (id < 0 || id >= components.size()) throw std::out_of_range ("ID out of range."); # endif // HPP_DEBUG return components[id]; } - int GraphComponent::id () const + std::size_t GraphComponent::id () const { return id_; } diff --git a/src/graph/statistics.cc b/src/graph/statistics.cc index 036acbc..b012763 100644 --- a/src/graph/statistics.cc +++ b/src/graph/statistics.cc @@ -158,7 +158,8 @@ namespace hpp { { ConfigProjectorPtr_t p = constraint_->configProjector (); if (p) { - threshold_ = p->errorThreshold () / sqrt(p->rightHandSide ().size ()); + threshold_ = p->errorThreshold () / + sqrt((double)p->rightHandSide ().size ()); } } @@ -171,7 +172,7 @@ namespace hpp { (*n->configuration ()), &threshold_)); } else { - it = insert (LeafBin (vector_t (0), &threshold_)); + it = insert (LeafBin (vector_t (), &threshold_)); } it->push_back (n); if (numberOfObservations()%10 == 0) { -- GitLab