Revision: 7325
          http://playerstage.svn.sourceforge.net/playerstage/?rev=7325&view=rev
Author:   gbiggs
Date:     2009-02-10 08:14:48 +0000 (Tue, 10 Feb 2009)

Log Message:
-----------
Changes to compile on Solaris

Modified Paths:
--------------
    code/player/trunk/client_libs/libplayerc/dev_vectormap.c
    code/player/trunk/cmake/internal/SearchForStuff.cmake
    code/player/trunk/server/drivers/laser/RS4LeuzeLaserDriver.cc
    code/player/trunk/server/drivers/laser/lms400_cola.h
    code/player/trunk/server/drivers/laser/urglaserdriver.cc
    code/player/trunk/server/drivers/mixed/irobot/create/create_driver.cc
    code/player/trunk/server/drivers/mixed/irobot/roomba/roomba_driver.cc
    code/player/trunk/server/drivers/mixed/khepera/khepera.cc
    code/player/trunk/server/drivers/wsn/mica2.cc

Modified: code/player/trunk/client_libs/libplayerc/dev_vectormap.c
===================================================================
--- code/player/trunk/client_libs/libplayerc/dev_vectormap.c    2009-02-10 
03:58:02 UTC (rev 7324)
+++ code/player/trunk/client_libs/libplayerc/dev_vectormap.c    2009-02-10 
08:14:48 UTC (rev 7325)
@@ -54,6 +54,7 @@
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
+#include <stddef.h>
 
 #include "playerc.h"
 #include "error.h"

Modified: code/player/trunk/cmake/internal/SearchForStuff.cmake
===================================================================
--- code/player/trunk/cmake/internal/SearchForStuff.cmake       2009-02-10 
03:58:02 UTC (rev 7324)
+++ code/player/trunk/cmake/internal/SearchForStuff.cmake       2009-02-10 
08:14:48 UTC (rev 7325)
@@ -47,7 +47,6 @@
 
 CHECK_FUNCTION_EXISTS (gettimeofday HAVE_GETTIMEOFDAY)
 CHECK_FUNCTION_EXISTS (usleep HAVE_USLEEP)
-CHECK_FUNCTION_EXISTS (nanosleep HAVE_NANOSLEEP)
 CHECK_FUNCTION_EXISTS (cfmakeraw HAVE_CFMAKERAW)
 CHECK_FUNCTION_EXISTS (dirname HAVE_DIRNAME)
 CHECK_INCLUDE_FILES (linux/joystick.h HAVE_LINUX_JOYSTICK_H)
@@ -62,6 +61,13 @@
 SET (CMAKE_REQUIRED_LIBRARIES dl)
 CHECK_LIBRARY_EXISTS (ltdl lt_dlopenext "${PLAYER_EXTRA_LIB_DIRS}" 
HAVE_LIBLTDL)
 SET (CMAKE_REQUIRED_LIBRARIES)
+IF (PLAYER_OS_SUN)
+    SET (CMAKE_REQUIRED_LIBRARIES rt)
+    CHECK_FUNCTION_EXISTS (nanosleep HAVE_NANOSLEEP)
+    SET (CMAKE_REQUIRED_LIBRARIES)
+ELSE (PLAYER_OS_SUN)
+    CHECK_FUNCTION_EXISTS (nanosleep HAVE_NANOSLEEP)
+ENDIF (PLAYER_OS_SUN)
 
 CHECK_FUNCTION_EXISTS (poll HAVE_POLL)
 IF (PLAYER_OS_WIN)

Modified: code/player/trunk/server/drivers/laser/RS4LeuzeLaserDriver.cc
===================================================================
--- code/player/trunk/server/drivers/laser/RS4LeuzeLaserDriver.cc       
2009-02-10 03:58:02 UTC (rev 7324)
+++ code/player/trunk/server/drivers/laser/RS4LeuzeLaserDriver.cc       
2009-02-10 08:14:48 UTC (rev 7325)
@@ -427,7 +427,6 @@
 
 //Registers the driver in the driver table. Called from the
 // player_driver_init function that the loader looks for
