[Tinyos-help] sim-sf deprecated warnings

Morten Tranberg Hansen mth at cs.au.dk
Wed Nov 17 17:22:36 PST 2010


Hi Phil,

When compiling sim-sf with python2.6 I get quite a few deprecated warnings
due to some missing char* casts.  I looks like you have added these casts
when compiling with sim.  Maybe you could apply the same changes when
compiling with sim-sf?  See the below diff which also includes a fix for a
printf warning when compiling with sim-sf

Morten.

diff --git a/tos/lib/tossim/sf/Throttle.cpp b/tos/lib/tossim/sf/Throttle.cpp
index 2a5350c..01520cb 100644
--- a/tos/lib/tossim/sf/Throttle.cpp
+++ b/tos/lib/tossim/sf/Throttle.cpp
@@ -111,7 +111,7 @@ int Throttle::simSleep(double seconds) {

 void Throttle::printStatistics() {

-    printf("Number of throttle events %d\n", throttleCount);
+    printf("Number of throttle events %lu\n", throttleCount);

     if (simEndTime > 0.0) {
         printf("Total Sim Time: %.6f\n", simEndTime - simStartTime);
diff --git a/tos/lib/tossim/sf/tossim.c b/tos/lib/tossim/sf/tossim.c
index 5a07d71..73db9e6 100644
--- a/tos/lib/tossim/sf/tossim.c
+++ b/tos/lib/tossim/sf/tossim.c
@@ -123,8 +123,8 @@ variable_string_t Variable::getData() {
     memcpy(data, ptr, len);
   }
   else {
-    str.ptr = "<no such variable>";
-    str.type = "<no such variable>";
+    str.ptr = (char*)"<no such variable>";
+    str.type = (char*)"<no such variable>";
     str.len = strlen("<no such variable>");
     str.isArray = 0;
   }
@@ -176,7 +176,7 @@ void Mote::setID(unsigned long val) {
 }

 Variable* Mote::getVariable(char* name) {
-  char* typeStr = "";
+  char* typeStr = (char*)"";
   int isArray;
   Variable* var;

diff --git a/tos/lib/tossim/sf/tossim.i b/tos/lib/tossim/sf/tossim.i
index 7789c3b..509acab 100644
--- a/tos/lib/tossim/sf/tossim.i
+++ b/tos/lib/tossim/sf/tossim.i
@@ -312,8 +312,8 @@ PyObject* listFromArray(char* type, char* ptr, int len)
{
         }
       }
       else {
-        app->variableNames[i] = "<bad string>";
-        app->variableTypes[i] = "<bad string>";
+        app->variableNames[i] = (char*)"<bad string>";
+        app->variableTypes[i] = (char*)"<bad string>";
       }
     }



-- 
Morten Hansen, http://mortent.dk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20101118/3c33f2ab/attachment.htm 


More information about the Tinyos-help mailing list