Don't assign a const char* variable to the c_str() value of a temporary (local) string.
This commit is contained in:
parent
a112b39c84
commit
28b751f121
1 changed files with 5 additions and 3 deletions
|
@ -112,11 +112,11 @@ DME::update (double delta_time_sec)
|
||||||
if (source[0] == '\0') {
|
if (source[0] == '\0') {
|
||||||
string branch;
|
string branch;
|
||||||
branch = "/instrumentation/" + name + "/frequencies/selected-mhz";
|
branch = "/instrumentation/" + name + "/frequencies/selected-mhz";
|
||||||
source = branch.c_str();
|
_source_node->setStringValue(branch.c_str());
|
||||||
_source_node->setStringValue(source);
|
source = _source_node->getStringValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the frequency
|
// Get the frequency
|
||||||
|
|
||||||
double frequency_mhz = fgGetDouble(source, 108.0);
|
double frequency_mhz = fgGetDouble(source, 108.0);
|
||||||
if (frequency_mhz != _last_frequency_mhz) {
|
if (frequency_mhz != _last_frequency_mhz) {
|
||||||
_time_before_search_sec = 0;
|
_time_before_search_sec = 0;
|
||||||
|
@ -153,9 +153,11 @@ DME::update (double delta_time_sec)
|
||||||
Point3D location =
|
Point3D location =
|
||||||
sgGeodToCart(Point3D(longitude_rad, latitude_rad, altitude_m));
|
sgGeodToCart(Point3D(longitude_rad, latitude_rad, altitude_m));
|
||||||
double distance_nm = _transmitter.distance3D(location) * SG_METER_TO_NM;
|
double distance_nm = _transmitter.distance3D(location) * SG_METER_TO_NM;
|
||||||
|
|
||||||
double range_nm = adjust_range(_transmitter_elevation_ft,
|
double range_nm = adjust_range(_transmitter_elevation_ft,
|
||||||
altitude_m * SG_METER_TO_FEET,
|
altitude_m * SG_METER_TO_FEET,
|
||||||
_transmitter_range_nm);
|
_transmitter_range_nm);
|
||||||
|
|
||||||
if (distance_nm <= range_nm) {
|
if (distance_nm <= range_nm) {
|
||||||
double speed_kt = (fabs(distance_nm - _last_distance_nm) *
|
double speed_kt = (fabs(distance_nm - _last_distance_nm) *
|
||||||
((1 / delta_time_sec) * 3600.0));
|
((1 / delta_time_sec) * 3600.0));
|
||||||
|
|
Loading…
Add table
Reference in a new issue