1
0
Fork 0

Remove most compile warnings

This commit is contained in:
Markus Pargmann 2012-06-17 12:14:35 +02:00 committed by James Turner
parent e4fed256b7
commit ecfbb951ae
7 changed files with 78 additions and 76 deletions

View file

@ -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

View 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:
@ -279,7 +282,7 @@ static naRef f_setDoubleValue(naContext c, naRef me, int argc, naRef* args)
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());
}

View file

@ -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;
@ -324,6 +331,7 @@ void MIDGTrack::parse_msg( const int id, char *buf, MIDGpos *pos, MIDGatt *att )
} else {
cout << "unknown id = " << id << endl;
}
#endif
}
@ -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 ) {

View file

@ -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);
}
@ -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;
}

View file

@ -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 ) {

View file

@ -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);
}
@ -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",

View file

@ -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);
}