[Fawkes Git] branch/timn/netconf-fixes: created (0.5.0-3082-gb4ded1b)

Tim Niemueller niemueller at kbsg.rwth-aachen.de
Tue Feb 23 16:19:46 CET 2016


Changes have been pushed for the project "Fawkes Robotics Software Framework".

Gitweb: http://git.fawkesrobotics.org/fawkes.git
Trac:   http://trac.fawkesrobotics.org

The branch, timn/netconf-fixes has been created
        at  b4ded1bc9721981dc7793e0e067be96f88290ba2 (commit)

http://git.fawkesrobotics.org/fawkes.git/timn/netconf-fixes

- *Log* ---------------------------------------------------------------
commit 8fd786fda1c049957a467b91dc675dae2cab54da
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Tue Feb 23 16:16:32 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Tue Feb 23 16:16:32 2016 +0100

    libconfig: fix variable shadowing in net handler
    
    The message preparation function had a local variable shadowing a
    reference variable intended to return the data size. This resulted in
    the data size always being zero and thus in invalid messages when
    retrieving individual values.

http://git.fawkesrobotics.org/fawkes.git/commit/8fd786f
http://trac.fawkesrobotics.org/changeset/8fd786f

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
commit b4ded1bc9721981dc7793e0e067be96f88290ba2
Author:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
AuthorDate: Tue Feb 23 16:17:40 2016 +0100
Commit:     Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
CommitDate: Tue Feb 23 16:17:40 2016 +0100

    libconfig: fix GCC optimization problem
    
    There was a problem that GCC 5.3 seems to apply some optimization which
    breaks the loop copying the values. Fix by making the loop counter
    volatile and make compiler being strict about loads and stores. Not sure
    what the actual cause of the problem is but proposed fix works for me.

http://git.fawkesrobotics.org/fawkes.git/commit/b4ded1b
http://trac.fawkesrobotics.org/changeset/b4ded1b

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


- *Summary* -----------------------------------------------------------
 src/libs/config/netconf.cpp |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)


- *Diffs* -------------------------------------------------------------

- *commit* 8fd786fda1c049957a467b91dc675dae2cab54da - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Tue Feb 23 16:16:32 2016 +0100
Subject: libconfig: fix variable shadowing in net handler

 src/libs/config/net_handler.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/config/net_handler.h b/src/libs/config/net_handler.h
