stricter warning checks and the corresponding fixes
Signed-off-by: Erik Boasson <eb@ilities.com>
This commit is contained in:
parent
87e4780446
commit
b7487b18a6
101 changed files with 1756 additions and 1615 deletions
|
@ -175,11 +175,7 @@ int ddsi_serdata_is_key (const struct serdata * serdata);
|
|||
int ddsi_serdata_is_empty (const struct serdata * serdata);
|
||||
|
||||
OSAPI_EXPORT void ddsi_serstate_append_blob (serstate_t st, size_t align, size_t sz, const void *data);
|
||||
OSAPI_EXPORT void ddsi_serstate_set_msginfo
|
||||
(
|
||||
serstate_t st, unsigned statusinfo, nn_wctime_t timestamp,
|
||||
void * dummy
|
||||
);
|
||||
OSAPI_EXPORT void ddsi_serstate_set_msginfo (serstate_t st, unsigned statusinfo, nn_wctime_t timestamp);
|
||||
OSAPI_EXPORT serstate_t ddsi_serstate_new (const struct sertopic * topic);
|
||||
OSAPI_EXPORT serdata_t ddsi_serstate_fix (serstate_t st);
|
||||
nn_mtime_t ddsi_serstate_twrite (const struct serstate *serstate);
|
||||
|
|
|
@ -18,9 +18,9 @@
|
|||
#include "ddsi/q_rtps.h" /* for nn_guid_t, nn_guid_prefix_t */
|
||||
#include "ddsi/q_protocol.h" /* for nn_sequence_number_t */
|
||||
|
||||
#define bswap2(x) ((short) bswap2u ((unsigned short) (x)))
|
||||
#define bswap4(x) ((int) bswap4u ((unsigned) (x)))
|
||||
#define bswap8(x) ((long long) bswap8u ((unsigned long long) (x)))
|
||||
#define bswap2(x) ((int16_t) bswap2u ((uint16_t) (x)))
|
||||
#define bswap4(x) ((int32_t) bswap4u ((uint32_t) (x)))
|
||||
#define bswap8(x) ((int64_t) bswap8u ((uint64_t) (x)))
|
||||
|
||||
#if NN_HAVE_C99_INLINE && !defined SUPPRESS_BSWAP_INLINES
|
||||
#include "q_bswap_template.h"
|
||||
|
@ -28,9 +28,9 @@
|
|||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
unsigned short bswap2u (unsigned short x);
|
||||
unsigned bswap4u (unsigned x);
|
||||
unsigned long long bswap8u (unsigned long long x);
|
||||
uint16_t bswap2u (uint16_t x);
|
||||
uint32_t bswap4u (uint32_t x);
|
||||
uint64_t bswap8u (uint64_t x);
|
||||
void bswapSN (nn_sequence_number_t *sn);
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
|
|
|
@ -16,21 +16,21 @@
|
|||
#define VDDS_INLINE
|
||||
#endif
|
||||
|
||||
VDDS_INLINE unsigned short bswap2u (unsigned short x)
|
||||
VDDS_INLINE uint16_t bswap2u (uint16_t x)
|
||||
{
|
||||
return (unsigned short) ((x >> 8) | (x << 8));
|
||||
}
|
||||
|
||||
VDDS_INLINE unsigned bswap4u (unsigned x)
|
||||
VDDS_INLINE uint32_t bswap4u (uint32_t x)
|
||||
{
|
||||
return (x >> 24) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | (x << 24);
|
||||
}
|
||||
|
||||
VDDS_INLINE unsigned long long bswap8u (unsigned long long x)
|
||||
VDDS_INLINE uint64_t bswap8u (uint64_t x)
|
||||
{
|
||||
const unsigned newhi = bswap4u ((unsigned) x);
|
||||
const unsigned newlo = bswap4u ((unsigned) (x >> 32));
|
||||
return ((unsigned long long) newhi << 32) | (unsigned long long) newlo;
|
||||
const uint32_t newhi = bswap4u ((uint32_t) x);
|
||||
const uint32_t newlo = bswap4u ((uint32_t) (x >> 32));
|
||||
return ((uint64_t) newhi << 32) | (uint64_t) newlo;
|
||||
}
|
||||
|
||||
VDDS_INLINE void bswapSN (nn_sequence_number_t *sn)
|
||||
|
|
|
@ -37,7 +37,6 @@ struct sertopic;
|
|||
struct whc;
|
||||
struct nn_xqos;
|
||||
struct nn_plist;
|
||||
struct v_gid_s;
|
||||
|
||||
struct proxy_group;
|
||||
struct proxy_endpoint_common;
|
||||
|
@ -142,7 +141,7 @@ struct local_reader_ary {
|
|||
os_mutex 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") */
|
||||
int n_readers;
|
||||
unsigned n_readers;
|
||||
struct reader **rdary; /* for efficient delivery, null-pointer terminated */
|
||||
};
|
||||
|
||||
|
@ -552,7 +551,7 @@ int delete_proxy_reader (const struct nn_guid *guid, nn_wctime_t timestamp, int
|
|||
void update_proxy_reader (struct proxy_reader * prd, struct addrset *as);
|
||||
void update_proxy_writer (struct proxy_writer * pwr, struct addrset *as);
|
||||
|
||||
int new_proxy_group (const struct nn_guid *guid, const struct v_gid_s *gid, const char *name, const struct nn_xqos *xqos, nn_wctime_t timestamp);
|
||||
int new_proxy_group (const struct nn_guid *guid, const char *name, const struct nn_xqos *xqos, nn_wctime_t timestamp);
|
||||
void delete_proxy_group (const struct nn_guid *guid, nn_wctime_t timestamp, int isimplicit);
|
||||
|
||||
void writer_exit_startup_mode (struct writer *wr);
|
||||
|
|
|
@ -30,7 +30,7 @@ struct hbcontrol {
|
|||
|
||||
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, 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);
|
||||
int writer_hbcontrol_must_send (const struct writer *wr, const struct whc_state *whcst, nn_mtime_t tnow);
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct v_gid_s;
|
||||
struct nn_guid;
|
||||
|
||||
int vendor_is_lite (nn_vendorid_t vendor);
|
||||
|
@ -40,7 +39,7 @@ int WildcardOverlap(char * p1, char * p2);
|
|||
int ddsi2_patmatch (const char *pat, const char *str);
|
||||
|
||||
|
||||
uint32_t crc32_calc (const void *buf, uint32_t length);
|
||||
uint32_t crc32_calc (const void *buf, size_t length);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ typedef struct nn_udpv4mcgen_address {
|
|||
|
||||
|
||||
struct cdrstring {
|
||||
unsigned length;
|
||||
uint32_t length;
|
||||
unsigned char contents[1]; /* C90 does not support flex. array members */
|
||||
};
|
||||
|
||||
|
|
|
@ -26,10 +26,10 @@ typedef struct {
|
|||
} nn_protocol_version_t;
|
||||
typedef union nn_guid_prefix {
|
||||
unsigned char s[12];
|
||||
unsigned u[3];
|
||||
uint32_t u[3];
|
||||
} nn_guid_prefix_t;
|
||||
typedef union nn_entityid {
|
||||
unsigned u;
|
||||
uint32_t u;
|
||||
} nn_entityid_t;
|
||||
typedef struct nn_guid {
|
||||
nn_guid_prefix_t prefix;
|
||||
|
|
|
@ -113,7 +113,7 @@ void nn_xmsg_guid_seq_fragid (const struct nn_xmsg *m, nn_guid_t *wrguid, seqno_
|
|||
void *nn_xmsg_submsg_from_marker (struct nn_xmsg *msg, struct nn_xmsg_marker marker);
|
||||
void *nn_xmsg_append (struct nn_xmsg *m, struct nn_xmsg_marker *marker, size_t sz);
|
||||
void nn_xmsg_shrink (struct nn_xmsg *m, struct nn_xmsg_marker marker, size_t sz);
|
||||
void nn_xmsg_serdata (struct nn_xmsg *m, struct serdata *serdata, unsigned off, unsigned len);
|
||||
void nn_xmsg_serdata (struct nn_xmsg *m, struct serdata *serdata, size_t off, size_t len);
|
||||
void nn_xmsg_submsg_setnext (struct nn_xmsg *msg, struct nn_xmsg_marker marker);
|
||||
void nn_xmsg_submsg_init (struct nn_xmsg *msg, struct nn_xmsg_marker marker, SubmessageKind_t smkind);
|
||||
void nn_xmsg_add_timestamp (struct nn_xmsg *m, nn_wctime_t t);
|
||||
|
|
|
@ -25,7 +25,7 @@ extern "C" {
|
|||
#define NN_DDS_LENGTH_UNLIMITED -1
|
||||
|
||||
typedef struct nn_octetseq {
|
||||
unsigned length;
|
||||
uint32_t length;
|
||||
unsigned char *value;
|
||||
} nn_octetseq_t;
|
||||
|
||||
|
@ -40,7 +40,7 @@ typedef struct nn_property {
|
|||
} nn_property_t;
|
||||
|
||||
typedef struct nn_propertyseq {
|
||||
unsigned n;
|
||||
uint32_t n;
|
||||
nn_property_t *props;
|
||||
} nn_propertyseq_t;
|
||||
|
||||
|
@ -51,7 +51,7 @@ typedef struct nn_binaryproperty {
|
|||
} nn_binaryproperty_t;
|
||||
|
||||
typedef struct nn_binarypropertyseq {
|
||||
unsigned n;
|
||||
uint32_t n;
|
||||
nn_binaryproperty_t *props;
|
||||
} nn_binarypropertyseq_t;
|
||||
|
||||
|
@ -78,13 +78,13 @@ typedef enum nn_history_kind {
|
|||
|
||||
typedef struct nn_history_qospolicy {
|
||||
nn_history_kind_t kind;
|
||||
int depth;
|
||||
int32_t depth;
|
||||
} nn_history_qospolicy_t;
|
||||
|
||||
typedef struct nn_resource_limits_qospolicy {
|
||||
int max_samples;
|
||||
int max_instances;
|
||||
int max_samples_per_instance;
|
||||
int32_t max_samples;
|
||||
int32_t max_instances;
|
||||
int32_t max_samples_per_instance;
|
||||
} nn_resource_limits_qospolicy_t;
|
||||
|
||||
typedef struct nn_durability_service_qospolicy {
|
||||
|
@ -123,7 +123,7 @@ typedef struct nn_ownership_qospolicy {
|
|||
} nn_ownership_qospolicy_t;
|
||||
|
||||
typedef struct nn_ownership_strength_qospolicy {
|
||||
int value;
|
||||
int32_t value;
|
||||
} nn_ownership_strength_qospolicy_t;
|
||||
|
||||
typedef enum nn_liveliness_kind {
|
||||
|
@ -142,7 +142,7 @@ typedef struct nn_time_based_filter_qospolicy {
|
|||
} nn_time_based_filter_qospolicy_t;
|
||||
|
||||
typedef struct nn_stringseq {
|
||||
unsigned n;
|
||||
uint32_t n;
|
||||
char **strs;
|
||||
} nn_stringseq_t;
|
||||
|
||||
|
@ -159,7 +159,7 @@ typedef struct nn_reliability_qospolicy {
|
|||
} nn_reliability_qospolicy_t;
|
||||
|
||||
typedef struct nn_external_reliability_qospolicy {
|
||||
int kind;
|
||||
uint32_t kind;
|
||||
nn_duration_t max_blocking_time;
|
||||
} nn_external_reliability_qospolicy_t;
|
||||
|
||||
|
@ -169,7 +169,7 @@ typedef struct nn_external_reliability_qospolicy {
|
|||
#define NN_INTEROP_RELIABLE_RELIABILITY_QOS 2
|
||||
|
||||
typedef struct nn_transport_priority_qospolicy {
|
||||
int value;
|
||||
int32_t value;
|
||||
} nn_transport_priority_qospolicy_t;
|
||||
|
||||
typedef struct nn_lifespan_qospolicy {
|
||||
|
|
|
@ -158,16 +158,25 @@ typedef struct ddsi_iovec {
|
|||
#endif
|
||||
|
||||
#if ! SYSDEPS_HAVE_MSGHDR
|
||||
#if defined _WIN32
|
||||
typedef DWORD ddsi_msg_iovlen_t;
|
||||
#else
|
||||
typedef int ddsi_msg_iovlen_t;
|
||||
#endif
|
||||
struct msghdr
|
||||
{
|
||||
void *msg_name;
|
||||
socklen_t msg_namelen;
|
||||
ddsi_iovec_t *msg_iov;
|
||||
size_t msg_iovlen;
|
||||
ddsi_msg_iovlen_t msg_iovlen;
|
||||
void *msg_control;
|
||||
size_t msg_controllen;
|
||||
int msg_flags;
|
||||
};
|
||||
#elif defined __linux
|
||||
typedef size_t ddsi_msg_iovlen_t;
|
||||
#else /* POSIX says int (which macOS, FreeBSD, Solaris do) */
|
||||
typedef int ddsi_msg_iovlen_t;
|
||||
#endif
|
||||
|
||||
#ifndef MSG_TRUNC
|
||||
|
|
|
@ -120,11 +120,7 @@ void ddsi_serstate_append_blob (serstate_t st, size_t align, size_t sz, const vo
|
|||
memcpy (p, data, sz);
|
||||
}
|
||||
|
||||
void ddsi_serstate_set_msginfo
|
||||
(
|
||||
serstate_t st, unsigned statusinfo, nn_wctime_t timestamp,
|
||||
void * dummy
|
||||
)
|
||||
void ddsi_serstate_set_msginfo (serstate_t st, unsigned statusinfo, nn_wctime_t timestamp)
|
||||
{
|
||||
serdata_t d = st->data;
|
||||
d->v.msginfo.statusinfo = statusinfo;
|
||||
|
|
|
@ -132,7 +132,7 @@ static const ut_avlTreedef_t ddsi_tcp_treedef = UT_AVL_TREEDEF_INITIALIZER_INDKE
|
|||
(
|
||||
offsetof (struct ddsi_tcp_node, m_avlnode),
|
||||
offsetof (struct ddsi_tcp_node, m_conn),
|
||||
(ut_avlCompare_t) ddsi_tcp_cmp_conn,
|
||||
ddsi_tcp_cmp_conn,
|
||||
0
|
||||
);
|
||||
|
||||
|
@ -559,15 +559,11 @@ static size_t iovlen_sum (size_t niov, const ddsi_iovec_t *iov)
|
|||
return tot;
|
||||
}
|
||||
|
||||
/* Turns out Darwin uses "int" for msg_iovlen, but glibc uses "size_t". The simplest
|
||||
way out is to do the assignment with the conversion warnings disabled */
|
||||
//OSPL_DIAG_OFF(conversion)
|
||||
static void set_msghdr_iov (struct msghdr *mhdr, ddsi_iovec_t *iov, size_t iovlen)
|
||||
{
|
||||
mhdr->msg_iov = iov;
|
||||
mhdr->msg_iovlen = iovlen;
|
||||
mhdr->msg_iovlen = (ddsi_msg_iovlen_t)iovlen;
|
||||
}
|
||||
//OSPL_DIAG_ON(conversion)
|
||||
|
||||
static ssize_t ddsi_tcp_conn_write (ddsi_tran_conn_t base, const nn_locator_t *dst, size_t niov, const ddsi_iovec_t *iov, uint32_t flags)
|
||||
{
|
||||
|
|
|
@ -97,15 +97,11 @@ static ssize_t ddsi_udp_conn_read (ddsi_tran_conn_t conn, unsigned char * buf, s
|
|||
return ret;
|
||||
}
|
||||
|
||||
/* Turns out Darwin uses "int" for msg_iovlen, but glibc uses "size_t". The simplest
|
||||
way out is to do the assignment with the conversion warnings disabled */
|
||||
//OSPL_DIAG_OFF(conversion)
|
||||
static void set_msghdr_iov (struct msghdr *mhdr, ddsi_iovec_t *iov, size_t iovlen)
|
||||
{
|
||||
mhdr->msg_iov = iov;
|
||||
mhdr->msg_iovlen = iovlen;
|
||||
mhdr->msg_iovlen = (ddsi_msg_iovlen_t)iovlen;
|
||||
}
|
||||
//OSPL_DIAG_ON(conversion)
|
||||
|
||||
static ssize_t ddsi_udp_conn_write (ddsi_tran_conn_t conn, const nn_locator_t *dst, size_t niov, const ddsi_iovec_t *iov, uint32_t flags)
|
||||
{
|
||||
|
@ -296,7 +292,7 @@ static ddsi_tran_conn_t ddsi_udp_create_conn
|
|||
|
||||
static int joinleave_asm_mcgroup (os_socket socket, int join, const nn_locator_t *mcloc, const struct nn_interface *interf)
|
||||
{
|
||||
int rc;
|
||||
os_result rc;
|
||||
os_sockaddr_storage mcip;
|
||||
ddsi_ipaddr_from_loc(&mcip, mcloc);
|
||||
#if OS_SOCKET_HAS_IPV6
|
||||
|
@ -319,13 +315,13 @@ static int joinleave_asm_mcgroup (os_socket socket, int join, const nn_locator_t
|
|||
mreq.imr_interface.s_addr = htonl (INADDR_ANY);
|
||||
rc = os_sockSetsockopt (socket, IPPROTO_IP, join ? IP_ADD_MEMBERSHIP : IP_DROP_MEMBERSHIP, (char *) &mreq, sizeof (mreq));
|
||||
}
|
||||
return (rc == -1) ? os_getErrno() : 0;
|
||||
return (rc != os_resultSuccess) ? os_getErrno() : 0;
|
||||
}
|
||||
|
||||
#ifdef DDSI_INCLUDE_SSM
|
||||
static int joinleave_ssm_mcgroup (os_socket socket, int join, const nn_locator_t *srcloc, const nn_locator_t *mcloc, const struct nn_interface *interf)
|
||||
{
|
||||
int rc;
|
||||
os_result rc;
|
||||
os_sockaddr_storage mcip, srcip;
|
||||
ddsi_ipaddr_from_loc(&mcip, mcloc);
|
||||
ddsi_ipaddr_from_loc(&srcip, srcloc);
|
||||
|
@ -352,7 +348,7 @@ static int joinleave_ssm_mcgroup (os_socket socket, int join, const nn_locator_t
|
|||
mreq.imr_interface.s_addr = INADDR_ANY;
|
||||
rc = os_sockSetsockopt (socket, IPPROTO_IP, join ? IP_ADD_SOURCE_MEMBERSHIP : IP_DROP_SOURCE_MEMBERSHIP, &mreq, sizeof (mreq));
|
||||
}
|
||||
return (rc == -1) ? os_getErrno() : 0;
|
||||
return (rc != os_resultSuccess) ? os_getErrno() : 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
@ -233,7 +233,7 @@ void set_unspec_locator (nn_locator_t *loc)
|
|||
|
||||
int is_unspec_locator (const nn_locator_t *loc)
|
||||
{
|
||||
static const nn_locator_t zloc;
|
||||
static const nn_locator_t zloc = { .kind = 0 };
|
||||
return (loc->kind == NN_LOCATOR_KIND_INVALID &&
|
||||
loc->port == NN_LOCATOR_PORT_INVALID &&
|
||||
memcmp (&zloc.address, loc->address, sizeof (zloc.address)) == 0);
|
||||
|
|
|
@ -204,6 +204,7 @@ DI(if_thread_properties);
|
|||
#define GROUP_W_ATTRS(name, children, attrs) name, children, attrs, 1, NULL, 0, 0, 0, 0, 0, 0
|
||||
#define MGROUP(name, children, attrs) name, children, attrs
|
||||
#define ATTR(name) name, NULL, NULL
|
||||
#define DEPRECATED_ATTR(name) "|" name, NULL, NULL
|
||||
/* MOVED: whereto must be a path relative to DDSI2Service, may not be used in/for lists and only for elements, may not be chained */
|
||||
#define MOVED(name, whereto) ">" name, NULL, NULL, 0, whereto, 0, 0, 0, 0, 0, 0, NULL
|
||||
static const struct cfgelem timestamp_cfgattrs[] = {
|
||||
|
@ -465,15 +466,19 @@ static const struct cfgelem unsupp_watermarks_cfgelems[] = {
|
|||
};
|
||||
|
||||
static const struct cfgelem control_topic_cfgattrs[] = {
|
||||
{ ATTR("Enable"), 1, "false", ABSOFF(enable_control_topic), 0, uf_boolean, 0, pf_boolean },
|
||||
{ ATTR("InitialReset"), 1, "inf", ABSOFF(initial_deaf_mute_reset), 0, uf_duration_inf, 0, pf_duration },
|
||||
{ DEPRECATED_ATTR("Enable"), 1, "false", ABSOFF(enable_control_topic), 0, uf_boolean, 0, pf_boolean,
|
||||
"<p>This element controls whether DDSI2E should create a topic to control DDSI2E's behaviour dynamically.<p>"
|
||||
},
|
||||
{ DEPRECATED_ATTR("InitialReset"), 1, "inf", ABSOFF(initial_deaf_mute_reset), 0, uf_duration_inf, 0, pf_duration,
|
||||
"<p>This element controls after how much time an initial deaf/mute state will automatically reset.<p>"
|
||||
},
|
||||
END_MARKER
|
||||
};
|
||||
|
||||
static const struct cfgelem control_topic_cfgelems[] = {
|
||||
{ LEAF ("Deaf"), 1, "false", ABSOFF (initial_deaf), 0, uf_deaf_mute, 0, pf_boolean,
|
||||
{ DEPRECATED_LEAF ("Deaf"), 1, "false", ABSOFF (initial_deaf), 0, uf_deaf_mute, 0, pf_boolean,
|
||||
"<p>This element controls whether DDSI2E defaults to deaf mode or to normal mode. This controls both the initial behaviour and what behaviour it auto-reverts to.</p>" },
|
||||
{ LEAF ("Mute"), 1, "false", ABSOFF (initial_mute), 0, uf_deaf_mute, 0, pf_boolean,
|
||||
{ DEPRECATED_LEAF ("Mute"), 1, "false", ABSOFF (initial_mute), 0, uf_deaf_mute, 0, pf_boolean,
|
||||
"<p>This element controls whether DDSI2E defaults to mute mode or to normal mode. This controls both the initial behaviour and what behaviour it auto-reverts to.</p>" },
|
||||
END_MARKER
|
||||
};
|
||||
|
@ -548,7 +553,8 @@ static const struct cfgelem unsupp_cfgelems[] = {
|
|||
{ LEAF("RetransmitMergingPeriod"), 1, "5 ms", ABSOFF(retransmit_merging_period), 0, uf_duration_us_1s, 0, pf_duration,
|
||||
"<p>This setting determines the size of the time window in which a NACK of some sample is ignored because a retransmit of that sample has been multicasted too recently. This setting has no effect on unicasted retransmits.</p>\n\
|
||||
<p>See also Internal/RetransmitMerging.</p>" },
|
||||
{ LEAF_W_ATTRS("HeartbeatInterval", heartbeat_interval_attrs), 1, "100 ms", ABSOFF(const_hb_intv_sched), 0, uf_duration_inf, 0, pf_duration },
|
||||
{ LEAF_W_ATTRS("HeartbeatInterval", heartbeat_interval_attrs), 1, "100 ms", ABSOFF(const_hb_intv_sched), 0, uf_duration_inf, 0, pf_duration,
|
||||
"<p>This elemnents allows configuring the base interval for sending writer heartbeats and the bounds within it can vary.</p>" },
|
||||
{ LEAF("MaxQueuedRexmitBytes"), 1, "50 kB", ABSOFF(max_queued_rexmit_bytes), 0, uf_memsize, 0, pf_memsize,
|
||||
"<p>This setting limits the maximum number of bytes queued for retransmission. The default value of 0 is unlimited unless an AuxiliaryBandwidthLimit has been set, in which case it becomes NackDelay * AuxiliaryBandwidthLimit. It must be large enough to contain the largest sample that may need to be retransmitted.</p>" },
|
||||
{ LEAF("MaxQueuedRexmitMessages"), 1, "200", ABSOFF(max_queued_rexmit_msgs), 0, uf_uint, 0, pf_uint,
|
||||
|
@ -1306,7 +1312,7 @@ static int uf_boolean_default (struct cfgst *cfgst, void *parent, struct cfgelem
|
|||
static const enum boolean_default ms[] = {
|
||||
BOOLDEF_DEFAULT, BOOLDEF_FALSE, BOOLDEF_TRUE, 0,
|
||||
};
|
||||
int *elem = cfg_address (cfgst, parent, cfgelem);
|
||||
enum boolean_default *elem = cfg_address (cfgst, parent, cfgelem);
|
||||
int idx = list_index (vs, value);
|
||||
assert (sizeof (vs) / sizeof (*vs) == sizeof (ms) / sizeof (*ms));
|
||||
if (idx < 0)
|
||||
|
@ -2857,7 +2863,7 @@ struct cfgst * config_init
|
|||
forces us to include a crc32 routine when we have md5
|
||||
available anyway */
|
||||
p->partitionId = config.nof_networkPartitions; /* starting at 1 */
|
||||
p->partitionHash = crc32_calc(p->name, (int) strlen(p->name));
|
||||
p->partitionHash = crc32_calc(p->name, strlen(p->name));
|
||||
p = p->next;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -325,7 +325,7 @@ int spdp_write (struct participant *pp)
|
|||
ddsi_serstate_append_blob (serstate, 4, payload_sz, payload_blob);
|
||||
kh = nn_hton_guid (pp->e.guid);
|
||||
serstate_set_key (serstate, 0, &kh);
|
||||
ddsi_serstate_set_msginfo (serstate, 0, now (), NULL);
|
||||
ddsi_serstate_set_msginfo (serstate, 0, now ());
|
||||
serdata = ddsi_serstate_fix (serstate);
|
||||
nn_plist_fini(&ps);
|
||||
nn_xmsg_free (mpayload);
|
||||
|
@ -362,7 +362,7 @@ int spdp_dispose_unregister (struct participant *pp)
|
|||
ddsi_serstate_append_blob (serstate, 4, payload_sz, payload_blob);
|
||||
kh = nn_hton_guid (pp->e.guid);
|
||||
serstate_set_key (serstate, 1, &kh);
|
||||
ddsi_serstate_set_msginfo (serstate, NN_STATUSINFO_DISPOSE | NN_STATUSINFO_UNREGISTER, now (), NULL);
|
||||
ddsi_serstate_set_msginfo (serstate, NN_STATUSINFO_DISPOSE | NN_STATUSINFO_UNREGISTER, now ());
|
||||
serdata = ddsi_serstate_fix (serstate);
|
||||
nn_xmsg_free (mpayload);
|
||||
|
||||
|
@ -977,7 +977,7 @@ static int sedp_write_endpoint
|
|||
statusinfo = NN_STATUSINFO_DISPOSE | NN_STATUSINFO_UNREGISTER;
|
||||
else
|
||||
statusinfo = 0;
|
||||
ddsi_serstate_set_msginfo (serstate, statusinfo, now (), NULL);
|
||||
ddsi_serstate_set_msginfo (serstate, statusinfo, now ());
|
||||
serdata = ddsi_serstate_fix (serstate);
|
||||
nn_xmsg_free (mpayload);
|
||||
|
||||
|
@ -1443,7 +1443,7 @@ int sedp_write_topic (struct participant *pp, const struct nn_plist *datap)
|
|||
md5_finish (&md5st, digest);
|
||||
|
||||
serstate_set_key (serstate, 0, digest);
|
||||
ddsi_serstate_set_msginfo (serstate, 0, now (), NULL);
|
||||
ddsi_serstate_set_msginfo (serstate, 0, now ());
|
||||
serdata = ddsi_serstate_fix (serstate);
|
||||
nn_xmsg_free (mpayload);
|
||||
|
||||
|
@ -1509,7 +1509,7 @@ int sedp_write_cm_participant (struct participant *pp, int alive)
|
|||
statusinfo = NN_STATUSINFO_DISPOSE | NN_STATUSINFO_UNREGISTER;
|
||||
else
|
||||
statusinfo = 0;
|
||||
ddsi_serstate_set_msginfo (serstate, statusinfo, now (), NULL);
|
||||
ddsi_serstate_set_msginfo (serstate, statusinfo, now ());
|
||||
serdata = ddsi_serstate_fix (serstate);
|
||||
nn_xmsg_free (mpayload);
|
||||
|
||||
|
@ -1619,7 +1619,7 @@ int sedp_write_cm_publisher (const struct nn_plist *datap, int alive)
|
|||
statusinfo = NN_STATUSINFO_DISPOSE | NN_STATUSINFO_UNREGISTER;
|
||||
else
|
||||
statusinfo = 0;
|
||||
ddsi_serstate_set_msginfo (serstate, statusinfo, now (), NULL);
|
||||
ddsi_serstate_set_msginfo (serstate, statusinfo, now ());
|
||||
serdata = ddsi_serstate_fix (serstate);
|
||||
nn_xmsg_free (mpayload);
|
||||
|
||||
|
@ -1674,7 +1674,7 @@ int sedp_write_cm_subscriber (const struct nn_plist *datap, int alive)
|
|||
statusinfo = NN_STATUSINFO_DISPOSE | NN_STATUSINFO_UNREGISTER;
|
||||
else
|
||||
statusinfo = 0;
|
||||
ddsi_serstate_set_msginfo (serstate, statusinfo, now (), NULL);
|
||||
ddsi_serstate_set_msginfo (serstate, statusinfo, now ());
|
||||
serdata = ddsi_serstate_fix (serstate);
|
||||
nn_xmsg_free (mpayload);
|
||||
|
||||
|
@ -1698,10 +1698,8 @@ static void handle_SEDP_GROUP_alive (nn_plist_t *datap /* note: potentially modi
|
|||
nn_log (LC_DISCOVERY, " alive\n");
|
||||
|
||||
{
|
||||
struct v_gid_s *gid = NULL;
|
||||
char *name;
|
||||
name = (datap->present & PP_ENTITY_NAME) ? datap->entity_name : "";
|
||||
new_proxy_group (&datap->group_guid, gid, name, &datap->qos, timestamp);
|
||||
char *name = (datap->present & PP_ENTITY_NAME) ? datap->entity_name : "";
|
||||
new_proxy_group (&datap->group_guid, name, &datap->qos, timestamp);
|
||||
}
|
||||
err:
|
||||
return;
|
||||
|
|
|
@ -197,7 +197,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)
|
||||
{
|
||||
int i;
|
||||
unsigned i;
|
||||
os_mutexLock (&x->rdary_lock);
|
||||
for (i = 0; i < x->n_readers; i++)
|
||||
{
|
||||
|
@ -1943,7 +1943,7 @@ static nn_entityid_t builtin_entityid_match (nn_entityid_t x)
|
|||
return res;
|
||||
}
|
||||
|
||||
static void writer_qos_mismatch (struct writer * wr, int32_t reason)
|
||||
static void writer_qos_mismatch (struct writer * wr, uint32_t reason)
|
||||
{
|
||||
/* When the reason is DDS_INVALID_QOS_POLICY_ID, it means that we compared
|
||||
* readers/writers from different topics: ignore that. */
|
||||
|
@ -1963,7 +1963,7 @@ static void writer_qos_mismatch (struct writer * wr, int32_t reason)
|
|||
}
|
||||
}
|
||||
|
||||
static void reader_qos_mismatch (struct reader * rd, int32_t reason)
|
||||
static void reader_qos_mismatch (struct reader * rd, uint32_t reason)
|
||||
{
|
||||
/* When the reason is DDS_INVALID_QOS_POLICY_ID, it means that we compared
|
||||
* readers/writers from different topics: ignore that. */
|
||||
|
@ -1996,7 +1996,7 @@ static void connect_writer_with_proxy_reader (struct writer *wr, struct proxy_re
|
|||
return;
|
||||
if (!isb0 && (reason = qos_match_p (prd->c.xqos, wr->xqos)) >= 0)
|
||||
{
|
||||
writer_qos_mismatch (wr, reason);
|
||||
writer_qos_mismatch (wr, (uint32_t)reason);
|
||||
return;
|
||||
}
|
||||
proxy_reader_add_connection (prd, wr);
|
||||
|
@ -2015,7 +2015,7 @@ static void connect_proxy_writer_with_reader (struct proxy_writer *pwr, struct r
|
|||
return;
|
||||
if (!isb0 && (reason = qos_match_p (rd->xqos, pwr->c.xqos)) >= 0)
|
||||
{
|
||||
reader_qos_mismatch (rd, reason);
|
||||
reader_qos_mismatch (rd, (uint32_t)reason);
|
||||
return;
|
||||
}
|
||||
reader_add_connection (rd, pwr, &init_count);
|
||||
|
@ -2025,12 +2025,13 @@ static void connect_proxy_writer_with_reader (struct proxy_writer *pwr, struct r
|
|||
static void connect_writer_with_reader (struct writer *wr, struct reader *rd, nn_mtime_t tnow)
|
||||
{
|
||||
int32_t reason;
|
||||
(void)tnow;
|
||||
if (is_builtin_entityid (wr->e.guid.entityid, ownvendorid) || is_builtin_entityid (rd->e.guid.entityid, ownvendorid))
|
||||
return;
|
||||
if ((reason = qos_match_p (rd->xqos, wr->xqos)) >= 0)
|
||||
{
|
||||
writer_qos_mismatch (wr, reason);
|
||||
reader_qos_mismatch (rd, reason);
|
||||
writer_qos_mismatch (wr, (uint32_t)reason);
|
||||
reader_qos_mismatch (rd, (uint32_t)reason);
|
||||
return;
|
||||
}
|
||||
reader_add_local_connection (rd, wr);
|
||||
|
@ -3882,10 +3883,11 @@ uint64_t participant_instance_id (const struct nn_guid *guid)
|
|||
|
||||
/* PROXY-GROUP --------------------------------------------------- */
|
||||
|
||||
int new_proxy_group (const struct nn_guid *guid, const struct v_gid_s *gid, const char *name, const struct nn_xqos *xqos, nn_wctime_t timestamp)
|
||||
int new_proxy_group (const struct nn_guid *guid, const char *name, const struct nn_xqos *xqos, nn_wctime_t timestamp)
|
||||
{
|
||||
struct proxy_participant *proxypp;
|
||||
nn_guid_t ppguid;
|
||||
(void)timestamp;
|
||||
ppguid.prefix = guid->prefix;
|
||||
ppguid.entityid.u = NN_ENTITYID_PARTICIPANT;
|
||||
if ((proxypp = ephash_lookup_proxy_participant_guid (&ppguid)) == NULL)
|
||||
|
@ -3948,6 +3950,8 @@ int new_proxy_group (const struct nn_guid *guid, const struct v_gid_s *gid, cons
|
|||
static void delete_proxy_group_locked (struct proxy_group *pgroup, nn_wctime_t timestamp, int isimplicit)
|
||||
{
|
||||
struct proxy_participant *proxypp = pgroup->proxypp;
|
||||
(void)timestamp;
|
||||
(void)isimplicit;
|
||||
assert ((pgroup->xqos != NULL) == (pgroup->name != NULL));
|
||||
nn_log (LC_DISCOVERY, "delete_proxy_group_locked %x:%x:%x:%x\n", PGUID (pgroup->guid));
|
||||
ut_avlDelete (&proxypp_groups_treedef, &proxypp->groups, pgroup);
|
||||
|
@ -4032,7 +4036,7 @@ int new_proxy_writer (const struct nn_guid *ppguid, const struct nn_guid *guid,
|
|||
struct proxy_writer *pwr;
|
||||
int isreliable;
|
||||
nn_mtime_t tnow = now_mt ();
|
||||
|
||||
(void)timestamp;
|
||||
assert (is_writer_entityid (guid->entityid));
|
||||
assert (ephash_lookup_proxy_writer_guid (guid) == NULL);
|
||||
|
||||
|
@ -4224,6 +4228,8 @@ static void gc_delete_proxy_writer (struct gcreq *gcreq)
|
|||
int delete_proxy_writer (const struct nn_guid *guid, nn_wctime_t timestamp, int isimplicit)
|
||||
{
|
||||
struct proxy_writer *pwr;
|
||||
(void)timestamp;
|
||||
(void)isimplicit;
|
||||
nn_log (LC_DISCOVERY, "delete_proxy_writer (%x:%x:%x:%x) ", PGUID (*guid));
|
||||
os_mutexLock (&gv.lock);
|
||||
if ((pwr = ephash_lookup_proxy_writer_guid (guid)) == NULL)
|
||||
|
@ -4255,6 +4261,7 @@ int new_proxy_reader (const struct nn_guid *ppguid, const struct nn_guid *guid,
|
|||
struct proxy_participant *proxypp;
|
||||
struct proxy_reader *prd;
|
||||
nn_mtime_t tnow = now_mt ();
|
||||
(void)timestamp;
|
||||
|
||||
assert (!is_writer_entityid (guid->entityid));
|
||||
assert (ephash_lookup_proxy_reader_guid (guid) == NULL);
|
||||
|
@ -4352,6 +4359,8 @@ static void gc_delete_proxy_reader (struct gcreq *gcreq)
|
|||
int delete_proxy_reader (const struct nn_guid *guid, nn_wctime_t timestamp, int isimplicit)
|
||||
{
|
||||
struct proxy_reader *prd;
|
||||
(void)timestamp;
|
||||
(void)isimplicit;
|
||||
nn_log (LC_DISCOVERY, "delete_proxy_reader (%x:%x:%x:%x) ", PGUID (*guid));
|
||||
os_mutexLock (&gv.lock);
|
||||
if ((prd = ephash_lookup_proxy_reader_guid (guid)) == NULL)
|
||||
|
|
|
@ -38,11 +38,11 @@ static const uint64_t unihashconsts[] = {
|
|||
static uint32_t hash_entity_guid (const struct entity_common *c)
|
||||
{
|
||||
return
|
||||
(int) (((((uint32_t) c->guid.prefix.u[0] + unihashconsts[0]) *
|
||||
((uint32_t) c->guid.prefix.u[1] + unihashconsts[1])) +
|
||||
(((uint32_t) c->guid.prefix.u[2] + unihashconsts[2]) *
|
||||
((uint32_t) c->guid.entityid.u + unihashconsts[3])))
|
||||
>> 32);
|
||||
(uint32_t) (((((uint32_t) c->guid.prefix.u[0] + unihashconsts[0]) *
|
||||
((uint32_t) c->guid.prefix.u[1] + unihashconsts[1])) +
|
||||
(((uint32_t) c->guid.prefix.u[2] + unihashconsts[2]) *
|
||||
((uint32_t) c->guid.entityid.u + unihashconsts[3])))
|
||||
>> 32);
|
||||
}
|
||||
|
||||
static uint32_t hash_entity_guid_wrapper (const void *c)
|
||||
|
@ -121,6 +121,7 @@ static void *ephash_lookup_guid_int (const struct ephash *ephash, const struct n
|
|||
/* FIXME: could (now) require guid to be first in entity_common; entity_common already is first in entity */
|
||||
struct entity_common e;
|
||||
struct entity_common *res;
|
||||
(void)ephash;
|
||||
e.guid = *guid;
|
||||
res = ut_chhLookup (gv.guid_hash->hash, &e);
|
||||
if (res && res->kind == kind)
|
||||
|
@ -287,7 +288,7 @@ void *ephash_enum_next (struct ephash_enum *st)
|
|||
if (st->cur)
|
||||
{
|
||||
st->cur = ut_chhIterNext (&st->it);
|
||||
while (st->cur && (int)st->cur->kind != st->kind)
|
||||
while (st->cur && st->cur->kind != st->kind)
|
||||
st->cur = ut_chhIterNext (&st->it);
|
||||
}
|
||||
return res;
|
||||
|
|
|
@ -199,6 +199,8 @@ _Check_return_ bool nn_freelist_push (_Inout_ struct nn_freelist *fl, _Inout_ _W
|
|||
_Check_return_ _Ret_maybenull_ void *nn_freelist_pushmany (_Inout_ struct nn_freelist *fl, _Inout_opt_ _When_ (return != 0, _Post_invalid_) void *first, _Inout_opt_ _When_ (return != 0, _Post_invalid_) void *last, uint32_t n)
|
||||
{
|
||||
void *m = first;
|
||||
(void)last;
|
||||
(void)n;
|
||||
while (m)
|
||||
{
|
||||
void *mnext = get_next (fl, m);
|
||||
|
|
|
@ -43,6 +43,8 @@ static void check(const struct inverse_uint32_set *set)
|
|||
assert(n->max <= set->max);
|
||||
assert(pn == NULL || n->min > pn->max+1);
|
||||
}
|
||||
#else
|
||||
(void)set;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -199,11 +199,12 @@ static const uint32_t crc32_table[] = {
|
|||
0xbcb4666d, 0xb8757bda, 0xb5365d03, 0xb1f740b4
|
||||
};
|
||||
|
||||
uint32_t crc32_calc (const void *buf, uint32_t length)
|
||||
uint32_t crc32_calc (const void *buf, size_t length)
|
||||
{
|
||||
const uint8_t *vptr = buf;
|
||||
uint32_t i, reg = 0;
|
||||
uint32_t reg = 0;
|
||||
uint8_t top;
|
||||
size_t i;
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
top = (uint8_t) (reg >> 24);
|
||||
|
|
|
@ -222,7 +222,7 @@ static int set_reuse_options (os_socket socket)
|
|||
|
||||
static int bind_socket (os_socket socket, unsigned short port)
|
||||
{
|
||||
int rc;
|
||||
os_result rc;
|
||||
|
||||
#if OS_SOCKET_HAS_IPV6
|
||||
if (config.transport_selector == TRANS_TCP6 || config.transport_selector == TRANS_UDP6)
|
||||
|
|
|
@ -63,7 +63,7 @@ typedef struct nn_ipaddress_params_tmp {
|
|||
|
||||
struct dd {
|
||||
const unsigned char *buf;
|
||||
unsigned bufsz;
|
||||
size_t bufsz;
|
||||
unsigned bswap: 1;
|
||||
nn_protocol_version_t protocol_version;
|
||||
nn_vendorid_t vendorid;
|
||||
|
@ -90,9 +90,9 @@ static int trace_plist (const char *fmt, ...)
|
|||
|
||||
static void log_octetseq (logcat_t cat, unsigned n, const unsigned char *xs);
|
||||
|
||||
static unsigned align4u (unsigned x)
|
||||
static size_t align4u (size_t x)
|
||||
{
|
||||
return (x + 3u) & (unsigned)-4;
|
||||
return (x + 3u) & ~(size_t)3;
|
||||
}
|
||||
|
||||
static int protocol_version_is_newer (nn_protocol_version_t pv)
|
||||
|
@ -101,7 +101,7 @@ static int protocol_version_is_newer (nn_protocol_version_t pv)
|
|||
return (pv.major < mv.major) ? 0 : (pv.major > mv.major) ? 1 : (pv.minor > mv.minor);
|
||||
}
|
||||
|
||||
static int validate_string (const struct dd *dd, unsigned *len)
|
||||
static int validate_string (const struct dd *dd, size_t *len)
|
||||
{
|
||||
const struct cdrstring *x = (const struct cdrstring *) dd->buf;
|
||||
if (dd->bufsz < sizeof (struct cdrstring))
|
||||
|
@ -112,7 +112,7 @@ static int validate_string (const struct dd *dd, unsigned *len)
|
|||
*len = dd->bswap ? bswap4u (x->length) : x->length;
|
||||
if (*len < 1 || *len > dd->bufsz - offsetof (struct cdrstring, contents))
|
||||
{
|
||||
TRACE (("plist/validate_string: length %u out of range\n", *len));
|
||||
TRACE (("plist/validate_string: length %" PRIuSIZE " out of range\n", *len));
|
||||
return ERR_INVALID;
|
||||
}
|
||||
if (x->contents[*len-1] != 0)
|
||||
|
@ -123,7 +123,7 @@ static int validate_string (const struct dd *dd, unsigned *len)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int alias_string (const unsigned char **ptr, const struct dd *dd, unsigned *len)
|
||||
static int alias_string (const unsigned char **ptr, const struct dd *dd, size_t *len)
|
||||
{
|
||||
int rc;
|
||||
if ((rc = validate_string (dd, len)) < 0)
|
||||
|
@ -153,7 +153,7 @@ static void unalias_string (char **str, int bswap)
|
|||
memcpy (*str, alias, len);
|
||||
}
|
||||
|
||||
static int validate_octetseq (const struct dd *dd, unsigned *len)
|
||||
static int validate_octetseq (const struct dd *dd, size_t *len)
|
||||
{
|
||||
const struct cdroctetseq *x = (const struct cdroctetseq *) dd->buf;
|
||||
if (dd->bufsz < offsetof (struct cdroctetseq, value))
|
||||
|
@ -166,14 +166,15 @@ static int validate_octetseq (const struct dd *dd, unsigned *len)
|
|||
|
||||
static int alias_octetseq (nn_octetseq_t *oseq, const struct dd *dd)
|
||||
{
|
||||
unsigned len;
|
||||
size_t len;
|
||||
int rc;
|
||||
if ((rc = validate_octetseq (dd, &len)) < 0)
|
||||
return rc;
|
||||
else
|
||||
{
|
||||
const struct cdroctetseq *x = (const struct cdroctetseq *) dd->buf;
|
||||
oseq->length = len;
|
||||
assert(len <= UINT32_MAX); /* it really is an uint32_t on the wire */
|
||||
oseq->length = (uint32_t)len;
|
||||
oseq->value = (len == 0) ? NULL : (unsigned char *) x->value;
|
||||
return 0;
|
||||
}
|
||||
|
@ -181,7 +182,8 @@ static int alias_octetseq (nn_octetseq_t *oseq, const struct dd *dd)
|
|||
|
||||
static int alias_blob (nn_octetseq_t *oseq, const struct dd *dd)
|
||||
{
|
||||
oseq->length = dd->bufsz;
|
||||
assert (dd->bufsz <= UINT32_MAX);
|
||||
oseq->length = (uint32_t)dd->bufsz;
|
||||
oseq->value = (oseq->length == 0) ? NULL : (unsigned char *) dd->buf;
|
||||
return 0;
|
||||
}
|
||||
|
@ -225,16 +227,16 @@ static int validate_stringseq (const struct dd *dd)
|
|||
{
|
||||
for (i = 0; i < n && seq <= seqend; i++)
|
||||
{
|
||||
unsigned len1;
|
||||
size_t len1;
|
||||
int rc;
|
||||
dd1.buf = seq;
|
||||
dd1.bufsz = (unsigned) (seqend - seq);
|
||||
dd1.bufsz = (size_t) (seqend - seq);
|
||||
if ((rc = validate_string (&dd1, &len1)) < 0)
|
||||
{
|
||||
TRACE (("plist/validate_stringseq: invalid string\n"));
|
||||
return rc;
|
||||
}
|
||||
seq += sizeof (unsigned) + align4u (len1);
|
||||
seq += sizeof (uint32_t) + align4u (len1);
|
||||
}
|
||||
if (i < n)
|
||||
{
|
||||
|
@ -266,7 +268,7 @@ static int alias_stringseq (nn_stringseq_t *strseq, const struct dd *dd)
|
|||
memcpy (&strseq->n, seq, sizeof (strseq->n));
|
||||
if (dd->bswap)
|
||||
strseq->n = bswap4u (strseq->n);
|
||||
seq += sizeof (unsigned);
|
||||
seq += sizeof (uint32_t);
|
||||
if (strseq->n >= UINT_MAX / sizeof(*strs))
|
||||
{
|
||||
TRACE (("plist/alias_stringseq: length %u out of range\n", strseq->n));
|
||||
|
@ -281,9 +283,9 @@ static int alias_stringseq (nn_stringseq_t *strseq, const struct dd *dd)
|
|||
strs = os_malloc (strseq->n * sizeof (*strs));
|
||||
for (i = 0; i < strseq->n && seq <= seqend; i++)
|
||||
{
|
||||
unsigned len1;
|
||||
size_t len1;
|
||||
dd1.buf = seq;
|
||||
dd1.bufsz = (unsigned) (seqend - seq);
|
||||
dd1.bufsz = (size_t)(seqend - seq);
|
||||
/* (const char **) to silence the compiler, unfortunately strseq
|
||||
can't have a const char **strs, that would require a const
|
||||
and a non-const version of it. */
|
||||
|
@ -292,7 +294,7 @@ static int alias_stringseq (nn_stringseq_t *strseq, const struct dd *dd)
|
|||
TRACE (("plist/alias_stringseq: invalid string\n"));
|
||||
goto fail;
|
||||
}
|
||||
seq += sizeof (unsigned) + align4u (len1);
|
||||
seq += sizeof (uint32_t) + align4u (len1);
|
||||
}
|
||||
if (i != strseq->n)
|
||||
{
|
||||
|
@ -358,11 +360,11 @@ assert (dest->strs == NULL);
|
|||
}
|
||||
|
||||
_Success_(return == 0)
|
||||
static int validate_property (_In_ const struct dd *dd, _Out_ unsigned *len)
|
||||
static int validate_property (_In_ const struct dd *dd, _Out_ size_t *len)
|
||||
{
|
||||
struct dd ddV = *dd;
|
||||
unsigned lenN;
|
||||
unsigned lenV;
|
||||
size_t lenN;
|
||||
size_t lenV;
|
||||
int rc;
|
||||
|
||||
/* Check name. */
|
||||
|
@ -372,7 +374,7 @@ static int validate_property (_In_ const struct dd *dd, _Out_ unsigned *len)
|
|||
TRACE (("plist/validate_property: name validation failed\n"));
|
||||
return rc;
|
||||
}
|
||||
lenN = sizeof(unsigned) + /* cdr string len arg + */
|
||||
lenN = sizeof(uint32_t) + /* cdr string len arg + */
|
||||
align4u(lenN); /* strlen + possible padding */
|
||||
|
||||
|
||||
|
@ -385,7 +387,7 @@ static int validate_property (_In_ const struct dd *dd, _Out_ unsigned *len)
|
|||
TRACE (("plist/validate_property: value validation failed\n"));
|
||||
return rc;
|
||||
}
|
||||
lenV = sizeof(unsigned) + /* cdr string len arg + */
|
||||
lenV = sizeof(uint32_t) + /* cdr string len arg + */
|
||||
align4u(lenV); /* strlen + possible padding */
|
||||
|
||||
*len = lenN + lenV;
|
||||
|
@ -394,11 +396,11 @@ static int validate_property (_In_ const struct dd *dd, _Out_ unsigned *len)
|
|||
}
|
||||
|
||||
_Success_(return == 0)
|
||||
static int alias_property (_Out_ nn_property_t *prop, _In_ const struct dd *dd, _Out_ unsigned *len)
|
||||
static int alias_property (_Out_ nn_property_t *prop, _In_ const struct dd *dd, _Out_ size_t *len)
|
||||
{
|
||||
struct dd ddV = *dd;
|
||||
unsigned lenN;
|
||||
unsigned lenV;
|
||||
size_t lenN;
|
||||
size_t lenV;
|
||||
int rc;
|
||||
|
||||
/* Get name */
|
||||
|
@ -408,7 +410,7 @@ static int alias_property (_Out_ nn_property_t *prop, _In_ const struct dd *dd,
|
|||
TRACE (("plist/alias_property: invalid name buffer\n"));
|
||||
return rc;
|
||||
}
|
||||
lenN = sizeof(unsigned) + /* cdr string len arg + */
|
||||
lenN = sizeof(uint32_t) + /* cdr string len arg + */
|
||||
align4u(lenN); /* strlen + possible padding */
|
||||
|
||||
/* Get value */
|
||||
|
@ -420,7 +422,7 @@ static int alias_property (_Out_ nn_property_t *prop, _In_ const struct dd *dd,
|
|||
TRACE (("plist/validate_property: invalid value buffer\n"));
|
||||
return rc;
|
||||
}
|
||||
lenV = sizeof(unsigned) + /* cdr string len arg + */
|
||||
lenV = sizeof(uint32_t) + /* cdr string len arg + */
|
||||
align4u (lenV); /* strlen + possible padding */
|
||||
|
||||
/* We got this from the wire; so it has been propagated. */
|
||||
|
@ -453,7 +455,7 @@ static void duplicate_property (_Out_ nn_property_t *dest, _In_ const nn_propert
|
|||
}
|
||||
|
||||
_Success_(return == 0)
|
||||
static int validate_propertyseq (_In_ const struct dd *dd, _Out_ unsigned *len)
|
||||
static int validate_propertyseq (_In_ const struct dd *dd, _Out_ size_t *len)
|
||||
{
|
||||
const unsigned char *seq = dd->buf;
|
||||
const unsigned char *seqend = seq + dd->bufsz;
|
||||
|
@ -481,10 +483,10 @@ static int validate_propertyseq (_In_ const struct dd *dd, _Out_ unsigned *len)
|
|||
{
|
||||
for (i = 0; i < n && seq <= seqend; i++)
|
||||
{
|
||||
unsigned len1;
|
||||
size_t len1;
|
||||
int rc;
|
||||
dd1.buf = seq;
|
||||
dd1.bufsz = (unsigned) (seqend - seq);
|
||||
dd1.bufsz = (size_t) (seqend - seq);
|
||||
if ((rc = validate_property (&dd1, &len1)) != 0)
|
||||
{
|
||||
TRACE (("plist/validate_propertyseq: invalid property\n"));
|
||||
|
@ -498,12 +500,12 @@ static int validate_propertyseq (_In_ const struct dd *dd, _Out_ unsigned *len)
|
|||
return ERR_INVALID;
|
||||
}
|
||||
}
|
||||
*len = align4u((unsigned)(seq - dd->buf));
|
||||
*len = align4u((size_t)(seq - dd->buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
_Success_(return == 0)
|
||||
static int alias_propertyseq (_Out_ nn_propertyseq_t *pseq, _In_ const struct dd *dd, _Out_ unsigned *len)
|
||||
static int alias_propertyseq (_Out_ nn_propertyseq_t *pseq, _In_ const struct dd *dd, _Out_ size_t *len)
|
||||
{
|
||||
/* Not truly an alias: it allocates an array of pointers that alias
|
||||
the individual components. Also: see validate_propertyseq */
|
||||
|
@ -522,7 +524,7 @@ static int alias_propertyseq (_Out_ nn_propertyseq_t *pseq, _In_ const struct dd
|
|||
memcpy (&pseq->n, seq, sizeof (pseq->n));
|
||||
if (dd->bswap)
|
||||
pseq->n = bswap4u (pseq->n);
|
||||
seq += sizeof (unsigned);
|
||||
seq += sizeof (uint32_t);
|
||||
if (pseq->n >= UINT_MAX / sizeof(*props))
|
||||
{
|
||||
TRACE (("plist/alias_propertyseq: length %u out of range\n", pseq->n));
|
||||
|
@ -537,9 +539,9 @@ static int alias_propertyseq (_Out_ nn_propertyseq_t *pseq, _In_ const struct dd
|
|||
props = os_malloc (pseq->n * sizeof (*props));
|
||||
for (i = 0; i < pseq->n && seq <= seqend; i++)
|
||||
{
|
||||
unsigned len1;
|
||||
size_t len1;
|
||||
dd1.buf = seq;
|
||||
dd1.bufsz = (unsigned) (seqend - seq);
|
||||
dd1.bufsz = (size_t) (seqend - seq);
|
||||
if ((result = alias_property (&props[i], &dd1, &len1)) != 0)
|
||||
{
|
||||
TRACE (("plist/alias_propertyseq: invalid property\n"));
|
||||
|
@ -555,7 +557,7 @@ static int alias_propertyseq (_Out_ nn_propertyseq_t *pseq, _In_ const struct dd
|
|||
}
|
||||
pseq->props = props;
|
||||
}
|
||||
*len = align4u((unsigned)(seq - dd->buf));
|
||||
*len = align4u((size_t)(seq - dd->buf));
|
||||
return 0;
|
||||
fail:
|
||||
os_free (props);
|
||||
|
@ -608,11 +610,11 @@ static void duplicate_propertyseq (_Out_ nn_propertyseq_t *dest, _In_ const nn_p
|
|||
}
|
||||
|
||||
_Success_(return == 0)
|
||||
static int validate_binaryproperty (_In_ const struct dd *dd, _Out_ unsigned *len)
|
||||
static int validate_binaryproperty (_In_ const struct dd *dd, _Out_ size_t *len)
|
||||
{
|
||||
struct dd ddV = *dd;
|
||||
unsigned lenN;
|
||||
unsigned lenV;
|
||||
size_t lenN;
|
||||
size_t lenV;
|
||||
int rc;
|
||||
|
||||
/* Check name. */
|
||||
|
@ -622,7 +624,7 @@ static int validate_binaryproperty (_In_ const struct dd *dd, _Out_ unsigned *le
|
|||
TRACE (("plist/validate_property: name validation failed\n"));
|
||||
return rc;
|
||||
}
|
||||
lenN = sizeof(unsigned) + /* cdr string len arg + */
|
||||
lenN = sizeof(uint32_t) + /* cdr string len arg + */
|
||||
align4u(lenN); /* strlen + possible padding */
|
||||
|
||||
/* Check value. */
|
||||
|
@ -634,7 +636,7 @@ static int validate_binaryproperty (_In_ const struct dd *dd, _Out_ unsigned *le
|
|||
TRACE (("plist/validate_property: value validation failed\n"));
|
||||
return rc;
|
||||
}
|
||||
lenV = sizeof(unsigned) + /* cdr sequence len arg + */
|
||||
lenV = sizeof(uint32_t) + /* cdr sequence len arg + */
|
||||
align4u(lenV); /* seqlen + possible padding */
|
||||
|
||||
*len = lenN + lenV;
|
||||
|
@ -643,11 +645,11 @@ static int validate_binaryproperty (_In_ const struct dd *dd, _Out_ unsigned *le
|
|||
}
|
||||
|
||||
_Success_(return == 0)
|
||||
static int alias_binaryproperty (_Out_ nn_binaryproperty_t *prop, _In_ const struct dd *dd, _Out_ unsigned *len)
|
||||
static int alias_binaryproperty (_Out_ nn_binaryproperty_t *prop, _In_ const struct dd *dd, _Out_ size_t *len)
|
||||
{
|
||||
struct dd ddV = *dd;
|
||||
unsigned lenN;
|
||||
unsigned lenV;
|
||||
size_t lenN;
|
||||
size_t lenV;
|
||||
int rc;
|
||||
|
||||
/* Get name */
|
||||
|
@ -657,7 +659,7 @@ static int alias_binaryproperty (_Out_ nn_binaryproperty_t *prop, _In_ const str
|
|||
TRACE (("plist/alias_property: invalid name buffer\n"));
|
||||
return rc;
|
||||
}
|
||||
lenN = sizeof(unsigned) + /* cdr string len arg + */
|
||||
lenN = sizeof(uint32_t) + /* cdr string len arg + */
|
||||
align4u(lenN); /* strlen + possible padding */
|
||||
|
||||
/* Get value */
|
||||
|
@ -669,7 +671,7 @@ static int alias_binaryproperty (_Out_ nn_binaryproperty_t *prop, _In_ const str
|
|||
TRACE (("plist/validate_property: invalid value buffer\n"));
|
||||
return rc;
|
||||
}
|
||||
lenV = sizeof(unsigned) + /* cdr sequence len arg + */
|
||||
lenV = sizeof(uint32_t) + /* cdr sequence len arg + */
|
||||
align4u(prop->value.length); /* seqlen + possible padding */
|
||||
|
||||
/* We got this from the wire; so it has been propagated. */
|
||||
|
@ -703,7 +705,7 @@ static void duplicate_binaryproperty (_Out_ nn_binaryproperty_t *dest, _In_ cons
|
|||
}
|
||||
|
||||
_Success_(return == 0)
|
||||
static int validate_binarypropertyseq (_In_ const struct dd *dd, _Out_ unsigned *len)
|
||||
static int validate_binarypropertyseq (_In_ const struct dd *dd, _Out_ size_t *len)
|
||||
{
|
||||
const unsigned char *seq = dd->buf;
|
||||
const unsigned char *seqend = seq + dd->bufsz;
|
||||
|
@ -731,10 +733,10 @@ static int validate_binarypropertyseq (_In_ const struct dd *dd, _Out_ unsigned
|
|||
{
|
||||
for (i = 0; i < n && seq <= seqend; i++)
|
||||
{
|
||||
unsigned len1;
|
||||
size_t len1;
|
||||
int rc;
|
||||
dd1.buf = seq;
|
||||
dd1.bufsz = (unsigned) (seqend - seq);
|
||||
dd1.bufsz = (size_t) (seqend - seq);
|
||||
if ((rc = validate_binaryproperty (&dd1, &len1)) != 0)
|
||||
{
|
||||
TRACE (("plist/validate_binarypropertyseq: invalid property\n"));
|
||||
|
@ -748,12 +750,12 @@ static int validate_binarypropertyseq (_In_ const struct dd *dd, _Out_ unsigned
|
|||
return ERR_INVALID;
|
||||
}
|
||||
}
|
||||
*len = align4u((unsigned)(seq - dd->buf));
|
||||
*len = align4u((size_t)(seq - dd->buf));
|
||||
return 0;
|
||||
}
|
||||
|
||||
_Success_(return == 0)
|
||||
static int alias_binarypropertyseq (_Out_ nn_binarypropertyseq_t *pseq, _In_ const struct dd *dd, _Out_ unsigned *len)
|
||||
static int alias_binarypropertyseq (_Out_ nn_binarypropertyseq_t *pseq, _In_ const struct dd *dd, _Out_ size_t *len)
|
||||
{
|
||||
/* Not truly an alias: it allocates an array of pointers that alias
|
||||
the individual components. Also: see validate_binarypropertyseq */
|
||||
|
@ -772,7 +774,7 @@ static int alias_binarypropertyseq (_Out_ nn_binarypropertyseq_t *pseq, _In_ con
|
|||
memcpy (&pseq->n, seq, sizeof (pseq->n));
|
||||
if (dd->bswap)
|
||||
pseq->n = bswap4u (pseq->n);
|
||||
seq += sizeof (unsigned);
|
||||
seq += sizeof (uint32_t);
|
||||
if (pseq->n >= UINT_MAX / sizeof(*props))
|
||||
{
|
||||
TRACE (("plist/alias_binarypropertyseq: length %u out of range\n", pseq->n));
|
||||
|
@ -787,9 +789,9 @@ static int alias_binarypropertyseq (_Out_ nn_binarypropertyseq_t *pseq, _In_ con
|
|||
props = os_malloc (pseq->n * sizeof (*props));
|
||||
for (i = 0; i < pseq->n && seq <= seqend; i++)
|
||||
{
|
||||
unsigned len1;
|
||||
size_t len1;
|
||||
dd1.buf = seq;
|
||||
dd1.bufsz = (unsigned) (seqend - seq);
|
||||
dd1.bufsz = (size_t) (seqend - seq);
|
||||
if ((result = alias_binaryproperty (&props[i], &dd1, &len1)) != 0)
|
||||
{
|
||||
TRACE (("plist/alias_binarypropertyseq: invalid property\n"));
|
||||
|
@ -805,7 +807,7 @@ static int alias_binarypropertyseq (_Out_ nn_binarypropertyseq_t *pseq, _In_ con
|
|||
}
|
||||
pseq->props = props;
|
||||
}
|
||||
*len = align4u((unsigned)(seq - dd->buf));
|
||||
*len = align4u((size_t)(seq - dd->buf));
|
||||
return 0;
|
||||
fail:
|
||||
os_free (props);
|
||||
|
@ -1012,7 +1014,7 @@ void nn_plist_unalias (nn_plist_t *ps)
|
|||
static int do_octetseq (nn_octetseq_t *dst, uint64_t *present, uint64_t *aliased, uint64_t wanted, uint64_t fl, const struct dd *dd)
|
||||
{
|
||||
int res;
|
||||
unsigned len;
|
||||
size_t len;
|
||||
if (!(wanted & fl))
|
||||
return NN_STRICT_P ? validate_octetseq (dd, &len) : 0;
|
||||
if ((res = alias_octetseq (dst, dd)) >= 0)
|
||||
|
@ -1039,7 +1041,7 @@ static int do_blob (nn_octetseq_t *dst, uint64_t *present, uint64_t *aliased, ui
|
|||
static int do_string (char **dst, uint64_t *present, uint64_t *aliased, uint64_t wanted, uint64_t fl, const struct dd *dd)
|
||||
{
|
||||
int res;
|
||||
unsigned len;
|
||||
size_t len;
|
||||
if (!(wanted & fl))
|
||||
return NN_STRICT_P ? validate_string (dd, &len) : 0;
|
||||
if ((res = alias_string ((const unsigned char **) dst, dd, &len)) >= 0)
|
||||
|
@ -1321,7 +1323,7 @@ int validate_liveliness_qospolicy (const nn_liveliness_qospolicy_t *q)
|
|||
|
||||
static void bswap_external_reliability_qospolicy (nn_external_reliability_qospolicy_t *qext)
|
||||
{
|
||||
qext->kind = bswap4 (qext->kind);
|
||||
qext->kind = bswap4u (qext->kind);
|
||||
bswap_duration (&qext->max_blocking_time);
|
||||
}
|
||||
|
||||
|
@ -1915,9 +1917,9 @@ static int do_prismtech_participant_version_info (nn_prismtech_participant_versi
|
|||
else
|
||||
{
|
||||
int res;
|
||||
unsigned sz = NN_PRISMTECH_PARTICIPANT_VERSION_INFO_FIXED_CDRSIZE - sizeof(unsigned);
|
||||
unsigned *pu = (unsigned *)dd->buf;
|
||||
unsigned len;
|
||||
unsigned sz = NN_PRISMTECH_PARTICIPANT_VERSION_INFO_FIXED_CDRSIZE - sizeof(uint32_t);
|
||||
uint32_t *pu = (uint32_t *)dd->buf;
|
||||
size_t len;
|
||||
struct dd dd1 = *dd;
|
||||
|
||||
memcpy (pvi, dd->buf, sz);
|
||||
|
@ -2069,7 +2071,7 @@ _Success_(return == 0)
|
|||
static int do_dataholder (_Out_ nn_dataholder_t *dh, _Inout_ uint64_t *present, _Inout_ uint64_t *aliased, _In_ uint64_t wanted, _In_ uint64_t fl, _In_ const struct dd *dd)
|
||||
{
|
||||
struct dd ddtmp = *dd;
|
||||
unsigned len;
|
||||
size_t len;
|
||||
int res;
|
||||
|
||||
memset(dh, 0, sizeof(nn_dataholder_t));
|
||||
|
@ -2082,7 +2084,7 @@ static int do_dataholder (_Out_ nn_dataholder_t *dh, _Inout_ uint64_t *present,
|
|||
/* check class_id */
|
||||
if ((res = validate_string (&ddtmp, &len)) == 0)
|
||||
{
|
||||
len = sizeof(unsigned) + /* cdr string len arg + */
|
||||
len = sizeof(uint32_t) + /* cdr string len arg + */
|
||||
align4u(len); /* strlen + possible padding */
|
||||
/* check properties */
|
||||
ddtmp.buf = &(dd->buf[len]);
|
||||
|
@ -2117,7 +2119,7 @@ static int do_dataholder (_Out_ nn_dataholder_t *dh, _Inout_ uint64_t *present,
|
|||
TRACE (("plist/do_dataholder: invalid class_id\n"));
|
||||
return res;
|
||||
}
|
||||
len = sizeof(unsigned) + /* cdr string len arg + */
|
||||
len = sizeof(uint32_t) + /* cdr string len arg + */
|
||||
align4u(len); /* strlen + possible padding */
|
||||
|
||||
/* get properties */
|
||||
|
@ -3046,7 +3048,7 @@ int nn_plist_init_frommsg
|
|||
}
|
||||
|
||||
dd.buf = (const unsigned char *) (par + 1);
|
||||
dd.bufsz = (unsigned) length;
|
||||
dd.bufsz = length;
|
||||
if ((res = init_one_parameter (dest, &dest_tmp, pwanted, qwanted, pid, &dd)) < 0)
|
||||
{
|
||||
/* make sure we print a trace message on error */
|
||||
|
@ -3070,7 +3072,7 @@ unsigned char *nn_plist_quickscan (struct nn_rsample_info *dest, const struct nn
|
|||
following parameter list, or NULL on error. Most errors will go
|
||||
undetected, unlike nn_plist_init_frommsg(). */
|
||||
const unsigned char *pl;
|
||||
|
||||
(void)rmsg;
|
||||
dest->statusinfo = 0;
|
||||
dest->pt_wr_info_zoff = NN_OFF_TO_ZOFF (0);
|
||||
dest->complex_qos = 0;
|
||||
|
|
|
@ -1067,7 +1067,7 @@ static int handle_AckNack (struct receiver_state *rst, nn_etime_t tnow, const Ac
|
|||
gradually lowering rate. If we just got a request for a
|
||||
retransmit, and there is more to be retransmitted, surely the
|
||||
rate should be kept up for now */
|
||||
writer_hbcontrol_note_asyncwrite (wr, &whcst, now_mt ());
|
||||
writer_hbcontrol_note_asyncwrite (wr, now_mt ());
|
||||
}
|
||||
/* If "final" flag not set, we must respond with a heartbeat. Do it
|
||||
now if we haven't done so already */
|
||||
|
@ -1543,7 +1543,7 @@ static int handle_NackFrag (struct receiver_state *rst, nn_etime_t tnow, const N
|
|||
struct whc_state whcst;
|
||||
wr->whc->ops->get_state(wr->whc, &whcst);
|
||||
force_heartbeat_to_peer (wr, &whcst, prd, 1);
|
||||
writer_hbcontrol_note_asyncwrite (wr, &whcst, now_mt ());
|
||||
writer_hbcontrol_note_asyncwrite (wr, now_mt ());
|
||||
}
|
||||
|
||||
out:
|
||||
|
@ -1792,11 +1792,12 @@ static serstate_t make_raw_serstate
|
|||
)
|
||||
{
|
||||
serstate_t st = ddsi_serstate_new (topic);
|
||||
ddsi_serstate_set_msginfo (st, statusinfo, tstamp, NULL);
|
||||
ddsi_serstate_set_msginfo (st, statusinfo, tstamp);
|
||||
st->kind = justkey ? STK_KEY : STK_DATA;
|
||||
/* the CDR header is always fully contained in the first fragment
|
||||
(see valid_DataFrag), so extracting it is easy */
|
||||
assert (fragchain->min == 0);
|
||||
(void)sz;
|
||||
|
||||
/* alignment at head-of-stream is guaranteed, requesting 1 byte
|
||||
alignment is therefore fine for pasting together fragments of
|
||||
|
@ -1891,7 +1892,7 @@ static serdata_t extract_sample_from_data
|
|||
{
|
||||
serstate_t st;
|
||||
st = ddsi_serstate_new (topic);
|
||||
ddsi_serstate_set_msginfo (st, statusinfo, tstamp, NULL);
|
||||
ddsi_serstate_set_msginfo (st, statusinfo, tstamp);
|
||||
st->kind = STK_KEY;
|
||||
ddsi_serstate_append_blob (st, 1, sizeof (qos->keyhash), qos->keyhash.value);
|
||||
sample = ddsi_serstate_fix_with_key (st, topic, sampleinfo->bswap);
|
||||
|
@ -3285,8 +3286,8 @@ static int check_and_handle_deafness_recover(struct local_deaf_state *st)
|
|||
ddsi_conn_free(data);
|
||||
rebuildws = 1;
|
||||
st->state = LDSR_REJOIN;
|
||||
/* FALLS THROUGH */
|
||||
}
|
||||
/* FALLS THROUGH */
|
||||
case LDSR_REJOIN:
|
||||
TRACE(("check_and_handle_deafness_recover: state %d rejoin on disc socket\n", (int)st->state));
|
||||
if (ddsi_rejoin_transferred_mcgroups(gv.disc_conn_mc) < 0)
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "os/os.h"
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ cleanup_thread_state(
|
|||
_In_opt_ void *data)
|
||||
{
|
||||
struct thread_state1 *ts = get_thread_state(os_threadIdSelf());
|
||||
|
||||
(void)data;
|
||||
assert(ts->state == THREAD_STATE_ALIVE);
|
||||
assert(vtime_asleep_p(ts->vtime));
|
||||
reset_thread_state(ts);
|
||||
|
|
|
@ -109,7 +109,7 @@ int64_t writer_hbcontrol_intv (const struct writer *wr, const struct whc_state *
|
|||
return ret;
|
||||
}
|
||||
|
||||
void writer_hbcontrol_note_asyncwrite (struct writer *wr, const struct whc_state *whcst, nn_mtime_t tnow)
|
||||
void writer_hbcontrol_note_asyncwrite (struct writer *wr, nn_mtime_t tnow)
|
||||
{
|
||||
struct hbcontrol * const hbc = &wr->hbcontrol;
|
||||
nn_mtime_t tnext;
|
||||
|
@ -284,7 +284,7 @@ struct nn_xmsg *writer_hbcontrol_piggyback (struct writer *wr, const struct whc_
|
|||
/* Update statistics, intervals, scheduling of heartbeat event,
|
||||
&c. -- there's no real difference between async and sync so we
|
||||
reuse the async version. */
|
||||
writer_hbcontrol_note_asyncwrite (wr, whcst, tnow);
|
||||
writer_hbcontrol_note_asyncwrite (wr, tnow);
|
||||
|
||||
*hbansreq = writer_hbcontrol_ack_required_generic (wr, whcst, tlast, tnow, 1);
|
||||
if (*hbansreq >= 2) {
|
||||
|
@ -467,6 +467,7 @@ int create_fragment_message (struct writer *wr, seqno_t seq, const struct nn_pli
|
|||
unsigned fragstart, fraglen;
|
||||
enum nn_xmsg_kind xmsg_kind = isnew ? NN_XMSG_KIND_DATA : NN_XMSG_KIND_DATA_REXMIT;
|
||||
int ret = 0;
|
||||
(void)plist;
|
||||
|
||||
ASSERT_MUTEX_HELD (&wr->e.lock);
|
||||
|
||||
|
@ -920,7 +921,9 @@ static os_result throttle_writer (struct nn_xpack *xp, struct writer *wr)
|
|||
wr->whc->ops->get_state(wr->whc, &whcst);
|
||||
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
nn_vendorid_t ownvendorid = MY_VENDOR_ID;
|
||||
#endif
|
||||
ASSERT_MUTEX_HELD (&wr->e.lock);
|
||||
assert (wr->throttling == 0);
|
||||
assert (vtime_awake_p (lookup_thread_state ()->vtime));
|
||||
|
@ -1004,6 +1007,7 @@ static int write_sample_eot (struct nn_xpack *xp, struct writer *wr, struct nn_p
|
|||
|
||||
/* If GC not allowed, we must be sure to never block when writing. That is only the case for (true, aggressive) KEEP_LAST writers, and also only if there is no limit to how much unacknowledged data the WHC may contain. */
|
||||
assert(gc_allowed || (wr->xqos->history.kind == NN_KEEP_LAST_HISTORY_QOS && wr->aggressive_keep_last && wr->whc_low == INT32_MAX));
|
||||
(void)gc_allowed;
|
||||
|
||||
if (ddsi_serdata_size (serdata) > config.max_sample_size)
|
||||
{
|
||||
|
@ -1112,7 +1116,7 @@ static int write_sample_eot (struct nn_xpack *xp, struct writer *wr, struct nn_p
|
|||
else
|
||||
{
|
||||
if (wr->heartbeat_xevent)
|
||||
writer_hbcontrol_note_asyncwrite (wr, &whcst, tnow);
|
||||
writer_hbcontrol_note_asyncwrite (wr, tnow);
|
||||
enqueue_sample_wrlock_held (wr, seq, plist, serdata, NULL, 1);
|
||||
os_mutexUnlock (&wr->e.lock);
|
||||
}
|
||||
|
|
|
@ -1138,7 +1138,7 @@ static void write_pmd_message (struct nn_xpack *xp, struct participant *pp, unsi
|
|||
serstate = ddsi_serstate_new (NULL);
|
||||
ddsi_serstate_append_blob (serstate, 4, sizeof (u.pad), &u.pmd);
|
||||
serstate_set_key (serstate, 0, &u.pmd);
|
||||
ddsi_serstate_set_msginfo (serstate, 0, now (), NULL);
|
||||
ddsi_serstate_set_msginfo (serstate, 0, now ());
|
||||
serdata = ddsi_serstate_fix (serstate);
|
||||
|
||||
/* HORRIBLE HACK ALERT -- serstate/serdata looks at whether topic is
|
||||
|
|
|
@ -230,9 +230,9 @@ struct nn_xpack
|
|||
#endif /* DDSI_INCLUDE_ENCRYPTION */
|
||||
};
|
||||
|
||||
static unsigned align4u (unsigned x)
|
||||
static size_t align4u (size_t x)
|
||||
{
|
||||
return (x + 3u) & (unsigned)-4;
|
||||
return (x + 3) & ~(size_t)3;
|
||||
}
|
||||
|
||||
/* XMSGPOOL ------------------------------------------------------------
|
||||
|
@ -472,7 +472,7 @@ void nn_xmsg_submsg_init (struct nn_xmsg *msg, struct nn_xmsg_marker marker, Sub
|
|||
{
|
||||
SubmessageHeader_t *hdr = (SubmessageHeader_t *) (msg->data->payload + marker.offset);
|
||||
assert (submsg_is_compatible (msg, smkind));
|
||||
hdr->submessageId = smkind;
|
||||
hdr->submessageId = (unsigned char)smkind;
|
||||
hdr->flags = PLATFORM_IS_LITTLE_ENDIAN ? SMFLAG_ENDIANNESS : 0;
|
||||
hdr->octetsToNextHeader = 0;
|
||||
}
|
||||
|
@ -554,15 +554,15 @@ void nn_xmsg_add_entityid (struct nn_xmsg * m)
|
|||
nn_xmsg_submsg_setnext (m, sm);
|
||||
}
|
||||
|
||||
void nn_xmsg_serdata (struct nn_xmsg *m, serdata_t serdata, unsigned off, unsigned len)
|
||||
void nn_xmsg_serdata (struct nn_xmsg *m, serdata_t serdata, size_t off, size_t len)
|
||||
{
|
||||
if (!ddsi_serdata_is_empty (serdata))
|
||||
{
|
||||
unsigned len4 = align4u (len);
|
||||
size_t len4 = align4u (len);
|
||||
assert (m->refd_payload == NULL);
|
||||
m->refd_payload = ddsi_serdata_ref (serdata);
|
||||
m->refd_payload_iov.iov_base = (char *) &m->refd_payload->hdr + off;
|
||||
m->refd_payload_iov.iov_len = len4;
|
||||
m->refd_payload_iov.iov_len = (ddsi_iov_len_t) len4;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -752,13 +752,14 @@ void nn_xmsg_setwriterseq_fragid (struct nn_xmsg *msg, const nn_guid_t *wrguid,
|
|||
msg->kindspecific.data.wrfragid = wrfragid;
|
||||
}
|
||||
|
||||
unsigned nn_xmsg_add_string_padded(_Inout_opt_ unsigned char *buf, _In_ char *str)
|
||||
size_t nn_xmsg_add_string_padded(_Inout_opt_ unsigned char *buf, _In_ char *str)
|
||||
{
|
||||
unsigned len = (unsigned) strlen (str) + 1;
|
||||
size_t len = strlen (str) + 1;
|
||||
assert (len <= UINT32_MAX);
|
||||
if (buf) {
|
||||
/* Add cdr string */
|
||||
struct cdrstring *p = (struct cdrstring *) buf;
|
||||
p->length = len;
|
||||
p->length = (uint32_t)len;
|
||||
memcpy (p->contents, str, len);
|
||||
/* clear padding */
|
||||
if (len < align4u (len)) {
|
||||
|
@ -770,7 +771,7 @@ unsigned nn_xmsg_add_string_padded(_Inout_opt_ unsigned char *buf, _In_ char *st
|
|||
return len;
|
||||
}
|
||||
|
||||
unsigned nn_xmsg_add_octseq_padded(_Inout_opt_ unsigned char *buf, _In_ nn_octetseq_t *seq)
|
||||
size_t nn_xmsg_add_octseq_padded(_Inout_opt_ unsigned char *buf, _In_ nn_octetseq_t *seq)
|
||||
{
|
||||
unsigned len = seq->length;
|
||||
if (buf) {
|
||||
|
@ -783,15 +784,15 @@ unsigned nn_xmsg_add_octseq_padded(_Inout_opt_ unsigned char *buf, _In_ nn_octet
|
|||
memset (buf + len, 0, align4u (len) - len);
|
||||
}
|
||||
}
|
||||
len = 4 + /* cdr sequence len arg + */
|
||||
align4u(len); /* seqlen + possible padding */
|
||||
return len;
|
||||
return 4 + /* cdr sequence len arg + */
|
||||
align4u(len); /* seqlen + possible padding */
|
||||
}
|
||||
|
||||
|
||||
unsigned nn_xmsg_add_dataholder_padded (_Inout_opt_ unsigned char *buf, const struct nn_dataholder *dh)
|
||||
size_t nn_xmsg_add_dataholder_padded (_Inout_opt_ unsigned char *buf, const struct nn_dataholder *dh)
|
||||
{
|
||||
unsigned i, len;
|
||||
unsigned i;
|
||||
size_t len;
|
||||
unsigned dummy = 0;
|
||||
unsigned *cnt = &dummy;
|
||||
|
||||
|
@ -870,7 +871,8 @@ void nn_xmsg_addpar_octetseq (struct nn_xmsg *m, unsigned pid, const nn_octetseq
|
|||
void nn_xmsg_addpar_stringseq (struct nn_xmsg *m, unsigned pid, const nn_stringseq_t *sseq)
|
||||
{
|
||||
unsigned char *tmp;
|
||||
unsigned i, len = 0;
|
||||
uint32_t i;
|
||||
size_t len = 0;
|
||||
|
||||
for (i = 0; i < sseq->n; i++)
|
||||
{
|
||||
|
@ -879,8 +881,8 @@ void nn_xmsg_addpar_stringseq (struct nn_xmsg *m, unsigned pid, const nn_strings
|
|||
|
||||
tmp = nn_xmsg_addpar (m, pid, 4 + len);
|
||||
|
||||
*((unsigned *) tmp) = sseq->n;
|
||||
tmp += sizeof (int);
|
||||
*((uint32_t *) tmp) = sseq->n;
|
||||
tmp += sizeof (uint32_t);
|
||||
for (i = 0; i < sseq->n; i++)
|
||||
{
|
||||
tmp += nn_xmsg_add_string_padded(tmp, sseq->strs[i]);
|
||||
|
@ -995,11 +997,12 @@ void nn_xmsg_addpar_share (struct nn_xmsg *m, unsigned pid, const struct nn_shar
|
|||
void nn_xmsg_addpar_subscription_keys (struct nn_xmsg *m, unsigned pid, const struct nn_subscription_keys_qospolicy *q)
|
||||
{
|
||||
unsigned char *tmp;
|
||||
unsigned i, len = 8; /* use_key_list, length of key_list */
|
||||
size_t len = 8; /* use_key_list, length of key_list */
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < q->key_list.n; i++)
|
||||
{
|
||||
unsigned len1 = (unsigned) strlen (q->key_list.strs[i]) + 1;
|
||||
size_t len1 = strlen (q->key_list.strs[i]) + 1;
|
||||
len += 4 + align4u (len1);
|
||||
}
|
||||
|
||||
|
@ -1011,13 +1014,14 @@ void nn_xmsg_addpar_subscription_keys (struct nn_xmsg *m, unsigned pid, const st
|
|||
tmp[i] = 0;
|
||||
}
|
||||
tmp += sizeof (int);
|
||||
*((unsigned *) tmp) = q->key_list.n;
|
||||
tmp += sizeof (unsigned);
|
||||
*((uint32_t *) tmp) = q->key_list.n;
|
||||
tmp += sizeof (uint32_t);
|
||||
for (i = 0; i < q->key_list.n; i++)
|
||||
{
|
||||
struct cdrstring *p = (struct cdrstring *) tmp;
|
||||
unsigned len1 = (unsigned) strlen (q->key_list.strs[i]) + 1;
|
||||
p->length = len1;
|
||||
size_t len1 = strlen (q->key_list.strs[i]) + 1;
|
||||
assert (len1 <= UINT32_MAX);
|
||||
p->length = (uint32_t)len1;
|
||||
memcpy (p->contents, q->key_list.strs[i], len1);
|
||||
if (len1 < align4u (len1))
|
||||
memset (p->contents + len1, 0, align4u (len1) - len1);
|
||||
|
@ -1077,7 +1081,7 @@ void nn_xmsg_addpar_eotinfo (struct nn_xmsg *m, unsigned pid, const struct nn_pr
|
|||
void nn_xmsg_addpar_dataholder (_In_ struct nn_xmsg *m, _In_ unsigned pid, _In_ const struct nn_dataholder *dh)
|
||||
{
|
||||
unsigned char *tmp;
|
||||
unsigned len;
|
||||
size_t len;
|
||||
|
||||
/* Get total payload length. */
|
||||
len = nn_xmsg_add_dataholder_padded(NULL, dh);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue