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
+2 -2
View File
@@ -238,7 +238,7 @@ BMA180::BMA180(int bus, spi_dev_e device) :
_reports(nullptr),
_accel_range_scale(0.0f),
_accel_range_m_s2(0.0f),
_accel_topic(0),
_accel_topic(nullptr),
_class_instance(-1),
_current_lowpass(0),
_current_range(0),
@@ -733,7 +733,7 @@ BMA180::measure()
poll_notify(POLLIN);
/* publish for subscribers */
if (_accel_topic != 0 && !(_pub_blocked))
if (_accel_topic != nullptr && !(_pub_blocked))
orb_publish(ORB_ID(sensor_accel), _accel_topic, &report);
/* stop the perf counter */