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
@@ -563,7 +563,7 @@ LSM303D::LSM303D(int bus, const char* path, spi_dev_e device, enum Rotation rota
_mag_range_ga(0.0f),
_mag_range_scale(0.0f),
_mag_samplerate(0),
_accel_topic(0),
_accel_topic(nullptr),
_accel_orb_class_instance(-1),
_accel_class_instance(-1),
_accel_read(0),
@@ -676,7 +676,7 @@ LSM303D::init()
_mag->_mag_topic = orb_advertise_multi(ORB_ID(sensor_mag), &mrp,
&_mag->_mag_orb_class_instance, ORB_PRIO_LOW);
if (_mag->_mag_topic == 0) {
if (_mag->_mag_topic == nullptr) {
warnx("ADVERT ERR");
}
@@ -691,7 +691,7 @@ LSM303D::init()
_accel_topic = orb_advertise_multi(ORB_ID(sensor_accel), &arp,
&_accel_orb_class_instance, (is_external()) ? ORB_PRIO_VERY_HIGH : ORB_PRIO_DEFAULT);
if (_accel_topic == 0) {
if (_accel_topic == nullptr) {
warnx("ADVERT ERR");
}
@@ -1770,7 +1770,7 @@ LSM303D::test_error()
LSM303D_mag::LSM303D_mag(LSM303D *parent) :
CDev("LSM303D_mag", LSM303D_DEVICE_PATH_MAG),
_parent(parent),
_mag_topic(0),
_mag_topic(nullptr),
_mag_orb_class_instance(-1),
_mag_class_instance(-1)
{