mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 05:43: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
@@ -59,7 +59,7 @@ __EXPORT int motor_test_main(int argc, char *argv[]);
|
||||
static void motor_test(unsigned channel, float value);
|
||||
static void usage(const char *reason);
|
||||
|
||||
static orb_advert_t _test_motor_pub = 0;
|
||||
static orb_advert_t _test_motor_pub = nullptr;
|
||||
|
||||
void motor_test(unsigned channel, float value)
|
||||
{
|
||||
@@ -69,7 +69,7 @@ void motor_test(unsigned channel, float value)
|
||||
_test_motor.timestamp = hrt_absolute_time();
|
||||
_test_motor.value = value;
|
||||
|
||||
if (_test_motor_pub > 0) {
|
||||
if (_test_motor_pub != nullptr) {
|
||||
/* publish test state */
|
||||
orb_publish(ORB_ID(test_motor), _test_motor_pub, &_test_motor);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user