Avoid implementation defined types, e.g. unsigned
There are some cases where "int" or "unsigend" actually makes sense, but in a large number of cases it is really supposed to be either a 32-bit integer, or, in some cases, at least a 32-bit integer. It is much to be preferred to be clear about this. Another reason is that at least some embedded platforms define, e.g., int32_t as "long" instead of "int". For the ones I am aware of the "int" and "long" are actually the same 32-bit integer, but that distinction can cause trouble with printf format specifications. So again a good reason to be consistent in avoiding the implementation-defined ones. Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
f9219bb5fa
commit
ffbf3d7843
31 changed files with 141 additions and 210 deletions
|
@ -62,8 +62,8 @@ DDS_EXPORT void dds_rhc_remove_readcondition (dds_readcond * cond);
|
|||
DDS_EXPORT int dds_rhc_takecdr
|
||||
(
|
||||
struct rhc *rhc, bool lock, struct ddsi_serdata **values, dds_sample_info_t *info_seq,
|
||||
uint32_t max_samples, unsigned sample_states,
|
||||
unsigned view_states, unsigned instance_states,
|
||||
uint32_t max_samples, uint32_t sample_states,
|
||||
uint32_t view_states, uint32_t instance_states,
|
||||
dds_instance_handle_t handle
|
||||
);
|
||||
|
||||
|
|
|
@ -234,16 +234,16 @@ struct rhc_sample {
|
|||
uint64_t wr_iid; /* unique id for writer of this sample (perhaps better in serdata) */
|
||||
dds_querycond_mask_t conds; /* matching query conditions */
|
||||
bool isread; /* READ or NOT_READ sample state */
|
||||
unsigned disposed_gen; /* snapshot of instance counter at time of insertion */
|
||||
unsigned no_writers_gen; /* __/ */
|
||||
uint32_t disposed_gen; /* snapshot of instance counter at time of insertion */
|
||||
uint32_t no_writers_gen; /* __/ */
|
||||
};
|
||||
|
||||
struct rhc_instance {
|
||||
uint64_t iid; /* unique instance id, key of table, also serves as instance handle */
|
||||
uint64_t wr_iid; /* unique of id of writer of latest sample or 0; if wrcount = 0 it is the wr_iid that caused */
|
||||
struct rhc_sample *latest; /* latest received sample; circular list old->new; null if no sample */
|
||||
unsigned nvsamples; /* number of "valid" samples in instance */
|
||||
unsigned nvread; /* number of READ "valid" samples in instance (0 <= nvread <= nvsamples) */
|
||||
uint32_t nvsamples; /* number of "valid" samples in instance */
|
||||
uint32_t nvread; /* number of READ "valid" samples in instance (0 <= nvread <= nvsamples) */
|
||||
dds_querycond_mask_t conds; /* matching query conditions */
|
||||
uint32_t wrcount; /* number of live writers */
|
||||
unsigned isnew : 1; /* NEW or NOT_NEW view state */
|
||||
|
@ -252,8 +252,8 @@ struct rhc_instance {
|
|||
unsigned wr_iid_islive : 1; /* whether wr_iid is of a live writer */
|
||||
unsigned inv_exists : 1; /* whether or not state change occurred since last sample (i.e., must return invalid sample) */
|
||||
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 disposed_gen; /* bloody generation counters - worst invention of mankind */
|
||||
uint32_t no_writers_gen; /* __/ */
|
||||
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 */
|
||||
|
@ -296,7 +296,7 @@ struct rhc {
|
|||
|
||||
dds_reader *reader; /* reader */
|
||||
const struct ddsi_sertopic *topic; /* topic description */
|
||||
unsigned history_depth; /* depth, 1 for KEEP_LAST_1, 2**32-1 for KEEP_ALL */
|
||||
uint32_t history_depth; /* depth, 1 for KEEP_LAST_1, 2**32-1 for KEEP_ALL */
|
||||
|
||||
ddsrt_mutex_t lock;
|
||||
dds_readcond * conds; /* List of associated read conditions */
|
||||
|
@ -1593,9 +1593,9 @@ static unsigned qmask_of_inst (const struct rhc_instance *inst)
|
|||
return qm;
|
||||
}
|
||||
|
||||
static unsigned qmask_from_dcpsquery (unsigned sample_states, unsigned view_states, unsigned instance_states)
|
||||
static uint32_t qmask_from_dcpsquery (uint32_t sample_states, uint32_t view_states, uint32_t instance_states)
|
||||
{
|
||||
unsigned qminv = 0;
|
||||
uint32_t qminv = 0;
|
||||
|
||||
switch ((dds_sample_state_t) sample_states)
|
||||
{
|
||||
|
@ -1639,7 +1639,7 @@ static unsigned qmask_from_dcpsquery (unsigned sample_states, unsigned view_stat
|
|||
return qminv;
|
||||
}
|
||||
|
||||
static unsigned qmask_from_mask_n_cond(uint32_t mask, dds_readcond* cond)
|
||||
static unsigned qmask_from_mask_n_cond (uint32_t mask, dds_readcond* cond)
|
||||
{
|
||||
unsigned qminv;
|
||||
if (mask == NO_STATE_MASK_SET) {
|
||||
|
@ -2553,40 +2553,19 @@ static bool update_conditions_locked (struct rhc *rhc, bool called_from_insert,
|
|||
****** READ/TAKE ******
|
||||
*************************/
|
||||
|
||||
int
|
||||
dds_rhc_read(
|
||||
struct rhc *rhc,
|
||||
bool lock,
|
||||
void ** values,
|
||||
dds_sample_info_t *info_seq,
|
||||
uint32_t max_samples,
|
||||
uint32_t mask,
|
||||
dds_instance_handle_t handle,
|
||||
dds_readcond *cond)
|
||||
int dds_rhc_read (struct rhc *rhc, bool lock, void **values, dds_sample_info_t *info_seq, uint32_t max_samples, uint32_t mask, dds_instance_handle_t handle, dds_readcond *cond)
|
||||
{
|
||||
unsigned qminv = qmask_from_mask_n_cond(mask, cond);
|
||||
return dds_rhc_read_w_qminv(rhc, lock, values, info_seq, max_samples, qminv, handle, cond);
|
||||
unsigned qminv = qmask_from_mask_n_cond (mask, cond);
|
||||
return dds_rhc_read_w_qminv (rhc, lock, values, info_seq, max_samples, qminv, handle, cond);
|
||||
}
|
||||
|
||||
int
|
||||
dds_rhc_take(
|
||||
struct rhc *rhc,
|
||||
bool lock,
|
||||
void ** values,
|
||||
dds_sample_info_t *info_seq,
|
||||
uint32_t max_samples,
|
||||
uint32_t mask,
|
||||
dds_instance_handle_t handle,
|
||||
dds_readcond *cond)
|
||||
int dds_rhc_take (struct rhc *rhc, bool lock, void **values, dds_sample_info_t *info_seq, uint32_t max_samples, uint32_t mask, dds_instance_handle_t handle, dds_readcond *cond)
|
||||
{
|
||||
unsigned qminv = qmask_from_mask_n_cond(mask, cond);
|
||||
return dds_rhc_take_w_qminv(rhc, lock, values, info_seq, max_samples, qminv, handle, cond);
|
||||
return dds_rhc_take_w_qminv (rhc, lock, values, info_seq, max_samples, qminv, handle, cond);
|
||||
}
|
||||
|
||||
int dds_rhc_takecdr
|
||||
(
|
||||
struct rhc *rhc, bool lock, struct ddsi_serdata ** values, dds_sample_info_t *info_seq, uint32_t max_samples,
|
||||
unsigned sample_states, unsigned view_states, unsigned instance_states, dds_instance_handle_t handle)
|
||||
int dds_rhc_takecdr (struct rhc *rhc, bool lock, struct ddsi_serdata ** values, dds_sample_info_t *info_seq, uint32_t max_samples, uint32_t sample_states, uint32_t view_states, uint32_t instance_states, dds_instance_handle_t handle)
|
||||
{
|
||||
unsigned qminv = qmask_from_dcpsquery (sample_states, view_states, instance_states);
|
||||
return dds_rhc_takecdr_w_qminv (rhc, lock, values, info_seq, max_samples, qminv, handle, NULL);
|
||||
|
|
|
@ -98,9 +98,8 @@ static dds_return_t deliver_locally (struct writer *wr, struct ddsi_serdata *pay
|
|||
{
|
||||
dds_duration_t max_block_ms = wr->xqos->reliability.max_blocking_time;
|
||||
struct proxy_writer_info pwr_info;
|
||||
unsigned i;
|
||||
make_proxy_writer_info (&pwr_info, &wr->e, wr->xqos);
|
||||
for (i = 0; rdary[i]; i++) {
|
||||
for (uint32_t i = 0; rdary[i]; i++) {
|
||||
DDS_TRACE ("reader "PGUIDFMT"\n", PGUID (rdary[i]->e.guid));
|
||||
if ((ret = try_store (rdary[i]->rhc, &pwr_info, payload, tk, &max_block_ms)) != DDS_RETCODE_OK)
|
||||
break;
|
||||
|
|
|
@ -147,7 +147,7 @@ struct local_reader_ary {
|
|||
ddsrt_mutex_t rdary_lock;
|
||||
unsigned valid: 1; /* always true until (proxy-)writer is being deleted; !valid => !fastpath_ok */
|
||||
unsigned fastpath_ok: 1; /* if not ok, fall back to using GUIDs (gives access to the reader-writer match data for handling readers that bumped into resource limits, hence can flip-flop, unlike "valid") */
|
||||
unsigned n_readers;
|
||||
uint32_t n_readers;
|
||||
struct reader **rdary; /* for efficient delivery, null-pointer terminated */
|
||||
};
|
||||
|
||||
|
@ -158,9 +158,9 @@ struct avail_entityid_set {
|
|||
struct participant
|
||||
{
|
||||
struct entity_common e;
|
||||
long long lease_duration; /* constant */
|
||||
unsigned bes; /* built-in endpoint set */
|
||||
unsigned prismtech_bes; /* prismtech-specific extension of built-in endpoints set */
|
||||
dds_duration_t lease_duration; /* constant */
|
||||
uint32_t bes; /* built-in endpoint set */
|
||||
uint32_t prismtech_bes; /* prismtech-specific extension of built-in endpoints set */
|
||||
unsigned is_ddsi2_pp: 1; /* true for the "federation leader", the ddsi2 participant itself in OSPL; FIXME: probably should use this for broker mode as well ... */
|
||||
struct nn_plist *plist; /* settings/QoS for this participant */
|
||||
struct xevent *spdp_xevent; /* timed event for periodically publishing SPDP */
|
||||
|
@ -242,7 +242,7 @@ struct writer
|
|||
struct addrset *as; /* set of addresses to publish to */
|
||||
struct addrset *as_group; /* alternate case, used for SPDP, when using Cloud with multiple bootstrap locators */
|
||||
struct xevent *heartbeat_xevent; /* timed event for "periodically" publishing heartbeats when unack'd data present, NULL <=> unreliable */
|
||||
long long lease_duration;
|
||||
dds_duration_t lease_duration;
|
||||
struct whc *whc; /* WHC tracking history, T-L durability service history + samples by sequence number for retransmit */
|
||||
uint32_t whc_low, whc_high; /* watermarks for WHC in bytes (counting only unack'd data) */
|
||||
nn_etime_t t_rexmit_end; /* time of last 1->0 transition of "retransmitting" */
|
||||
|
@ -588,7 +588,7 @@ void delete_local_orphan_writer (struct local_orphan_writer *wr);
|
|||
/* Set when this proxy participant is not to be announced on the built-in topics yet */
|
||||
#define CF_PROXYPP_NO_SPDP (1 << 3)
|
||||
|
||||
void new_proxy_participant (const struct nn_guid *guid, unsigned bes, unsigned prismtech_bes, const struct nn_guid *privileged_pp_guid, struct addrset *as_default, struct addrset *as_meta, const struct nn_plist *plist, int64_t tlease_dur, nn_vendorid_t vendor, unsigned custom_flags, nn_wctime_t timestamp);
|
||||
void new_proxy_participant (const struct nn_guid *guid, unsigned bes, unsigned prismtech_bes, const struct nn_guid *privileged_pp_guid, struct addrset *as_default, struct addrset *as_meta, const struct nn_plist *plist, dds_duration_t tlease_dur, nn_vendorid_t vendor, unsigned custom_flags, nn_wctime_t timestamp);
|
||||
int delete_proxy_participant_by_guid (const struct nn_guid * guid, nn_wctime_t timestamp, int isimplicit);
|
||||
uint64_t participant_instance_id (const struct nn_guid *guid);
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ struct proxy_reader;
|
|||
typedef void (*gcreq_cb_t) (struct gcreq *gcreq);
|
||||
|
||||
struct idx_vtime {
|
||||
unsigned idx;
|
||||
uint32_t idx;
|
||||
vtime_t vtime;
|
||||
};
|
||||
|
||||
|
@ -39,8 +39,8 @@ struct gcreq {
|
|||
struct gcreq_queue *queue;
|
||||
gcreq_cb_t cb;
|
||||
void *arg;
|
||||
unsigned nvtimes;
|
||||
struct idx_vtime vtimes[1 /* really a flex ary */];
|
||||
uint32_t nvtimes;
|
||||
struct idx_vtime vtimes[];
|
||||
};
|
||||
|
||||
DDS_EXPORT struct gcreq_queue *gcreq_queue_new (void);
|
||||
|
|
|
@ -210,7 +210,7 @@ struct q_globals {
|
|||
it is only a global variable because it needs to be freed way later
|
||||
than the receive thread itself terminates */
|
||||
#define MAX_RECV_THREADS 3
|
||||
unsigned n_recv_threads;
|
||||
uint32_t n_recv_threads;
|
||||
struct recv_thread {
|
||||
const char *name;
|
||||
struct thread_state1 *ts;
|
||||
|
|
|
@ -24,15 +24,15 @@ struct hbcontrol {
|
|||
nn_mtime_t t_of_last_hb;
|
||||
nn_mtime_t t_of_last_ackhb;
|
||||
nn_mtime_t tsched;
|
||||
unsigned hbs_since_last_write;
|
||||
unsigned last_packetid;
|
||||
uint32_t hbs_since_last_write;
|
||||
uint32_t last_packetid;
|
||||
};
|
||||
|
||||
void writer_hbcontrol_init (struct hbcontrol *hbc);
|
||||
int64_t writer_hbcontrol_intv (const struct writer *wr, const struct whc_state *whcst, nn_mtime_t tnow);
|
||||
void writer_hbcontrol_note_asyncwrite (struct writer *wr, nn_mtime_t tnow);
|
||||
int writer_hbcontrol_ack_required (const struct writer *wr, const struct whc_state *whcst, nn_mtime_t tnow);
|
||||
struct nn_xmsg *writer_hbcontrol_piggyback (struct writer *wr, const struct whc_state *whcst, nn_mtime_t tnow, unsigned packetid, int *hbansreq);
|
||||
struct nn_xmsg *writer_hbcontrol_piggyback (struct writer *wr, const struct whc_state *whcst, nn_mtime_t tnow, uint32_t packetid, int *hbansreq);
|
||||
int writer_hbcontrol_must_send (const struct writer *wr, const struct whc_state *whcst, nn_mtime_t tnow);
|
||||
struct nn_xmsg *writer_hbcontrol_create_heartbeat (struct writer *wr, const struct whc_state *whcst, nn_mtime_t tnow, int hbansreq, int issync);
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ void lease_renew (struct lease *l, nn_etime_t tnow);
|
|||
void lease_set_expiry (struct lease *l, nn_etime_t when);
|
||||
int64_t check_and_handle_lease_expiration (nn_etime_t tnow);
|
||||
|
||||
void handle_PMD (const struct receiver_state *rst, nn_wctime_t timestamp, unsigned statusinfo, const void *vdata, unsigned len);
|
||||
void handle_PMD (const struct receiver_state *rst, nn_wctime_t timestamp, uint32_t statusinfo, const void *vdata, uint32_t len);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
|
|
|
@ -26,15 +26,15 @@ extern "C" {
|
|||
struct nn_interface {
|
||||
nn_locator_t loc;
|
||||
nn_locator_t netmask;
|
||||
unsigned if_index;
|
||||
uint32_t if_index;
|
||||
unsigned mc_capable: 1;
|
||||
unsigned point_to_point: 1;
|
||||
char *name;
|
||||
};
|
||||
|
||||
int make_socket (ddsrt_socket_t *socket, unsigned short port, bool stream, bool reuse);
|
||||
int make_socket (ddsrt_socket_t *socket, uint16_t port, bool stream, bool reuse);
|
||||
int find_own_ip (const char *requested_address);
|
||||
unsigned locator_to_hopefully_unique_uint32 (const nn_locator_t *src);
|
||||
uint32_t locator_to_hopefully_unique_uint32 (const nn_locator_t *src);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ struct thread_state1 {
|
|||
|
||||
struct thread_states {
|
||||
ddsrt_mutex_t lock;
|
||||
unsigned nthreads;
|
||||
uint32_t nthreads;
|
||||
struct thread_state1 *ts; /* [nthreads] */
|
||||
};
|
||||
|
||||
|
|
|
@ -49,8 +49,7 @@ static uint32_t threadmon_thread (struct ddsi_threadmon *sl)
|
|||
nn_mtime_t next_thread_cputime = { 0 };
|
||||
nn_mtime_t tlast = { 0 };
|
||||
bool was_alive = true;
|
||||
unsigned i;
|
||||
for (i = 0; i < thread_states.nthreads; i++)
|
||||
for (uint32_t i = 0; i < thread_states.nthreads; i++)
|
||||
{
|
||||
sl->av_ary[i].alive = true;
|
||||
}
|
||||
|
@ -78,7 +77,7 @@ static uint32_t threadmon_thread (struct ddsi_threadmon *sl)
|
|||
else
|
||||
{
|
||||
tlast = tnow;
|
||||
for (i = 0; i < thread_states.nthreads; i++)
|
||||
for (uint32_t i = 0; i < thread_states.nthreads; i++)
|
||||
{
|
||||
if (thread_states.ts[i].state == THREAD_STATE_ZERO)
|
||||
n_unused++;
|
||||
|
|
|
@ -121,8 +121,7 @@ void ddsi_conn_free (ddsi_tran_conn_t conn)
|
|||
/* FIXME: rethink the socket waitset & the deleting of entries; the biggest issue is TCP handling that can open & close sockets at will and yet expects the waitset to wake up at the apprioriate times. (This pretty much works with the select-based version, but not the kqueue-based one.) TCP code can also have connections without a socket ... Calling sockWaitsetRemove here (where there shouldn't be any knowledge of it) at least ensures that it is removed in time and that there can't be aliasing of connections and sockets. */
|
||||
if (ddsi_conn_handle (conn) != DDSRT_INVALID_SOCKET)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < gv.n_recv_threads; i++)
|
||||
for (uint32_t i = 0; i < gv.n_recv_threads; i++)
|
||||
{
|
||||
if (!gv.recv_threads[i].ts)
|
||||
assert (!gv.rtps_keepgoing);
|
||||
|
|
|
@ -541,15 +541,13 @@ void addrset_forall (struct addrset *as, addrset_forall_fun_t f, void *arg)
|
|||
|
||||
int addrset_forone (struct addrset *as, addrset_forone_fun_t f, void *arg)
|
||||
{
|
||||
unsigned i;
|
||||
addrset_node_t n;
|
||||
ddsrt_avl_ctree_t *trees[2];
|
||||
ddsrt_avl_citer_t iter;
|
||||
|
||||
trees[0] = &as->mcaddrs;
|
||||
trees[1] = &as->ucaddrs;
|
||||
|
||||
for (i = 0; i < 2u; i++)
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
n = (addrset_node_t) ddsrt_avl_citer_first (&addrset_treedef, trees[i], &iter);
|
||||
while (n)
|
||||
|
|
|
@ -61,8 +61,8 @@ void bswap_sequence_number_set_hdr (nn_sequence_number_set_t *snset)
|
|||
|
||||
void bswap_sequence_number_set_bitmap (nn_sequence_number_set_t *snset)
|
||||
{
|
||||
unsigned i, n = (snset->numbits + 31) / 32;
|
||||
for (i = 0; i < n; i++)
|
||||
const uint32_t n = (snset->numbits + 31) / 32;
|
||||
for (uint32_t i = 0; i < n; i++)
|
||||
snset->bits[i] = bswap4u (snset->bits[i]);
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,7 @@ void bswap_fragment_number_set_hdr (nn_fragment_number_set_t *fnset)
|
|||
|
||||
void bswap_fragment_number_set_bitmap (nn_fragment_number_set_t *fnset)
|
||||
{
|
||||
unsigned i, n = (fnset->numbits + 31) / 32;
|
||||
for (i = 0; i < n; i++)
|
||||
const uint32_t n = (fnset->numbits + 31) / 32;
|
||||
for (uint32_t i = 0; i < n; i++)
|
||||
fnset->bits[i] = bswap4u (fnset->bits[i]);
|
||||
}
|
||||
|
|
|
@ -1703,7 +1703,7 @@ static int uf_networkAddresses (struct cfgst *cfgst, void *parent, struct cfgele
|
|||
{
|
||||
char *** const elem = cfg_address (cfgst, parent, cfgelem);
|
||||
char *copy;
|
||||
unsigned count;
|
||||
uint32_t count;
|
||||
|
||||
/* First count how many addresses we have - but do it stupidly by
|
||||
counting commas and adding one (so two commas in a row are both
|
||||
|
@ -1723,7 +1723,7 @@ static int uf_networkAddresses (struct cfgst *cfgst, void *parent, struct cfgele
|
|||
|
||||
{
|
||||
char *cursor = copy, *tok;
|
||||
unsigned idx = 0;
|
||||
uint32_t idx = 0;
|
||||
while ((tok = ddsrt_strsep (&cursor, ",")) != NULL) {
|
||||
assert (idx < count);
|
||||
(*elem)[idx] = ddsrt_strdup (tok);
|
||||
|
@ -2458,7 +2458,7 @@ static int sort_channels_check_nodups (struct config *cfg)
|
|||
structure, sorting is much easier in an array, and hence we
|
||||
convert back and forth. */
|
||||
struct config_channel_listelem **ary, *c;
|
||||
unsigned i, n;
|
||||
uint32_t i, n;
|
||||
int result;
|
||||
|
||||
n = 0;
|
||||
|
@ -2469,7 +2469,7 @@ static int sort_channels_check_nodups (struct config *cfg)
|
|||
ary = ddsrt_malloc (n * sizeof (*ary));
|
||||
|
||||
i = 0;
|
||||
for (c = cfg->channels; c; c = c->next)
|
||||
for (c = cfg->channels; c; c = c->next)
|
||||
ary[i++] = c;
|
||||
qsort (ary, n, sizeof (*ary), sort_channels_cmp);
|
||||
|
||||
|
|
|
@ -778,7 +778,7 @@ static int handle_SPDP_alive (const struct receiver_state *rst, nn_wctime_t time
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void handle_SPDP (const struct receiver_state *rst, nn_wctime_t timestamp, unsigned statusinfo, const void *vdata, unsigned len)
|
||||
static void handle_SPDP (const struct receiver_state *rst, nn_wctime_t timestamp, unsigned statusinfo, const void *vdata, uint32_t len)
|
||||
{
|
||||
const struct CDRHeader *data = vdata; /* built-ins not deserialized (yet) */
|
||||
DDS_TRACE("SPDP ST%x", statusinfo);
|
||||
|
@ -1321,7 +1321,7 @@ static void handle_SEDP_dead (nn_plist_t *datap, nn_wctime_t timestamp)
|
|||
DDS_LOG(DDS_LC_DISCOVERY, " %s\n", (res < 0) ? " unknown" : " delete");
|
||||
}
|
||||
|
||||
static void handle_SEDP (const struct receiver_state *rst, nn_wctime_t timestamp, unsigned statusinfo, const void *vdata, unsigned len)
|
||||
static void handle_SEDP (const struct receiver_state *rst, nn_wctime_t timestamp, unsigned statusinfo, const void *vdata, uint32_t len)
|
||||
{
|
||||
const struct CDRHeader *data = vdata; /* built-ins not deserialized (yet) */
|
||||
DDS_LOG(DDS_LC_DISCOVERY, "SEDP ST%x", statusinfo);
|
||||
|
@ -1447,7 +1447,7 @@ int sedp_write_cm_participant (struct participant *pp, int alive)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static void handle_SEDP_CM (const struct receiver_state *rst, nn_entityid_t wr_entity_id, nn_wctime_t timestamp, unsigned statusinfo, const void *vdata, unsigned len)
|
||||
static void handle_SEDP_CM (const struct receiver_state *rst, nn_entityid_t wr_entity_id, nn_wctime_t timestamp, uint32_t statusinfo, const void *vdata, uint32_t len)
|
||||
{
|
||||
const struct CDRHeader *data = vdata; /* built-ins not deserialized (yet) */
|
||||
DDS_LOG(DDS_LC_DISCOVERY, "SEDP_CM ST%x", statusinfo);
|
||||
|
@ -1611,7 +1611,7 @@ static void handle_SEDP_GROUP_dead (nn_plist_t *datap, nn_wctime_t timestamp)
|
|||
delete_proxy_group (&datap->group_guid, timestamp, 0);
|
||||
}
|
||||
|
||||
static void handle_SEDP_GROUP (const struct receiver_state *rst, nn_wctime_t timestamp, unsigned statusinfo, const void *vdata, unsigned len)
|
||||
static void handle_SEDP_GROUP (const struct receiver_state *rst, nn_wctime_t timestamp, unsigned statusinfo, const void *vdata, uint32_t len)
|
||||
{
|
||||
const struct CDRHeader *data = vdata; /* built-ins not deserialized (yet) */
|
||||
DDS_LOG(DDS_LC_DISCOVERY, "SEDP_GROUP ST%x", statusinfo);
|
||||
|
|
|
@ -113,9 +113,8 @@ static int print_any_endpoint_common (ddsi_tran_conn_t conn, const char *label,
|
|||
x += cpf (conn, " %s %x:%x:%x:%x ", label, PGUID (e->guid));
|
||||
if (xqos->present & QP_PARTITION)
|
||||
{
|
||||
unsigned i;
|
||||
if (xqos->partition.n > 1) cpf (conn, "{");
|
||||
for (i = 0; i < xqos->partition.n; i++)
|
||||
for (uint32_t i = 0; i < xqos->partition.n; i++)
|
||||
x += cpf (conn, "%s%s", i == 0 ? "" : ",", xqos->partition.strs[i]);
|
||||
if (xqos->partition.n > 1) cpf (conn, "}");
|
||||
x += cpf (conn, ".%s/%s",
|
||||
|
|
|
@ -218,7 +218,7 @@ void local_reader_ary_insert (struct local_reader_ary *x, struct reader *rd)
|
|||
|
||||
void local_reader_ary_remove (struct local_reader_ary *x, struct reader *rd)
|
||||
{
|
||||
unsigned i;
|
||||
uint32_t i;
|
||||
ddsrt_mutex_lock (&x->rdary_lock);
|
||||
for (i = 0; i < x->n_readers; i++)
|
||||
{
|
||||
|
@ -2709,16 +2709,13 @@ static void new_writer_guid_common_init (struct writer *wr, const struct ddsi_se
|
|||
wr->as_group = NULL;
|
||||
|
||||
#ifdef DDSI_INCLUDE_NETWORK_PARTITIONS
|
||||
{
|
||||
unsigned i;
|
||||
/* This is an open issue how to encrypt mesages send for various
|
||||
partitions that match multiple network partitions. From a safety
|
||||
point of view a wierd configuration. Here we chose the first one
|
||||
that we find */
|
||||
wr->partition_id = 0;
|
||||
for (i = 0; i < wr->xqos->partition.n && wr->partition_id == 0; i++)
|
||||
wr->partition_id = get_partitionid_from_mapping (wr->xqos->partition.strs[i], wr->xqos->topic_name);
|
||||
}
|
||||
/* This is an open issue how to encrypt mesages send for various
|
||||
partitions that match multiple network partitions. From a safety
|
||||
point of view a wierd configuration. Here we chose the first one
|
||||
that we find */
|
||||
wr->partition_id = 0;
|
||||
for (uint32_t i = 0; i < wr->xqos->partition.n && wr->partition_id == 0; i++)
|
||||
wr->partition_id = get_partitionid_from_mapping (wr->xqos->partition.strs[i], wr->xqos->topic_name);
|
||||
#endif /* DDSI_INCLUDE_NETWORK_PARTITIONS */
|
||||
|
||||
#ifdef DDSI_INCLUDE_SSM
|
||||
|
@ -3128,12 +3125,11 @@ static void join_mcast_helper (const nn_locator_t *n, void * varg)
|
|||
nn_locator_t l = *n;
|
||||
nn_udpv4mcgen_address_t l1;
|
||||
uint32_t iph;
|
||||
unsigned i;
|
||||
memcpy(&l1, l.address, sizeof(l1));
|
||||
l.kind = NN_LOCATOR_KIND_UDPv4;
|
||||
memset(l.address, 0, 12);
|
||||
iph = ntohl(l1.ipv4.s_addr);
|
||||
for (i = 1; i < (1u << l1.count); i++)
|
||||
for (uint32_t i = 1; i < ((uint32_t)1 << l1.count); i++)
|
||||
{
|
||||
uint32_t ipn, iph1 = iph;
|
||||
if (i & (1u << l1.idx))
|
||||
|
@ -3170,12 +3166,11 @@ static void leave_mcast_helper (const nn_locator_t *n, void * varg)
|
|||
nn_locator_t l = *n;
|
||||
nn_udpv4mcgen_address_t l1;
|
||||
uint32_t iph;
|
||||
unsigned i;
|
||||
memcpy(&l1, l.address, sizeof(l1));
|
||||
l.kind = NN_LOCATOR_KIND_UDPv4;
|
||||
memset(l.address, 0, 12);
|
||||
iph = ntohl(l1.ipv4.s_addr);
|
||||
for (i = 1; i < (1u << l1.count); i++)
|
||||
for (uint32_t i = 1; i < ((uint32_t)1 << l1.count); i++)
|
||||
{
|
||||
uint32_t ipn, iph1 = iph;
|
||||
if (i & (1u << l1.idx))
|
||||
|
@ -3270,10 +3265,8 @@ static dds_return_t new_reader_guid
|
|||
rd->as = new_addrset ();
|
||||
if (config.allowMulticast & ~AMC_SPDP)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
/* compile address set from the mapped network partitions */
|
||||
for (i = 0; i < rd->xqos->partition.n; i++)
|
||||
for (uint32_t i = 0; i < rd->xqos->partition.n; i++)
|
||||
{
|
||||
struct addrset *pas = get_as_from_mapping (rd->xqos->partition.strs[i], rd->xqos->topic_name);
|
||||
if (pas)
|
||||
|
@ -3483,7 +3476,7 @@ void new_proxy_participant
|
|||
struct addrset *as_default,
|
||||
struct addrset *as_meta,
|
||||
const nn_plist_t *plist,
|
||||
int64_t tlease_dur,
|
||||
dds_duration_t tlease_dur,
|
||||
nn_vendorid_t vendor,
|
||||
unsigned custom_flags,
|
||||
nn_wctime_t timestamp
|
||||
|
@ -3538,7 +3531,7 @@ void new_proxy_participant
|
|||
{
|
||||
/* Lease duration is meaningless when the lease never expires, but when proxy participants are created implicitly because of endpoint discovery from a cloud service, we do want the lease to expire eventually when the cloud discovery service disappears and never reappears. The normal data path renews the lease, so if the lease expiry is changed after the DS disappears but data continues to flow (even if it is only a single sample) the proxy participant would immediately go back to a non-expiring lease with no further triggers for deleting it. Instead, we take tlease_dur == NEVER as a special value meaning a lease that doesn't expire now and that has a "reasonable" lease duration. That way the lease renewal in the data path is fine, and we only need to do something special in SEDP handling. */
|
||||
nn_etime_t texp = add_duration_to_etime (now_et(), tlease_dur);
|
||||
int64_t dur = (tlease_dur == T_NEVER) ? config.lease_duration : tlease_dur;
|
||||
dds_duration_t dur = (tlease_dur == T_NEVER) ? config.lease_duration : tlease_dur;
|
||||
ddsrt_atomic_stvoidp (&proxypp->lease, lease_new (texp, dur, &proxypp->e));
|
||||
proxypp->owns_lease = 1;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ struct gcreq_queue {
|
|||
static void threads_vtime_gather_for_wait (unsigned *nivs, struct idx_vtime *ivs)
|
||||
{
|
||||
/* copy vtimes of threads, skipping those that are sleeping */
|
||||
unsigned i, j;
|
||||
uint32_t i, j;
|
||||
for (i = j = 0; i < thread_states.nthreads; i++)
|
||||
{
|
||||
vtime_t vtime = thread_states.ts[i].vtime;
|
||||
|
@ -55,14 +55,14 @@ static void threads_vtime_gather_for_wait (unsigned *nivs, struct idx_vtime *ivs
|
|||
*nivs = j;
|
||||
}
|
||||
|
||||
static int threads_vtime_check (unsigned *nivs, struct idx_vtime *ivs)
|
||||
static int threads_vtime_check (uint32_t *nivs, struct idx_vtime *ivs)
|
||||
{
|
||||
/* check all threads in ts have made progress those that have are
|
||||
removed from the set */
|
||||
unsigned i = 0;
|
||||
uint32_t i = 0;
|
||||
while (i < *nivs)
|
||||
{
|
||||
unsigned thridx = ivs[i].idx;
|
||||
uint32_t thridx = ivs[i].idx;
|
||||
vtime_t vtime = thread_states.ts[thridx].vtime;
|
||||
assert (vtime_awake_p (ivs[i].vtime));
|
||||
if (!vtime_gt (vtime, ivs[i].vtime))
|
||||
|
|
|
@ -705,7 +705,6 @@ static void wait_for_receive_threads_helper (struct xevent *xev, void *varg, nn_
|
|||
static void wait_for_receive_threads (void)
|
||||
{
|
||||
struct xevent *trigev;
|
||||
unsigned i;
|
||||
struct wait_for_receive_threads_helper_arg cbarg;
|
||||
cbarg.count = 0;
|
||||
if ((trigev = qxev_callback (add_duration_to_mtime (now_mt (), T_SECOND), wait_for_receive_threads_helper, &cbarg)) == NULL)
|
||||
|
@ -715,7 +714,7 @@ static void wait_for_receive_threads (void)
|
|||
dropping the packets until the user approves. */
|
||||
DDS_WARNING("wait_for_receive_threads: failed to schedule periodic triggering of the receive threads to deal with packet loss\n");
|
||||
}
|
||||
for (i = 0; i < gv.n_recv_threads; i++)
|
||||
for (uint32_t i = 0; i < gv.n_recv_threads; i++)
|
||||
{
|
||||
if (gv.recv_threads[i].ts)
|
||||
{
|
||||
|
@ -766,8 +765,7 @@ static void free_special_topics (void)
|
|||
|
||||
static int setup_and_start_recv_threads (void)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < MAX_RECV_THREADS; i++)
|
||||
for (uint32_t i = 0; i < MAX_RECV_THREADS; i++)
|
||||
{
|
||||
gv.recv_threads[i].ts = NULL;
|
||||
gv.recv_threads[i].arg.mode = RTM_SINGLE;
|
||||
|
@ -806,7 +804,7 @@ static int setup_and_start_recv_threads (void)
|
|||
assert (gv.n_recv_threads <= MAX_RECV_THREADS);
|
||||
|
||||
/* For each thread, create rbufpool and waitset if needed, then start it */
|
||||
for (i = 0; i < gv.n_recv_threads; i++)
|
||||
for (uint32_t i = 0; i < gv.n_recv_threads; i++)
|
||||
{
|
||||
/* We create the rbufpool for the receive thread, and so we'll
|
||||
become the initial owner thread. The receive thread will change
|
||||
|
@ -836,7 +834,7 @@ fail:
|
|||
/* to trigger any threads we already started to stop - xevent thread has already been started */
|
||||
rtps_term_prep ();
|
||||
wait_for_receive_threads ();
|
||||
for (i = 0; i < gv.n_recv_threads; i++)
|
||||
for (uint32_t i = 0; i < gv.n_recv_threads; i++)
|
||||
{
|
||||
if (gv.recv_threads[i].arg.mode == RTM_MANY && gv.recv_threads[i].arg.u.many.ws)
|
||||
os_sockWaitsetFree (gv.recv_threads[i].arg.u.many.ws);
|
||||
|
@ -1617,14 +1615,11 @@ void rtps_fini (void)
|
|||
been dropped, which only happens once all receive threads have
|
||||
stopped, defrags and reorders have been freed, and all delivery
|
||||
queues been drained. I.e., until very late in the game. */
|
||||
for (uint32_t i = 0; i < gv.n_recv_threads; i++)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < gv.n_recv_threads; i++)
|
||||
{
|
||||
if (gv.recv_threads[i].arg.mode == RTM_MANY)
|
||||
os_sockWaitsetFree (gv.recv_threads[i].arg.u.many.ws);
|
||||
nn_rbufpool_free (gv.recv_threads[i].arg.rbpool);
|
||||
}
|
||||
if (gv.recv_threads[i].arg.mode == RTM_MANY)
|
||||
os_sockWaitsetFree (gv.recv_threads[i].arg.u.many.ws);
|
||||
nn_rbufpool_free (gv.recv_threads[i].arg.rbpool);
|
||||
}
|
||||
|
||||
ddsi_tkmap_free (gv.m_tkmap);
|
||||
|
|
|
@ -47,7 +47,7 @@ struct lease {
|
|||
ddsrt_fibheap_node_t heapnode;
|
||||
nn_etime_t tsched; /* access guarded by leaseheap_lock */
|
||||
nn_etime_t tend; /* access guarded by lock_lease/unlock_lease */
|
||||
int64_t tdur; /* constant (renew depends on it) */
|
||||
dds_duration_t tdur; /* constant (renew depends on it) */
|
||||
struct entity_common *entity; /* constant */
|
||||
};
|
||||
|
||||
|
@ -89,7 +89,7 @@ static ddsrt_mutex_t *lock_lease_addr (struct lease const * const l)
|
|||
{
|
||||
uint32_t u = (uint16_t) ((uintptr_t) l >> 3);
|
||||
uint32_t v = u * 0xb4817365;
|
||||
unsigned idx = v >> (32 - N_LEASE_LOCKS_LG2);
|
||||
uint32_t idx = v >> (32 - N_LEASE_LOCKS_LG2);
|
||||
return &gv.lease_locks[idx];
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ static void unlock_lease (const struct lease *l)
|
|||
ddsrt_mutex_unlock (lock_lease_addr (l));
|
||||
}
|
||||
|
||||
struct lease *lease_new (nn_etime_t texpire, int64_t tdur, struct entity_common *e)
|
||||
struct lease *lease_new (nn_etime_t texpire, dds_duration_t tdur, struct entity_common *e)
|
||||
{
|
||||
struct lease *l;
|
||||
if ((l = ddsrt_malloc (sizeof (*l))) == NULL)
|
||||
|
@ -327,7 +327,7 @@ static void debug_print_rawdata (const char *msg, const void *data, size_t len)
|
|||
DDS_TRACE(">");
|
||||
}
|
||||
|
||||
void handle_PMD (UNUSED_ARG (const struct receiver_state *rst), nn_wctime_t timestamp, unsigned statusinfo, const void *vdata, unsigned len)
|
||||
void handle_PMD (UNUSED_ARG (const struct receiver_state *rst), nn_wctime_t timestamp, unsigned statusinfo, const void *vdata, uint32_t len)
|
||||
{
|
||||
const struct CDRHeader *data = vdata; /* built-ins not deserialized (yet) */
|
||||
const int bswap = (data->identifier == CDR_LE) ^ (DDSRT_ENDIAN == DDSRT_LITTLE_ENDIAN);
|
||||
|
@ -348,8 +348,8 @@ void handle_PMD (UNUSED_ARG (const struct receiver_state *rst), nn_wctime_t time
|
|||
{
|
||||
const ParticipantMessageData_t *pmd = (ParticipantMessageData_t *) (data + 1);
|
||||
nn_guid_prefix_t p = nn_ntoh_guid_prefix (pmd->participantGuidPrefix);
|
||||
unsigned kind = ntohl (pmd->kind);
|
||||
unsigned length = bswap ? bswap4u (pmd->length) : pmd->length;
|
||||
uint32_t kind = ntohl (pmd->kind);
|
||||
uint32_t length = bswap ? bswap4u (pmd->length) : pmd->length;
|
||||
DDS_TRACE(" pp %"PRIx32":%"PRIx32":%"PRIx32" kind %u data %u", p.u[0], p.u[1], p.u[2], kind, length);
|
||||
if (len - sizeof (struct CDRHeader) - offsetof (ParticipantMessageData_t, value) < length)
|
||||
debug_print_rawdata (" SHORT2", pmd->value, len - sizeof (struct CDRHeader) - offsetof (ParticipantMessageData_t, value));
|
||||
|
@ -374,7 +374,7 @@ void handle_PMD (UNUSED_ARG (const struct receiver_state *rst), nn_wctime_t time
|
|||
case NN_STATUSINFO_DISPOSE | NN_STATUSINFO_UNREGISTER:
|
||||
/* Serialized key; BE or LE doesn't matter as both fields are
|
||||
defined as octets. */
|
||||
if (len < (int) (sizeof (struct CDRHeader) + sizeof (nn_guid_prefix_t)))
|
||||
if (len < sizeof (struct CDRHeader) + sizeof (nn_guid_prefix_t))
|
||||
debug_print_rawdata (" SHORT3", data, len);
|
||||
else
|
||||
{
|
||||
|
|
|
@ -38,9 +38,9 @@ static void print_sockerror (const char *msg)
|
|||
DDS_ERROR("SOCKET %s\n", msg);
|
||||
}
|
||||
|
||||
unsigned locator_to_hopefully_unique_uint32 (const nn_locator_t *src)
|
||||
uint32_t locator_to_hopefully_unique_uint32 (const nn_locator_t *src)
|
||||
{
|
||||
unsigned id = 0;
|
||||
uint32_t id = 0;
|
||||
if (src->kind == NN_LOCATOR_KIND_UDPv4 || src->kind == NN_LOCATOR_KIND_TCPv4)
|
||||
memcpy (&id, src->address + 12, sizeof (id));
|
||||
else
|
||||
|
@ -342,7 +342,7 @@ static int set_mc_options_transmit (ddsrt_socket_t socket)
|
|||
int make_socket
|
||||
(
|
||||
ddsrt_socket_t * sock,
|
||||
unsigned short port,
|
||||
uint16_t port,
|
||||
bool stream,
|
||||
bool reuse
|
||||
)
|
||||
|
|
|
@ -37,10 +37,9 @@ static int partition_patmatch_p (const char *pat, const char *name)
|
|||
|
||||
static int partitions_match_default (const dds_qos_t *x)
|
||||
{
|
||||
unsigned i;
|
||||
if (!(x->present & QP_PARTITION) || x->partition.n == 0)
|
||||
return 1;
|
||||
for (i = 0; i < x->partition.n; i++)
|
||||
for (uint32_t i = 0; i < x->partition.n; i++)
|
||||
if (partition_patmatch_p (x->partition.strs[i], ""))
|
||||
return 1;
|
||||
return 0;
|
||||
|
@ -54,9 +53,8 @@ int partitions_match_p (const dds_qos_t *a, const dds_qos_t *b)
|
|||
return partitions_match_default (a);
|
||||
else
|
||||
{
|
||||
unsigned i, j;
|
||||
for (i = 0; i < a->partition.n; i++)
|
||||
for (j = 0; j < b->partition.n; j++)
|
||||
for (uint32_t i = 0; i < a->partition.n; i++)
|
||||
for (uint32_t j = 0; j < b->partition.n; j++)
|
||||
{
|
||||
if (partition_patmatch_p (a->partition.strs[i], b->partition.strs[j]) ||
|
||||
partition_patmatch_p (b->partition.strs[j], a->partition.strs[i]))
|
||||
|
|
|
@ -679,7 +679,6 @@ static int handle_AckNack (struct receiver_state *rst, nn_etime_t tnow, const Ac
|
|||
seqno_t max_seq_in_reply;
|
||||
struct whc_node *deferred_free_list = NULL;
|
||||
struct whc_state whcst;
|
||||
unsigned i;
|
||||
int hb_sent_in_response = 0;
|
||||
memset (gapbits, 0, sizeof (gapbits));
|
||||
countp = (nn_count_t *) ((char *) msg + offsetof (AckNack_t, readerSNState) +
|
||||
|
@ -690,7 +689,7 @@ static int handle_AckNack (struct receiver_state *rst, nn_etime_t tnow, const Ac
|
|||
dst.entityid = msg->writerId;
|
||||
DDS_TRACE("ACKNACK(%s#%"PRId32":%"PRId64"/%"PRIu32":", msg->smhdr.flags & ACKNACK_FLAG_FINAL ? "F" : "",
|
||||
*countp, fromSN (msg->readerSNState.bitmap_base), msg->readerSNState.numbits);
|
||||
for (i = 0; i < msg->readerSNState.numbits; i++)
|
||||
for (uint32_t i = 0; i < msg->readerSNState.numbits; i++)
|
||||
DDS_TRACE("%c", nn_bitset_isset (msg->readerSNState.numbits, msg->readerSNState.bits, i) ? '1' : '0');
|
||||
seqbase = fromSN (msg->readerSNState.bitmap_base);
|
||||
|
||||
|
@ -889,7 +888,7 @@ static int handle_AckNack (struct receiver_state *rst, nn_etime_t tnow, const Ac
|
|||
seq_xmit = READ_SEQ_XMIT(wr);
|
||||
const bool gap_for_already_acked = vendor_is_eclipse (rst->vendor) && prd->c.xqos->durability.kind == DDS_DURABILITY_VOLATILE && seqbase <= rn->seq;
|
||||
const seqno_t min_seq_to_rexmit = gap_for_already_acked ? rn->seq + 1 : 0;
|
||||
for (i = 0; i < numbits && seqbase + i <= seq_xmit && enqueued; i++)
|
||||
for (uint32_t i = 0; i < numbits && seqbase + i <= seq_xmit && enqueued; i++)
|
||||
{
|
||||
/* Accelerated schedule may run ahead of sequence number set
|
||||
contained in the acknack, and assumes all messages beyond the
|
||||
|
@ -954,7 +953,7 @@ static int handle_AckNack (struct receiver_state *rst, nn_etime_t tnow, const Ac
|
|||
}
|
||||
else if (seqbase + i - gapend < 256)
|
||||
{
|
||||
unsigned idx = (unsigned) (seqbase + i - gapend);
|
||||
uint32_t idx = (uint32_t) (seqbase + i - gapend);
|
||||
DDS_TRACE(" M%"PRId64, seqbase + i);
|
||||
gapnumbits = idx + 1;
|
||||
nn_bitset_set (gapnumbits, gapbits, idx);
|
||||
|
@ -989,7 +988,7 @@ static int handle_AckNack (struct receiver_state *rst, nn_etime_t tnow, const Ac
|
|||
if (gapend-1 + gapnumbits > max_seq_in_reply)
|
||||
max_seq_in_reply = gapend-1 + gapnumbits;
|
||||
DDS_TRACE(" XGAP%"PRId64"..%"PRId64"/%u:", gapstart, gapend, gapnumbits);
|
||||
for (i = 0; i < gapnumbits; i++)
|
||||
for (uint32_t i = 0; i < gapnumbits; i++)
|
||||
DDS_TRACE("%c", nn_bitset_isset (gapnumbits, gapbits, i) ? '1' : '0');
|
||||
m = nn_xmsg_new (gv.xmsgpool, &wr->e.guid.prefix, 0, NN_XMSG_KIND_CONTROL);
|
||||
#ifdef DDSI_INCLUDE_NETWORK_PARTITIONS
|
||||
|
@ -1421,7 +1420,6 @@ static int handle_NackFrag (struct receiver_state *rst, nn_etime_t tnow, const N
|
|||
nn_guid_t src, dst;
|
||||
nn_count_t *countp;
|
||||
seqno_t seq = fromSN (msg->writerSN);
|
||||
unsigned i;
|
||||
|
||||
countp = (nn_count_t *) ((char *) msg + offsetof (NackFrag_t, fragmentNumberState) + NN_FRAGMENT_NUMBER_SET_SIZE (msg->fragmentNumberState.numbits));
|
||||
src.prefix = rst->src_guid_prefix;
|
||||
|
@ -1430,7 +1428,7 @@ static int handle_NackFrag (struct receiver_state *rst, nn_etime_t tnow, const N
|
|||
dst.entityid = msg->writerId;
|
||||
|
||||
DDS_TRACE("NACKFRAG(#%"PRId32":%"PRId64"/%u/%"PRIu32":", *countp, seq, msg->fragmentNumberState.bitmap_base, msg->fragmentNumberState.numbits);
|
||||
for (i = 0; i < msg->fragmentNumberState.numbits; i++)
|
||||
for (uint32_t i = 0; i < msg->fragmentNumberState.numbits; i++)
|
||||
DDS_TRACE("%c", nn_bitset_isset (msg->fragmentNumberState.numbits, msg->fragmentNumberState.bits, i) ? '1' : '0');
|
||||
|
||||
if (!rst->forme)
|
||||
|
@ -1487,7 +1485,7 @@ static int handle_NackFrag (struct receiver_state *rst, nn_etime_t tnow, const N
|
|||
const unsigned base = msg->fragmentNumberState.bitmap_base - 1;
|
||||
int enqueued = 1;
|
||||
DDS_TRACE(" scheduling requested frags ...\n");
|
||||
for (i = 0; i < msg->fragmentNumberState.numbits && enqueued; i++)
|
||||
for (uint32_t i = 0; i < msg->fragmentNumberState.numbits && enqueued; i++)
|
||||
{
|
||||
if (nn_bitset_isset (msg->fragmentNumberState.numbits, msg->fragmentNumberState.bits, i))
|
||||
{
|
||||
|
@ -1670,8 +1668,8 @@ static int handle_Gap (struct receiver_state *rst, nn_etime_t tnow, struct nn_rm
|
|||
struct pwr_rd_match *wn;
|
||||
nn_guid_t src, dst;
|
||||
seqno_t gapstart, listbase;
|
||||
int64_t last_included_rel;
|
||||
unsigned listidx;
|
||||
int32_t last_included_rel;
|
||||
uint32_t listidx;
|
||||
|
||||
src.prefix = rst->src_guid_prefix;
|
||||
src.entityid = msg->writerId;
|
||||
|
@ -1687,7 +1685,7 @@ static int handle_Gap (struct receiver_state *rst, nn_etime_t tnow, struct nn_rm
|
|||
for (listidx = 0; listidx < msg->gapList.numbits; listidx++)
|
||||
if (!nn_bitset_isset (msg->gapList.numbits, msg->gapList.bits, listidx))
|
||||
break;
|
||||
last_included_rel = (int)listidx - 1;
|
||||
last_included_rel = (int32_t) listidx - 1;
|
||||
|
||||
if (!rst->forme)
|
||||
{
|
||||
|
@ -1741,8 +1739,8 @@ static int handle_Gap (struct receiver_state *rst, nn_etime_t tnow, struct nn_rm
|
|||
listidx++;
|
||||
else
|
||||
{
|
||||
unsigned j;
|
||||
for (j = listidx+1; j < msg->gapList.numbits; j++)
|
||||
uint32_t j;
|
||||
for (j = listidx + 1; j < msg->gapList.numbits; j++)
|
||||
if (!nn_bitset_isset (msg->gapList.numbits, msg->gapList.bits, j))
|
||||
break;
|
||||
/* spec says gapList (2) identifies an additional list of sequence numbers that
|
||||
|
@ -1750,7 +1748,7 @@ static int handle_Gap (struct receiver_state *rst, nn_etime_t tnow, struct nn_rm
|
|||
initial interval is to be ignored and the bitmap to be applied */
|
||||
(void) handle_one_gap (pwr, wn, listbase + listidx, listbase + j, gap, &refc_adjust);
|
||||
assert(j >= 1);
|
||||
last_included_rel = j - 1;
|
||||
last_included_rel = (int32_t) j - 1;
|
||||
listidx = j;
|
||||
}
|
||||
}
|
||||
|
@ -2010,8 +2008,7 @@ static int deliver_user_data (const struct nn_rsample_info *sampleinfo, const st
|
|||
if (pwr->rdary.fastpath_ok)
|
||||
{
|
||||
struct reader ** const rdary = pwr->rdary.rdary;
|
||||
unsigned i;
|
||||
for (i = 0; rdary[i]; i++)
|
||||
for (uint32_t i = 0; rdary[i]; i++)
|
||||
{
|
||||
DDS_TRACE("reader "PGUIDFMT"\n", PGUID (rdary[i]->e.guid));
|
||||
if (! (ddsi_plugin.rhc_plugin.rhc_store_fn) (rdary[i]->rhc, &pwr_info, payload, tk))
|
||||
|
@ -3120,7 +3117,7 @@ static size_t dedup_sorted_array (void *base, size_t nel, size_t width, int (*co
|
|||
|
||||
struct local_participant_set {
|
||||
struct local_participant_desc *ps;
|
||||
unsigned nps;
|
||||
uint32_t nps;
|
||||
uint32_t gen;
|
||||
};
|
||||
|
||||
|
@ -3222,10 +3219,9 @@ uint32_t listen_thread (struct ddsi_tran_listener * listener)
|
|||
|
||||
static int recv_thread_waitset_add_conn (os_sockWaitset ws, ddsi_tran_conn_t conn)
|
||||
{
|
||||
unsigned i;
|
||||
if (conn == NULL)
|
||||
return 0;
|
||||
for (i = 0; i < gv.n_recv_threads; i++)
|
||||
for (uint32_t i = 0; i < gv.n_recv_threads; i++)
|
||||
if (gv.recv_threads[i].arg.mode == RTM_SINGLE && gv.recv_threads[i].arg.u.single.conn == conn)
|
||||
return 0;
|
||||
return os_sockWaitsetAdd (ws, conn);
|
||||
|
@ -3324,8 +3320,7 @@ static int check_and_handle_deafness(struct local_deaf_state *st, unsigned num_f
|
|||
|
||||
void trigger_recv_threads (void)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < gv.n_recv_threads; i++)
|
||||
for (uint32_t i = 0; i < gv.n_recv_threads; i++)
|
||||
{
|
||||
if (gv.recv_threads[i].ts == NULL)
|
||||
continue;
|
||||
|
@ -3373,7 +3368,6 @@ uint32_t recv_thread (void *vrecv_thread_arg)
|
|||
struct local_participant_set lps;
|
||||
unsigned num_fixed = 0, num_fixed_uc = 0;
|
||||
os_sockWaitsetCtx ctx;
|
||||
unsigned i;
|
||||
struct local_deaf_state lds;
|
||||
lds.state = gv.deaf ? LDSR_DEAF : LDSR_NORMAL;
|
||||
lds.tnext = now_mt();
|
||||
|
@ -3416,7 +3410,7 @@ uint32_t recv_thread (void *vrecv_thread_arg)
|
|||
only happens when the participant set has changed, so might as well rebuild it */
|
||||
rebuild_local_participant_set (ts1, &lps);
|
||||
os_sockWaitsetPurge (waitset, num_fixed);
|
||||
for (i = 0; i < lps.nps; i++)
|
||||
for (uint32_t i = 0; i < lps.nps; i++)
|
||||
{
|
||||
if (lps.ps[i].m_conn)
|
||||
os_sockWaitsetAdd (waitset, lps.ps[i].m_conn);
|
||||
|
|
|
@ -1658,14 +1658,13 @@ static os_ssize_t q_security_sendmsg
|
|||
uint32_t sz32, data_size32;
|
||||
ssize_t ret = DDS_RETCODE_ERROR;
|
||||
PT_InfoContainer_t * securityHeader;
|
||||
unsigned i;
|
||||
|
||||
assert (niov > 2);
|
||||
securityHeader = iov[1].iov_base;
|
||||
/* first determine the size of the message, then select the
|
||||
on-stack buffer or allocate one on the heap ... */
|
||||
sz = q_securityEncoderSetHeaderSize (*codec); /* reserve appropriate headersize */
|
||||
for (i = 2; i < niov; i++)
|
||||
for (uint32_t i = 2; i < niov; i++)
|
||||
{
|
||||
sz += iov[i].iov_len;
|
||||
}
|
||||
|
@ -1679,7 +1678,7 @@ static os_ssize_t q_security_sendmsg
|
|||
}
|
||||
/* ... then copy data into buffer */
|
||||
data_size = 0;
|
||||
for (i = 2; i < niov; i++)
|
||||
for (uint32_t i = 2; i < niov; i++)
|
||||
{
|
||||
memcpy (buf + data_size, iov[i].iov_base, iov[i].iov_len);
|
||||
data_size += iov[i].iov_len;
|
||||
|
|
|
@ -311,9 +311,7 @@ os_sockWaitset os_sockWaitsetNew (void)
|
|||
|
||||
void os_sockWaitsetFree (os_sockWaitset ws)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < ws->ctx.n; i++)
|
||||
for (unsigned i = 0; i < ws->ctx.n; i++)
|
||||
{
|
||||
WSACloseEvent (ws->ctx.events[i]);
|
||||
}
|
||||
|
@ -323,10 +321,8 @@ void os_sockWaitsetFree (os_sockWaitset ws)
|
|||
|
||||
void os_sockWaitsetPurge (os_sockWaitset ws, unsigned index)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
ddsrt_mutex_lock (&ws->mutex);
|
||||
for (i = index + 1; i < ws->ctx.n; i++)
|
||||
for (unsigned i = index + 1; i < ws->ctx.n; i++)
|
||||
{
|
||||
ws->ctx.conns[i] = NULL;
|
||||
if (!WSACloseEvent (ws->ctx.events[i]))
|
||||
|
@ -340,10 +336,8 @@ void os_sockWaitsetPurge (os_sockWaitset ws, unsigned index)
|
|||
|
||||
void os_sockWaitsetRemove (os_sockWaitset ws, ddsi_tran_conn_t conn)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
ddsrt_mutex_lock (&ws->mutex);
|
||||
for (i = 0; i < ws->ctx.n; i++)
|
||||
for (unsigned i = 0; i < ws->ctx.n; i++)
|
||||
{
|
||||
if (conn == ws->ctx.conns[i])
|
||||
{
|
||||
|
@ -805,13 +799,12 @@ int os_sockWaitsetAdd (os_sockWaitset ws, ddsi_tran_conn_t conn)
|
|||
|
||||
void os_sockWaitsetPurge (os_sockWaitset ws, unsigned index)
|
||||
{
|
||||
unsigned i;
|
||||
os_sockWaitsetSet * set = &ws->set;
|
||||
|
||||
ddsrt_mutex_lock (&ws->mutex);
|
||||
if (index + 1 <= set->n)
|
||||
{
|
||||
for (i = index + 1; i < set->n; i++)
|
||||
for (unsigned i = index + 1; i < set->n; i++)
|
||||
{
|
||||
set->conns[i] = NULL;
|
||||
set->fds[i] = 0;
|
||||
|
@ -823,11 +816,10 @@ void os_sockWaitsetPurge (os_sockWaitset ws, unsigned index)
|
|||
|
||||
void os_sockWaitsetRemove (os_sockWaitset ws, ddsi_tran_conn_t conn)
|
||||
{
|
||||
unsigned i;
|
||||
os_sockWaitsetSet * set = &ws->set;
|
||||
|
||||
ddsrt_mutex_lock (&ws->mutex);
|
||||
for (i = 0; i < set->n; i++)
|
||||
for (unsigned i = 0; i < set->n; i++)
|
||||
{
|
||||
if (conn == set->conns[i])
|
||||
{
|
||||
|
|
|
@ -82,8 +82,6 @@ void thread_states_init_static (void)
|
|||
|
||||
void thread_states_init (unsigned maxthreads)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
ddsrt_mutex_init (&thread_states.lock);
|
||||
thread_states.nthreads = maxthreads;
|
||||
thread_states.ts =
|
||||
|
@ -91,7 +89,7 @@ void thread_states_init (unsigned maxthreads)
|
|||
memset (thread_states.ts, 0, maxthreads * sizeof (*thread_states.ts));
|
||||
/* The compiler doesn't realize that ts is large enough. */
|
||||
DDSRT_WARNING_MSVC_OFF(6386);
|
||||
for (i = 0; i < thread_states.nthreads; i++)
|
||||
for (uint32_t i = 0; i < thread_states.nthreads; i++)
|
||||
{
|
||||
thread_states.ts[i].state = THREAD_STATE_ZERO;
|
||||
thread_states.ts[i].vtime = 0u;
|
||||
|
@ -102,8 +100,7 @@ void thread_states_init (unsigned maxthreads)
|
|||
|
||||
void thread_states_fini (void)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < thread_states.nthreads; i++)
|
||||
for (uint32_t i = 0; i < thread_states.nthreads; i++)
|
||||
assert (thread_states.ts[i].state != THREAD_STATE_ALIVE);
|
||||
ddsrt_mutex_destroy (&thread_states.lock);
|
||||
ddsrt_free_aligned (thread_states.ts);
|
||||
|
@ -119,11 +116,10 @@ void thread_states_fini (void)
|
|||
static struct thread_state1 *find_thread_state (ddsrt_thread_t tid)
|
||||
{
|
||||
if (thread_states.ts) {
|
||||
unsigned i;
|
||||
for (i = 0; i < thread_states.nthreads; i++) {
|
||||
if (ddsrt_thread_equal (thread_states.ts[i].tid, tid)) {
|
||||
for (uint32_t i = 0; i < thread_states.nthreads; i++)
|
||||
{
|
||||
if (ddsrt_thread_equal (thread_states.ts[i].tid, tid))
|
||||
return &thread_states.ts[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
|
@ -195,7 +191,7 @@ static uint32_t create_thread_wrapper (void *ptr)
|
|||
|
||||
static int find_free_slot (const char *name)
|
||||
{
|
||||
for (unsigned i = 0; i < thread_states.nthreads; i++)
|
||||
for (uint32_t i = 0; i < thread_states.nthreads; i++)
|
||||
if (thread_states.ts[i].state == THREAD_STATE_ZERO)
|
||||
return (int) i;
|
||||
DDS_FATAL("create_thread: %s: no free slot\n", name ? name : "(anon)");
|
||||
|
@ -329,13 +325,8 @@ void downgrade_main_thread (void)
|
|||
|
||||
void log_stack_traces (void)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < thread_states.nthreads; i++)
|
||||
{
|
||||
for (uint32_t i = 0; i < thread_states.nthreads; i++)
|
||||
if (thread_states.ts[i].state != THREAD_STATE_ZERO)
|
||||
{
|
||||
log_stacktrace (thread_states.ts[i].name, thread_states.ts[i].tid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -270,10 +270,10 @@ int writer_hbcontrol_ack_required (const struct writer *wr, const struct whc_sta
|
|||
return writer_hbcontrol_ack_required_generic (wr, whcst, hbc->t_of_last_write, tnow, 0);
|
||||
}
|
||||
|
||||
struct nn_xmsg *writer_hbcontrol_piggyback (struct writer *wr, const struct whc_state *whcst, nn_mtime_t tnow, unsigned packetid, int *hbansreq)
|
||||
struct nn_xmsg *writer_hbcontrol_piggyback (struct writer *wr, const struct whc_state *whcst, nn_mtime_t tnow, uint32_t packetid, int *hbansreq)
|
||||
{
|
||||
struct hbcontrol * const hbc = &wr->hbcontrol;
|
||||
unsigned last_packetid;
|
||||
uint32_t last_packetid;
|
||||
nn_mtime_t tlast;
|
||||
struct nn_xmsg *msg;
|
||||
|
||||
|
@ -691,16 +691,15 @@ static int must_skip_frag (const char *frags_to_skip, unsigned frag)
|
|||
}
|
||||
#endif
|
||||
|
||||
static void transmit_sample_lgmsg_unlocked (struct nn_xpack *xp, struct writer *wr, const struct whc_state *whcst, seqno_t seq, const struct nn_plist *plist, struct ddsi_serdata *serdata, struct proxy_reader *prd, int isnew, unsigned nfrags)
|
||||
static void transmit_sample_lgmsg_unlocked (struct nn_xpack *xp, struct writer *wr, const struct whc_state *whcst, seqno_t seq, const struct nn_plist *plist, struct ddsi_serdata *serdata, struct proxy_reader *prd, int isnew, uint32_t nfrags)
|
||||
{
|
||||
unsigned i;
|
||||
#if 0
|
||||
const char *frags_to_skip = getenv ("SKIPFRAGS");
|
||||
#endif
|
||||
assert(xp);
|
||||
assert((wr->heartbeat_xevent != NULL) == (whcst != NULL));
|
||||
|
||||
for (i = 0; i < nfrags; i++)
|
||||
for (uint32_t i = 0; i < nfrags; i++)
|
||||
{
|
||||
struct nn_xmsg *fmsg = NULL;
|
||||
struct nn_xmsg *hmsg = NULL;
|
||||
|
|
|
@ -703,9 +703,8 @@ static void add_AckNack (struct nn_xmsg *msg, struct proxy_writer *pwr, struct p
|
|||
struct nn_reorder *reorder;
|
||||
AckNack_t *an;
|
||||
struct nn_xmsg_marker sm_marker;
|
||||
unsigned i, numbits;
|
||||
uint32_t i, numbits;
|
||||
seqno_t base;
|
||||
unsigned ui;
|
||||
|
||||
union {
|
||||
struct nn_fragment_number_set set;
|
||||
|
@ -808,7 +807,7 @@ static void add_AckNack (struct nn_xmsg *msg, struct proxy_writer *pwr, struct p
|
|||
DDS_TRACE("acknack "PGUIDFMT" -> "PGUIDFMT": #%"PRId32":%"PRId64"/%"PRIu32":",
|
||||
PGUID (rwn->rd_guid), PGUID (pwr->e.guid), rwn->count,
|
||||
base, an->readerSNState.numbits);
|
||||
for (ui = 0; ui != an->readerSNState.numbits; ui++)
|
||||
for (uint32_t ui = 0; ui != an->readerSNState.numbits; ui++)
|
||||
DDS_TRACE("%c", nn_bitset_isset (numbits, an->readerSNState.bits, ui) ? '1' : '0');
|
||||
}
|
||||
|
||||
|
@ -837,7 +836,7 @@ static void add_AckNack (struct nn_xmsg *msg, struct proxy_writer *pwr, struct p
|
|||
nn_xmsg_submsg_setnext (msg, sm_marker);
|
||||
|
||||
DDS_TRACE(" + nackfrag #%"PRId32":%"PRId64"/%u/%"PRIu32":", *countp, fromSN (nf->writerSN), nf->fragmentNumberState.bitmap_base, nf->fragmentNumberState.numbits);
|
||||
for (ui = 0; ui != nf->fragmentNumberState.numbits; ui++)
|
||||
for (uint32_t ui = 0; ui != nf->fragmentNumberState.numbits; ui++)
|
||||
DDS_TRACE("%c", nn_bitset_isset (nf->fragmentNumberState.numbits, nf->fragmentNumberState.bits, ui) ? '1' : '0');
|
||||
}
|
||||
}
|
||||
|
@ -1071,8 +1070,8 @@ static void handle_xevk_spdp (UNUSED_ARG (struct nn_xpack *xp), struct xevent *e
|
|||
/* schedule next when 80% of the interval has elapsed, or 2s
|
||||
before the lease ends, whichever comes first (similar to PMD),
|
||||
but never wait longer than spdp_interval */
|
||||
const int64_t mindelta = 10 * T_MILLISECOND;
|
||||
const int64_t ldur = pp->lease_duration;
|
||||
const dds_duration_t mindelta = 10 * T_MILLISECOND;
|
||||
const dds_duration_t ldur = pp->lease_duration;
|
||||
nn_mtime_t tnext;
|
||||
int64_t intv;
|
||||
|
||||
|
@ -1134,7 +1133,7 @@ static void write_pmd_message (struct thread_state1 * const ts1, struct nn_xpack
|
|||
static void handle_xevk_pmd_update (struct thread_state1 * const ts1, struct nn_xpack *xp, struct xevent *ev, nn_mtime_t tnow)
|
||||
{
|
||||
struct participant *pp;
|
||||
int64_t intv;
|
||||
dds_duration_t intv;
|
||||
nn_mtime_t tnext;
|
||||
|
||||
if ((pp = ephash_lookup_participant_guid (&ev->u.pmd_update.pp_guid)) == NULL)
|
||||
|
|
|
@ -784,19 +784,18 @@ size_t nn_xmsg_add_string_padded(unsigned char *buf, char *str)
|
|||
|
||||
size_t nn_xmsg_add_octseq_padded(unsigned char *buf, ddsi_octetseq_t *seq)
|
||||
{
|
||||
unsigned len = seq->length;
|
||||
uint32_t len = seq->length;
|
||||
if (buf) {
|
||||
/* Add cdr octet seq */
|
||||
*((unsigned *)buf) = len;
|
||||
buf += sizeof (int);
|
||||
*((uint32_t *) buf) = len;
|
||||
buf += sizeof (uint32_t);
|
||||
memcpy (buf, seq->value, len);
|
||||
/* clear padding */
|
||||
if (len < align4u (len)) {
|
||||
memset (buf + len, 0, align4u (len) - len);
|
||||
}
|
||||
}
|
||||
return 4 + /* cdr sequence len arg + */
|
||||
align4u(len); /* seqlen + possible padding */
|
||||
return 4 + align4u (len);
|
||||
}
|
||||
|
||||
void *nn_xmsg_addpar (struct nn_xmsg *m, nn_parameterid_t pid, size_t len)
|
||||
|
@ -964,9 +963,8 @@ void nn_xmsg_addpar_subscription_keys (struct nn_xmsg *m, nn_parameterid_t pid,
|
|||
{
|
||||
unsigned char *tmp;
|
||||
size_t len = 8; /* use_key_list, length of key_list */
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < q->key_list.n; i++)
|
||||
for (uint32_t i = 0; i < q->key_list.n; i++)
|
||||
{
|
||||
size_t len1 = strlen (q->key_list.strs[i]) + 1;
|
||||
len += 4 + align4u (len1);
|
||||
|
@ -975,14 +973,14 @@ void nn_xmsg_addpar_subscription_keys (struct nn_xmsg *m, nn_parameterid_t pid,
|
|||
tmp = nn_xmsg_addpar (m, pid, len);
|
||||
|
||||
tmp[0] = q->use_key_list;
|
||||
for (i = 1; i < sizeof (int); i++)
|
||||
for (uint32_t i = 1; i < sizeof (int); i++)
|
||||
{
|
||||
tmp[i] = 0;
|
||||
}
|
||||
tmp += sizeof (int);
|
||||
*((uint32_t *) tmp) = q->key_list.n;
|
||||
tmp += sizeof (uint32_t);
|
||||
for (i = 0; i < q->key_list.n; i++)
|
||||
for (uint32_t i = 0; i < q->key_list.n; i++)
|
||||
{
|
||||
struct cdrstring *p = (struct cdrstring *) tmp;
|
||||
size_t len1 = strlen (q->key_list.strs[i]) + 1;
|
||||
|
|
|
@ -207,7 +207,7 @@ void *ddsrt_fibheap_extract_min (const ddsrt_fibheap_def_t *fhdef, ddsrt_fibheap
|
|||
keys anyway to find the minimum */
|
||||
{
|
||||
ddsrt_fibheap_node_t *mark, *cursor, *newmin;
|
||||
unsigned i;
|
||||
uint32_t i;
|
||||
for (i = 0; roots[i] == NULL; i++) {
|
||||
assert (i+1 < min_degree_noninit);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue