diff --git a/src/Airports/dynamicloader.cxx b/src/Airports/dynamicloader.cxx index 53027f63d..986b1dd39 100644 --- a/src/Airports/dynamicloader.cxx +++ b/src/Airports/dynamicloader.cxx @@ -13,6 +13,8 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // +#include + #include "dynamicloader.hxx" FGAirportDynamicsXMLLoader::FGAirportDynamicsXMLLoader(FGAirportDynamics* dyn): @@ -50,7 +52,7 @@ void FGAirportDynamicsXMLLoader::startElement (const char * name, const XMLAttr //cout << " " << atts.getName(i) << '=' << atts.getValue(i) << endl; attname = atts.getName(i); if (attname == string("index")) - park.setIndex(atoi(atts.getValue(i))); + park.setIndex(std::atoi(atts.getValue(i))); else if (attname == string("type")) park.setType(atts.getValue(i)); else if (attname == string("name")) @@ -62,13 +64,13 @@ void FGAirportDynamicsXMLLoader::startElement (const char * name, const XMLAttr else if (attname == string("lon")) park.setLongitude(atts.getValue(i)); else if (attname == string("heading")) - park.setHeading(atof(atts.getValue(i))); + park.setHeading(std::atof(atts.getValue(i))); else if (attname == string("radius")) { string radius = atts.getValue(i); if (radius.find("M") != string::npos) radius = radius.substr(0, radius.find("M",0)); //cerr << "Radius " << radius <getGroundNetwork()->addSegment(taxiSegment); } diff --git a/src/Airports/runwayprefloader.cxx b/src/Airports/runwayprefloader.cxx index 3819a39a8..bfdcf8dd6 100644 --- a/src/Airports/runwayprefloader.cxx +++ b/src/Airports/runwayprefloader.cxx @@ -13,10 +13,15 @@ // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // +#include +#include + #include #include "runwayprefloader.hxx" +using namespace std; + FGRunwayPreferenceXMLLoader::FGRunwayPreferenceXMLLoader(FGRunwayPreference* p):XMLVisitor(), _pref(p) {} void FGRunwayPreferenceXMLLoader::startXML () { diff --git a/src/Airports/runways.cxx b/src/Airports/runways.cxx index b5770fc82..c1b224522 100644 --- a/src/Airports/runways.cxx +++ b/src/Airports/runways.cxx @@ -25,8 +25,9 @@ # include #endif -#include // fabs() -#include // sprintf() +#include // fabs() +#include // sprintf() +#include // atoi() #include #include diff --git a/src/FDM/JSBSim/input_output/FGfdmSocket.cpp b/src/FDM/JSBSim/input_output/FGfdmSocket.cpp index 37f29336e..c1a582699 100644 --- a/src/FDM/JSBSim/input_output/FGfdmSocket.cpp +++ b/src/FDM/JSBSim/input_output/FGfdmSocket.cpp @@ -37,6 +37,8 @@ HISTORY INCLUDES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/ +#include + #include "FGfdmSocket.h" namespace JSBSim { @@ -79,7 +81,7 @@ FGfdmSocket::FGfdmSocket(string address, int port) memset(&scktName, 0, sizeof(struct sockaddr_in)); scktName.sin_family = AF_INET; scktName.sin_port = htons(port); - memcpy(&scktName.sin_addr, host->h_addr_list[0], host->h_length); + std::memcpy(&scktName.sin_addr, host->h_addr_list[0], host->h_length); int len = sizeof(struct sockaddr_in); if (connect(sckt, (struct sockaddr*)&scktName, len) == 0) { // successful cout << "Successfully connected to socket for output ..." << endl; @@ -113,7 +115,7 @@ FGfdmSocket::FGfdmSocket(int port) sckt = socket(AF_INET, SOCK_STREAM, 0); if (sckt >= 0) { // successful - memset(&scktName, 0, sizeof(struct sockaddr_in)); + std::memset(&scktName, 0, sizeof(struct sockaddr_in)); scktName.sin_family = AF_INET; scktName.sin_port = htons(port); int len = sizeof(struct sockaddr_in); diff --git a/src/FDM/YASim/Airplane.cpp b/src/FDM/YASim/Airplane.cpp index c6b5ae925..1b3fbd4ba 100644 --- a/src/FDM/YASim/Airplane.cpp +++ b/src/FDM/YASim/Airplane.cpp @@ -417,7 +417,7 @@ float Airplane::getTailIncidence() return _tailIncidence; } -char* Airplane::getFailureMsg() +const char* Airplane::getFailureMsg() { return _failureMsg; } diff --git a/src/FDM/YASim/Airplane.hpp b/src/FDM/YASim/Airplane.hpp index e0e53f4e5..913eb49ed 100644 --- a/src/FDM/YASim/Airplane.hpp +++ b/src/FDM/YASim/Airplane.hpp @@ -90,7 +90,7 @@ public: float getCruiseAoA(); float getTailIncidence(); float getApproachElevator() { return _approachElevator.val; } - char* getFailureMsg(); + const char* getFailureMsg(); static void setupState(float aoa, float speed, float gla, State* s); // utility @@ -172,7 +172,7 @@ private: float _cruiseAoA; float _tailIncidence; Control _approachElevator; - char* _failureMsg; + const char* _failureMsg; }; }; // namespace yasim diff --git a/src/FDM/YASim/FGFDM.cpp b/src/FDM/YASim/FGFDM.cpp index 5d68308f1..921fdcf60 100644 --- a/src/FDM/YASim/FGFDM.cpp +++ b/src/FDM/YASim/FGFDM.cpp @@ -1013,7 +1013,7 @@ char* FGFDM::dup(const char* s) return s2; } -int FGFDM::attri(XMLAttributes* atts, char* attr) +int FGFDM::attri(XMLAttributes* atts, const char* attr) { if(!atts->hasAttribute(attr)) { SG_LOG(SG_FLIGHT,SG_ALERT,"Missing '" << attr << @@ -1023,14 +1023,14 @@ int FGFDM::attri(XMLAttributes* atts, char* attr) return attri(atts, attr, 0); } -int FGFDM::attri(XMLAttributes* atts, char* attr, int def) +int FGFDM::attri(XMLAttributes* atts, const char* attr, int def) { const char* val = atts->getValue(attr); if(val == 0) return def; else return atol(val); } -float FGFDM::attrf(XMLAttributes* atts, char* attr) +float FGFDM::attrf(XMLAttributes* atts, const char* attr) { if(!atts->hasAttribute(attr)) { SG_LOG(SG_FLIGHT,SG_ALERT,"Missing '" << attr << @@ -1040,14 +1040,14 @@ float FGFDM::attrf(XMLAttributes* atts, char* attr) return attrf(atts, attr, 0); } -float FGFDM::attrf(XMLAttributes* atts, char* attr, float def) +float FGFDM::attrf(XMLAttributes* atts, const char* attr, float def) { const char* val = atts->getValue(attr); if(val == 0) return def; else return (float)atof(val); } -double FGFDM::attrd(XMLAttributes* atts, char* attr) +double FGFDM::attrd(XMLAttributes* atts, const char* attr) { if(!atts->hasAttribute(attr)) { SG_LOG(SG_FLIGHT,SG_ALERT,"Missing '" << attr << @@ -1057,7 +1057,7 @@ double FGFDM::attrd(XMLAttributes* atts, char* attr) return attrd(atts, attr, 0); } -double FGFDM::attrd(XMLAttributes* atts, char* attr, double def) +double FGFDM::attrd(XMLAttributes* atts, const char* attr, double def) { const char* val = atts->getValue(attr); if(val == 0) return def; @@ -1075,7 +1075,7 @@ double FGFDM::attrd(XMLAttributes* atts, char* attr, double def) // Unfortunately, this usage creeped into existing configuration files // while I wasn't active, and it's going to be hard to remove. Issue // a warning to nag people into changing their ways for now... -bool FGFDM::attrb(XMLAttributes* atts, char* attr) +bool FGFDM::attrb(XMLAttributes* atts, const char* attr) { const char* val = atts->getValue(attr); if(val == 0) return false; diff --git a/src/FDM/YASim/FGFDM.hpp b/src/FDM/YASim/FGFDM.hpp index 1df2c4872..0d5b43e37 100644 --- a/src/FDM/YASim/FGFDM.hpp +++ b/src/FDM/YASim/FGFDM.hpp @@ -49,13 +49,13 @@ private: bool eq(const char* a, const char* b); bool caseeq(const char* a, const char* b); char* dup(const char* s); - int attri(XMLAttributes* atts, char* attr); - int attri(XMLAttributes* atts, char* attr, int def); - float attrf(XMLAttributes* atts, char* attr); - float attrf(XMLAttributes* atts, char* attr, float def); - double attrd(XMLAttributes* atts, char* attr); - double attrd(XMLAttributes* atts, char* attr, double def); - bool attrb(XMLAttributes* atts, char* attr); + int attri(XMLAttributes* atts, const char* attr); + int attri(XMLAttributes* atts, const char* attr, int def); + float attrf(XMLAttributes* atts, const char* attr); + float attrf(XMLAttributes* atts, const char* attr, float def); + double attrd(XMLAttributes* atts, const char* attr); + double attrd(XMLAttributes* atts, const char* attr, double def); + bool attrb(XMLAttributes* atts, const char* attr); // The core Airplane object we manage. Airplane _airplane; diff --git a/src/FDM/YASim/yasim-test.cpp b/src/FDM/YASim/yasim-test.cpp index cff1c1558..2fa642526 100644 --- a/src/FDM/YASim/yasim-test.cpp +++ b/src/FDM/YASim/yasim-test.cpp @@ -1,5 +1,8 @@ #include +#include +#include + #include #include @@ -93,8 +96,8 @@ int main(int argc, char** argv) if(!a->getFailureMsg() && argc > 2 && strcmp(argv[2], "-g") == 0) { float alt = 5000, kts = 100; for(int i=3; i +#include + #include SG_USING_STD(vector); @@ -112,7 +114,7 @@ fgExit (int status) #endif SG_LOG(SG_GENERAL, SG_INFO, "Exiting FlightGear with status " << status); - exit(status); + std::exit(status); } diff --git a/utils/GPSsmooth/UGear_command.cxx b/utils/GPSsmooth/UGear_command.cxx index 7e64cc887..85485749f 100644 --- a/utils/GPSsmooth/UGear_command.cxx +++ b/utils/GPSsmooth/UGear_command.cxx @@ -1,3 +1,5 @@ +#include + #include "UGear_command.hxx" @@ -18,7 +20,7 @@ static char calc_nmea_cksum(const char *sentence) { // cout << sentence << endl; - len = strlen(sentence); + len = std::strlen(sentence); sum = sentence[0]; for ( i = 1; i < len; i++ ) { // cout << sentence[i];