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:
Mark Charlebois
2015-05-27 14:42:49 -07:00
committed by Lorenz Meier
parent 180c8b0cb0
commit 1ca05aaa64
59 changed files with 263 additions and 269 deletions
+4 -4
View File
@@ -507,7 +507,7 @@ MPU6000::MPU6000(int bus, const char *path_accel, const char *path_gyro, spi_dev
_accel_scale{},
_accel_range_scale(0.0f),
_accel_range_m_s2(0.0f),
_accel_topic(0),
_accel_topic(nullptr),
_accel_orb_class_instance(-1),
_accel_class_instance(-1),
_gyro_reports(nullptr),
@@ -658,7 +658,7 @@ MPU6000::init()
_accel_topic = orb_advertise_multi(ORB_ID(sensor_accel), &arp,
&_accel_orb_class_instance, (is_external()) ? ORB_PRIO_MAX : ORB_PRIO_HIGH);
if (_accel_topic == 0) {
if (_accel_topic == nullptr) {
warnx("ADVERT FAIL");
}
@@ -670,7 +670,7 @@ MPU6000::init()
_gyro->_gyro_topic = orb_advertise_multi(ORB_ID(sensor_gyro), &grp,
&_gyro->_gyro_orb_class_instance, (is_external()) ? ORB_PRIO_MAX : ORB_PRIO_HIGH);
if (_gyro->_gyro_topic == 0) {
if (_gyro->_gyro_topic == nullptr) {
warnx("ADVERT FAIL");
}
@@ -1847,7 +1847,7 @@ MPU6000::print_registers()
MPU6000_gyro::MPU6000_gyro(MPU6000 *parent, const char *path) :
CDev("MPU6000_gyro", path),
_parent(parent),
_gyro_topic(0),
_gyro_topic(nullptr),
_gyro_orb_class_instance(-1),
_gyro_class_instance(-1)
{