From fc93cf0ea08ca056d27594eb777beb3f26ae76c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sergi=20Hern=C3=A0ndez=20Juan?= <shernand@iri.upc.edu>
Date: Wed, 18 Oct 2017 07:58:53 +0000
Subject: [PATCH] Added a return statement in all the functions returning a
 value. Removed some unused internal variables.

---
 include/iri_ros_tools/module_action.h     | 2 --
 include/iri_ros_tools/module_dyn_reconf.h | 4 ++++
 include/iri_ros_tools/module_service.h    | 2 --
 src/timeout.cpp                           | 2 ++
 4 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/include/iri_ros_tools/module_action.h b/include/iri_ros_tools/module_action.h
index 0af4c93..cc6c7f0 100644
--- a/include/iri_ros_tools/module_action.h
+++ b/include/iri_ros_tools/module_action.h
@@ -503,8 +503,6 @@ class CModuleAction
 template<class action_ros>
 CModuleAction<action_ros>::CModuleAction(const std::string &name,const std::string &name_space):nh(ros::this_node::getName()+"/"+name_space)
 {
-  std::size_t position;
-
   this->name=this->nh.getNamespace()+"/"+name;
   this->status=ACTION_IDLE;
   // retry control
diff --git a/include/iri_ros_tools/module_dyn_reconf.h b/include/iri_ros_tools/module_dyn_reconf.h
index 21f4aff..091a051 100644
--- a/include/iri_ros_tools/module_dyn_reconf.h
+++ b/include/iri_ros_tools/module_dyn_reconf.h
@@ -231,6 +231,7 @@ bool CModuleDynReconf::set_parameter(const std::string &name,bool value)
     case ACT_SRV_FAIL: ROS_ERROR_STREAM("CModuleDynReconf::set_parameters: Request failed on server: " << this->get_name());
                        return false;
                        break;
+    default: return false;
   }
 }
 
@@ -255,6 +256,7 @@ bool CModuleDynReconf::set_parameter(const std::string &name,int value)
     case ACT_SRV_FAIL: ROS_ERROR_STREAM("CModuleDynReconf::set_parameters: Request failed on server: " << this->get_name());
                        return false;
                        break;
+    default: return false;
   }
 }
 
@@ -279,6 +281,7 @@ bool CModuleDynReconf::set_parameter(const std::string &name,std::string &value)
     case ACT_SRV_FAIL: ROS_ERROR_STREAM("CModuleDynReconf::set_parameters: Request failed on server: " << this->get_name());
                        return false;
                        break;
+    default: return false;
   }
 }
 
@@ -303,6 +306,7 @@ bool CModuleDynReconf::set_parameter(const std::string &name,double value)
     case ACT_SRV_FAIL: ROS_ERROR_STREAM("CModuleDynReconf::set_parameters: Request failed on server: " << this->get_name());
                        return false;
                        break;
+    default: return false;
   }
 }
 
diff --git a/include/iri_ros_tools/module_service.h b/include/iri_ros_tools/module_service.h
index 518a927..e05dce2 100644
--- a/include/iri_ros_tools/module_service.h
+++ b/include/iri_ros_tools/module_service.h
@@ -171,8 +171,6 @@ class CModuleService
 template<class service_msg>
 CModuleService<service_msg>::CModuleService(const std::string &name,const std::string &name_space):nh(ros::this_node::getName()+"/"+name_space)
 {
-  std::size_t position;
-
   this->current_num_retries=0;
   this->max_num_retries=DEFAULT_SERVICE_MAX_RETRIES;
   this->service_client=this->nh.template serviceClient<service_msg>(name); 
diff --git a/src/timeout.cpp b/src/timeout.cpp
index 600c910..5d003e5 100644
--- a/src/timeout.cpp
+++ b/src/timeout.cpp
@@ -44,6 +44,8 @@ bool CROSTimeout::timed_out(void)
       return false;
     }
   }
+  else
+    return false;
 }
 
 CROSTimeout::~CROSTimeout()
-- 
GitLab