Clean up return code types

* Remove dds_return_t / dds_retcode_t distinction (now there is only
  dds_return_t and all error codes are always negative)

* Remove Q_ERR_... error codes and replace them by DDS_RETCODE_...
  ones so that there is only one set of error codes

* Replace a whole bunch "int" return types that were used to return
  Q_ERR_... codes by "dds_return_t" return types

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2019-05-23 16:51:43 +02:00 committed by eboasson
parent a652ecb78e
commit 19aec98b8a
126 changed files with 1565 additions and 1722 deletions

View file

@ -26,17 +26,10 @@
#include "dds/export.h"
/* TODO: Move to appropriate location */
/**
* Return code indicating success (DDS_RETCODE_OK) or failure. If a given
* operation failed the value will be a unique error code and dds_err_nr() must
* be used to extract the DDS_RETCODE_* value.
*/
typedef int32_t dds_return_t;
/**
* Handle to an entity. A valid entity handle will always have a positive
* integer value. Should the value be negative, the value represents a unique
* error code. dds_err_nr() can be used to extract the DDS_RETCODE_* value.
* integer value. Should the value be negative, it is one of the DDS_RETCODE_*
* error codes.
*/
typedef int32_t dds_entity_t;
@ -1223,7 +1216,7 @@ dds_create_reader(
* @returns a status, 0 on success, TIMEOUT on timeout or a negative value to indicate error.
*/
/* TODO: Complete list of error codes */
DDS_EXPORT int
DDS_EXPORT dds_return_t
dds_reader_wait_for_historical_data(
dds_entity_t reader,
dds_duration_t max_wait);

View file

@ -28,6 +28,8 @@
extern "C" {
#endif
/* ** DEPRECATED ** */
/* Error masks for returned status values */
#define DDS_ERR_NR_MASK 0x000000ff
@ -37,13 +39,13 @@ extern "C" {
/* Error code handling functions */
/** Macro to extract error number */
#define dds_err_nr(e) ((-(e)) & DDS_ERR_NR_MASK)
#define dds_err_nr(e) (e))
/** Macro to extract line number */
#define dds_err_line(e) (((-(e)) & DDS_ERR_LINE_MASK) >> 8)
#define dds_err_line(e) (0)
/** Macro to extract file identifier */
#define dds_err_file_id(e) (((-(e)) & DDS_ERR_FILE_ID_MASK) >> 22)
#define dds_err_file_id(e) (0)
#if defined (__cplusplus)
}

View file

@ -185,7 +185,7 @@ dds_inconsistent_topic_status_t;
* @param[out] status The pointer to \ref DCPS_Status_InconsistentTopic to get the status
*
* @returns 0 - Success
* @returns <0 - Failure (use dds_err_nr() to get error value).
* @returns <0 - Failure
*
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.
@ -212,7 +212,7 @@ dds_get_inconsistent_topic_status (
* @param[out] status The pointer to \ref DCPS_Status_PublicationMatched to get the status
*
* @returns 0 - Success
* @returns <0 - Failure (use dds_err_nr() to get error value).
* @returns <0 - Failure
*
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.
@ -239,7 +239,7 @@ dds_get_publication_matched_status (
* @param[out] status The pointer to \ref DCPS_Status_LivelinessLost to get the status
*
* @returns 0 - Success
* @returns <0 - Failure (use dds_err_nr() to get error value).
* @returns <0 - Failure
*
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.
@ -266,7 +266,7 @@ dds_get_liveliness_lost_status (
* @param[out] status The pointer to \ref DCPS_Status_OfferedDeadlineMissed to get the status
*
* @returns 0 - Success
* @returns <0 - Failure (use dds_err_nr() to get error value).
* @returns <0 - Failure
*
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.
@ -293,7 +293,7 @@ dds_get_offered_deadline_missed_status(
* @param[out] status The pointer to \ref DCPS_Status_OfferedIncompatibleQoS to get the status
*
* @returns 0 - Success
* @returns <0 - Failure (use dds_err_nr() to get error value).
* @returns <0 - Failure
*
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.
@ -320,7 +320,7 @@ dds_get_offered_incompatible_qos_status (
* @param[out] status The pointer to \ref DCPS_Status_SubscriptionMatched to get the status
*
* @returns 0 - Success
* @returns <0 - Failure (use dds_err_nr() to get error value).
* @returns <0 - Failure
*
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.
@ -347,7 +347,7 @@ dds_get_subscription_matched_status (
* @param[out] status The pointer to \ref DCPS_Status_LivelinessChanged to get the status
*
* @returns 0 - Success
* @returns <0 - Failure (use dds_err_nr() to get error value).
* @returns <0 - Failure
*
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.
@ -374,7 +374,7 @@ dds_get_liveliness_changed_status (
* @param[out] status The pointer to \ref DCPS_Status_SampleRejected to get the status
*
* @returns 0 - Success
* @returns <0 - Failure (use dds_err_nr() to get error value).
* @returns <0 - Failure
*
* @retval DDS_RETCODE_ERROR
* An internal error has occurred.