From e769f42f3b6bf3275a7724d9ef2e01e2073b5c27 Mon Sep 17 00:00:00 2001 From: ehofman Date: Wed, 12 Oct 2005 08:55:58 +0000 Subject: [PATCH] =?utf8?q?Mathias=20Fr=F6hlich:?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit I stumbled across two memory errors with two wrong const references to std::string. As I fixed that, I also moved aircraft_dir which is only used from UIUC into UIUC. With that uiuc_aircraftdir.h is empty and can be removed. --- src/FDM/UIUCModel/Makefile.am | 2 +- src/FDM/UIUCModel/uiuc_aircraftdir.h | 80 ---------------------------- src/FDM/UIUCModel/uiuc_wrapper.cpp | 4 +- src/Main/fg_init.cxx | 6 +-- src/Main/fg_props.cxx | 23 -------- src/Main/main.cxx | 4 -- src/Main/options.cxx | 1 - 7 files changed, 4 insertions(+), 116 deletions(-) diff --git a/src/FDM/UIUCModel/Makefile.am b/src/FDM/UIUCModel/Makefile.am index 56ccf9a85..7ac5a00bb 100644 --- a/src/FDM/UIUCModel/Makefile.am +++ b/src/FDM/UIUCModel/Makefile.am @@ -9,7 +9,7 @@ libUIUCModel_a_SOURCES = \ uiuc_2Dinterpolation.cpp uiuc_2Dinterpolation.h \ uiuc_3Dinterpolation.cpp uiuc_3Dinterpolation.h \ uiuc_aerodeflections.cpp uiuc_aerodeflections.h \ - uiuc_aircraftdir.h uiuc_aircraft.h \ + uiuc_aircraft.h \ uiuc_alh_ap.cpp uiuc_alh_ap.h \ uiuc_auto_pilot.cpp uiuc_auto_pilot.h \ uiuc_betaprobe.cpp uiuc_betaprobe.h \ diff --git a/src/FDM/UIUCModel/uiuc_aircraftdir.h b/src/FDM/UIUCModel/uiuc_aircraftdir.h index 9432838da..e69de29bb 100644 --- a/src/FDM/UIUCModel/uiuc_aircraftdir.h +++ b/src/FDM/UIUCModel/uiuc_aircraftdir.h @@ -1,80 +0,0 @@ -/********************************************************************** - - FILENAME: uiuc_aircraftdir.h - ----------------------------------------------------------------------- - - DESCRIPTION: Stores the name of the aircraft directory to be used - ----------------------------------------------------------------------- - - STATUS: alpha version - ----------------------------------------------------------------------- - - REFERENCES: - ----------------------------------------------------------------------- - - HISTORY: 02/22/2000 initial release - ----------------------------------------------------------------------- - - AUTHOR(S): Bipin Sehgal - ----------------------------------------------------------------------- - - VARIABLES: - ----------------------------------------------------------------------- - - INPUTS: * - ----------------------------------------------------------------------- - - OUTPUTS: * - ----------------------------------------------------------------------- - - CALLED BY: * - ----------------------------------------------------------------------- - - CALLS TO: * - ----------------------------------------------------------------------- - - COPYRIGHT: (C) 2000 by Michael Selig - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, - USA or view http://www.gnu.org/copyleft/gpl.html. - -**********************************************************************/ - - -#ifndef _AIRCRAFTDIR_H_ -#define _AIRCRAFTDIR_H_ - -#include - -typedef struct -{ - string aircraft_dir; - #define aircraft_dir aircraftdir_->aircraft_dir - -} AIRCRAFTDIR; - -extern AIRCRAFTDIR *aircraftdir_; // usually defined in the first program that includes uiuc_aircraft.h - -#endif // endif _AIRCRAFTDIR_H diff --git a/src/FDM/UIUCModel/uiuc_wrapper.cpp b/src/FDM/UIUCModel/uiuc_wrapper.cpp index 06be6b61b..a2e57c7ff 100644 --- a/src/FDM/UIUCModel/uiuc_wrapper.cpp +++ b/src/FDM/UIUCModel/uiuc_wrapper.cpp @@ -89,7 +89,6 @@ #include
#include "uiuc_aircraft.h" -#include "uiuc_aircraftdir.h" #include "uiuc_coefficients.h" #include "uiuc_getwind.h" #include "uiuc_engine.h" @@ -120,7 +119,6 @@ extern "C" void uiuc_network_recv_routine(); extern "C" void uiuc_network_send_routine(); AIRCRAFT *aircraft_ = new AIRCRAFT; -AIRCRAFTDIR *aircraftdir_ = new AIRCRAFTDIR; // SendArray testarray(4950); @@ -321,7 +319,7 @@ void uiuc_init_aeromodel () // Initializes the UIUC aircraft model. // Called once from uiuc_init_2_wrapper SGPath path(globals->get_fg_root()); - path.append(aircraft_dir); + path.append(fgGetString("/sim/aircraft-dir")); path.append("aircraft.dat"); cout << "We are using "<< path.str() << endl; uiuc_initializemaps(); // Initialize the maps diff --git a/src/Main/fg_init.cxx b/src/Main/fg_init.cxx index 8cf6a435d..17ee5c525 100644 --- a/src/Main/fg_init.cxx +++ b/src/Main/fg_init.cxx @@ -64,7 +64,6 @@ #include #include -#include #include #include #include @@ -1304,8 +1303,7 @@ void fgInitFDM() { } double dt = 1.0 / fgGetInt("/sim/model-hz"); - aircraft_dir = fgGetString("/sim/aircraft-dir"); - const string &model = fgGetString("/sim/flight-model"); + string model = fgGetString("/sim/flight-model"); try { if ( model == "larcsim" ) { @@ -1466,7 +1464,7 @@ void fgInitTimeOffset() { // Okay, we now have several possible scenarios int offset = fgGetInt("/sim/startup/time-offset"); - const string &offset_type = fgGetString("/sim/startup/time-offset-type"); + string offset_type = fgGetString("/sim/startup/time-offset-type"); int warp = 0; if ( offset_type == "real" ) { diff --git a/src/Main/fg_props.cxx b/src/Main/fg_props.cxx index 8c603096e..0a78154f9 100644 --- a/src/Main/fg_props.cxx +++ b/src/Main/fg_props.cxx @@ -36,7 +36,6 @@ #include #include #include