From c0b64dccdbab3a4302a2839ce0f05dce5c29f76c Mon Sep 17 00:00:00 2001 From: torsten Date: Sat, 2 Jan 2010 20:22:02 +0000 Subject: [PATCH 1/3] purge gcc warning xxx will be initialized after yyy --- src/ATCDCL/ATC.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ATCDCL/ATC.cxx b/src/ATCDCL/ATC.cxx index 41c56e648..68963fe92 100644 --- a/src/ATCDCL/ATC.cxx +++ b/src/ATCDCL/ATC.cxx @@ -35,8 +35,8 @@ FGATC::FGATC() : - _voiceOK(false), _playing(false), + _voiceOK(false), _sgr(NULL), freqClear(true), receiving(false), From 1290c25a38175ce490e3ca775a5ce10100b6e4de Mon Sep 17 00:00:00 2001 From: torsten Date: Sat, 2 Jan 2010 20:28:38 +0000 Subject: [PATCH 2/3] eliminate gcc warnings --- src/ATCDCL/AILocalTraffic.cxx | 4 ++-- src/ATCDCL/ATCutils.cxx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ATCDCL/AILocalTraffic.cxx b/src/ATCDCL/AILocalTraffic.cxx index 6c1b77d8f..b0b1c6e22 100644 --- a/src/ATCDCL/AILocalTraffic.cxx +++ b/src/ATCDCL/AILocalTraffic.cxx @@ -164,8 +164,8 @@ void FGAILocalTraffic::GetRwyDetails(const string& id) { // move to the +l end/center of the runway //cout << "Runway center is at " << runway._lon << ", " << runway._lat << '\n'; - double tshlon, tshlat, tshr; - double tolon, tolat, tor; + double tshlon = 0.0, tshlat = 0.0, tshr; + double tolon = 0.0, tolat = 0.0, tor; rwy.length = runway->lengthM(); rwy.width = runway->widthM(); geo_direct_wgs_84 ( aptElev, runway->latitude(), runway->longitude(), other_way, diff --git a/src/ATCDCL/ATCutils.cxx b/src/ATCDCL/ATCutils.cxx index fe484f256..02485a549 100644 --- a/src/ATCDCL/ATCutils.cxx +++ b/src/ATCDCL/ATCutils.cxx @@ -86,7 +86,7 @@ string ConvertNumToSpokenDigits(const int& n) { // Anything else is not guaranteed to be handled correctly! string ConvertRwyNumToSpokenString(const string &rwy) { string rslt; - for (int ii = 0; ii < rwy.length(); ii++){ + for (size_t ii = 0; ii < rwy.length(); ii++){ if (rslt.length()) rslt += " "; string ch = rwy.substr(ii,1); if (isdigit(ch[0])) rslt += ConvertNumToSpokenDigits(atoi(ch.c_str())); From f14fc6b98f58592303212c5440dabf04d7fd130e Mon Sep 17 00:00:00 2001 From: torsten Date: Sat, 2 Jan 2010 20:51:32 +0000 Subject: [PATCH 3/3] wrong logic never found the 'end' --- src/Sound/morse.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Sound/morse.cxx b/src/Sound/morse.cxx index 942b637a5..df6c969fa 100644 --- a/src/Sound/morse.cxx +++ b/src/Sound/morse.cxx @@ -193,7 +193,7 @@ SGSoundSample *FGMorse::make_ident( const string& id, const int freq ) { for ( i = 0; i < (int)id.length(); ++i ) { if ( idptr[i] >= 'A' && idptr[i] <= 'Z' ) { int c = (int)(idptr[i] - 'A'); - for ( j = 0; j < 4 || alphabet[c][j] == end; ++j ) { + for ( j = 0; j < 4 && alphabet[c][j] != end; ++j ) { if ( alphabet[c][j] == DIT ) { length += DIT_SIZE; } else if ( alphabet[c][j] == DAH ) { @@ -227,7 +227,7 @@ SGSoundSample *FGMorse::make_ident( const string& id, const int freq ) { for ( i = 0; i < (int)id.length(); ++i ) { if ( idptr[i] >= 'A' && idptr[i] <= 'Z' ) { int c = (int)(idptr[i] - 'A'); - for ( j = 0; j < 4 || alphabet[c][j] == end; ++j ) { + for ( j = 0; j < 4 && alphabet[c][j] != end; ++j ) { if ( alphabet[c][j] == DIT ) { memcpy( buf_ptr, dit_ptr, DIT_SIZE ); buf_ptr += DIT_SIZE;