1
0
Fork 0

Ladislav Michnovic:

Using new gcc 4.0 I have some serios warnings about uninitialized
variables, that are used. I created a patch, but I have no idea if it
is possible to do it my way. Can you check this out please?


Erik: I've modified the patch slightly based on the contents of an older
      version of hitlist.cxx. I think this is correct now.
This commit is contained in:
ehofman 2005-10-16 09:05:40 +00:00
parent b82166fb4d
commit 2631cf9cc5
3 changed files with 9 additions and 6 deletions

View file

@ -352,6 +352,8 @@ bool runway_instr::boundOutsidePoints(sgdVec3 v, sgdVec3 m) {
void runway_instr::drawArrow() { void runway_instr::drawArrow() {
Point3D ac,rwy; Point3D ac,rwy;
memset(&ac,0,sizeof(ac));
memset(&rwy,0,sizeof(rwy));
ac.setlat(current_aircraft.fdm_state->get_Latitude_deg()); ac.setlat(current_aircraft.fdm_state->get_Latitude_deg());
ac.setlon(current_aircraft.fdm_state->get_Longitude_deg()); ac.setlon(current_aircraft.fdm_state->get_Longitude_deg());
rwy.setlat(runway._lat); rwy.setlat(runway._lat);

View file

@ -201,8 +201,8 @@ void balloon::update()
sgScaleVec3(fTotal, gravity_vector, mTotal); sgScaleVec3(fTotal, gravity_vector, mTotal);
sgAddVec3(fTotal, fLift); //sgAddVec3(fTotal, fLift); //FIXME: uninitialized fLift
sgAddVec3(fTotal, fFriction); //sgAddVec3(fTotal, fFriction); //FIXME: uninitialized fFriction
//claculate acceleration: a = F / m //claculate acceleration: a = F / m
sgVec3 aTotal, vTotal, dTotal; sgVec3 aTotal, vTotal, dTotal;

View file

@ -15,6 +15,7 @@
#include <simgear/sg_inlines.h> #include <simgear/sg_inlines.h>
#include <simgear/debug/logstream.hxx> #include <simgear/debug/logstream.hxx>
#include <simgear/math/point3d.hxx> #include <simgear/math/point3d.hxx>
#include <simgear/math/polar3d.hxx>
#include <simgear/math/sg_geodesy.hxx> #include <simgear/math/sg_geodesy.hxx>
#include <simgear/math/vector.hxx> #include <simgear/math/vector.hxx>
#include <simgear/timing/timestamp.hxx> #include <simgear/timing/timestamp.hxx>
@ -633,7 +634,6 @@ bool fgCurrentElev( sgdVec3 abs_view_pos, double max_alt_m,
int this_hit = -1; int this_hit = -1;
int max_hit = -1; int max_hit = -1;
Point3D geoc;
double hit_elev = -9999; double hit_elev = -9999;
double max_elev = -9999; double max_elev = -9999;
Point3D sc(scenery_center[0], scenery_center[1], scenery_center[2]) ; Point3D sc(scenery_center[0], scenery_center[1], scenery_center[2]) ;
@ -668,7 +668,7 @@ bool fgCurrentElev( sgdVec3 abs_view_pos, double max_alt_m,
if ( hit_elev > -9000 ) { if ( hit_elev > -9000 ) {
*terrain_elev = hit_elev; *terrain_elev = hit_elev;
*radius = geoc.radius(); *radius = sgCartToPolar3d(sc + hit_list->get_point(this_hit)).radius();
sgVec3 tmp; sgVec3 tmp;
sgSetVec3(tmp, hit_list->get_normal(this_hit)); sgSetVec3(tmp, hit_list->get_normal(this_hit));
// cout << "cur_normal: " << tmp[0] << " " << tmp[1] << " " << tmp[2] << endl; // cout << "cur_normal: " << tmp[0] << " " << tmp[1] << " " << tmp[2] << endl;
@ -726,7 +726,6 @@ bool fgCurrentElev( sgdVec3 abs_view_pos, double max_alt_m,
int this_hit = -1; int this_hit = -1;
int max_hit = -1; int max_hit = -1;
Point3D geoc;
double hit_elev = -9999; double hit_elev = -9999;
double max_elev = -9999; double max_elev = -9999;
Point3D sc(scenery_center[0], scenery_center[1], scenery_center[2]) ; Point3D sc(scenery_center[0], scenery_center[1], scenery_center[2]) ;
@ -752,6 +751,7 @@ bool fgCurrentElev( sgdVec3 abs_view_pos, double max_alt_m,
max_hit = i; max_hit = i;
} }
} }
if ( this_hit < 0 ) { if ( this_hit < 0 ) {
// no hits below us, take the max hit // no hits below us, take the max hit
@ -761,7 +761,8 @@ bool fgCurrentElev( sgdVec3 abs_view_pos, double max_alt_m,
if ( hit_elev > -9000 ) { if ( hit_elev > -9000 ) {
*terrain_elev = hit_elev; *terrain_elev = hit_elev;
*radius = geoc.radius(); *radius = sgCartToPolar3d(sc + hit_list->get_point(this_hit)).radius();
sgVec3 tmp; sgVec3 tmp;
sgSetVec3(tmp, hit_list->get_normal(this_hit)); sgSetVec3(tmp, hit_list->get_normal(this_hit));
// cout << "cur_normal: " << tmp[0] << " " << tmp[1] << " " << tmp[2] << endl; // cout << "cur_normal: " << tmp[0] << " " << tmp[1] << " " << tmp[2] << endl;