Update of /cvsroot/playerstage/code/player/server/drivers/localization
In directory 
sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10946/server/drivers/localization

Modified Files:
        .cvsignore fakelocalize.cc 
Log Message:
applied Toby's patch to replace fixed-size arrays

Index: .cvsignore
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/server/drivers/localization/.cvsignore,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** .cvsignore  17 Sep 2007 02:18:52 -0000      1.2
--- .cvsignore  1 Nov 2007 22:16:19 -0000       1.3
***************
*** 4,5 ****
--- 4,7 ----
  *.la
  *.a
+ .libs
+ *.lo

Index: fakelocalize.cc
===================================================================
RCS file: 
/cvsroot/playerstage/code/player/server/drivers/localization/fakelocalize.cc,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** fakelocalize.cc     31 Oct 2007 01:37:28 -0000      1.15
--- fakelocalize.cc     1 Nov 2007 22:16:19 -0000       1.16
***************
*** 105,108 ****
--- 105,109 ----
    // Constructor
    public: FakeLocalize( ConfigFile* cf, int section);
+   ~FakeLocalize();
  
    // Setup/shutdown/run routines.
***************
*** 120,124 ****
    private: player_devaddr_t sim_id;
    private: player_devaddr_t localize_addr;
!   private: const char* model;
  };
  
--- 121,125 ----
    private: player_devaddr_t sim_id;
    private: player_devaddr_t localize_addr;
!   private: char* model;
  };
  
***************
*** 165,169 ****
  
  
!   if(!(this->model = cf->ReadString(section, "model", NULL)))
    {
      PLAYER_ERROR("must specify non-NULL model name");
--- 166,170 ----
  
  
!   if(!(this->model = strdup(cf->ReadString(section, "model", NULL))))
    {
      PLAYER_ERROR("must specify non-NULL model name");
***************
*** 171,184 ****
      return;
    }
-   if(strlen(this->model) >= PLAYER_SIMULATION_IDENTIFIER_MAXLEN)
-   {
-     PLAYER_ERROR("model name is too long");
-     this->SetError(-1);
-     return;
-   }
  
    return;
  }
  
  
  
////////////////////////////////////////////////////////////////////////////////
--- 172,183 ----
      return;
    }
  
    return;
  }
  
+ FakeLocalize::~FakeLocalize()
+ {
+   free (this->model);
+ }
  
  
////////////////////////////////////////////////////////////////////////////////
***************
*** 222,228 ****
    
    // Request pose
!   strncpy(cfg.name, this->model, PLAYER_SIMULATION_IDENTIFIER_MAXLEN);
!   cfg.name[PLAYER_SIMULATION_IDENTIFIER_MAXLEN - 1] = '\0';
!   cfg.name_count = 
min(strlen(cfg.name),PLAYER_SIMULATION_IDENTIFIER_MAXLEN-1) + 1;
  
    Message * Reply = sim->Request(InQueue, PLAYER_MSGTYPE_REQ, 
PLAYER_SIMULATION_REQ_GET_POSE2D,
--- 221,226 ----
    
    // Request pose
!   cfg.name = this->model;
!   cfg.name_count = strlen(cfg.name);
  
    Message * Reply = sim->Request(InQueue, PLAYER_MSGTYPE_REQ, 
PLAYER_SIMULATION_REQ_GET_POSE2D,
***************
*** 232,236 ****
    {
        // we got a good reply so update our data
!       assert(Reply->GetDataSize() == sizeof(cfg));
        player_simulation_pose2d_req_t * resp = 
reinterpret_cast<player_simulation_pose2d_req_t *> (Reply->GetPayload());
        
--- 230,234 ----
    {
        // we got a good reply so update our data
!       assert(Reply->GetDataSize() > 0);
        player_simulation_pose2d_req_t * resp = 
reinterpret_cast<player_simulation_pose2d_req_t *> (Reply->GetPayload());
        
***************
*** 239,242 ****
--- 237,241 ----
      loc_data.pending_time = Reply->GetHeader()->timestamp;
      loc_data.hypoths_count = 1;
+     loc_data.hypoths = new player_localize_hypoth_t;
  
      loc_data.hypoths[0].mean = resp->pose;
***************
*** 247,252 ****
  
      Publish(device_addr, PLAYER_MSGTYPE_DATA, 
PLAYER_LOCALIZE_DATA_HYPOTHS,&loc_data,sizeof(loc_data));
      delete Reply;
!       Reply = NULL;
    }
    else
--- 246,252 ----
  
      Publish(device_addr, PLAYER_MSGTYPE_DATA, 
PLAYER_LOCALIZE_DATA_HYPOTHS,&loc_data,sizeof(loc_data));
+     delete loc_data.hypoths;
      delete Reply;
!     Reply = NULL;
    }
    else
***************
*** 323,329 ****
  
        // Request pose
!       strncpy(cfg.name, this->model, PLAYER_SIMULATION_IDENTIFIER_MAXLEN);
!       cfg.name[PLAYER_SIMULATION_IDENTIFIER_MAXLEN - 1] = '\0';
!       cfg.name_count = 
min(strlen(cfg.name),PLAYER_SIMULATION_IDENTIFIER_MAXLEN-1) + 1;
        
        Message * Reply = sim->Request(InQueue, PLAYER_MSGTYPE_REQ, 
PLAYER_SIMULATION_REQ_GET_POSE2D,
--- 323,328 ----
  
        // Request pose
!       cfg.name = this->model;
!       cfg.name_count = strlen(cfg.name);
        
        Message * Reply = sim->Request(InQueue, PLAYER_MSGTYPE_REQ, 
PLAYER_SIMULATION_REQ_GET_POSE2D,


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to