]> git.mxchange.org Git - flightgear.git/commitdiff
Remove most compile warnings
authorMarkus Pargmann <mpargmann@allfex.org>
Sun, 17 Jun 2012 10:14:35 +0000 (12:14 +0200)
committerJames Turner <zakalawe@mac.com>
Thu, 26 Jul 2012 10:10:27 +0000 (11:10 +0100)
src/Model/modelmgr.cxx
src/Scripting/nasal-props.cxx
utils/GPSsmooth/MIDG-II.cxx
utils/GPSsmooth/MIDG_main.cxx
utils/GPSsmooth/UGear.cxx
utils/GPSsmooth/UGear_main.cxx
utils/GPSsmooth/gps_main.cxx

index 142d7af4080d95b313853bdbb3c9757330f073e6..0310274bd612c38cf55dbb38ff08a17e0dd9ac26 100644 (file)
@@ -81,7 +81,7 @@ FGModelMgr::add_model (SGPropertyNode * node)
         << t.getFormattedMessage() << t.getOrigin());
     return;
   }
-  
+
   Instance * instance = new Instance;
   SGModelPlacement *model = new SGModelPlacement;
   instance->model = model;
@@ -161,6 +161,7 @@ struct UpdateFunctor : public std::unary_function<FGModelMgr::Instance*, void>
     {
         SGModelPlacement* model = instance->model;
         double lon, lat, elev, roll, pitch, heading;
+        lon = lat = elev = roll = pitch = heading = 0.0;
 
         try {
             // Optionally set position from properties
index eee439c7b0181267c9fac32ba36b2695359b78d4..78a2428778aa67fff42d18cda3c621e5b0e784a9 100644 (file)
@@ -54,17 +54,20 @@ naRef FGNasalSys::propNodeGhost(SGPropertyNode* handle)
 // array.  This allows the Nasal handlers to do things like:
 //   Node.getChild = func { _getChild(me.ghost, arg) }
 //
-#define NODEARG()                                                       \
+#define NODENOARG()                                                       \
     if(argc < 2 || !naIsGhost(args[0]) ||                               \
        naGhost_type(args[0]) != &PropNodeGhostType)                       \
         naRuntimeError(c, "bad argument to props function");            \
-    SGPropertyNode_ptr* node = (SGPropertyNode_ptr*)naGhost_ptr(args[0]); \
+    SGPropertyNode_ptr* node = (SGPropertyNode_ptr*)naGhost_ptr(args[0]);
+
+#define NODEARG()                                                       \
+    NODENOARG();                                                       \
     naRef argv = args[1]
 
 static naRef f_getType(naContext c, naRef me, int argc, naRef* args)
 {
     using namespace simgear;
-    NODEARG();
+    NODENOARG();
     const char* t = "unknown";
     switch((*node)->getType()) {
     case props::NONE:   t = "NONE";   break;
@@ -141,13 +144,13 @@ static naRef f_setAttribute(naContext c, naRef me, int argc, naRef* args)
 
 static naRef f_getName(naContext c, naRef me, int argc, naRef* args)
 {
-    NODEARG();
+    NODENOARG();
     return NASTR((*node)->getName());
 }
 
 static naRef f_getIndex(naContext c, naRef me, int argc, naRef* args)
 {
-    NODEARG();
+    NODENOARG();
     return naNum((*node)->getIndex());
 }
 
@@ -166,7 +169,7 @@ naRef makeVectorFromVec(naContext c, const T& vec)
 static naRef f_getValue(naContext c, naRef me, int argc, naRef* args)
 {
     using namespace simgear;
-    NODEARG();
+    NODENOARG();
     switch((*node)->getType()) {
     case props::BOOL:   case props::INT:
     case props::LONG:   case props::FLOAT:
@@ -177,10 +180,10 @@ static naRef f_getValue(naContext c, naRef me, int argc, naRef* args)
           SG_LOG(SG_NASAL, SG_ALERT, "Nasal getValue: property " << (*node)->getPath() << " is NaN");
           return naNil();
         }
-        
+
         return naNum(dv);
     }
-    
+
     case props::STRING:
     case props::UNSPECIFIED:
         return NASTR((*node)->getStringValue());
@@ -228,12 +231,12 @@ static naRef f_setValue(naContext c, naRef me, int argc, naRef* args)
         naRef n = naNumValue(val);
         if(naIsNil(n))
             naRuntimeError(c, "props.setValue() with non-number");
-            
+
         double d = naNumValue(val).num;
         if (osg::isNaN(d)) {
           naRuntimeError(c, "props.setValue() passed a NaN");
         }
-        
+
         result = (*node)->setDoubleValue(d);
     }
     return naNum(result);
@@ -269,17 +272,17 @@ static naRef f_setDoubleValue(naContext c, naRef me, int argc, naRef* args)
     naRef r = naNumValue(naVec_get(argv, 0));
     if (naIsNil(r))
         naRuntimeError(c, "props.setDoubleValue() with non-number");
-        
+
     if (osg::isNaN(r.num)) {
       naRuntimeError(c, "props.setDoubleValue() passed a NaN");
     }
-        
+
     return naNum((*node)->setDoubleValue(r.num));
 }
 
 static naRef f_getParent(naContext c, naRef me, int argc, naRef* args)
 {
-    NODEARG();
+    NODENOARG();
     SGPropertyNode* n = (*node)->getParent();
     if(!n) return naNil();
     return propNodeGhostCreate(c, n);
@@ -390,13 +393,13 @@ static naRef f_alias(naContext c, naRef me, int argc, naRef* args)
 
 static naRef f_unalias(naContext c, naRef me, int argc, naRef* args)
 {
-    NODEARG();
+    NODENOARG();
     return naNum((*node)->unalias());
 }
 
 static naRef f_getAliasTarget(naContext c, naRef me, int argc, naRef* args)
 {
-    NODEARG();
+    NODENOARG();
     return propNodeGhostCreate(c, (*node)->getAliasTarget());
 }
 
index 5ca224d15ec78fd45c8c32c1aa7d394e6dcb97d4..fa3ce462d600e775bc16b3c2d8416cbc08346161 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
-#endif 
+#endif
 
 #include <simgear/compiler.h>
 
@@ -23,8 +23,10 @@ MIDGTrack::MIDGTrack() {};
 MIDGTrack::~MIDGTrack() {};
 
 
-
-
+/*
+ * Unused function
+ */
+#if(0)
 static uint32_t read_swab( char *buf, size_t offset, size_t size ) {
     uint32_t result = 0;
 
@@ -51,6 +53,7 @@ static uint32_t read_swab( char *buf, size_t offset, size_t size ) {
 
     return result;
 }
+#endif
 
 
 static bool validate_cksum( uint8_t id, uint8_t size, char *buf,
@@ -88,6 +91,10 @@ static bool validate_cksum( uint8_t id, uint8_t size, char *buf,
 
 void MIDGTrack::parse_msg( const int id, char *buf, MIDGpos *pos, MIDGatt *att )
 {
+/*
+ * Completely unused parser results. Removed from compiling to remove the warnings
+ */
+#if(0)
     if ( id == 1 ) {
         uint32_t ts;
         uint16_t status;
@@ -98,7 +105,7 @@ void MIDGTrack::parse_msg( const int id, char *buf, MIDGpos *pos, MIDGatt *att )
         // timestamp
         ts = (uint32_t)read_swab( buf, 0, 4 );
         // cout << "  time stamp = " << ts << endl;
-            
+
         // status
         status = (uint16_t)read_swab( buf, 4, 2 );
         // cout << "  status = " << status << endl;
@@ -312,18 +319,19 @@ void MIDGTrack::parse_msg( const int id, char *buf, MIDGpos *pos, MIDGatt *att )
         // position dop
         pdop = (uint16_t)read_swab( buf, 32, 2 );
         // cout << "  pdop = " << pdop <<  endl;
-       
+
         // position accuracy
         pacc = (uint16_t)read_swab( buf, 34, 2 );
         // cout << "  pacc = " << pacc <<  endl;
-       
+
         // speed accuracy
         sacc = (uint16_t)read_swab( buf, 36, 2 );
         // cout << "  sacc = " << sacc <<  endl;
-       
+
     } else {
         cout << "unknown id = " << id << endl;
     }
+#endif
 }
 
 
@@ -463,7 +471,7 @@ int MIDGTrack::next_message( SGIOChannel *ch, SGIOChannel *log,
     // read checksum
     myread( ch, log, tmpbuf, 1 ); uint8_t cksum0 = (unsigned char)tmpbuf[0];
     myread( ch, log, tmpbuf, 1 ); uint8_t cksum1 = (unsigned char)tmpbuf[0];
-    
+
     if ( validate_cksum( id, size, savebuf, cksum0, cksum1 ) ) {
         parse_msg( id, savebuf, pos, att );
         return id;
@@ -480,7 +488,6 @@ int MIDGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
 {
     char tmpbuf[256];
     char savebuf[256];
-    int result = 0;
 
     cout << "in next_message()" << endl;
 
@@ -488,7 +495,7 @@ int MIDGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
 
     // scan for sync characters
     uint8_t sync0, sync1;
-    result = serial_read( serial, tmpbuf, 2 );
+    serial_read( serial, tmpbuf, 2 );
     sync0 = (unsigned char)tmpbuf[0];
     sync1 = (unsigned char)tmpbuf[1];
     while ( (sync0 != 129 || sync1 != 161) && !myeof ) {
@@ -514,7 +521,7 @@ int MIDGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
     serial_read( serial, tmpbuf, 2 );
     uint8_t cksum0 = (unsigned char)tmpbuf[0];
     uint8_t cksum1 = (unsigned char)tmpbuf[1];
-    
+
     if ( validate_cksum( id, size, savebuf, cksum0, cksum1 ) ) {
         parse_msg( id, savebuf, pos, att );
 
@@ -529,7 +536,7 @@ int MIDGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
     cout << "Check sum failure!" << endl;
     return -1;
 
-    
+
 }
 
 
index 118c6198bf960c8c0c6190394bb98898a2c3d79c..72a798808b77c85e5d08f50b0ad48e369eacced4 100644 (file)
@@ -77,15 +77,15 @@ bool inited = false;
 // point value.  By doing the BIG_ENDIAN test, I can optimize the
 // routine for big-endian processors so it can be as efficient as
 // possible
-static void htond (double &x)  
+static void htond (double &x)
 {
     if ( sgIsLittleEndian() ) {
         int    *Double_Overlay;
         int     Holding_Buffer;
-    
+
         Double_Overlay = (int *) &x;
         Holding_Buffer = Double_Overlay [0];
-    
+
         Double_Overlay [0] = htonl (Double_Overlay [1]);
         Double_Overlay [1] = htonl (Holding_Buffer);
     } else {
@@ -94,15 +94,15 @@ static void htond (double &x)
 }
 
 // Float version
-static void htonf (float &x)   
+static void htonf (float &x)
 {
     if ( sgIsLittleEndian() ) {
         int    *Float_Overlay;
         int     Holding_Buffer;
-    
+
         Float_Overlay = (int *) &x;
         Holding_Buffer = Float_Overlay [0];
-    
+
         Float_Overlay [0] = htonl (Holding_Buffer);
     } else {
         return;
@@ -279,16 +279,13 @@ static void midg2fg( const MIDGpos pos, const MIDGatt att,
 
 
 static void send_data( const MIDGpos pos, const MIDGatt att ) {
-    int len;
     int fdmsize = sizeof( FGNetFDM );
 
-    // cout << "Running main loop" << endl;
-
     FGNetFDM fgfdm;
     FGNetCtrls fgctrls;
 
     midg2fg( pos, att, &fgfdm, &fgctrls );
-    len = fdm_sock.send(&fgfdm, fdmsize, 0);
+    fdm_sock.send(&fgfdm, fdmsize, 0);
 }
 
 
@@ -466,10 +463,10 @@ int main( int argc, char **argv ) {
 
         MIDGpos pos0, pos1;
         pos0 = pos1 = track.get_pospt( 0 );
-    
+
         MIDGatt att0, att1;
         att0 = att1 = track.get_attpt( 0 );
-    
+
         while ( current_time < end_time ) {
             // cout << "current_time = " << current_time << " end_time = "
             //      << end_time << endl;
@@ -566,7 +563,6 @@ int main( int argc, char **argv ) {
         // process incoming data from the serial port
 
         int count = 0;
-        double current_time = 0.0;
 
         MIDGpos pos;
         MIDGatt att;
@@ -602,14 +598,14 @@ int main( int argc, char **argv ) {
             if ( id == 10 ) {
                 if ( att.get_msec() > att_time ) {
                     att_time = att.get_msec();
-                    current_time = att_time;
+                    //current_time = att_time;
                 } else {
                     cout << "oops att back in time" << endl;
                 }
             } else if ( id == 12 ) {
                 if ( pos.get_msec() > pos_time ) {
                     pos_time = pos.get_msec();
-                    current_time = pos_time;
+                    //current_time = pos_time;
                 } else {
                     cout << "oops pos back in time" << endl;
                 }
index 2a570e1e9070a9ea8c659463fffc0053f67223d3..c81ec350d93c4b4331da6e9f02782c45beafe2d3 100644 (file)
@@ -1,6 +1,6 @@
 #ifdef HAVE_CONFIG_H
 #  include <config.h>
-#endif 
+#endif
 
 #include <iostream>
 #include <cstdio>
@@ -430,7 +430,7 @@ int UGTrack::next_message( SGIOChannel *ch, SGIOChannel *log,
     myread( ch, log, tmpbuf, 2 );
     uint8_t cksum0 = (unsigned char)tmpbuf[0];
     uint8_t cksum1 = (unsigned char)tmpbuf[1];
-    
+
     if ( validate_cksum( id, size, savebuf, cksum0, cksum1, ignore_checksum ) )
     {
         parse_msg( id, savebuf, gpspacket, imupacket, navpacket, servopacket,
@@ -451,7 +451,6 @@ int UGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
 {
     char tmpbuf[256];
     char savebuf[256];
-    int result = 0;
 
     // cout << "in next_message()" << endl;
 
@@ -460,7 +459,7 @@ int UGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
     // scan for sync characters
     int scan_count = 0;
     uint8_t sync0, sync1;
-    result = serial_read( serial, log, tmpbuf, 2 );
+    serial_read( serial, log, tmpbuf, 2 );
     sync0 = (unsigned char)tmpbuf[0];
     sync1 = (unsigned char)tmpbuf[1];
     while ( (sync0 != START_OF_MSG0 || sync1 != START_OF_MSG1) && !myeof ) {
@@ -493,7 +492,7 @@ int UGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
     uint8_t cksum1 = (unsigned char)tmpbuf[1];
     // cout << "cksum0 = " << (int)cksum0 << " cksum1 = " << (int)cksum1
     //      << endl;
-    
+
     if ( validate_cksum( id, size, savebuf, cksum0, cksum1, ignore_checksum ) )
     {
         parse_msg( id, savebuf, gpspacket, imupacket, navpacket, servopacket,
@@ -505,7 +504,7 @@ int UGTrack::next_message( SGSerialPort *serial, SGIOChannel *log,
     cout << "Check sum failure!" << endl;
     return -1;
 
-    
+
 }
 
 
index 43d44b6f2af0ec05ebe94805d61dbc71d587fb3b..d2417226a7eeabe5cae12a12e7a14a627e85856b 100644 (file)
@@ -100,15 +100,15 @@ float gps_status = -1.0;
 // point value.  By doing the BIG_ENDIAN test, I can optimize the
 // routine for big-endian processors so it can be as efficient as
 // possible
-static void htond (double &x)  
+static void htond (double &x)
 {
     if ( sgIsLittleEndian() ) {
         int    *Double_Overlay;
         int     Holding_Buffer;
-    
+
         Double_Overlay = (int *) &x;
         Holding_Buffer = Double_Overlay [0];
-    
+
         Double_Overlay [0] = htonl (Double_Overlay [1]);
         Double_Overlay [1] = htonl (Holding_Buffer);
     } else {
@@ -117,15 +117,15 @@ static void htond (double &x)
 }
 
 // Float version
-static void htonf (float &x)   
+static void htonf (float &x)
 {
     if ( sgIsLittleEndian() ) {
         int    *Float_Overlay;
         int     Holding_Buffer;
-    
+
         Float_Overlay = (int *) &x;
         Holding_Buffer = Float_Overlay [0];
-    
+
         Float_Overlay [0] = htonl (Holding_Buffer);
     } else {
         return;
@@ -353,7 +353,7 @@ static void ugear2fg( gps *gpspacket, imu *imupacket, nav *navpacket,
     htonf(fdm->speedbrake);
     htonf(fdm->spoilers);
 
-#if 0    
+#if 0
     ctrls->version = FG_NET_CTRLS_VERSION;
     ctrls->elevator_trim = 0.0;
     ctrls->flaps = 0.0;
@@ -499,7 +499,6 @@ static void ugear2opengc( gps *gpspacket, imu *imupacket, nav *navpacket,
 static void send_data_udp( gps *gpspacket, imu *imupacket, nav *navpacket,
                            servo *servopacket, health *healthpacket )
 {
-    int len;
     int ogcsize = sizeof( ogcFGData );
     int fdmsize = sizeof( FGNetFDM );
     // int ctrlsize = sizeof( FGNetCtrls );
@@ -514,8 +513,8 @@ static void send_data_udp( gps *gpspacket, imu *imupacket, nav *navpacket,
              &fgfdm, &fgctrls );
     ugear2opengc( gpspacket, imupacket, navpacket, servopacket, healthpacket,
                   &fgogc );
-    len = opengc_sock.send(&fgogc, ogcsize, 0);
-    len = fdm_sock.send(&fgfdm, fdmsize, 0);
+    opengc_sock.send(&fgogc, ogcsize, 0);
+    fdm_sock.send(&fgfdm, fdmsize, 0);
     // len = ctrls_sock.send(&fgctrls, ctrlsize, 0);
 }
 
@@ -776,16 +775,16 @@ int main( int argc, char **argv ) {
 
         gps gps0, gps1;
         gps0 = gps1 = track.get_gpspt( 0 );
-    
+
         imu imu0, imu1;
         imu0 = imu1 = track.get_imupt( 0 );
-    
+
         nav nav0, nav1;
         nav0 = nav1 = track.get_navpt( 0 );
-    
+
         servo servo0, servo1;
         servo0 = servo1 = track.get_servopt( 0 );
-    
+
         health health0, health1;
         health0 = health1 = track.get_healthpt( 0 );
 
@@ -1087,7 +1086,7 @@ int main( int argc, char **argv ) {
                 } else {
                     cout << "oops health back in time: " << healthpacket.time << " " << health_time << endl;
                 }
-                
+
             }
 
             if ( (current_time > gps_time + 2) ||
@@ -1106,7 +1105,7 @@ int main( int argc, char **argv ) {
                 command_mgr.add("hb");
                 command_heartbeat = current_time;
             }
-                
+
             // Command update @ 1hz
             if ( current_time >= command_time + 1 ) {
                 command_mgr.update(&uavcom);
@@ -1120,8 +1119,6 @@ int main( int argc, char **argv ) {
                 // double lonmin = fabs(navpacket.lon - londeg);
                 int latdeg = (int)navpacket.lat;
                 // double latmin = fabs(navpacket.lat - latdeg);
-                char londir = 'E'; if ( londeg < 0 ) londir = 'W';
-                char latdir = 'N'; if ( latdeg < 0 ) latdir = 'S';
                 londeg = abs(londeg);
                 latdeg = abs(latdeg);
                 /*printf( "%.2f  %c%02d:%.4f %c%03d:%.4f %.1f  %.2f %.2f %.2f\n",
index 5dfc76c6729a242fb23ba392a0b29b7c0d3d4bf3..d28f8f1f4c58b7613ed6e874c2b32e3f615a88a5 100644 (file)
@@ -60,15 +60,15 @@ bool inited = false;
 // point value.  By doing the BIG_ENDIAN test, I can optimize the
 // routine for big-endian processors so it can be as efficient as
 // possible
-static void htond (double &x)  
+static void htond (double &x)
 {
     if ( sgIsLittleEndian() ) {
         int    *Double_Overlay;
         int     Holding_Buffer;
-    
+
         Double_Overlay = (int *) &x;
         Holding_Buffer = Double_Overlay [0];
-    
+
         Double_Overlay [0] = htonl (Double_Overlay [1]);
         Double_Overlay [1] = htonl (Holding_Buffer);
     } else {
@@ -77,15 +77,15 @@ static void htond (double &x)
 }
 
 // Float version
-static void htonf (float &x)   
+static void htonf (float &x)
 {
     if ( sgIsLittleEndian() ) {
         int    *Float_Overlay;
         int     Holding_Buffer;
-    
+
         Float_Overlay = (int *) &x;
         Holding_Buffer = Float_Overlay [0];
-    
+
         Float_Overlay [0] = htonl (Holding_Buffer);
     } else {
         return;
@@ -281,7 +281,6 @@ static void gps2fg( const GPSPoint p, FGNetFDM *fdm, FGNetCtrls *ctrls )
 
 
 static void send_data( const GPSPoint p ) {
-    int len;
 //    int ctrlsize = sizeof( FGNetCtrls );
     int fdmsize = sizeof( FGNetFDM );
 
@@ -291,7 +290,7 @@ static void send_data( const GPSPoint p ) {
     FGNetCtrls fgctrls;
 
     gps2fg( p, &fgfdm, &fgctrls );
-    len = fdm_sock.send(&fgfdm, fdmsize, 0);
+    fdm_sock.send(&fgfdm, fdmsize, 0);
 }
 
 
@@ -431,7 +430,7 @@ int main( int argc, char **argv ) {
 
     GPSPoint p, p0, p1;
     p0 = p1 = track.get_point( 0 );
-    
+
     while ( current_time < end_time ) {
         // cout << "current_time = " << current_time << " end_time = "
         //      << end_time << endl;