mirror of
https://github.com/paparazzi/paparazzi.git
synced 2026-05-30 11:37:06 +08:00
Coverity fixes (#1790)
* Various coverity fixes (High Impact Outstanding) * Removed typo in comment * Removed wrong line of code. * Minor fixes * snprintf finally done right * Added space * Wind direction finally OK
This commit is contained in:
committed by
GitHub
parent
b3042ba955
commit
6b777fcbf3
@@ -506,10 +506,24 @@ static void init_jsbsim(double dt)
|
||||
|
||||
char buf[1024];
|
||||
string rootdir;
|
||||
string jsbsim_home = "/conf/simulator/jsbsim/";
|
||||
string jsbsim_ic_name;
|
||||
|
||||
sprintf(buf, "%s/conf/simulator/jsbsim/", getenv("PAPARAZZI_HOME"));
|
||||
rootdir = string(buf);
|
||||
char* pprz_home = getenv("PAPARAZZI_HOME");
|
||||
|
||||
int cnt = -1;
|
||||
if (strlen(pprz_home) < sizeof(buf)) {
|
||||
cnt = snprintf(buf, strlen(pprz_home) + 1, "%s", pprz_home);
|
||||
rootdir = string(buf) + jsbsim_home;
|
||||
}
|
||||
|
||||
// check the results
|
||||
if (cnt < 0){
|
||||
// Either pprz_home path too long for the buffer
|
||||
// or writing the string was not successful.
|
||||
cout << "PPRZ_HOME not set correctly, exiting..." << endl;
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
/* if jsbsim initial conditions are defined, use them
|
||||
* otherwise use flightplan location
|
||||
|
||||
@@ -160,6 +160,7 @@ void nps_flightgear_send()
|
||||
struct FGNetGUI gui;
|
||||
|
||||
gui.version = FG_NET_GUI_VERSION;
|
||||
gui.padding1 = 0; // initialize the padding variable to zero
|
||||
|
||||
gui.latitude = fdm.lla_pos.lat;
|
||||
gui.longitude = fdm.lla_pos.lon;
|
||||
|
||||
@@ -33,6 +33,7 @@ int nps_radio_control_spektrum_init(const char *device)
|
||||
return -1;
|
||||
}
|
||||
struct termios termios;
|
||||
termios.c_iflag = 0; // properly initialize variable
|
||||
/* input modes */
|
||||
termios.c_iflag &= ~(IGNBRK | BRKINT | PARMRK | INPCK | ISTRIP | INLCR | IGNCR
|
||||
| ICRNL | IUCLC | IXON | IXANY | IXOFF | IMAXBEL);
|
||||
|
||||
Reference in New Issue
Block a user