stricter warning checks and the corresponding fixes

Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
Erik Boasson 2018-08-07 17:30:17 +02:00 committed by eboasson
parent 87e4780446
commit b7487b18a6
101 changed files with 1756 additions and 1615 deletions

View file

@ -3043,7 +3043,7 @@ DDS_EXPORT _Must_inspect_result_ dds_return_t
dds_return_loan(
_In_ dds_entity_t reader_or_condition,
_Inout_updates_(bufsz) void **buf,
_In_ size_t bufsz);
_In_ int32_t bufsz);
/*
Instance handle <=> key value mapping.

View file

@ -43,10 +43,10 @@ struct rhc;
/* Internal entity status flags */
#define DDS_INTERNAL_STATUS_MASK (0xFF000000)
#define DDS_INTERNAL_STATUS_MASK (0xFF000000u)
#define DDS_WAITSET_TRIGGER_STATUS (0x01000000)
#define DDS_DELETING_STATUS (0x02000000)
#define DDS_WAITSET_TRIGGER_STATUS (0x01000000u)
#define DDS_DELETING_STATUS (0x02000000u)
/* This can be used when polling for various states.
* Obviously, it is encouraged to use condition variables and such. But
@ -78,8 +78,8 @@ typedef struct c_listener {
/* Entity flag values */
#define DDS_ENTITY_ENABLED 0x0001
#define DDS_ENTITY_IMPLICIT 0x0002
#define DDS_ENTITY_ENABLED 0x0001u
#define DDS_ENTITY_IMPLICIT 0x0002u
typedef struct dds_domain
{

View file

@ -17,7 +17,7 @@ This file was the one orginally in ./src/api/dcps/saj/code/.
(and therefore by implication ./src/api/dcps/cj/java/code).
*/
#define BUILTIN_TOPIC_KEY_TYPE_NATIVE long
#define BUILTIN_TOPIC_KEY_TYPE_NATIVE unsigned long
module DDS {

View file

@ -990,7 +990,7 @@ dds_valid_hdl(
/* When the given handle already contains an error, then return that
* same error to retain the original information. */
if (hdl >= 0) {
utr = ut_handle_status(hdl, NULL, kind);
utr = ut_handle_status(hdl, NULL, (int32_t)kind);
if(utr == UT_HANDLE_OK){
rc = DDS_RETCODE_OK;
} else if(utr == UT_HANDLE_UNEQUAL_KIND){
@ -1029,7 +1029,7 @@ dds_entity_lock(
/* When the given handle already contains an error, then return that
* same error to retain the original information. */
if (hdl >= 0) {
utr = ut_handle_claim(hdl, NULL, kind, (void**)e);
utr = ut_handle_claim(hdl, NULL, (int32_t)kind, (void**)e);
if (utr == UT_HANDLE_OK) {
os_mutexLock(&((*e)->m_mutex));
/* The handle could have been closed while we were waiting for the mutex. */
@ -1195,14 +1195,13 @@ dds_entity_observer_unregister(
_In_ dds_entity_t observer)
{
dds__retcode_t rc;
dds_return_t ret;
dds_entity *e;
rc = dds_entity_lock(observed, DDS_KIND_DONTCARE, &e);
if (rc == DDS_RETCODE_OK) {
rc = dds_entity_observer_unregister_nl(e, observer);
dds_entity_unlock(e);
} else{
ret = DDS_ERRNO(rc, "Error occurred on locking entity");
rc = DDS_ERRNO(rc, "Error occurred on locking entity");
}
return rc;
}

View file

@ -37,7 +37,7 @@ static const char * dds_err_code_array[DDS_ERR_CODE_NUM] =
const char * dds_err_str (dds_return_t err)
{
unsigned index = DDS_ERR_NR_INDEX (err);
unsigned index = (unsigned)DDS_ERR_NR_INDEX (err);
if (err >= 0)
{
return "Success";

View file

@ -37,12 +37,7 @@ char *os_environ[] = { NULL };
struct q_globals gv;
dds_globals dds_global =
{
DDS_DOMAIN_DEFAULT, 0,
NULL, NULL, NULL, NULL
};
dds_globals dds_global = { .m_default_domain = DDS_DOMAIN_DEFAULT };
static struct cfgst * dds_cfgst = NULL;
dds_return_t

View file

@ -20,7 +20,7 @@
#ifndef NDEBUG
static bool keyhash_is_reset(const dds_key_hash_t *kh)
{
static const char nullhash[sizeof(kh->m_hash)];
static const char nullhash[sizeof(kh->m_hash)] = { 0 };
return kh->m_flags == 0 && memcmp(kh->m_hash, nullhash, sizeof(nullhash)) == 0;
}
#endif
@ -33,7 +33,7 @@ void dds_key_md5 (dds_key_hash_t * kh)
md5_finish (&md5st, (unsigned char *) kh->m_hash);
}
/*
/*
dds_key_gen: Generates key and keyhash for a sample.
See section 9.6.3.3 of DDSI spec.
*/
@ -85,9 +85,13 @@ void dds_key_gen
case DDS_OP_VAL_2BY: len += 2; break;
case DDS_OP_VAL_4BY: len += 4; break;
case DDS_OP_VAL_8BY: len += 8; break;
case DDS_OP_VAL_STR: src = *((char**) src); /* Fall-through intentional */
case DDS_OP_VAL_BST: len += (uint32_t) (5 + strlen (src)); break;
case DDS_OP_VAL_ARR:
case DDS_OP_VAL_STR:
src = *((char**) src);
/* FALLS THROUGH */
case DDS_OP_VAL_BST:
len += (uint32_t) (5 + strlen (src));
break;
case DDS_OP_VAL_ARR:
len += op[2] * dds_op_size[DDS_OP_SUBTYPE (*op)];
break;
default: assert (0);
@ -143,7 +147,8 @@ void dds_key_gen
case DDS_OP_VAL_STR:
{
src = *((char**) src);
} /* Fall-through intentional */
}
/* FALLS THROUGH */
case DDS_OP_VAL_BST:
{
uint32_t u32;
@ -173,7 +178,7 @@ void dds_key_gen
/* Hash is md5 of key */
if ((kh->m_flags & DDS_KEY_IS_HASH) == 0)
if ((kh->m_flags & DDS_KEY_IS_HASH) == 0)
{
dds_key_md5 (kh);
}

View file

@ -21,7 +21,7 @@
#include "dds__err.h"
#include "dds__report.h"
#define DDS_PARTICIPANT_STATUS_MASK 0
#define DDS_PARTICIPANT_STATUS_MASK 0u
/* List of created participants */
@ -101,6 +101,7 @@ dds_participant_qos_validate(
{
dds_return_t ret = DDS_RETCODE_OK;
assert(qos);
(void)enabled;
/* Check consistency. */
if ((qos->present & QP_USER_DATA) && !validate_octetseq(&qos->user_data)) {
@ -120,6 +121,7 @@ dds_participant_qos_set(
bool enabled)
{
dds_return_t ret = dds_participant_qos_validate(qos, enabled);
(void)e;
if (ret == DDS_RETCODE_OK) {
if (enabled) {
/* TODO: CHAM-95: DDSI does not support changing QoS policies. */

View file

@ -18,15 +18,15 @@
#include "dds__report.h"
#include "ddsc/ddsc_project.h"
#define DDS_PUBLISHER_STATUS_MASK 0
#define DDS_PUBLISHER_STATUS_MASK 0u
static dds_return_t
dds_publisher_instance_hdl(
dds_entity *e,
dds_instance_handle_t *i)
{
assert(e);
assert(i);
(void)e;
(void)i;
/* TODO: Get/generate proper handle. */
return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Getting publisher instance handle is not supported");
}
@ -66,6 +66,7 @@ dds_publisher_qos_set(
bool enabled)
{
dds_return_t ret = dds_publisher_qos_validate(qos, enabled);
(void)e;
if (ret == DDS_RETCODE_OK) {
if (enabled) {
/* TODO: CHAM-95: DDSI does not support changing QoS policies. */
@ -207,6 +208,7 @@ dds_publisher_begin_coherent(
_In_ dds_entity_t e)
{
/* TODO: CHAM-124 Currently unsupported. */
(void)e;
return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Using coherency to get a coherent data set is not being supported yet");
}
@ -215,6 +217,7 @@ dds_publisher_end_coherent(
_In_ dds_entity_t e)
{
/* TODO: CHAM-124 Currently unsupported. */
(void)e;
return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Using coherency to get a coherent data set is not being supported yet");
}

View file

@ -207,6 +207,7 @@ dds_readcdr_impl(
assert (si);
assert (hand == DDS_HANDLE_NIL);
assert (maxs > 0);
(void)take;
if (asleep)
{
@ -817,7 +818,7 @@ _Must_inspect_result_ dds_return_t
dds_return_loan(
_In_ dds_entity_t reader_or_condition,
_Inout_updates_(bufsz) void **buf,
_In_ size_t bufsz)
_In_ int32_t bufsz)
{
dds__retcode_t rc;
const dds_topic_descriptor_t * desc;
@ -845,7 +846,7 @@ dds_return_loan(
/* Only free sample contents if they have been allocated */
if (desc->m_flagset & DDS_TOPIC_NO_OPTIMIZE) {
size_t i = 0;
int32_t i = 0;
for (i = 0; i < bufsz; i++) {
dds_sample_free(buf[i], desc, DDS_FREE_CONTENTS);
}

View file

@ -134,6 +134,7 @@ dds_reader_qos_set(
bool enabled)
{
dds_return_t ret = dds_reader_qos_validate(qos, enabled);
(void)e;
if (ret == DDS_RETCODE_OK) {
if (enabled) {
/* TODO: CHAM-95: DDSI does not support changing QoS policies. */
@ -517,7 +518,7 @@ dds_reader_ddsi2direct(
else
{
memset (&pwrguid_next, 0xff, sizeof (pwrguid_next));
pwrguid_next.entityid.u = (pwrguid_next.entityid.u & ~0xff) | NN_ENTITYID_KIND_WRITER_NO_KEY;
pwrguid_next.entityid.u = (pwrguid_next.entityid.u & ~(uint32_t)0xff) | NN_ENTITYID_KIND_WRITER_NO_KEY;
}
os_mutexUnlock (&rd->e.lock);
if ((pwr = ephash_lookup_proxy_writer_guid (&pwrguid)) != NULL)
@ -541,9 +542,7 @@ dds_reader_lock_samples(
{
uint32_t ret = 0;
dds_reader *rd;
ret = dds_reader_lock(reader, &rd);
if (ret == DDS_RETCODE_OK) {
if (dds_reader_lock(reader, &rd) == DDS_RETCODE_OK) {
ret = dds_rhc_lock_samples(rd->m_rd->rhc);
dds_reader_unlock(rd);
} else {

View file

@ -248,7 +248,7 @@ struct rhc_instance
unsigned inv_isread : 1; /* whether or not that state change has been read before */
unsigned disposed_gen; /* bloody generation counters - worst invention of mankind */
unsigned no_writers_gen; /* __/ */
uint32_t strength; /* "current" ownership strength */
int32_t strength; /* "current" ownership strength */
nn_guid_t wr_guid; /* guid of last writer (if wr_iid != 0 then wr_guid is the corresponding guid, else undef) */
nn_wctime_t tstamp; /* source time stamp of last update */
struct rhc_instance *next; /* next non-empty instance in arbitrary ordering */
@ -313,7 +313,7 @@ struct trigger_info
#define QMASK_OF_SAMPLE(s) ((s)->isread ? DDS_READ_SAMPLE_STATE : DDS_NOT_READ_SAMPLE_STATE)
#define QMASK_OF_INVSAMPLE(i) ((i)->inv_isread ? DDS_READ_SAMPLE_STATE : DDS_NOT_READ_SAMPLE_STATE)
#define INST_NSAMPLES(i) ((i)->nvsamples + (i)->inv_exists)
#define INST_NREAD(i) ((i)->nvread + ((i)->inv_exists & (i)->inv_isread))
#define INST_NREAD(i) ((i)->nvread + (unsigned)((i)->inv_exists & (i)->inv_isread))
#define INST_IS_EMPTY(i) (INST_NSAMPLES (i) == 0)
#define INST_HAS_READ(i) (INST_NREAD (i) > 0)
#define INST_HAS_UNREAD(i) (INST_NREAD (i) < INST_NSAMPLES (i))
@ -413,7 +413,8 @@ void dds_rhc_set_qos (struct rhc * rhc, const nn_xqos_t * qos)
rhc->by_source_ordering = (qos->destination_order.kind == NN_BY_SOURCE_TIMESTAMP_DESTINATIONORDER_QOS);
rhc->exclusive_ownership = (qos->ownership.kind == NN_EXCLUSIVE_OWNERSHIP_QOS);
rhc->reliable = (qos->reliability.kind == NN_RELIABLE_RELIABILITY_QOS);
rhc->history_depth = (qos->history.kind == NN_KEEP_LAST_HISTORY_QOS) ? qos->history.depth : ~0u;
assert(qos->history.kind != NN_KEEP_LAST_HISTORY_QOS || qos->history.depth > 0);
rhc->history_depth = (qos->history.kind == NN_KEEP_LAST_HISTORY_QOS) ? (uint32_t)qos->history.depth : ~0u;
}
static struct rhc_sample * alloc_sample (struct rhc_instance *inst)
@ -706,7 +707,7 @@ static int inst_accepts_sample
}
if (rhc->exclusive_ownership && inst->wr_iid_islive && inst->wr_iid != pwr_info->iid)
{
uint32_t strength = pwr_info->ownership_strength;
int32_t strength = pwr_info->ownership_strength;
if (strength > inst->strength) {
/* ok */
} else if (strength < inst->strength) {
@ -729,6 +730,7 @@ static void update_inst
const struct rhc *rhc, struct rhc_instance *inst,
const struct proxy_writer_info * __restrict pwr_info, bool wr_iid_valid, nn_wctime_t tstamp)
{
(void)rhc;
inst->tstamp = tstamp;
inst->wr_iid_islive = wr_iid_valid;
if (wr_iid_valid)
@ -1016,7 +1018,6 @@ static void dds_rhc_unregister
static struct rhc_instance * alloc_new_instance
(
const struct rhc *rhc,
const struct proxy_writer_info *pwr_info,
struct serdata *serdata,
struct tkmap_instance *tk
@ -1086,7 +1087,7 @@ static rhc_store_result_t rhc_store_new_instance
return RHC_REJECTED;
}
inst = alloc_new_instance (rhc, pwr_info, sample, tk);
inst = alloc_new_instance (pwr_info, sample, tk);
if (has_data)
{
if (!add_sample (rhc, inst, pwr_info, sample, cb_data))
@ -1298,8 +1299,8 @@ bool dds_rhc_store
}
else
{
rhc->n_not_alive_disposed += inst->isdisposed - old_isdisposed;
rhc->n_new += inst->isnew - old_isnew;
rhc->n_not_alive_disposed += (uint32_t)(inst->isdisposed - old_isdisposed);
rhc->n_new += (uint32_t)(inst->isnew - old_isnew);
}
}
else
@ -1740,7 +1741,8 @@ static int dds_rhc_read_w_qminv
dds_entity_status_signal((dds_entity*)(rhc->reader));
}
return n;
assert (n <= INT_MAX);
return (int)n;
}
static int dds_rhc_take_w_qminv
@ -1904,7 +1906,8 @@ static int dds_rhc_take_w_qminv
dds_entity_status_signal((dds_entity*)(rhc->reader));
}
return n;
assert (n <= INT_MAX);
return (int)n;
}
static int dds_rhc_takecdr_w_qminv
@ -1916,6 +1919,7 @@ static int dds_rhc_takecdr_w_qminv
bool trigger_waitsets = false;
uint64_t iid;
uint32_t n = 0;
(void)cond;
if (lock)
{
@ -2053,7 +2057,8 @@ static int dds_rhc_takecdr_w_qminv
dds_entity_status_signal((dds_entity*)(rhc->reader));
}
return n;
assert (n <= INT_MAX);
return (int)n;
}
/*************************

View file

@ -46,7 +46,7 @@ static void dds_stream_read
(dds_stream_t * is, char * data, const uint32_t * ops);
#define DDS_SWAP16(v) \
(((v) >> 8) | ((v) << 8))
((uint16_t)(((v) >> 8) | ((v) << 8)))
#define DDS_SWAP32(v) \
(((v) >> 24) | \
(((v) & 0x00ff0000) >> 8) | \
@ -207,12 +207,12 @@ void dds_stream_grow (dds_stream_t * st, size_t size)
/* Reallocate on 4k boundry */
size_t newSize = (needed & ~0xfff) + 0x1000;
size_t newSize = (needed & ~(size_t)0xfff) + 0x1000;
uint8_t * old = st->m_buffer.p8;
st->m_buffer.p8 = dds_realloc (old, newSize);
memset (st->m_buffer.p8 + st->m_size, 0, newSize - st->m_size);
st->m_size = (int32_t) newSize;
st->m_size = newSize;
}
bool dds_stream_read_bool (dds_stream_t * is)
@ -280,12 +280,12 @@ double dds_stream_read_double (dds_stream_t * is)
return val;
}
char * dds_stream_reuse_string
char * dds_stream_reuse_string
(dds_stream_t * is, char * str, const uint32_t bound)
{
uint32_t length;
void * src;
DDS_CDR_ALIGN4 (is);
if (DDS_IS_OK (is, 4))
{
@ -356,7 +356,7 @@ void dds_stream_swap (void * buff, uint32_t size, uint32_t num)
}
}
static void dds_stream_read_fixed_buffer
static void dds_stream_read_fixed_buffer
(dds_stream_t * is, void * buff, uint32_t len, const uint32_t size, const bool swap)
{
if (size && len)
@ -423,12 +423,16 @@ void dds_stream_write_uint64 (dds_stream_t * os, uint64_t val)
void dds_stream_write_float (dds_stream_t * os, float val)
{
DDS_OS_PUT4 (os, val, float);
union { float f; uint32_t u; } u;
u.f = val;
dds_stream_write_uint32 (os, u.u);
}
void dds_stream_write_double (dds_stream_t * os, double val)
{
DDS_OS_PUT8 (os, val, double);
union { double f; uint64_t u; } u;
u.f = val;
dds_stream_write_uint64 (os, u.u);
}
void dds_stream_write_string (dds_stream_t * os, const char * val)
@ -457,7 +461,7 @@ void dds_stream_write_buffer (dds_stream_t * os, uint32_t len, uint8_t * buffer)
DDS_OS_PUT_BYTES (os, buffer, len);
}
static void dds_stream_write
static void dds_stream_write
(
dds_stream_t * os,
const char * data,
@ -633,7 +637,7 @@ static void dds_stream_write
const uint32_t * jsr_ops = ops + DDS_OP_ADR_JSR (*ops) - 3;
const uint32_t jmp = DDS_OP_ADR_JMP (*ops);
const uint32_t elem_size = ops[1];
while (num--)
{
dds_stream_write (os, addr, jsr_ops);
@ -1225,7 +1229,8 @@ void dds_stream_write_key
DDS_OS_PUT8 (os, *((uint64_t*) src), uint64_t);
break;
case DDS_OP_VAL_STR:
src = *(char**) src; /* drop through */
src = *(char**) src;
/* FALLS THROUGH */
case DDS_OP_VAL_BST:
dds_stream_write_string (os, src);
break;
@ -1243,14 +1248,14 @@ void dds_stream_write_key
}
}
/*
/*
dds_stream_get_keyhash: Extract key values from a stream and generate
keyhash used for instance identification. Non key fields are skipped.
Key hash data is big endian CDR encoded with no padding. Returns length
of key hash. Input stream may contain full sample of just key data.
*/
static uint32_t dds_stream_get_keyhash
static uint32_t dds_stream_get_keyhash
(
dds_stream_t * is,
char * dst,
@ -1308,7 +1313,7 @@ static uint32_t dds_stream_get_keyhash
{
case DDS_OP_VAL_1BY:
{
*dst++ = DDS_IS_GET1 (is);
*dst++ = (char) DDS_IS_GET1 (is);
break;
}
case DDS_OP_VAL_2BY:
@ -1523,7 +1528,7 @@ static uint32_t dds_stream_get_keyhash
if ((jeq_op[1] == disc) || (has_default && (num == 0)))
{
subtype = DDS_JEQ_TYPE (jeq_op[0]);
switch (subtype)
{
case DDS_OP_VAL_1BY:
@ -1579,7 +1584,7 @@ static uint32_t dds_stream_get_keyhash
#ifndef NDEBUG
static bool keyhash_is_reset(const dds_key_hash_t *kh)
{
static const char nullhash[sizeof(kh->m_hash)];
static const char nullhash[sizeof(kh->m_hash)] = { 0 };
return kh->m_flags == 0 && memcmp(kh->m_hash, nullhash, sizeof(nullhash)) == 0;
}
#endif

View file

@ -25,8 +25,8 @@ dds_subscriber_instance_hdl(
dds_entity *e,
dds_instance_handle_t *i)
{
assert(e);
assert(i);
(void)e;
(void)i;
/* TODO: Get/generate proper handle. */
return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Generating subscriber instance handle is not supported");
}
@ -67,6 +67,7 @@ dds_subscriber_qos_set(
bool enabled)
{
dds_return_t ret = dds__subscriber_qos_validate(qos, enabled);
(void)e;
if (ret == DDS_RETCODE_OK) {
if (enabled) {
/* TODO: CHAM-95: DDSI does not support changing QoS policies. */
@ -210,6 +211,7 @@ dds_subscriber_begin_coherent(
_In_ dds_entity_t e)
{
/* TODO: CHAM-124 Currently unsupported. */
(void)e;
return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Using coherency to get a coherent data set is not currently being supported");
}
@ -218,6 +220,7 @@ dds_subscriber_end_coherent(
_In_ dds_entity_t e)
{
/* TODO: CHAM-124 Currently unsupported. */
(void)e;
return DDS_ERRNO(DDS_RETCODE_UNSUPPORTED, "Using coherency to get a coherent data set is not currently being supported");
}

View file

@ -27,7 +27,7 @@ dds_time_t dds_time (void)
void dds_sleepfor (dds_duration_t n)
{
os_time interval = { (os_timeSec) (n / DDS_NSECS_IN_SEC), (uint32_t) (n % DDS_NSECS_IN_SEC) };
os_time interval = { (os_timeSec) (n / DDS_NSECS_IN_SEC), (int32_t) (n % DDS_NSECS_IN_SEC) };
os_nanoSleep (interval);
}

View file

@ -297,6 +297,7 @@ dds_topic_qos_set(
bool enabled)
{
dds_return_t ret = dds_topic_qos_validate(qos, enabled);
(void)e;
if (ret == DDS_RETCODE_OK) {
if (enabled) {
/* TODO: CHAM-95: DDSI does not support changing QoS policies. */
@ -426,9 +427,9 @@ dds_create_topic(
st->id = next_topicid++;
#ifdef VXWORKS_RTP
st->hash = (st->id * UINT64_C (12844332200329132887UL)) >> 32;
st->hash = (uint32_t)((st->id * UINT64_C (12844332200329132887UL)) >> 32);
#else
st->hash = (st->id * UINT64_C (12844332200329132887)) >> 32;
st->hash = (uint32_t)((st->id * UINT64_C (12844332200329132887)) >> 32);
#endif
/* Check if topic cannot be optimised (memcpy marshal) */
@ -518,6 +519,9 @@ dds_topic_mod_filter(
*ctx = t->m_stopic->filter_ctx;
}
dds_topic_unlock(t);
} else {
*filter = 0;
*ctx = NULL;
}
}
@ -541,7 +545,7 @@ dds_topic_get_filter(
void *ctx;
dds_topic_mod_filter (topic, &filter, &ctx, false);
return
(filter == dds_topic_chaining_filter) ? (dds_topic_filter_fn)ctx : NULL;
(filter == dds_topic_chaining_filter) ? (dds_topic_filter_fn)ctx : 0;
}
void
@ -560,7 +564,7 @@ dds_topic_get_filter_with_ctx(
dds_topic_intern_filter_fn filter;
void *ctx;
dds_topic_mod_filter (topic, &filter, &ctx, false);
return (filter == dds_topic_chaining_filter) ? NULL : filter;
return (filter == dds_topic_chaining_filter) ? 0 : filter;
}
_Pre_satisfies_((topic & DDS_ENTITY_KIND_MASK) == DDS_KIND_TOPIC)

View file

@ -125,7 +125,7 @@ dds_waitset_wait_impl(
to.tv_nsec = DDS_NSECS_IN_SEC - 1;
} else {
to.tv_sec = (os_timeSec) (dt / DDS_NSECS_IN_SEC);
to.tv_nsec = (uint32_t) (dt % DDS_NSECS_IN_SEC);
to.tv_nsec = (int32_t) (dt % DDS_NSECS_IN_SEC);
}
(void)os_condTimedWait(&ws->m_entity.m_cond, &ws->m_entity.m_mutex, &to);
tnow = dds_time();

View file

@ -54,7 +54,7 @@ struct whc_intvnode {
};
struct whc_idxnode {
int64_t iid;
uint64_t iid;
seqno_t prune_seq;
struct tkmap_instance *tk;
unsigned headidx;
@ -1017,11 +1017,11 @@ static unsigned whc_remove_acked_messages (struct whc *whc_generic, seqno_t max_
if (config.enabled_logcats & LC_WHC)
{
struct whc_state whcst;
get_state_locked(whc, &whcst);
struct whc_state tmp;
get_state_locked(whc, &tmp);
TRACE_WHC(("whc_remove_acked_messages(%p max_drop_seq %"PRId64")\n", (void *)whc, max_drop_seq));
TRACE_WHC((" whc: [%"PRId64",%"PRId64"] max_drop_seq %"PRId64" h %u tl %u\n",
whcst.min_seq, whcst.max_seq, whc->max_drop_seq, whc->hdepth, whc->tldepth));
tmp.min_seq, tmp.max_seq, whc->max_drop_seq, whc->hdepth, whc->tldepth));
}
check_whc (whc);

View file

@ -192,6 +192,7 @@ get_bandwidth_limit(
struct config_channel_listelem *channel = find_channel (transport_priority);
return channel->data_bandwidth_limit;
#else
(void)transport_priority;
return 0;
#endif
}
@ -360,25 +361,25 @@ static struct whc *make_whc(const dds_qos_t *qos)
an index at all (e.g., volatile KEEP_ALL) */
if (config.startup_mode_full) {
startup_mode = gv.startup_mode &&
(qos->durability.kind >= DDS_DURABILITY_TRANSIENT ||
(qos->durability.kind == DDS_DURABILITY_VOLATILE &&
qos->reliability.kind != DDS_RELIABILITY_BEST_EFFORT));
(qos->durability.kind >= NN_TRANSIENT_DURABILITY_QOS ||
(qos->durability.kind == NN_VOLATILE_DURABILITY_QOS &&
qos->reliability.kind != NN_BEST_EFFORT_RELIABILITY_QOS));
} else {
startup_mode = gv.startup_mode &&
(qos->durability.kind == DDS_DURABILITY_VOLATILE &&
qos->reliability.kind != DDS_RELIABILITY_BEST_EFFORT);
(qos->durability.kind == NN_VOLATILE_DURABILITY_QOS &&
qos->reliability.kind != NN_BEST_EFFORT_RELIABILITY_QOS);
}
/* Construct WHC -- if aggressive_keep_last1 is set, the WHC will
drop all samples for which a later update is available. This
forces it to maintain a tlidx. */
handle_as_transient_local = (qos->durability.kind == DDS_DURABILITY_TRANSIENT_LOCAL);
if (!config.aggressive_keep_last_whc || qos->history.kind == DDS_HISTORY_KEEP_ALL)
handle_as_transient_local = (qos->durability.kind == NN_TRANSIENT_LOCAL_DURABILITY_QOS);
if (!config.aggressive_keep_last_whc || qos->history.kind == NN_KEEP_ALL_HISTORY_QOS)
hdepth = 0;
else
hdepth = (unsigned)qos->history.depth;
if (handle_as_transient_local) {
if (qos->durability_service.history.kind == DDS_HISTORY_KEEP_ALL)
if (qos->durability_service.history.kind == NN_KEEP_ALL_HISTORY_QOS)
tldepth = 0;
else
tldepth = (unsigned)qos->durability_service.history.depth;

View file

@ -104,7 +104,7 @@ qos_init(void)
g_pol_liveliness.lease_duration.sec = 40000;
g_pol_liveliness.lease_duration.nanosec = 44000;
g_pol_time_based_filter.minimum_separation.sec = 50000;
g_pol_time_based_filter.minimum_separation.sec = 12000;
g_pol_time_based_filter.minimum_separation.nanosec = 55000;
g_pol_partition.name._buffer = (char**)c_partitions;
@ -127,7 +127,7 @@ qos_init(void)
g_pol_durability_service.history_depth = 1;
g_pol_durability_service.history_kind = DDS_KEEP_LAST_HISTORY_QOS;
g_pol_durability_service.max_samples = 2;
g_pol_durability_service.max_samples = 12;
g_pol_durability_service.max_instances = 3;
g_pol_durability_service.max_samples_per_instance = 4;
g_pol_durability_service.service_cleanup_delay.sec = 90000;
@ -170,7 +170,7 @@ teardown(void)
int64_t from_ddsi_duration (DDS_Duration_t x)
{
int64_t t;
t = x.sec * 10^9 + x.nanosec;
t = (int64_t)x.sec * T_SECOND + x.nanosec;
return t;
}
@ -627,12 +627,13 @@ Test(ddsc_builtin_topics, datareader_qos, .init = setup, .fini = teardown)
dds_qset_destination_order(g_qos, (dds_destination_order_kind_t)g_pol_destination_order.kind);
dds_qset_userdata(g_qos, g_pol_userdata.value._buffer, g_pol_userdata.value._length);
dds_qset_time_based_filter(g_qos, from_ddsi_duration(g_pol_time_based_filter.minimum_separation));
dds_qset_presentation(g_qos, g_pol_presentation.access_scope, g_pol_presentation.coherent_access, g_pol_presentation.ordered_access);
dds_qset_presentation(g_qos, (dds_presentation_access_scope_kind_t)g_pol_presentation.access_scope, g_pol_presentation.coherent_access, g_pol_presentation.ordered_access);
dds_qset_partition(g_qos, g_pol_partition.name._length, c_partitions);
dds_qset_topicdata(g_qos, g_pol_topicdata.value._buffer, g_pol_topicdata.value._length);
dds_qset_groupdata(g_qos, g_pol_groupdata.value._buffer, g_pol_groupdata.value._length);
rdr = dds_create_reader(g_subscriber, g_topic, g_qos, NULL);
cr_assert_gt(rdr, 0, "Failed to create a data reader.");
subscription_samples[0] = DDS_SubscriptionBuiltinTopicData__alloc();
@ -693,7 +694,7 @@ Test(ddsc_builtin_topics, datawriter_qos, .init = setup, .fini = teardown)
void * publication_samples[MAX_SAMPLES];
dds_qset_durability(g_qos, g_pol_durability.kind);
dds_qset_durability(g_qos, (dds_durability_kind_t)g_pol_durability.kind);
dds_qset_deadline(g_qos, from_ddsi_duration(g_pol_deadline.period));
dds_qset_latency_budget(g_qos, from_ddsi_duration(g_pol_latency_budget.duration));
dds_qset_liveliness(g_qos, (dds_liveliness_kind_t)g_pol_liveliness.kind, from_ddsi_duration(g_pol_liveliness.lease_duration));
@ -703,11 +704,12 @@ Test(ddsc_builtin_topics, datawriter_qos, .init = setup, .fini = teardown)
dds_qset_userdata(g_qos, g_pol_userdata.value._buffer, g_pol_userdata.value._length);
dds_qset_ownership(g_qos, (dds_ownership_kind_t)g_pol_ownership.kind);
dds_qset_ownership_strength(g_qos, g_pol_ownership_strength.value);
dds_qset_presentation(g_qos, g_pol_presentation.access_scope, g_pol_presentation.coherent_access, g_pol_presentation.ordered_access);
dds_qset_presentation(g_qos, (dds_presentation_access_scope_kind_t)g_pol_presentation.access_scope, g_pol_presentation.coherent_access, g_pol_presentation.ordered_access);
dds_qset_partition(g_qos, g_pol_partition.name._length, c_partitions);
dds_qset_topicdata(g_qos, g_pol_topicdata.value._buffer, g_pol_topicdata.value._length);
wrtr = dds_create_writer(g_publisher, g_topic, g_qos, NULL);
cr_assert_gt(wrtr, 0, "Failed to create a data writer.");
publication_samples[0] = DDS_PublicationBuiltinTopicData__alloc();
@ -771,7 +773,7 @@ Test(ddsc_builtin_topics, topic_qos, .init = setup, .fini = teardown)
void * topic_samples[MAX_SAMPLES];
dds_qset_durability(g_qos, g_pol_durability.kind);
dds_qset_durability(g_qos, (dds_durability_kind_t)g_pol_durability.kind);
dds_qset_durability_service(g_qos,
from_ddsi_duration(g_pol_durability_service.service_cleanup_delay),
(dds_history_kind_t)g_pol_durability_service.history_kind,
@ -794,6 +796,7 @@ Test(ddsc_builtin_topics, topic_qos, .init = setup, .fini = teardown)
tpc = dds_create_topic(g_participant, &Space_Type1_desc, "SpaceType1", g_qos, NULL);
cr_assert_gt(tpc, 0, "Failed to create a topic.");
topic_samples[0] = DDS_PublicationBuiltinTopicData__alloc();

View file

@ -61,7 +61,7 @@ create_topic_name(const char *prefix, char *name, size_t size)
static void
disposing_init(void)
{
Space_Type1 sample = { 0 };
Space_Type1 sample = { 0, 0, 0 };
dds_qos_t *qos = dds_qos_create ();
dds_attach_t triggered;
dds_return_t ret;

View file

@ -15,8 +15,10 @@
/* We are deliberately testing some bad arguments that SAL will complain about.
* So, silence SAL regarding these issues. */
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 6387 28020)
#endif
/* Add --verbose command line argument to get the cr_log_info traces (if there are any). */
@ -320,13 +322,13 @@ Test(ddsc_entity, get_entities, .init = create_entity, .fini = delete_entity)
/* Get Children, of which there are currently none. */
status = dds_get_children (entity, NULL, 0);
if (status > 0) {
cr_assert("dds_get_children(entity, NULL, 0) un-expectantly found children");
cr_assert(false, "dds_get_children(entity, NULL, 0) un-expectantly found children");
} else {
cr_assert_eq(status, 0, "dds_get_children(entity, NULL, 0) failed");
}
status = dds_get_children (entity, &child, 1);
if (status > 0) {
cr_assert("dds_get_children(entity, child, 1) un-expectantly returned children");
cr_assert(false, "dds_get_children(entity, child, 1) un-expectantly returned children");
} else {
cr_assert_eq(status, 0, "dds_get_children(entity, child, 1) failed");
}
@ -362,4 +364,6 @@ Test(ddsc_entity, delete, .init = create_entity)
entity = 0;
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif

View file

@ -40,6 +40,7 @@ static dds_entity_t g_querycond = 0;
static bool
accept_all(const void * sample)
{
(void)sample;
return true;
}
@ -840,7 +841,7 @@ Test(ddsc_entity_explicit_subscriber, invalid_topic)
Test(ddsc_entity_get_children, implicit_publisher)
{
dds_entity_t participant;
dds_entity_t publisher;
dds_entity_t publisher = 0;
dds_entity_t writer;
dds_entity_t topic;
dds_entity_t child[2], child2[2];
@ -885,7 +886,7 @@ Test(ddsc_entity_get_children, implicit_publisher)
Test(ddsc_entity_get_children, implicit_subscriber)
{
dds_entity_t participant;
dds_entity_t subscriber;
dds_entity_t subscriber = 0;
dds_entity_t reader;
dds_entity_t topic;
dds_entity_t child[2], child2[2];

View file

@ -130,7 +130,7 @@ Test(ddsc_entity_status, publication_matched, .init=init_entity_status, .fini=fi
/* Wait for publication matched status */
ret = dds_waitset_wait(waitSetwr, wsresults, wsresultsize, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
ret = dds_get_publication_matched_status(wri, &publication_matched);
cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
cr_assert_eq(publication_matched.current_count, 1);
@ -149,7 +149,7 @@ Test(ddsc_entity_status, publication_matched, .init=init_entity_status, .fini=fi
/* Wait for publication matched status */
ret = dds_waitset_wait(waitSetwr, wsresults, wsresultsize, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
ret = dds_get_publication_matched_status(wri, &publication_matched);
cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
cr_assert_eq(publication_matched.current_count, 0);
@ -167,7 +167,7 @@ Test(ddsc_entity_status, subscription_matched, .init=init_entity_status, .fini=f
/* Wait for subscription matched status */
ret = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
ret = dds_get_subscription_matched_status(rea, &subscription_matched);
cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
cr_assert_eq(subscription_matched.current_count, 1);
@ -186,7 +186,7 @@ Test(ddsc_entity_status, subscription_matched, .init=init_entity_status, .fini=f
/* Wait for subscription matched status */
ret = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
ret = dds_get_subscription_matched_status(rea, &subscription_matched);
cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
cr_assert_eq(subscription_matched.current_count, 0);
@ -199,8 +199,10 @@ Test(ddsc_entity_status, subscription_matched, .init=init_entity_status, .fini=f
Test(ddsc_entity, incompatible_qos, .init=init_entity_status, .fini=fini_entity_status)
{
dds_entity_t reader2;
dds_requested_incompatible_qos_status_t req_incompatible_qos = {0};
dds_offered_incompatible_qos_status_t off_incompatible_qos = {0};
dds_requested_incompatible_qos_status_t req_incompatible_qos;
dds_offered_incompatible_qos_status_t off_incompatible_qos;
memset (&req_incompatible_qos, 0, sizeof (req_incompatible_qos));
memset (&off_incompatible_qos, 0, sizeof (off_incompatible_qos));
dds_qset_durability (qos, DDS_DURABILITY_PERSISTENT);
/* Create a reader with persistent durability */
@ -236,7 +238,7 @@ Test(ddsc_entity, incompatible_qos, .init=init_entity_status, .fini=fini_entity_
/* Wait for offered incompatible QoS status */
ret = dds_waitset_wait(waitSetwr, wsresults, wsresultsize, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
ret = dds_get_offered_incompatible_qos_status (wri, &off_incompatible_qos);
cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
cr_assert_eq(off_incompatible_qos.total_count, 1);
@ -267,7 +269,7 @@ Test(ddsc_entity, liveliness_changed, .init=init_entity_status, .fini=fini_entit
/* wait for LIVELINESS_CHANGED status */
ret = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
ret = dds_get_liveliness_changed_status (rea, &liveliness_changed);
cr_assert_eq(ret, DDS_RETCODE_OK);
@ -288,7 +290,7 @@ Test(ddsc_entity, liveliness_changed, .init=init_entity_status, .fini=fini_entit
/* wait for LIVELINESS_CHANGED when a writer is deleted */
ret = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
ret = dds_get_liveliness_changed_status (rea, &liveliness_changed);
cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
@ -301,10 +303,12 @@ Test(ddsc_entity, liveliness_changed, .init=init_entity_status, .fini=fini_entit
Test(ddsc_entity, sample_rejected, .init=init_entity_status, .fini=fini_entity_status)
{
dds_sample_rejected_status_t sample_rejected = {0};
dds_sample_rejected_status_t sample_rejected;
/* Topic instance */
RoundTripModule_DataType sample = { 0 };
RoundTripModule_DataType sample;
memset (&sample_rejected, 0, sizeof (sample_rejected));
memset (&sample, 0, sizeof (sample));
ret = dds_set_enabled_status(wri, DDS_PUBLICATION_MATCHED_STATUS);
cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
@ -313,9 +317,9 @@ Test(ddsc_entity, sample_rejected, .init=init_entity_status, .fini=fini_entity_s
/* Wait for subscription matched and publication matched */
ret = dds_waitset_wait(waitSetwr, wsresults, wsresultsize, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
ret = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
ret = dds_set_enabled_status(rea, DDS_SAMPLE_REJECTED_STATUS);
cr_assert_eq(ret, DDS_RETCODE_OK);
@ -329,7 +333,7 @@ Test(ddsc_entity, sample_rejected, .init=init_entity_status, .fini=fini_entity_s
/* wait for sample rejected status */
ret = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
ret = dds_get_sample_rejected_status (rea, &sample_rejected);
cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
cr_assert_eq(sample_rejected.total_count, 4);
@ -360,7 +364,7 @@ Test(ddsc_entity, inconsistent_topic)
/* Wait for pub inconsistent topic status callback */
ret = dds_waitset_wait(waitSetwr, wsresults, wsresultsize, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
ret = dds_get_inconsistent_topic_status (top, &topic_status);
cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
cr_assert_gt(topic_status.total_count, 0);
@ -387,10 +391,12 @@ Test(ddsc_entity, inconsistent_topic)
Test(ddsc_entity, sample_lost, .init=init_entity_status, .fini=fini_entity_status)
{
dds_sample_lost_status_t sample_lost = {0};
dds_sample_lost_status_t sample_lost;
dds_time_t time1;
/* Topic instance */
RoundTripModule_DataType sample = { 0 };
RoundTripModule_DataType sample;
memset (&sample_lost, 0, sizeof (sample_lost));
memset (&sample, 0, sizeof (sample));
ret = dds_set_enabled_status(wri, DDS_PUBLICATION_MATCHED_STATUS);
cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
@ -399,9 +405,9 @@ Test(ddsc_entity, sample_lost, .init=init_entity_status, .fini=fini_entity_statu
/* Wait for subscription matched and publication matched */
ret = dds_waitset_wait(waitSetwr, wsresults, wsresultsize, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
ret = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
ret = dds_set_enabled_status(rea, DDS_SAMPLE_LOST_STATUS);
cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
@ -418,7 +424,7 @@ Test(ddsc_entity, sample_lost, .init=init_entity_status, .fini=fini_entity_statu
/* wait for sample lost status */
ret = dds_waitset_wait(waitSetrd, wsresults, wsresultsize, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
ret = dds_get_sample_lost_status (rea, &sample_lost);
cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
cr_assert_eq(sample_lost.total_count, 1);
@ -432,7 +438,8 @@ Test(ddsc_entity, sample_lost, .init=init_entity_status, .fini=fini_entity_statu
Test(ddsc_entity, data_available, .init=init_entity_status, .fini=fini_entity_status)
{
RoundTripModule_DataType sample = { 0 };
RoundTripModule_DataType sample;
memset (&sample, 0, sizeof (sample));
ret = dds_set_enabled_status(wri, DDS_PUBLICATION_MATCHED_STATUS);
cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
@ -441,9 +448,9 @@ Test(ddsc_entity, data_available, .init=init_entity_status, .fini=fini_entity_st
/* Wait for subscription and publication matched status */
ret = dds_waitset_wait(waitSetwr, wsresults, wsresultsize, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
ret = dds_waitset_wait(waitSetrd, wsresults2, wsresultsize2, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
/* Write the sample */
ret = dds_write (wri, &sample);
@ -455,7 +462,7 @@ Test(ddsc_entity, data_available, .init=init_entity_status, .fini=fini_entity_st
cr_assert_eq(sta, DDS_SUBSCRIPTION_MATCHED_STATUS);
ret = dds_waitset_wait(waitSetrd, wsresults2, wsresultsize2, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
ret = dds_get_status_changes (rea, &sta);
cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);
@ -477,10 +484,11 @@ Test(ddsc_entity, all_data_available, .init=init_entity_status, .fini=fini_entit
dds_sample_info_t info;
/* Topic instance */
RoundTripModule_DataType p_sample = { 0 };
RoundTripModule_DataType p_sample;
void * s_samples[1];
RoundTripModule_DataType s_sample;
memset (&p_sample, 0, sizeof (p_sample));
memset (&s_sample, 0, sizeof (s_sample));
s_samples[0] = &s_sample;
@ -500,13 +508,13 @@ Test(ddsc_entity, all_data_available, .init=init_entity_status, .fini=fini_entit
/* Wait for publication matched status */
ret = dds_waitset_wait(waitSetwr, wsresults, wsresultsize, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
/* Wait for subscription matched status on both readers */
ret = dds_waitset_wait(waitSetrd, wsresults2, wsresultsize2, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
ret = dds_waitset_wait(waitSetrd2, wsresults2, wsresultsize2, waitTimeout);
cr_assert_eq(ret, wsresultsize);
cr_assert_eq(ret, (dds_return_t)wsresultsize);
ret = dds_write (wri, &p_sample);
cr_assert_dds_return_t_eq(ret, DDS_RETCODE_OK);

View file

@ -83,17 +83,17 @@ static dds_entity_t cb_writer = 0;
static dds_entity_t cb_reader = 0;
static dds_entity_t cb_subscriber = 0;
static dds_inconsistent_topic_status_t cb_inconsistent_topic_status = { 0 };
static dds_liveliness_lost_status_t cb_liveliness_lost_status = { 0 };
static dds_offered_deadline_missed_status_t cb_offered_deadline_missed_status = { 0 };
static dds_offered_incompatible_qos_status_t cb_offered_incompatible_qos_status = { 0 };
static dds_sample_lost_status_t cb_sample_lost_status = { 0 };
static dds_sample_rejected_status_t cb_sample_rejected_status = { 0 };
static dds_liveliness_changed_status_t cb_liveliness_changed_status = { 0 };
static dds_requested_deadline_missed_status_t cb_requested_deadline_missed_status = { 0 };
static dds_requested_incompatible_qos_status_t cb_requested_incompatible_qos_status= { 0 };
static dds_publication_matched_status_t cb_publication_matched_status = { 0 };
static dds_subscription_matched_status_t cb_subscription_matched_status = { 0 };
static dds_inconsistent_topic_status_t cb_inconsistent_topic_status;
static dds_liveliness_lost_status_t cb_liveliness_lost_status;
static dds_offered_deadline_missed_status_t cb_offered_deadline_missed_status;
static dds_offered_incompatible_qos_status_t cb_offered_incompatible_qos_status;
static dds_sample_lost_status_t cb_sample_lost_status;
static dds_sample_rejected_status_t cb_sample_rejected_status;
static dds_liveliness_changed_status_t cb_liveliness_changed_status;
static dds_requested_deadline_missed_status_t cb_requested_deadline_missed_status;
static dds_requested_incompatible_qos_status_t cb_requested_incompatible_qos_status;
static dds_publication_matched_status_t cb_publication_matched_status;
static dds_subscription_matched_status_t cb_subscription_matched_status;
static void
@ -101,6 +101,7 @@ inconsistent_topic_cb(
dds_entity_t topic,
const dds_inconsistent_topic_status_t status, void* arg)
{
(void)arg;
os_mutexLock(&g_mutex);
cb_topic = topic;
cb_inconsistent_topic_status = status;
@ -115,6 +116,7 @@ liveliness_lost_cb(
const dds_liveliness_lost_status_t status,
void* arg)
{
(void)arg;
os_mutexLock(&g_mutex);
cb_writer = writer;
cb_liveliness_lost_status = status;
@ -129,6 +131,7 @@ offered_deadline_missed_cb(
const dds_offered_deadline_missed_status_t status,
void* arg)
{
(void)arg;
os_mutexLock(&g_mutex);
cb_writer = writer;
cb_offered_deadline_missed_status = status;
@ -143,6 +146,7 @@ offered_incompatible_qos_cb(
const dds_offered_incompatible_qos_status_t status,
void* arg)
{
(void)arg;
os_mutexLock(&g_mutex);
cb_writer = writer;
cb_offered_incompatible_qos_status = status;
@ -156,6 +160,7 @@ data_on_readers_cb(
dds_entity_t subscriber,
void* arg)
{
(void)arg;
os_mutexLock(&g_mutex);
cb_subscriber = subscriber;
cb_called |= DDS_DATA_ON_READERS_STATUS;
@ -169,6 +174,7 @@ sample_lost_cb(
const dds_sample_lost_status_t status,
void* arg)
{
(void)arg;
os_mutexLock(&g_mutex);
cb_reader = reader;
cb_sample_lost_status = status;
@ -182,6 +188,7 @@ data_available_cb(
dds_entity_t reader,
void* arg)
{
(void)arg;
os_mutexLock(&g_mutex);
cb_reader = reader;
cb_called |= DDS_DATA_AVAILABLE_STATUS;
@ -195,6 +202,7 @@ sample_rejected_cb(
const dds_sample_rejected_status_t status,
void* arg)
{
(void)arg;
os_mutexLock(&g_mutex);
cb_reader = reader;
cb_sample_rejected_status = status;
@ -209,6 +217,7 @@ liveliness_changed_cb(
const dds_liveliness_changed_status_t status,
void* arg)
{
(void)arg;
os_mutexLock(&g_mutex);
cb_reader = reader;
cb_liveliness_changed_status = status;
@ -223,6 +232,7 @@ requested_deadline_missed_cb(
const dds_requested_deadline_missed_status_t status,
void* arg)
{
(void)arg;
os_mutexLock(&g_mutex);
cb_reader = reader;
cb_requested_deadline_missed_status = status;
@ -237,6 +247,7 @@ requested_incompatible_qos_cb(
const dds_requested_incompatible_qos_status_t status,
void* arg)
{
(void)arg;
os_mutexLock(&g_mutex);
cb_reader = reader;
cb_requested_incompatible_qos_status = status;
@ -251,6 +262,7 @@ publication_matched_cb(
const dds_publication_matched_status_t status,
void* arg)
{
(void)arg;
os_mutexLock(&g_mutex);
cb_writer = writer;
cb_publication_matched_status = status;
@ -265,6 +277,7 @@ subscription_matched_cb(
const dds_subscription_matched_status_t status,
void* arg)
{
(void)arg;
os_mutexLock(&g_mutex);
cb_reader = reader;
cb_subscription_matched_status = status;
@ -584,12 +597,13 @@ Test(ddsc_listener, getters_setters)
****************************************************************************/
Test(ddsc_listener, propagation, .init=init_triggering_base, .fini=fini_triggering_base)
{
RoundTripModule_DataType sample = { 0 };
dds_listener_t *listener_par = NULL;
dds_listener_t *listener_pub = NULL;
dds_listener_t *listener_sub = NULL;
uint32_t triggered;
dds_return_t ret;
RoundTripModule_DataType sample;
memset (&sample, 0, sizeof (sample));
/* Let participant be interested in data. */
listener_par = dds_listener_create(NULL);
@ -807,7 +821,8 @@ Test(ddsc_listener, data_available, .init=init_triggering_test, .fini=fini_trigg
dds_return_t ret;
uint32_t triggered;
uint32_t status;
RoundTripModule_DataType sample = { 0 };
RoundTripModule_DataType sample;
memset (&sample, 0, sizeof (sample));
/* We are interested in data available notifications. */
dds_lset_data_available(g_listener, data_available_cb);
@ -837,7 +852,8 @@ Test(ddsc_listener, data_on_readers, .init=init_triggering_test, .fini=fini_trig
dds_return_t ret;
uint32_t triggered;
uint32_t status;
RoundTripModule_DataType sample = { 0 };
RoundTripModule_DataType sample;
memset (&sample, 0, sizeof (sample));
/* We are interested in data available notifications. */
dds_lset_data_on_readers(g_listener, data_on_readers_cb);
@ -875,7 +891,8 @@ Test(ddsc_listener, sample_lost, .init=init_triggering_test, .fini=fini_triggeri
uint32_t triggered;
dds_time_t the_past;
uint32_t status;
RoundTripModule_DataType sample = { 0 };
RoundTripModule_DataType sample;
memset (&sample, 0, sizeof (sample));
/* Get a time that should be historic on all platforms.*/
the_past = dds_time() - 1000000;
@ -911,7 +928,8 @@ Test(ddsc_listener, sample_rejected, .init=init_triggering_test, .fini=fini_trig
dds_return_t ret;
uint32_t triggered;
uint32_t status;
RoundTripModule_DataType sample = { 0 };
RoundTripModule_DataType sample;
memset (&sample, 0, sizeof (sample));
/* We are interested in sample rejected notifications. */
dds_lset_sample_rejected(g_listener, sample_rejected_cb);

View file

@ -15,14 +15,19 @@
/* We are deliberately testing some bad arguments that SAL will complain about.
* So, silence SAL regarding these issues. */
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 28020)
#endif
#define cr_assert_status_eq(s1, s2, ...) cr_assert_eq(dds_err_nr(s1), s2, __VA_ARGS__)
/* Dummy callback */
static void data_available_cb(dds_entity_t reader, void* arg) {}
static void data_available_cb(dds_entity_t reader, void* arg)
{
(void)reader;
(void)arg;
}
Test(ddsc_publisher, create)
@ -62,8 +67,10 @@ Test(ddsc_publisher, create)
dds_delete(publisher);
/* Somehow, the compiler thinks the char arrays might not be zero-terminated... */
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 6054)
#endif
/* Use qos with single partition */
dds_qset_partition (qos, 1, singlePartitions);
@ -83,7 +90,9 @@ Test(ddsc_publisher, create)
cr_assert_gt(publisher, 0, "dds_create_publisher(participant,qos,NULL) where qos with duplicate partitions");
dds_delete(publisher);
#ifdef _MSC_VER
#pragma warning(pop)
#endif
/* Use listener(NULL) */
listener = dds_listener_create(NULL);
@ -265,4 +274,6 @@ Test(ddsc_publisher, coherency)
return;
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif

View file

@ -15,13 +15,12 @@
#include <criterion/logging.h>
#if 0
#else
/* We are deliberately testing some bad arguments that SAL will complain about.
* So, silence SAL regarding these issues. */
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 6387 28020)
#endif
/****************************************************************************
@ -243,7 +242,7 @@ qos_fini(void)
****************************************************************************/
Test(ddsc_qos, userdata, .init=qos_init, .fini=qos_fini)
{
struct pol_userdata p = { 0 };
struct pol_userdata p = { NULL, 0 };
/* NULLs shouldn't crash and be a noops. */
dds_qset_userdata(NULL, g_pol_userdata.value, g_pol_userdata.sz);
@ -261,7 +260,7 @@ Test(ddsc_qos, userdata, .init=qos_init, .fini=qos_fini)
Test(ddsc_qos, topicdata, .init=qos_init, .fini=qos_fini)
{
struct pol_topicdata p = { 0 };
struct pol_topicdata p = { NULL, 0 };
/* NULLs shouldn't crash and be a noops. */
dds_qset_topicdata(NULL, g_pol_topicdata.value, g_pol_topicdata.sz);
@ -279,7 +278,7 @@ Test(ddsc_qos, topicdata, .init=qos_init, .fini=qos_fini)
Test(ddsc_qos, groupdata, .init=qos_init, .fini=qos_fini)
{
struct pol_groupdata p = { 0 };
struct pol_groupdata p = { NULL, 0 };
/* NULLs shouldn't crash and be a noops. */
dds_qset_groupdata(NULL, g_pol_groupdata.value, g_pol_groupdata.sz);
@ -297,7 +296,7 @@ Test(ddsc_qos, groupdata, .init=qos_init, .fini=qos_fini)
Test(ddsc_qos, durability, .init=qos_init, .fini=qos_fini)
{
struct pol_durability p = { 0 };
struct pol_durability p = { DDS_DURABILITY_VOLATILE };
/* NULLs shouldn't crash and be a noops. */
dds_qset_durability(NULL, g_pol_durability.kind);
@ -312,7 +311,7 @@ Test(ddsc_qos, durability, .init=qos_init, .fini=qos_fini)
Test(ddsc_qos, history, .init=qos_init, .fini=qos_fini)
{
struct pol_history p = { 0 };
struct pol_history p = { DDS_HISTORY_KEEP_ALL, 0 };
/* NULLs shouldn't crash and be a noops. */
dds_qset_history(NULL, g_pol_history.kind, g_pol_history.depth);
@ -328,7 +327,7 @@ Test(ddsc_qos, history, .init=qos_init, .fini=qos_fini)
Test(ddsc_qos, resource_limits, .init=qos_init, .fini=qos_fini)
{
struct pol_resource_limits p = { 0 };
struct pol_resource_limits p = { 0, 0, 0 };
/* NULLs shouldn't crash and be a noops. */
dds_qset_resource_limits(NULL, g_pol_resource_limits.max_samples, g_pol_resource_limits.max_instances, g_pol_resource_limits.max_samples_per_instance);
@ -345,7 +344,7 @@ Test(ddsc_qos, resource_limits, .init=qos_init, .fini=qos_fini)
Test(ddsc_qos, presentation, .init=qos_init, .fini=qos_fini)
{
struct pol_presentation p = { 0 };
struct pol_presentation p = { DDS_PRESENTATION_INSTANCE, false, false };
/* NULLs shouldn't crash and be a noops. */
dds_qset_presentation(NULL, g_pol_presentation.access_scope, g_pol_presentation.coherent_access, g_pol_presentation.ordered_access);
@ -407,7 +406,7 @@ Test(ddsc_qos, latency_budget, .init=qos_init, .fini=qos_fini)
Test(ddsc_qos, ownership, .init=qos_init, .fini=qos_fini)
{
struct pol_ownership p = { 0 };
struct pol_ownership p = { DDS_OWNERSHIP_SHARED };
/* NULLs shouldn't crash and be a noops. */
dds_qset_ownership(NULL, g_pol_ownership.kind);
@ -437,7 +436,7 @@ Test(ddsc_qos, ownership_strength, .init=qos_init, .fini=qos_fini)
Test(ddsc_qos, liveliness, .init=qos_init, .fini=qos_fini)
{
struct pol_liveliness p = { 0 };
struct pol_liveliness p = { DDS_LIVELINESS_AUTOMATIC, 0 };
/* NULLs shouldn't crash and be a noops. */
dds_qset_liveliness(NULL, g_pol_liveliness.kind, g_pol_liveliness.lease_duration);
@ -468,7 +467,7 @@ Test(ddsc_qos, time_base_filter, .init=qos_init, .fini=qos_fini)
Test(ddsc_qos, partition, .init=qos_init, .fini=qos_fini)
{
struct pol_partition p = { 0 };
struct pol_partition p = { 0, NULL };
/* NULLs shouldn't crash and be a noops. */
dds_qset_partition(NULL, g_pol_partition.n, c_partitions);
@ -490,7 +489,7 @@ Test(ddsc_qos, partition, .init=qos_init, .fini=qos_fini)
Test(ddsc_qos, reliability, .init=qos_init, .fini=qos_fini)
{
struct pol_reliability p = { 0 };
struct pol_reliability p = { DDS_RELIABILITY_BEST_EFFORT, 0 };
/* NULLs shouldn't crash and be a noops. */
dds_qset_reliability(NULL, g_pol_reliability.kind, g_pol_reliability.max_blocking_time);
@ -521,7 +520,7 @@ Test(ddsc_qos, transport_priority, .init=qos_init, .fini=qos_fini)
Test(ddsc_qos, destination_order, .init=qos_init, .fini=qos_fini)
{
struct pol_destination_order p = { 0 };
struct pol_destination_order p = { DDS_DESTINATIONORDER_BY_RECEPTION_TIMESTAMP };
/* NULLs shouldn't crash and be a noops. */
dds_qset_destination_order(NULL, g_pol_destination_order.kind);
@ -536,7 +535,7 @@ Test(ddsc_qos, destination_order, .init=qos_init, .fini=qos_fini)
Test(ddsc_qos, writer_data_lifecycle, .init=qos_init, .fini=qos_fini)
{
struct pol_writer_data_lifecycle p = { 0 };
struct pol_writer_data_lifecycle p = { false };
/* NULLs shouldn't crash and be a noops. */
dds_qset_writer_data_lifecycle(NULL, g_pol_writer_data_lifecycle.autodispose);
@ -551,7 +550,7 @@ Test(ddsc_qos, writer_data_lifecycle, .init=qos_init, .fini=qos_fini)
Test(ddsc_qos, reader_data_lifecycle, .init=qos_init, .fini=qos_fini)
{
struct pol_reader_data_lifecycle p = { 0 };
struct pol_reader_data_lifecycle p = { 0, 0 };
/* NULLs shouldn't crash and be a noops. */
dds_qset_reader_data_lifecycle(NULL, g_pol_reader_data_lifecycle.autopurge_nowriter_samples_delay, g_pol_reader_data_lifecycle.autopurge_disposed_samples_delay);
@ -567,7 +566,7 @@ Test(ddsc_qos, reader_data_lifecycle, .init=qos_init, .fini=qos_fini)
Test(ddsc_qos, durability_service, .init=qos_init, .fini=qos_fini)
{
struct pol_durability_service p = { 0 };
struct pol_durability_service p = { 0, DDS_HISTORY_KEEP_LAST, 0, 0, 0, 0 };
/* NULLs shouldn't crash and be a noops. */
dds_qset_durability_service(NULL,
@ -615,7 +614,6 @@ Test(ddsc_qos, durability_service, .init=qos_init, .fini=qos_fini)
cr_assert_eq(p.max_samples_per_instance, g_pol_durability_service.max_samples_per_instance);
}
#endif
#ifdef _MSC_VER
#pragma warning(pop)
#endif

View file

@ -89,7 +89,7 @@ create_topic_name(const char *prefix, char *name, size_t size)
static void
querycondition_init(void)
{
Space_Type1 sample = { 0 };
Space_Type1 sample = { 0, 0, 0 };
dds_qos_t *qos = dds_qos_create ();
dds_attach_t triggered;
dds_return_t ret;

View file

@ -67,7 +67,6 @@ static Space_Type1 g_data[MAX_SAMPLES];
static dds_sample_info_t g_info[MAX_SAMPLES];
static dds_instance_handle_t g_hdl_valid;
static dds_instance_handle_t g_hdl_nil = DDS_HANDLE_NIL;
static bool
filter_mod2(const void * sample)
@ -89,7 +88,7 @@ create_topic_name(const char *prefix, char *name, size_t size)
static void
read_instance_init(void)
{
Space_Type1 sample = { 0 };
Space_Type1 sample = { 0, 0, 0 };
dds_attach_t triggered;
dds_return_t ret;
char name[100];
@ -180,6 +179,7 @@ read_instance_init(void)
for(int i = 0; i < ret; i++) {
Space_Type1 *s = (Space_Type1*)g_samples[i];
PRINT_SAMPLE("INIT: Read ", (*s));
(void)s;
}
/* | long_1 | long_2 | long_3 | sst | vst | ist |
* ----------------------------------------------------------

View file

@ -82,7 +82,7 @@ create_topic_name(const char *prefix, char *name, size_t size)
static void
readcondition_init(void)
{
Space_Type1 sample = { 0 };
Space_Type1 sample = { 0, 0, 0 };
dds_qos_t *qos = dds_qos_create ();
dds_attach_t triggered;
dds_return_t ret;

View file

@ -84,7 +84,7 @@ create_topic_name(const char *prefix, char *name, size_t size)
static void
reader_init(void)
{
Space_Type1 sample = { 0 };
Space_Type1 sample = { 0, 0, 0 };
dds_attach_t triggered;
dds_return_t ret;
char name[100];
@ -174,6 +174,7 @@ reader_init(void)
for(int i = 0; i < ret; i++) {
Space_Type1 *s = (Space_Type1*)g_samples[i];
PRINT_SAMPLE("INIT: Read ", (*s));
(void)s;
}
/* Re-write the samples that should be not_read&old_view. */
@ -2499,7 +2500,7 @@ Test(ddsc_take_mask, take_instance_last_sample)
int expected_long_3 = 2;
#endif
dds_return_t expected_cnt = 1;
Space_Type1 sample = { 0 };
Space_Type1 sample = { 0, 0, 0 };
dds_attach_t triggered;
dds_return_t ret;
char name[100];

View file

@ -89,9 +89,6 @@ static void* g_samples[MAX_SAMPLES];
static Space_Type1 g_data[MAX_SAMPLES];
static dds_sample_info_t g_info[MAX_SAMPLES];
static dds_instance_handle_t g_hdl_valid;
static dds_instance_handle_t g_hdl_nil = DDS_HANDLE_NIL;
static char*
create_topic_name(const char *prefix, char *name, size_t size)
{
@ -128,7 +125,7 @@ filter_mod2(const void * sample)
static void
reader_iterator_init(void)
{
Space_Type1 sample = { 0 };
Space_Type1 sample = { 0, 0, 0 };
dds_attach_t triggered;
dds_return_t ret;
char name[100];
@ -364,9 +361,9 @@ Test(ddsc_read_next, reader, .init=reader_iterator_init, .fini=reader_iterator_f
dds_instance_state_t expected_ist = SAMPLE_IST(expected_long_1);
/* Check data. */
cr_assert_eq(sample->long_1, expected_long_1 );
cr_assert_eq(sample->long_2, expected_long_2 );
cr_assert_eq(sample->long_3, expected_long_2 *2);
cr_assert_eq(sample->long_1, expected_long_1);
cr_assert_eq(sample->long_2, expected_long_2);
cr_assert_eq(sample->long_3, expected_long_3);
/* Check states. */
cr_assert_eq(g_info[0].valid_data, true);
@ -399,7 +396,7 @@ Theory((dds_entity_t rdr), ddsc_read_next, invalid_readers, .init=reader_iterato
dds_return_t ret;
ret = dds_read_next(rdr, g_samples, g_info);
cr_assert_eq(dds_err_nr(ret), dds_err_nr(exp), "returned %d != expected %d", dds_err_str(ret), dds_err_nr(exp));
cr_assert_eq(dds_err_nr(ret), dds_err_nr(exp), "returned %d != expected %d", dds_err_nr(ret), dds_err_nr(exp));
}
/*************************************************************************************************/
@ -476,9 +473,9 @@ Test(ddsc_read_next_wl, reader, .init=reader_iterator_init, .fini=reader_iterato
dds_instance_state_t expected_ist = SAMPLE_IST(expected_long_1);
/* Check data. */
cr_assert_eq(sample->long_1, expected_long_2/3 );
cr_assert_eq(sample->long_2, expected_long_2 );
cr_assert_eq(sample->long_3, expected_long_2 *2);
cr_assert_eq(sample->long_1, expected_long_1);
cr_assert_eq(sample->long_2, expected_long_2);
cr_assert_eq(sample->long_3, expected_long_3);
/* Check states. */
cr_assert_eq(g_info[0].valid_data, true);
@ -590,9 +587,9 @@ Test(ddsc_take_next, reader, .init=reader_iterator_init, .fini=reader_iterator_f
dds_instance_state_t expected_ist = SAMPLE_IST(expected_long_1);
/* Check data. */
cr_assert_eq(sample->long_1, expected_long_1 );
cr_assert_eq(sample->long_2, expected_long_2 );
cr_assert_eq(sample->long_3, expected_long_2 *2);
cr_assert_eq(sample->long_1, expected_long_1);
cr_assert_eq(sample->long_2, expected_long_2);
cr_assert_eq(sample->long_3, expected_long_3);
/* Check states. */
cr_assert_eq(g_info[0].valid_data, true);
@ -700,9 +697,9 @@ Test(ddsc_take_next_wl, reader, .init=reader_iterator_init, .fini=reader_iterato
dds_instance_state_t expected_ist = SAMPLE_IST(expected_long_1);
/* Check data. */
cr_assert_eq(sample->long_1, expected_long_2/3 );
cr_assert_eq(sample->long_2, expected_long_2 );
cr_assert_eq(sample->long_3, expected_long_2 *2);
cr_assert_eq(sample->long_1, expected_long_1);
cr_assert_eq(sample->long_2, expected_long_2);
cr_assert_eq(sample->long_3, expected_long_3);
/* Check states. */
cr_assert_eq(g_info[0].valid_data, true);

View file

@ -39,7 +39,6 @@ static dds_time_t g_present = 0;
static void* g_samples[MAX_SAMPLES];
static Space_Type1 g_data[MAX_SAMPLES];
static dds_sample_info_t g_info[MAX_SAMPLES];
static char*
create_topic_name(const char *prefix, char *name, size_t size)
@ -54,7 +53,7 @@ create_topic_name(const char *prefix, char *name, size_t size)
static void
registering_init(void)
{
Space_Type1 sample = { 0 };
Space_Type1 sample = { 0, 0, 0 };
dds_qos_t *qos = dds_qos_create ();
dds_attach_t triggered;
dds_return_t ret;
@ -163,7 +162,6 @@ TheoryDataPoints(ddsc_register_instance, invalid_params) = {
};
Theory((dds_instance_handle_t *hndl2, void *datap), ddsc_register_instance, invalid_params/*, .init=registering_init, .fini=registering_fini*/)
{
dds_return_t exp = DDS_RETCODE_BAD_PARAMETER * -1;
dds_return_t ret;
/* Only test when the combination of parameters is actually invalid.*/

View file

@ -92,19 +92,27 @@ Test(ddsc_reader, return_loan_bad_params, .init = create_entities, .fini = delet
DDS_TO_STRING(DDS_RETCODE_BAD_PARAMETER),
dds_err_str(result));
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 6387)
#endif
result = dds_return_loan(reader, buf, 10);
#ifdef _MSC_VER
#pragma warning(pop)
#endif
cr_expect_eq(dds_err_nr(result), DDS_RETCODE_BAD_PARAMETER, "Invalid buffer size, Expected(%s) Returned(%s)",
DDS_TO_STRING(DDS_RETCODE_BAD_PARAMETER),
dds_err_str(result));
buf = create_loan_buf(10, false);
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 28020)
#endif
result = dds_return_loan(0, buf, 10);
#ifdef _MSC_VER
#pragma warning(pop)
#endif
cr_expect_eq(dds_err_nr(result), DDS_RETCODE_BAD_PARAMETER, "Invalid entity, Expected(%s) Returned(%s)",
DDS_TO_STRING(DDS_RETCODE_BAD_PARAMETER),
dds_err_str(result));

View file

@ -17,11 +17,23 @@
/* We are deliberately testing some bad arguments that SAL will complain about.
* So, silence SAL regarding these issues. */
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 6387 28020)
#endif
static void on_data_available(dds_entity_t reader, void* arg) {}
static void on_publication_matched(dds_entity_t writer, const dds_publication_matched_status_t status, void* arg) {}
static void on_data_available(dds_entity_t reader, void* arg)
{
(void)reader;
(void)arg;
}
static void on_publication_matched(dds_entity_t writer, const dds_publication_matched_status_t status, void* arg)
{
(void)writer;
(void)status;
(void)arg;
}
Test(ddsc_subscriber, notify_readers) {
dds_entity_t participant;
@ -108,4 +120,6 @@ Test(ddsc_subscriber, create) {
dds_delete(participant);
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif

View file

@ -67,7 +67,6 @@ static Space_Type1 g_data[MAX_SAMPLES];
static dds_sample_info_t g_info[MAX_SAMPLES];
static dds_instance_handle_t g_hdl_valid;
static dds_instance_handle_t g_hdl_nil = DDS_HANDLE_NIL;
static bool
filter_mod2(const void * sample)
@ -89,7 +88,7 @@ create_topic_name(const char *prefix, char *name, size_t size)
static void
take_instance_init(void)
{
Space_Type1 sample = { 0 };
Space_Type1 sample = { 0, 0, 0 };
dds_attach_t triggered;
dds_return_t ret;
char name[100];
@ -180,6 +179,7 @@ take_instance_init(void)
for(int i = 0; i < ret; i++) {
Space_Type1 *s = (Space_Type1*)g_samples[i];
PRINT_SAMPLE("INIT: Read ", (*s));
(void)s;
}
/* | long_1 | long_2 | long_3 | sst | vst | ist |
* ----------------------------------------------------------

View file

@ -19,7 +19,7 @@
#define MAX_SAMPLES (7)
Test(ddsc_transient_local, late_joiner)
{
Space_Type1 sample = { 0 };
Space_Type1 sample = { 0, 0, 0 };
dds_return_t ret;
dds_entity_t par;
dds_entity_t pub;

View file

@ -53,7 +53,7 @@ create_topic_name(const char *prefix, char *name, size_t size)
static void
unregistering_init(void)
{
Space_Type1 sample = { 0 };
Space_Type1 sample = { 0, 0, 0 };
dds_qos_t *qos = dds_qos_create ();
dds_attach_t triggered;
dds_return_t ret;

View file

@ -664,11 +664,10 @@ TheoryDataPoints(ddsc_waitset_wait, invalid_params) = {
};
Theory((dds_attach_t *a, size_t size, int msec), ddsc_waitset_wait, invalid_params, .init=ddsc_waitset_basic_init, .fini=ddsc_waitset_basic_fini)
{
dds_return_t exp = DDS_RETCODE_BAD_PARAMETER * -1;
dds_return_t ret;
/* Only test when the combination of parameters is actually invalid. */
cr_assume(((a == NULL) && (size != 0)) || ((a != NULL) && (size == 0)) || (size < 0) || (msec < 0));
cr_assume(((a == NULL) && (size != 0)) || ((a != NULL) && (size == 0)) || (msec < 0));
ret = dds_waitset_wait(waitset, a, size, DDS_MSECS(msec));
cr_assert_eq(dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER, "returned %d != expected %d", dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER);
@ -722,11 +721,10 @@ TheoryDataPoints(ddsc_waitset_wait_until, invalid_params) = {
};
Theory((dds_attach_t *a, size_t size), ddsc_waitset_wait_until, invalid_params, .init=ddsc_waitset_basic_init, .fini=ddsc_waitset_basic_fini)
{
dds_return_t exp = DDS_RETCODE_BAD_PARAMETER * -1;
dds_return_t ret;
/* Only test when the combination of parameters is actually invalid. */
cr_assume(((a == NULL) && (size != 0)) || ((a != NULL) && (size == 0)) || (size < 0));
cr_assume(((a == NULL) && (size != 0)) || ((a != NULL) && (size == 0)));
ret = dds_waitset_wait_until(waitset, a, size, dds_time());
cr_assert_eq(dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER, "returned %d != expected %d", dds_err_nr(ret), DDS_RETCODE_BAD_PARAMETER);
@ -820,7 +818,7 @@ Theory((size_t size), ddsc_waitset_get_entities, array_sizes, .init=ddsc_waitset
}
/* Every found entity should be a known one. */
cr_assert_eq(NumberOfSetBits(found), ret, "Not all found entities are known");
cr_assert_eq((dds_return_t)NumberOfSetBits(found), ret, "Not all found entities are known");
}
/*************************************************************************************************/
@ -839,7 +837,6 @@ Test(ddsc_waitset_get_entities, no_array, .init=ddsc_waitset_attached_init, .fin
/*************************************************************************************************/
Test(ddsc_waitset_get_entities, deleted_waitset, .init=ddsc_waitset_attached_init, .fini=ddsc_waitset_attached_fini)
{
uint32_t found = 0;
dds_return_t ret;
dds_entity_t entities[MAX_ENTITIES_CNT];
dds_delete(waitset);
@ -1078,7 +1075,6 @@ static os_result
thread_reached_state(thread_state_t *actual, thread_state_t expected, int32_t msec)
{
/* Convenience function. */
bool stopped = false;
os_time msec10 = { 0, 10000000 };
while ((msec > 0) && (*actual != expected)) {
os_nanoSleep(msec10);

View file

@ -20,8 +20,8 @@
/* Tests in this file only concern themselves with very basic api tests of
dds_write and dds_write_ts */
static const int payloadSize = 32;
static RoundTripModule_DataType data = { 0 };
static const uint32_t payloadSize = 32;
static RoundTripModule_DataType data;
static dds_entity_t participant = 0;
static dds_entity_t topic = 0;