mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 05:53:34 +08:00
orb_advert_t changed to void * and checks changed to nullptr
The existing orb_advert_t use thoughout the code sometimes tries to treat it as a file descriptor and there are checks for < 0 and ::close calls on orb_advert_t types which is an invalid use of an object pointer, which is what orb_advert_t really is. Initially I had changed the -1 initializations to 0 but it was suggested that this should be nullptr. That was a good recommendation but the definition of orb_advert_t had to change to void * because you cannot initialize a uintptr_t as nullptr. Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
committed by
Lorenz Meier
parent
180c8b0cb0
commit
1ca05aaa64
@@ -86,8 +86,8 @@ Airspeed::Airspeed(int bus, int address, unsigned conversion_interval, const cha
|
||||
_measure_ticks(0),
|
||||
_collect_phase(false),
|
||||
_diff_pres_offset(0.0f),
|
||||
_airspeed_pub(0),
|
||||
_subsys_pub(0),
|
||||
_airspeed_pub(nullptr),
|
||||
_subsys_pub(nullptr),
|
||||
_class_instance(-1),
|
||||
_conversion_interval(conversion_interval),
|
||||
_sample_perf(perf_alloc(PC_ELAPSED, "airspeed_read")),
|
||||
@@ -146,7 +146,7 @@ Airspeed::init()
|
||||
/* measurement will have generated a report, publish */
|
||||
_airspeed_pub = orb_advertise(ORB_ID(differential_pressure), &arp);
|
||||
|
||||
if (_airspeed_pub == 0)
|
||||
if (_airspeed_pub == nullptr)
|
||||
warnx("uORB started?");
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ Airspeed::update_status()
|
||||
SUBSYSTEM_TYPE_DIFFPRESSURE
|
||||
};
|
||||
|
||||
if (_subsys_pub == 0) {
|
||||
if (_subsys_pub == nullptr) {
|
||||
orb_publish(ORB_ID(subsystem_info), _subsys_pub, &info);
|
||||
} else {
|
||||
_subsys_pub = orb_advertise(ORB_ID(subsystem_info), &info);
|
||||
|
||||
Reference in New Issue
Block a user