[TeamTalk 213]: [749] trunk/moast-bth/moast/src: Imported bugfix for segment tool and traffic sim.

tk@edam.speech.cs.cmu.edu tk at edam.speech.cs.cmu.edu
Tue Sep 18 15:28:54 EDT 2007


An HTML attachment was scrubbed...
URL: http://mailman.srv.cs.cmu.edu/pipermail/teamtalk-developers/attachments/20070918/4cfd2a7d/attachment.html
-------------- next part --------------
Modified: trunk/moast-bth/moast/src/sim/simWare/trafficSupSkin.cc
===================================================================
--- trunk/moast-bth/moast/src/sim/simWare/trafficSupSkin.cc	2007-09-18 19:26:47 UTC (rev 748)
+++ trunk/moast-bth/moast/src/sim/simWare/trafficSupSkin.cc	2007-09-18 19:28:54 UTC (rev 749)
@@ -154,13 +154,8 @@
       return false;
     }
   
-  thr.push_back(new pthread_t);
-  if ( 0 != pthread_create (thr[thr.size()-1], NULL, (void *(*)(void *)) spawnTrafficThr,
-			    (void *) traffic) )
-    {
-      printf("** ERROR ** <TrafficSupSkin::openSkin> : Error Spawning Trafficility thread\n");  
-      return false;
-    }
+
+  //** First get handle to kb
   // figure out handles for ground truth sensor
   grdTruth = new SIMwareKBSenGrdTruth* [numVeh];
   vector<SIMwareKBSen *> navSen;
@@ -184,8 +179,19 @@
 	  itr++;
 	}
     }
+  //** Then start thread that uses kb
+  thr.push_back(new pthread_t);
+  if ( 0 != pthread_create (thr[thr.size()-1], NULL, (void *(*)(void *)) spawnTrafficThr,
+			    (void *) traffic) )
+    {
+      printf("** ERROR ** <TrafficSupSkin::openSkin> : Error Spawning Trafficility thread\n");  
+      return false;
+    }
+
+  state=SW_KB_STATE_INITIALIZED;
+  
   nml_start();
-  state=SW_KB_STATE_INITIALIZED;
+  
   return true;
 }
 

Modified: trunk/moast-bth/moast/src/tools/segmentTools/polyIntersect.cc
===================================================================
--- trunk/moast-bth/moast/src/tools/segmentTools/polyIntersect.cc	2007-09-18 19:26:47 UTC (rev 748)
+++ trunk/moast-bth/moast/src/tools/segmentTools/polyIntersect.cc	2007-09-18 19:28:54 UTC (rev 749)
@@ -40,6 +40,16 @@
     }
   
   polygonNumber = 0;
+  // needed to get rid of getline
+  linePtSize = 300;
+  linePt = new char[linePtSize];
+  if(linePt == NULL )
+    {
+      printf( "unable to allocate string storage\n");
+      return(-1);
+    }
+  // end of getline stuff
+
   for( fileNo=0; fileNo<2; fileNo++ )
     {
       polygonNumber++;
@@ -53,13 +63,16 @@
 	  printf( "Unable to open input file\n" );
 	  return -1;
 	}
-      getline(&linePt, (size_t*)&linePtSize, fp);
+      //      getline(&linePt, (size_t*)&linePtSize, fp);
+      fgets(linePt, linePtSize, fp);
       sscanf( linePt, "%lf %lf %lf", &xOffset, &yOffset, &zOffset );
       xOffset /= amResolution;
       yOffset /= amResolution;
       dataSet = false;
-      while( (sizeRead=getline(&linePt, (size_t *)&linePtSize, fp)) != -1 )
+      //      while( (sizeRead=getline(&linePt, (size_t *)&linePtSize, fp)) != -1 )
+      while( (fgets(linePt, linePtSize, fp)) != NULL )
 	{
+	  sizeRead = strlen(linePt);
 	  if( sizeRead == 1 )
 	    {
 	      fprintf( stdout, "\n" );


More information about the TeamTalk-developers mailing list