mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 19: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
@@ -293,7 +293,6 @@ SF0X::init()
|
||||
|
||||
_class_instance = register_class_devname(RANGE_FINDER_BASE_DEVICE_PATH);
|
||||
|
||||
<<<<<<< HEAD
|
||||
if (_class_instance == CLASS_DEVICE_PRIMARY) {
|
||||
/* get a publish handle on the range finder topic */
|
||||
struct distance_sensor_s ds_report = {};
|
||||
@@ -301,13 +300,9 @@ SF0X::init()
|
||||
_distance_sensor_topic = orb_advertise_multi(ORB_ID(distance_sensor), &ds_report,
|
||||
&_orb_class_instance, ORB_PRIO_HIGH);
|
||||
|
||||
if (_distance_sensor_topic < 0) {
|
||||
if (_distance_sensor_topic == nullptr) {
|
||||
log("failed to create distance_sensor object. Did you start uOrb?");
|
||||
}
|
||||
=======
|
||||
if (_range_finder_topic == 0) {
|
||||
warnx("advert err");
|
||||
>>>>>>> extensive orb_advert_t fixes
|
||||
}
|
||||
|
||||
} while(0);
|
||||
|
||||
Reference in New Issue
Block a user