ERROR macro: get rid of the many 'oddly, ERROR is not defined for c++', use PX4_ERROR

This commit is contained in:
Beat Küng
2016-09-20 10:30:18 +02:00
committed by Julian Oes
parent c606554da3
commit 241fd629ce
42 changed files with 207 additions and 504 deletions
+5 -11
View File
@@ -49,6 +49,7 @@
#include <stdio.h>
#include <ctype.h>
#include <px4_config.h>
#include <px4_defines.h>
#include <unistd.h>
#include <geo/geo.h>
#include <drivers/drv_hrt.h>
@@ -56,13 +57,6 @@
#define GEOFENCE_RANGE_WARNING_LIMIT 5000000
/* Oddly, ERROR is not defined for C++ */
#ifdef ERROR
# undef ERROR
#endif
static const int ERROR = -1;
Geofence::Geofence(Navigator *navigator) :
SuperBlock(NULL, "GF"),
_navigator(navigator),
@@ -323,7 +317,7 @@ Geofence::loadFromFile(const char *filename)
int pointCounter = 0;
bool gotVertical = false;
const char commentChar = '#';
int rc = ERROR;
int rc = PX4_ERROR;
/* Make sure no data is left in the datamanager */
clearDm();
@@ -332,7 +326,7 @@ Geofence::loadFromFile(const char *filename)
fp = fopen(GEOFENCE_FILENAME, "r");
if (fp == NULL) {
return ERROR;
return PX4_ERROR;
}
/* create geofence points from valid lines and store in DM */
@@ -408,7 +402,7 @@ Geofence::loadFromFile(const char *filename)
_vertices_count = pointCounter;
warnx("Geofence: imported successfully");
mavlink_log_info(_navigator->get_mavlink_log_pub(), "Geofence imported");
rc = OK;
rc = PX4_OK;
} else {
warnx("Geofence: import error");
@@ -423,5 +417,5 @@ error:
int Geofence::clearDm()
{
dm_clear(DM_KEY_FENCE_POINTS);
return OK;
return PX4_OK;
}