stricter warning checks and the corresponding fixes

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

View file

@ -59,7 +59,6 @@ static struct topictab{
const unsigned int MAX_SAMPLES = 10;
unsigned int states = DDS_ANY_SAMPLE_STATE | DDS_ANY_VIEW_STATE | DDS_ANY_INSTANCE_STATE;
int status = 0;
int reader_wait = 0;
dds_entity_t participant;
dds_entity_t subscriber;
@ -68,8 +67,8 @@ dds_sample_info_t info[10];
dds_qos_t* tqos;
dds_qos_t* sqos;
void _zero(void ** samples, int size) {
int i;
void _zero(void ** samples, size_t size) {
size_t i;
for(i = 0; i < size;i++) {
samples[i] = NULL;
}
@ -416,6 +415,7 @@ void print_dcps_topic(FILE *fp){
reader_wait = dds_reader_wait_for_historical_data(dcps_topic_reader, DDS_SECS(5));
PRINTD("reader wait status: %d, %s \n", reader_wait, dds_err_str(reader_wait));
while(true){
int status = 0;
zero(dcps_topic_samples, MAX_SAMPLES);
status = dds_take_mask(dcps_topic_reader, (void**)dcps_topic_samples, info, MAX_SAMPLES, MAX_SAMPLES, states);
PRINTD("DDS reading samples returns %d \n", status);
@ -457,6 +457,7 @@ void print_dcps_participant(FILE *fp){
reader_wait = dds_reader_wait_for_historical_data(dcps_participant_reader, DDS_SECS(5));
PRINTD("reader wait status: %d, %s \n", reader_wait, dds_err_str(reader_wait));
while(true){
int status = 0;
zero(dcps_participant_samples, MAX_SAMPLES);
status = dds_take_mask(dcps_participant_reader, (void**)dcps_participant_samples, info, MAX_SAMPLES, MAX_SAMPLES, states);
PRINTD("DDS reading samples returns %d \n", status);
@ -484,6 +485,7 @@ void print_dcps_subscription(FILE *fp){
reader_wait = dds_reader_wait_for_historical_data(dcps_subscription_reader, DDS_SECS(5));
PRINTD("reader wait status: %d, %s \n", reader_wait, dds_err_str(reader_wait));
while(true){
int status = 0;
zero(dcps_subscription_samples, MAX_SAMPLES);
status = dds_take_mask(dcps_subscription_reader, (void**)dcps_subscription_samples, info, MAX_SAMPLES, MAX_SAMPLES, states);
PRINTD("DDS reading samples returns %d \n", status);
@ -526,6 +528,7 @@ void print_dcps_publication(FILE *fp){
reader_wait = dds_reader_wait_for_historical_data(dcps_publication_reader, DDS_SECS(5));
PRINTD("reader wait status: %d, %s \n", reader_wait, dds_err_str(reader_wait));
while(true){
int status = 0;
zero(dcps_publication_samples, MAX_SAMPLES);
status = dds_take_mask(dcps_publication_reader, (void**)dcps_publication_samples, info, MAX_SAMPLES, MAX_SAMPLES, states);
PRINTD("DDS reading samples returns %d \n", status);
@ -569,6 +572,7 @@ void print_cm_participant(FILE *fp){
reader_wait = dds_reader_wait_for_historical_data(cm_participant_reader, DDS_SECS(5));
PRINTD("reader wait status: %d, %s \n", reader_wait, dds_err_str(reader_wait));
while(true){
int status = 0;
zero(cm_participant_samples, MAX_SAMPLES);
status = dds_take_mask(cm_participant_reader, (void**)cm_participant_samples, info, MAX_SAMPLES, MAX_SAMPLES, states);
PRINTD("DDS reading samples returns %d \n", status);
@ -596,6 +600,7 @@ void print_cm_publisher(FILE *fp){
reader_wait = dds_reader_wait_for_historical_data(cm_publisher_reader, DDS_SECS(5));
PRINTD("reader wait status: %d, %s \n", reader_wait, dds_err_str(reader_wait));
while(true){
int status = 0;
zero(cm_publisher_samples, MAX_SAMPLES);
status = dds_take_mask(cm_publisher_reader, (void**)cm_publisher_samples, info, MAX_SAMPLES, MAX_SAMPLES, states);
PRINTD("DDS reading samples returns %d \n", status);
@ -627,7 +632,8 @@ void print_cm_subscriber(FILE *fp){
reader_wait = dds_reader_wait_for_historical_data(cm_subscriber_reader, DDS_SECS(5));
PRINTD("reader wait status: %d, %s \n", reader_wait, dds_err_str(reader_wait));
while(true){
zero(cm_subscriber_samples, MAX_SAMPLES);
int status = 0;
zero(cm_subscriber_samples, MAX_SAMPLES);
status = dds_take_mask(cm_subscriber_reader, (void**)cm_subscriber_samples, info, MAX_SAMPLES, MAX_SAMPLES, states);
PRINTD("DDS reading samples returns %d \n", status);
for(i = 0; i < status; i++) {
@ -659,6 +665,7 @@ void print_cm_datawriter(FILE *fp){
reader_wait = dds_reader_wait_for_historical_data(cm_datawriter_reader, DDS_SECS(5));
PRINTD("reader wait status: %d, %s \n", reader_wait, dds_err_str(reader_wait));
while(true){
int status = 0;
zero(cm_datawriter_samples, MAX_SAMPLES);
status = dds_take_mask(cm_datawriter_reader, (void**)cm_datawriter_samples, info, MAX_SAMPLES, MAX_SAMPLES, states);
PRINTD("DDS reading samples returns %d \n", status);
@ -691,6 +698,7 @@ void print_cm_datareader(FILE *fp){
reader_wait = dds_reader_wait_for_historical_data(cm_datareader_reader, DDS_SECS(5));
PRINTD("reader wait status: %d, %s \n", reader_wait, dds_err_str(reader_wait));
while(true){
int status = 0;
zero(cm_datareader_samples, MAX_SAMPLES);
status = dds_take_mask(cm_datareader_reader, (void**)cm_datareader_samples, info, MAX_SAMPLES, MAX_SAMPLES, states);
PRINTD("DDS reading samples returns %d \n", status);
@ -719,7 +727,7 @@ void print_cm_datareader(FILE *fp){
void usage(){
/*describe the default options*/
int tpindex;
size_t tpindex;
printf("\n OPTIONS:\n");
printf("-f <filename> <topics> -- write to file\n");
printf("-a -- all topics\n");
@ -733,7 +741,7 @@ int main(int argc, char **argv){
FILE *fp = NULL;
int flags = 0;
int j;
int index;
size_t index;
char *fname = NULL;
if(argc == 1){
usage();
@ -777,7 +785,7 @@ int main(int argc, char **argv){
// it's an option, don't process it...
continue;
}
int k;
size_t k;
bool matched = false;
for(k = 0; k < TOPICTAB_SIZE; k++) {
if(os_strcasecmp(argv[j], topictab[k].name) == 0) {

View file

@ -133,7 +133,7 @@ void hist_print(struct hist *h, dds_time_t dt, int reset) {
const size_t hist_size = sizeof(char) * h->nbins + 1;
char *l = (char *) dds_alloc(l_size);
char *hist = (char *) dds_alloc(hist_size);
double dt_s = dt / 1e9, avg;
double dt_s = (double)dt / 1e9, avg;
uint64_t peak = 0, cnt = h->under + h->over;
size_t p = 0;
hist[h->nbins] = 0;
@ -160,7 +160,7 @@ void hist_print(struct hist *h, dds_time_t dt, int reset) {
else hist[i] = '@';
}
avg = cnt / dt_s;
avg = (double)cnt / dt_s;
if (avg < 999.5)
xsnprintf(l, l_size, &p, "%5.3g", avg);
else if (avg < 1e6)
@ -172,9 +172,9 @@ void hist_print(struct hist *h, dds_time_t dt, int reset) {
if (cnt < (uint64_t) 10e3)
xsnprintf(l, l_size, &p, "%5"PRIu64" ", cnt);
else if (cnt < (uint64_t) 1e6)
xsnprintf(l, l_size, &p, "%5.1fk", cnt / 1e3);
xsnprintf(l, l_size, &p, "%5.1fk", (double)cnt / 1e3);
else
xsnprintf(l, l_size, &p, "%5.1fM", cnt / 1e6);
xsnprintf(l, l_size, &p, "%5.1fM", (double)cnt / 1e6);
xsnprintf(l, l_size, &p, " in %.1fs) ", dt_s);
@ -395,13 +395,13 @@ static void inapplicable_qos(dds_entity_kind_t qt, const char *n) {
fprintf(stderr, "warning: %s entity ignoring inapplicable QoS \"%s\"\n", en, n);
}
#define get_qos_T(qt, q, n) ((qt == DDS_KIND_TOPIC) ? q : (inapplicable_qos((qt), n), NULL))
#define get_qos_R(qt, q, n) ((qt == DDS_KIND_READER) ? q : (inapplicable_qos((qt), n), NULL))
#define get_qos_W(qt, q, n) ((qt == DDS_KIND_WRITER) ? q : (inapplicable_qos((qt), n), NULL))
#define get_qos_TW(qt, q, n) ((qt == DDS_KIND_TOPIC) || (qt == DDS_KIND_WRITER) ? q : (inapplicable_qos((qt), n), NULL))
#define get_qos_RW(qt, q, n) ((qt == DDS_KIND_READER) || (qt == DDS_KIND_WRITER) ? q : (inapplicable_qos((qt), n), NULL))
#define get_qos_PS(qt, q, n) ((qt == DDS_KIND_PUBLISHER) || (qt == DDS_KIND_SUBSCRIBER) ? q : (inapplicable_qos((qt), n), NULL))
#define get_qos_TRW(qt, q, n) ((qt == DDS_KIND_TOPIC) || (qt == DDS_KIND_READER) || (qt == DDS_KIND_WRITER) ? q : (inapplicable_qos((qt), n), NULL))
#define get_qos_T(qt, q, n) ((qt == DDS_KIND_TOPIC) ? q : (inapplicable_qos((qt), n), (dds_qos_t*)0))
#define get_qos_R(qt, q, n) ((qt == DDS_KIND_READER) ? q : (inapplicable_qos((qt), n), (dds_qos_t*)0))
#define get_qos_W(qt, q, n) ((qt == DDS_KIND_WRITER) ? q : (inapplicable_qos((qt), n), (dds_qos_t*)0))
#define get_qos_TW(qt, q, n) ((qt == DDS_KIND_TOPIC) || (qt == DDS_KIND_WRITER) ? q : (inapplicable_qos((qt), n), (dds_qos_t*)0))
#define get_qos_RW(qt, q, n) ((qt == DDS_KIND_READER) || (qt == DDS_KIND_WRITER) ? q : (inapplicable_qos((qt), n), (dds_qos_t*)0))
#define get_qos_PS(qt, q, n) ((qt == DDS_KIND_PUBLISHER) || (qt == DDS_KIND_SUBSCRIBER) ? q : (inapplicable_qos((qt), n), (dds_qos_t*)0))
#define get_qos_TRW(qt, q, n) ((qt == DDS_KIND_TOPIC) || (qt == DDS_KIND_READER) || (qt == DDS_KIND_WRITER) ? q : (inapplicable_qos((qt), n), (dds_qos_t*)0))
void qos_durability(dds_entity_kind_t qt, dds_qos_t *q, const char *arg) {
dds_qos_t *qp = get_qos_TRW(qt, q, "durability");
@ -484,15 +484,15 @@ static unsigned char gethexchar(const char **str) {
switch (**str) {
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
v = 16 * v + (unsigned char) **str - '0';
v = (unsigned char) (16 * v + (unsigned char) **str - '0');
(*str)++;
break;
case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
v = 16 * v + (unsigned char) **str - 'a' + 10;
v = (unsigned char) (16 * v + (unsigned char) **str - 'a' + 10);
(*str)++;
break;
case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
v = 16 * v + (unsigned char) **str - 'A' + 10;
v = (unsigned char) (16 * v + (unsigned char) **str - 'A' + 10);
(*str)++;
break;
default:
@ -511,7 +511,7 @@ static unsigned char getoctchar(const char **str) {
int nseen = 0;
while (**str && nseen < 3) {
if (**str >= '0' && **str <= '7') {
v = 8 * v + (unsigned char) **str - '0';
v = (unsigned char) (8 * v + (unsigned char) **str - '0');
(*str)++;
nseen++;
} else {
@ -859,6 +859,7 @@ QOS (not all are universally applicable):\n\
void set_qosprovider(const char *arg) {
//Todo: There is no qosprovider_create in dds.h, yet
(void)arg;
// int result = DDS_RETCODE_OK;
// const char *p = strchr(arg, ',');
// const char *xs = strstr(arg, "://");

View file

@ -74,11 +74,11 @@ void hist_record(struct hist *h, uint64_t x, unsigned weight);
void hist_print(struct hist *h, dds_time_t dt, int reset);
void error(const char *fmt, ...);
#define error_abort(rc, fmt, ...) if (rc < DDS_SUCCESS) { error(fmt); DDS_ERR_CHECK(rc, DDS_CHECK_FAIL); }
#define error_report(rc, fmt, ...) if (rc < DDS_SUCCESS) { error(fmt); DDS_ERR_CHECK(rc, DDS_CHECK_REPORT); }
#define error_return(rc, fmt, ...) if (rc < DDS_SUCCESS) { error_report(rc, fmt); return; }
#define error_exit(fmt, ...) { error(fmt); exit(2); }
#define os_error_exit(osres, fmt, ...) if (osres != os_resultSuccess) { error(fmt); exit(2); }
#define error_abort(rc, ...) if (rc < DDS_SUCCESS) { error(__VA_ARGS__); DDS_ERR_CHECK(rc, DDS_CHECK_FAIL); }
#define error_report(rc, ...) if (rc < DDS_SUCCESS) { error(__VA_ARGS__); DDS_ERR_CHECK(rc, DDS_CHECK_REPORT); }
#define error_return(rc, ...) if (rc < DDS_SUCCESS) { error_report(rc, __VA_ARGS__); return; }
#define error_exit(...) { error(__VA_ARGS__); exit(2); }
#define os_error_exit(osres, ...) if (osres != os_resultSuccess) { error(__VA_ARGS__); exit(2); }
void save_argv0(const char *argv0);
int common_init(const char *argv0);

View file

@ -919,6 +919,12 @@ static void print_seq_OU(dds_time_t *tstart, dds_time_t tnow, dds_entity_t rd __
}
static void print_seq_ARB(dds_time_t *tstart, dds_time_t tnow, dds_entity_t rd __attribute__ ((unused)), const char *tag, const dds_sample_info_t *iseq, const void **mseq, const struct tgtopic *tgtp) {
(void)tnow;
(void)tstart;
(void)tag;
(void)iseq;
(void)mseq;
(void)tgtp;
// TODO ARB type support
// unsigned i;
// for (i = 0; i < mseq->_length; i++)
@ -1047,6 +1053,7 @@ static void wr_on_publication_matched(dds_entity_t wr __attribute__((unused)), c
static int register_instance_wrapper(dds_entity_t wr, const void *d, const dds_time_t tstamp) {
dds_instance_handle_t handle;
(void)tstamp;
return dds_register_instance(wr, &handle, d);
}
@ -1221,7 +1228,7 @@ static void pub_do_auto(const struct writerspec *spec) {
t = dds_time();
}
if (++bi == spec->burstsize) {
while (((ntot / spec->burstsize) / ((t - tfirst0) / 1e9 + 5e-3)) > spec->writerate && !termflag) {
while (((double)(ntot / spec->burstsize) / ((double)(t - tfirst0) / 1e9 + 5e-3)) > spec->writerate && !termflag) {
/* FIXME: only doing this manually because batching is not yet implemented properly */
dds_write_flush(spec->wr);
dds_sleepfor(DDS_MSECS(10));
@ -1236,7 +1243,7 @@ static void pub_do_auto(const struct writerspec *spec) {
tlast = dds_time();
hist_print(hist, tlast - tfirst, 0);
hist_free(hist);
printf ("total writes: %" PRId64 " (%e/s)\n", ntot, ntot * 1e9 / (tlast - tfirst0));
printf ("total writes: %" PRId64 " (%e/s)\n", ntot, (double)ntot * 1e9 / (double)(tlast - tfirst0));
if (spec->topicsel == KS) {
dds_free(d.ks.baggage._buffer);
}
@ -1592,7 +1599,7 @@ static uint32_t subthread(void *vspec) {
dds_entity_t stcond = 0;
dds_return_t rc;
uintptr_t exitcode = 0;
char tag[256];
char tag[270];
char tn[256];
size_t nxs = 0;
@ -1680,6 +1687,7 @@ static uint32_t subthread(void *vspec) {
tnow = dds_time();
for (gi = 0; gi < (spec->polling ? 1 : nxs); gi++) {
dds_entity_t cond = !spec->polling && xs[gi] != 0 ? (dds_entity_t) xs[gi] : 0;
dds_return_t nread;
int32_t i;
if (cond == termcond)
@ -1724,22 +1732,22 @@ static uint32_t subthread(void *vspec) {
// error ("DDS_Subscriber_begin_access: %d (%s)\n", (int) result, dds_err_str(result));
if (spec->mode == MODE_CHECK || (spec->mode == MODE_DUMP && spec->use_take) || spec->polling) {
rc = dds_take_mask(rd, mseq, iseq, spec->read_maxsamples, spec->read_maxsamples, DDS_ANY_STATE);
nread = dds_take_mask(rd, mseq, iseq, spec->read_maxsamples, spec->read_maxsamples, DDS_ANY_STATE);
} else if (spec->mode == MODE_DUMP) {
rc = dds_read_mask(rd, mseq, iseq, spec->read_maxsamples, spec->read_maxsamples, DDS_ANY_STATE);
nread = dds_read_mask(rd, mseq, iseq, spec->read_maxsamples, spec->read_maxsamples, DDS_ANY_STATE);
} else if (spec->use_take || cond == rdcondD) {
rc = dds_take(cond, mseq, iseq, spec->read_maxsamples, spec->read_maxsamples);
nread = dds_take(cond, mseq, iseq, spec->read_maxsamples, spec->read_maxsamples);
} else {
rc = dds_read(cond, mseq, iseq, spec->read_maxsamples, spec->read_maxsamples);
nread = dds_read(cond, mseq, iseq, spec->read_maxsamples, spec->read_maxsamples);
}
if (rc < 1) {
if (spec->polling && rc == 0) {
if (nread < 1) {
if (spec->polling && nread == 0) {
; /* expected */
} else if (spec->mode == MODE_CHECK || spec->mode == MODE_DUMP || spec->polling) {
printf ("%s: %d (%s) on %s\n", (!spec->use_take && spec->mode == MODE_DUMP) ? "read" : "take", (int) rc, dds_err_str(rc), spec->polling ? "poll" : "stcond");
printf ("%s: %d (%s) on %s\n", (!spec->use_take && spec->mode == MODE_DUMP) ? "read" : "take", (int) nread, dds_err_str(nread), spec->polling ? "poll" : "stcond");
} else {
printf ("%s: %d (%s) on rdcond%s\n", spec->use_take ? "take" : "read", (int) rc, dds_err_str(rc), (cond == rdcondA) ? "A" : (cond == rdcondD) ? "D" : "?");
printf ("%s: %d (%s) on rdcond%s\n", spec->use_take ? "take" : "read", (int) nread, dds_err_str(nread), (cond == rdcondA) ? "A" : (cond == rdcondD) ? "D" : "?");
}
continue;
}
@ -1753,18 +1761,18 @@ static uint32_t subthread(void *vspec) {
case MODE_DUMP:
switch (spec->topicsel) {
case UNSPEC: assert(0);
case KS: print_seq_KS(&tstart, tnow, rd, tag, iseq, (KeyedSeq **)mseq, rc); break;
case K32: print_seq_K32(&tstart, tnow, rd, tag, iseq, (Keyed32 **)mseq, rc); break;
case K64: print_seq_K64(&tstart, tnow, rd, tag, iseq, (Keyed64 **)mseq, rc); break;
case K128: print_seq_K128(&tstart, tnow, rd, tag, iseq, (Keyed128 **)mseq, rc); break;
case K256: print_seq_K256(&tstart, tnow, rd, tag, iseq, (Keyed256 **)mseq, rc); break;
case OU: print_seq_OU(&tstart, tnow, rd, tag, iseq, (const OneULong **)mseq, rc); break;
case KS: print_seq_KS(&tstart, tnow, rd, tag, iseq, (KeyedSeq **)mseq, nread); break;
case K32: print_seq_K32(&tstart, tnow, rd, tag, iseq, (Keyed32 **)mseq, nread); break;
case K64: print_seq_K64(&tstart, tnow, rd, tag, iseq, (Keyed64 **)mseq, nread); break;
case K128: print_seq_K128(&tstart, tnow, rd, tag, iseq, (Keyed128 **)mseq, nread); break;
case K256: print_seq_K256(&tstart, tnow, rd, tag, iseq, (Keyed256 **)mseq, nread); break;
case OU: print_seq_OU(&tstart, tnow, rd, tag, iseq, (const OneULong **)mseq, nread); break;
case ARB: print_seq_ARB(&tstart, tnow, rd, tag, iseq, (const void **)mseq, spec->tgtp); break;
}
break;
case MODE_CHECK:
for (i = 0; i < rc; i++) {
for (i = 0; i < nread; i++) {
int keyval = 0;
unsigned seq = 0;
unsigned size = 0;
@ -1793,7 +1801,7 @@ static uint32_t subthread(void *vspec) {
const dds_time_t tdelta_s = tdelta_ns / DDS_NSECS_IN_SEC;
const dds_time_t tdelta_ms = ((tdelta_ns % DDS_NSECS_IN_SEC) + 500000) / DDS_NSECS_IN_MSEC;
const long long ndelta = nreceived - last_nreceived;
const double rate_Mbps = (nreceived_bytes - last_nreceived_bytes) * 8 / 1e6;
const double rate_Mbps = (double)(nreceived_bytes - last_nreceived_bytes) * 8 / 1e6;
printf ("%"PRId64".%03"PRId64" ntot %lld nseq %lld ndelta %lld rate %.2f Mb/s\n",
tdelta_s, tdelta_ms, nreceived, out_of_seq, ndelta, rate_Mbps);
last_nreceived = nreceived;
@ -1807,7 +1815,7 @@ static uint32_t subthread(void *vspec) {
case MODE_ZEROLOAD:
break;
}
rc = dds_return_loan(rd, mseq, spec->read_maxsamples);
rc = dds_return_loan(rd, mseq, nread);
error_report(rc, "dds_return_loan failed");
if (spec->sleep_ns) {
dds_sleepfor(spec->sleep_ns);
@ -1822,13 +1830,14 @@ static uint32_t subthread(void *vspec) {
// error ("DDS_Subscriber_begin_access: %d (%s)\n", (int) result, dds_err_str (result));
/* This is the final Read/Take */
rc = dds_take_mask(rd, mseq, iseq, spec->read_maxsamples, spec->read_maxsamples, DDS_ANY_STATE);
if (rc == 0) {
dds_return_t nread;
nread = dds_take_mask(rd, mseq, iseq, spec->read_maxsamples, spec->read_maxsamples, DDS_ANY_STATE);
if (nread == 0) {
if (!once_mode)
printf ("-- final take: data reader empty --\n");
else
exitcode = 1;
} else if (rc < DDS_SUCCESS) {
} else if (nread < DDS_SUCCESS) {
if (!once_mode) {
error_report(rc, "-- final take --\n");
} else {
@ -1840,12 +1849,12 @@ static uint32_t subthread(void *vspec) {
if (spec->mode == MODE_PRINT || spec->mode == MODE_DUMP) {
switch (spec->topicsel) {
case UNSPEC: assert(0);
case KS: print_seq_KS(&tstart, dds_time(), rd, tag, iseq, (KeyedSeq **) mseq, rc); break;
case K32: print_seq_K32(&tstart, dds_time(), rd, tag, iseq, (Keyed32 **) mseq, rc); break;
case K64: print_seq_K64(&tstart, dds_time(), rd, tag, iseq, (Keyed64 **) mseq, rc); break;
case K128: print_seq_K128(&tstart, dds_time(), rd, tag, iseq, (Keyed128 **) mseq, rc); break;
case K256: print_seq_K256(&tstart, dds_time(), rd, tag, iseq, (Keyed256 **) mseq, rc); break;
case OU: print_seq_OU(&tstart, dds_time(), rd, tag, iseq, (const OneULong **) mseq, rc); break;
case KS: print_seq_KS(&tstart, dds_time(), rd, tag, iseq, (KeyedSeq **) mseq, nread); break;
case K32: print_seq_K32(&tstart, dds_time(), rd, tag, iseq, (Keyed32 **) mseq, nread); break;
case K64: print_seq_K64(&tstart, dds_time(), rd, tag, iseq, (Keyed64 **) mseq, nread); break;
case K128: print_seq_K128(&tstart, dds_time(), rd, tag, iseq, (Keyed128 **) mseq, nread); break;
case K256: print_seq_K256(&tstart, dds_time(), rd, tag, iseq, (Keyed256 **) mseq, nread); break;
case OU: print_seq_OU(&tstart, dds_time(), rd, tag, iseq, (const OneULong **) mseq, nread); break;
case ARB: print_seq_ARB(&tstart, dds_time(), rd, tag, iseq, (const void **) mseq, spec->tgtp); break;
}
}
@ -1853,7 +1862,7 @@ static uint32_t subthread(void *vspec) {
// TODO coherency support
// if (need_access && (result = DDS_Subscriber_end_access(sub)) != DDS_RETCODE_OK)
// error ("DDS_Subscriber_end_access: %d (%s)\n", (int) result, dds_err_str(result));
rc = dds_return_loan(rd, mseq, spec->read_maxsamples);
rc = dds_return_loan(rd, mseq, nread);
error_report(rc, "dds_return_loan failed");
}
dds_free(iseq);
@ -1973,6 +1982,7 @@ static int get_metadata(char **metadata, char **typename, char **keylist, const
static dds_entity_t find_topic(dds_entity_t dpFindTopic, const char *name, const dds_duration_t *timeout) {
dds_entity_t tp;
(void)timeout;
// TODO ARB type support
// int isbuiltin = 0;
@ -2077,8 +2087,8 @@ static void addspec(unsigned whatfor, unsigned *specsofar, unsigned *specidx, st
*specsofar |= whatfor;
}
static void set_print_mode(const char *optarg) {
char *copy = dds_string_dup(optarg), *cursor = copy, *tok;
static void set_print_mode(const char *modestr) {
char *copy = dds_string_dup(modestr), *cursor = copy, *tok;
while ((tok = os_strsep(&cursor, ",")) != NULL) {
int enable;
if (strncmp(tok, "no", 2) == 0)
@ -2121,7 +2131,7 @@ static void set_print_mode(const char *optarg) {
else
print_metadata &= ~tab[i].flag;
} else {
fprintf (stderr, "-P %s: invalid print mode\n", optarg);
fprintf (stderr, "-P %s: invalid print mode\n", modestr);
exit(2);
}
}
@ -2136,11 +2146,11 @@ int MAIN(int argc, char *argv[]) {
dds_listener_t *wrlistener = dds_listener_create(NULL);
dds_qos_t *qos;
const char **qtopic = (const char **) dds_alloc(sizeof(char *) * argc);
const char **qreader = (const char **) dds_alloc(sizeof(char *) * (2+argc));
const char **qwriter = (const char **) dds_alloc(sizeof(char *) * (2+argc));
const char **qpublisher = (const char **) dds_alloc(sizeof(char *) * (2+argc));
const char **qsubscriber = (const char **) dds_alloc(sizeof(char *) * (2+argc));
const char **qtopic = (const char **) dds_alloc(sizeof(char *) * (unsigned)argc);
const char **qreader = (const char **) dds_alloc(sizeof(char *) * (2+(unsigned)argc));
const char **qwriter = (const char **) dds_alloc(sizeof(char *) * (2+(unsigned)argc));
const char **qpublisher = (const char **) dds_alloc(sizeof(char *) * (2+(unsigned)argc));
const char **qsubscriber = (const char **) dds_alloc(sizeof(char *) * (2+(unsigned)argc));
int nqtopic = 0, nqreader = 0, nqwriter = 0;
int nqpublisher = 0, nqsubscriber = 0;
int opt, pos;
@ -2344,7 +2354,7 @@ int MAIN(int argc, char *argv[]) {
break;
}
case 'n':
spec[specidx].rd.read_maxsamples = atoi(os_get_optarg());
spec[specidx].rd.read_maxsamples = (uint32_t)atoi(os_get_optarg());
break;
case 'O':
once_mode = 1;
@ -2503,7 +2513,7 @@ int MAIN(int argc, char *argv[]) {
dds_write_set_batch(true); // FIXME: hack (the global batching flag is a hack anyway)
{
char **ps = (char **) dds_alloc(sizeof(char *) * (argc - os_get_optind()));
char **ps = (char **) dds_alloc(sizeof(char *) * (uint32_t)(argc - os_get_optind()));
for (i = 0; i < (unsigned) (argc - os_get_optind()); i++)
ps[i] = expand_envvars(argv[(unsigned) os_get_optind() + i]);
if (want_reader) {