index 164c098..805aca3 100644
--- a/src/libs/config/net_handler.h
+++ b/src/libs/config/net_handler.h
@@ -84,9 +84,9 @@ class ConfigNetworkHandler
   template <typename T>
   void *
     prepare_value_msg(const char *path, bool is_default, bool is_list,
-		      uint16_t num_values, size_t &datasize, void * __attribute__((__may_alias__)) * data)
+		      uint16_t num_values, size_t &data_size, void * __attribute__((__may_alias__)) * data)
   {
-    size_t data_size = sizeof(config_descriptor_t) + sizeof(T) * (is_list ? num_values : 1);
+    data_size = sizeof(config_descriptor_t) + sizeof(T) * (is_list ? num_values : 1);
     void* m = calloc(1, data_size);
     config_descriptor_t *cd = (config_descriptor_t *)m;
     strncpy(cd->path, path, CONFIG_MSG_PATH_LENGTH);

- *commit* b4ded1bc9721981dc7793e0e067be96f88290ba2 - - - - - - - - - -
Author:  Tim Niemueller <niemueller at kbsg.rwth-aachen.de>
Date:    Tue Feb 23 16:17:40 2016 +0100
Subject: libconfig: fix GCC optimization problem

 src/libs/config/netconf.cpp |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/config/netconf.cpp b/src/libs/config/netconf.cpp
index 7586d8a..d7a4bec 100644
--- a/src/libs/config/netconf.cpp
+++ b/src/libs/config/netconf.cpp
@@ -966,7 +966,7 @@ NetworkConfiguration::inbound_received(FawkesNetworkMessage *m,
 				       unsigned int id) throw()
 {
   if ( m->cid() == FAWKES_CID_CONFIGMANAGER ) {
-
+	  
     if ( __mirror_mode ) {
       switch (m->msgid()) {
       case MSG_CONFIG_LIST:
@@ -984,7 +984,7 @@ NetworkConfiguration::inbound_received(FawkesNetworkMessage *m,
 		  (float *)((char *)cle + sizeof(config_list_entity_header_t));
 		if (cle->cp.num_values > 0) {
 		  std::vector<float> values(cle->cp.num_values, 0);
-		  for (unsigned int j = 0; j < cle->cp.num_values; ++j) {
+		  for (volatile unsigned int j = 0; j < cle->cp.num_values; ++j) {
 		    values[j] = msg_values[j];
 		  }
 		  mirror_config->set_floats(cle->cp.path, values);
@@ -1004,7 +1004,7 @@ NetworkConfiguration::inbound_received(FawkesNetworkMessage *m,
 		  (int32_t *)((char *)cle + sizeof(config_list_entity_header_t));
 		if (cle->cp.num_values > 0) {
 		  std::vector<int32_t> values(cle->cp.num_values, 0);
-		  for (unsigned int j = 0; j < cle->cp.num_values; ++j) {
+		  for (volatile unsigned int j = 0; j < cle->cp.num_values; ++j) {
 		    values[j] = msg_values[j];
 		  }
 		  mirror_config->set_ints(cle->cp.path, values);
@@ -1024,7 +1024,7 @@ NetworkConfiguration::inbound_received(FawkesNetworkMessage *m,
 		  (uint32_t *)((char *)cle + sizeof(config_list_entity_header_t));
 		if (cle->cp.num_values > 0) {
 		  std::vector<uint32_t> values(cle->cp.num_values, 0);
-		  for (unsigned int j = 0; j < cle->cp.num_values; ++j) {
+		  for (volatile unsigned int j = 0; j < cle->cp.num_values; ++j) {
 		    values[j] = msg_values[j];
 		  }
 		  mirror_config->set_uints(cle->cp.path, values);
@@ -1044,7 +1044,7 @@ NetworkConfiguration::inbound_received(FawkesNetworkMessage *m,
 		  (int32_t *)((char *)cle + sizeof(config_list_entity_header_t));
 		if (cle->cp.num_values > 0) {
 		  std::vector<bool> values(cle->cp.num_values, 0);
-		  for (unsigned int j = 0; j < cle->cp.num_values; ++j) {
+		  for (volatile unsigned int j = 0; j < cle->cp.num_values; ++j) {
 		    values[j] = (msg_values[j] != 0);
 		  }
 		  mirror_config->set_bools(cle->cp.path, values);
@@ -1063,7 +1063,7 @@ NetworkConfiguration::inbound_received(FawkesNetworkMessage *m,
 		char *tmpdata = (char *)cle + sizeof(config_list_entity_header_t);
 		if (cle->cp.num_values > 0) {
 		  std::vector<std::string> values(cle->cp.num_values, "");
-		  for (unsigned int j = 0; j < cle->cp.num_values; ++j) {
+		  for (volatile unsigned int j = 0; j < cle->cp.num_values; ++j) {
 		    config_string_value_t *csv = (config_string_value_t *)tmpdata;
 		    char *msg_string = tmpdata + sizeof(config_string_value_t);
 		    values[j] = std::string(msg_string, csv->s_length);
@@ -1818,7 +1818,7 @@ NetworkConfiguration::NetConfValueIterator::get_string() const
       config_string_value_t *sv =
 	(config_string_value_t *)((char *)msg->payload() + sizeof(config_descriptor_t));
       char *msg_string =
-	(char *)msg->payload() + sizeof(config_string_value_t);
+	(char *)msg->payload() + sizeof(config_descriptor_t) + sizeof(config_string_value_t);
       return std::string(msg_string, sv->s_length);
     } else {
       throw TypeMismatchException("NetConfValueIterator::get_string: type mismatch, expected %u, got %u",




-- 
Fawkes Robotics Framework                 http://www.fawkesrobotics.org


More information about the fawkes-commits mailing list