-int rs4leuze_Register(DriverTable* table) {
+void rs4leuze_Register(DriverTable* table) {
        table->AddDriver("rs4leuze", RS4LeuzeLaserDriver_Init);
-  return 0;
 }

Modified: code/player/trunk/server/drivers/laser/lms400_cola.h
===================================================================
--- code/player/trunk/server/drivers/laser/lms400_cola.h        2009-02-10 
03:58:02 UTC (rev 7324)
+++ code/player/trunk/server/drivers/laser/lms400_cola.h        2009-02-10 
08:14:48 UTC (rev 7325)
@@ -91,7 +91,7 @@
     const char* hostname;
     int sockfd, portno, n;
     struct sockaddr_in serv_addr;
-#if defined (HAVE_GETADDRINFO)
+#if HAVE_GETADDRINFO
     struct addrinfo *addr_ptr;
 #else
     struct hostent *server;

Modified: code/player/trunk/server/drivers/laser/urglaserdriver.cc
===================================================================
--- code/player/trunk/server/drivers/laser/urglaserdriver.cc    2009-02-10 
03:58:02 UTC (rev 7324)
+++ code/player/trunk/server/drivers/laser/urglaserdriver.cc    2009-02-10 
08:14:48 UTC (rev 7325)
@@ -373,9 +373,8 @@
 
 // Registers the driver in the driver table. Called from the
 // player_driver_init function that the loader looks for
-int
+void
   urglaser_Register (DriverTable* table)
 {
   table->AddDriver ("urglaser", URGLaserDriver_Init);
-  return (0);
 }

Modified: code/player/trunk/server/drivers/mixed/irobot/create/create_driver.cc
===================================================================
--- code/player/trunk/server/drivers/mixed/irobot/create/create_driver.cc       
2009-02-10 03:58:02 UTC (rev 7324)
+++ code/player/trunk/server/drivers/mixed/irobot/create/create_driver.cc       
2009-02-10 08:14:48 UTC (rev 7325)
@@ -527,9 +527,20 @@
     {
       uint8_t index = opaque_data.data[1];
       uint8_t length = opaque_data.data[2];
-      uint8_t notes[length];
-      uint8_t note_lengths[length];
+      uint8_t *notes;
+      uint8_t *note_lengths;
 
+      if ((notes = new uint8_t[length]) == NULL)
+      {
+        PLAYER_ERROR("Failed to allocate memory for notes in create driver.");
+        return(-1);
+      }
+      if ((note_lengths = new uint8_t [length]) == NULL)
+      {
+        PLAYER_ERROR("Failed to allocate memory for note_lengths in create 
driver.");
+        delete [] notes;
+        return -1;
+      }
       for (unsigned int i=0; i<length; i++)
       {
         notes[i] = opaque_data.data[3+i*2];
@@ -538,6 +549,8 @@
 
       create_set_song(this->create_dev, index, length,
           notes, note_lengths);
+      delete [] notes;
+      delete [] note_lengths;
     }
     // Set the LEDs
     else if (opaque_data.data[0] == 2)

Modified: code/player/trunk/server/drivers/mixed/irobot/roomba/roomba_driver.cc
===================================================================
--- code/player/trunk/server/drivers/mixed/irobot/roomba/roomba_driver.cc       
2009-02-10 03:58:02 UTC (rev 7324)
+++ code/player/trunk/server/drivers/mixed/irobot/roomba/roomba_driver.cc       
2009-02-10 08:14:48 UTC (rev 7325)
@@ -111,6 +111,7 @@
 #include <string.h>
 #include <pthread.h>
 #include <time.h>
+#include <stdlib.h>
 #include <libplayercore/playercore.h>
 
 #include "roomba_comms.h"
@@ -354,14 +355,20 @@
      memset(&bumperdata,0,sizeof(bumperdata));
 
      bumperdata.bumpers_count = 2;
-     bumperdata.bumpers = new uint8_t[bumperdata.bumpers_count];
-     bumperdata.bumpers[0] = this->roomba_dev->bumper_left;
-     bumperdata.bumpers[1] = this->roomba_dev->bumper_right;
+     if ((bumperdata.bumpers = new uint8_t[bumperdata.bumpers_count]) == NULL)
+     {
+       PLAYER_ERROR ("Failed to allocate memory for bumper data in roomba 
driver.");
+     }
+     else
+     {
+       bumperdata.bumpers[0] = this->roomba_dev->bumper_left;
+       bumperdata.bumpers[1] = this->roomba_dev->bumper_right;
 
-     this->Publish(this->bumper_addr,
-                   PLAYER_MSGTYPE_DATA, PLAYER_BUMPER_DATA_STATE,
-                   (void*)&bumperdata);
-     delete [] bumperdata.bumpers;
+       this->Publish(this->bumper_addr,
+                     PLAYER_MSGTYPE_DATA, PLAYER_BUMPER_DATA_STATE,
+                     (void*)&bumperdata);
+       delete [] bumperdata.bumpers;
+     }
 
      ////////////////////////////
      // Update IR data
@@ -369,23 +376,29 @@
      memset(&irdata,0,sizeof(irdata));
 
      irdata.ranges_count = 11;
-     irdata.ranges = new float [irdata.ranges_count];
-     irdata.ranges[0] = (float)this->roomba_dev->wall;
-     irdata.ranges[1] = (float)this->roomba_dev->cliff_left;
-     irdata.ranges[2] = (float)this->roomba_dev->cliff_frontleft;
-     irdata.ranges[3] = (float)this->roomba_dev->cliff_frontright;
-     irdata.ranges[4] = (float)this->roomba_dev->cliff_right;
-     irdata.ranges[5] = (float)this->roomba_dev->virtual_wall;
-     irdata.ranges[6] = (float)this->roomba_dev->dirtdetector_right;
-     irdata.ranges[7] = (float)this->roomba_dev->dirtdetector_left;
-     irdata.ranges[8] = (float)this->roomba_dev->wheeldrop_caster;
-     irdata.ranges[9] = (float)this->roomba_dev->wheeldrop_left;
-     irdata.ranges[10] = (float)this->roomba_dev->wheeldrop_right;
+     if ((irdata.ranges = new float [irdata.ranges_count]) == NULL)
+     {
+       PLAYER_ERROR ("Failed to allocate memory for IR data in roomba 
driver.");
+     }
+     else
+     {
+       irdata.ranges[0] = (float)this->roomba_dev->wall;
+       irdata.ranges[1] = (float)this->roomba_dev->cliff_left;
+       irdata.ranges[2] = (float)this->roomba_dev->cliff_frontleft;
+       irdata.ranges[3] = (float)this->roomba_dev->cliff_frontright;
+       irdata.ranges[4] = (float)this->roomba_dev->cliff_right;
+       irdata.ranges[5] = (float)this->roomba_dev->virtual_wall;
+       irdata.ranges[6] = (float)this->roomba_dev->dirtdetector_right;
+       irdata.ranges[7] = (float)this->roomba_dev->dirtdetector_left;
+       irdata.ranges[8] = (float)this->roomba_dev->wheeldrop_caster;
+       irdata.ranges[9] = (float)this->roomba_dev->wheeldrop_left;
+       irdata.ranges[10] = (float)this->roomba_dev->wheeldrop_right;
 
-     this->Publish(this->ir_addr,
-         PLAYER_MSGTYPE_DATA, PLAYER_IR_DATA_RANGES,
-         (void*)&irdata);
-     delete [] irdata.ranges;
+       this->Publish(this->ir_addr,
+           PLAYER_MSGTYPE_DATA, PLAYER_IR_DATA_RANGES,
+           (void*)&irdata);
+       delete [] irdata.ranges;
+     }
 
 
      ////////////////////////////
@@ -408,19 +421,24 @@
      memset(&cpdata,0,sizeof(cpdata));
 
      cpdata.data_count=5;
-     cpdata.data = new uint8_t [cpdata.data_count];
+     if ((cpdata.data = new uint8_t [cpdata.data_count]) == NULL)
+     {
+       PLAYER_ERROR ("Failed to allocate memory for opaque data in roomba 
driver.");
+     }
+     else
+     {
+       cpdata.data[0]=this->roomba_dev->button_max;
+       cpdata.data[1]=this->roomba_dev->button_clean;
+       cpdata.data[2]=this->roomba_dev->button_spot;
+       cpdata.data[3]=this->roomba_dev->button_power;
+       cpdata.data[4]=this->roomba_dev->remote_opcode;
 
-     cpdata.data[0]=this->roomba_dev->button_max;
-     cpdata.data[1]=this->roomba_dev->button_clean;
-     cpdata.data[2]=this->roomba_dev->button_spot;
-     cpdata.data[3]=this->roomba_dev->button_power;
-     cpdata.data[4]=this->roomba_dev->remote_opcode;
+       this->Publish(this->opaque_addr,
+           PLAYER_MSGTYPE_DATA,PLAYER_OPAQUE_DATA_STATE,
+           (void*)&cpdata);
+       delete [] cpdata.data;
+     }
 
-     this->Publish(this->opaque_addr,
-         PLAYER_MSGTYPE_DATA,PLAYER_OPAQUE_DATA_STATE,
-         (void*)&cpdata);
-     delete [] cpdata.data;
-
      struct timespec ts;
      ts.tv_sec = 0;
      ts.tv_nsec = CYCLE_TIME_NS;
@@ -576,9 +594,21 @@
     {
       uint8_t index = opaque_data.data[1];
       uint8_t length = opaque_data.data[2];
-      uint8_t notes[length];
-      uint8_t note_lengths[length];
+      uint8_t *notes;
+      uint8_t *note_lengths;
 
+      if ((notes = new uint8_t[length]) == NULL)
+      {
+        PLAYER_ERROR ("Failed to allocate memory for notes in roomba driver.");
+        return -1;
+      }
+      if ((note_lengths = new uint8_t[length]) == NULL)
+      {
+        PLAYER_ERROR ("Failed to allocate memory for note_lengths in roomba 
driver.");
+        delete [] notes;
+        return -1;
+      }
+
       for (unsigned int i=0; i<length; i++)
       {
         notes[i] = opaque_data.data[3+i*2];
@@ -587,6 +617,8 @@
 
       roomba_set_song(this->roomba_dev, index, length,
           notes, note_lengths);
+      delete [] notes;
+      delete [] note_lengths;
     }
     // Set the LEDs
     else if (opaque_data.data[0] == 2)

Modified: code/player/trunk/server/drivers/mixed/khepera/khepera.cc
===================================================================
--- code/player/trunk/server/drivers/mixed/khepera/khepera.cc   2009-02-10 
03:58:02 UTC (rev 7324)
+++ code/player/trunk/server/drivers/mixed/khepera/khepera.cc   2009-02-10 
08:14:48 UTC (rev 7325)
@@ -521,7 +521,7 @@
 
   for (unsigned int i =0; i < geometry->ir.poses_count; i++)
   {
-    d->ranges[i] = geometry->scale * geometry->ir_calib_a[i] * 
pow(d->voltages[i],geometry->ir_calib_b[i]);
+    d->ranges[i] = geometry->scale * geometry->ir_calib_a[i] * 
pow(static_cast<double> (d->voltages[i]),static_cast<double> 
(geometry->ir_calib_b[i]));
     d->voltages[i] = d->voltages[i];
   }
 }

Modified: code/player/trunk/server/drivers/wsn/mica2.cc
===================================================================
--- code/player/trunk/server/drivers/wsn/mica2.cc       2009-02-10 03:58:02 UTC 
(rev 7324)
+++ code/player/trunk/server/drivers/wsn/mica2.cc       2009-02-10 08:14:48 UTC 
(rev 7325)
@@ -1050,8 +1050,8 @@
 
                            wsn_data.data_packet.temperature =
                                        (1 / (0.001307050f + 0.000214381f *
-                                       log (rthr) + 0.000000093f *
-                                       pow (log (rthr),3))) - 273.15;
+                                       log (static_cast<double> (rthr)) + 
0.000000093f *
+                                       pow (log (static_cast<double> 
(rthr)),3))) - 273.15;
 
                            // Convert the magnetometer data to Gauss
                            wsn_data.data_packet.magn_x      =


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
_______________________________________________
Playerstage-commit mailing list
Playerstage-commit@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to