mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
fix: several compiler warnings / errors emitted by clang
This commit is contained in:
parent
3c4bca7cf8
commit
f569f14602
6 changed files with 21 additions and 17 deletions
|
@ -73,7 +73,7 @@ int hook_jitter_ts(struct hook *h, struct sample *smps[], size_t *cnt)
|
|||
D(i,j) = (Rj-Ri)-(Sj-Si) = (Rj-Sj)-(Ri-Si)
|
||||
J(i) = J(i-1)+(|D(i-1,i)|-J(i-1))/16
|
||||
*/
|
||||
jitter_val[(curr_count+1)%GPS_NTP_DELAY_WIN_SIZE] = jitter_val[curr_count] + (abs(curr_delay_us) - jitter_val[curr_count])/16;
|
||||
jitter_val[(curr_count+1)%GPS_NTP_DELAY_WIN_SIZE] = jitter_val[curr_count] + (labs(curr_delay_us) - jitter_val[curr_count])/16;
|
||||
|
||||
stats("%s: jitter=%" PRId64 " usec, moving average=%" PRId64 " usec, moving variance=%" PRId64 " usec", __FUNCTION__, jitter_val[(curr_count+1)%GPS_NTP_DELAY_WIN_SIZE], moving_avg[curr_count], moving_var[curr_count]);
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
int mapping_entry_parse_str(struct mapping_entry *e, const char *str)
|
||||
{
|
||||
int id;
|
||||
char *cpy, *type, *field, *subfield, *end;
|
||||
|
||||
cpy = strdup(str);
|
||||
|
@ -56,10 +57,12 @@ int mapping_entry_parse_str(struct mapping_entry *e, const char *str)
|
|||
if (end)
|
||||
goto invalid_format;
|
||||
|
||||
e->stats.id = stats_lookup_id(field);
|
||||
if (e->stats.id < 0)
|
||||
id = stats_lookup_id(field);
|
||||
if (id < 0)
|
||||
goto invalid_format;
|
||||
|
||||
e->stats.id = id;
|
||||
|
||||
if (!strcmp(subfield, "total"))
|
||||
e->stats.type = MAPPING_STATS_TYPE_TOTAL;
|
||||
else if (!strcmp(subfield, "last"))
|
||||
|
|
|
@ -87,26 +87,21 @@ static struct timespec file_calc_read_offset(const struct timespec *first, const
|
|||
switch (mode) {
|
||||
case FILE_EPOCH_DIRECT: /* read first value at now + epoch */
|
||||
offset = time_diff(first, &now);
|
||||
offset = time_add(&offset, epoch);
|
||||
break;
|
||||
return time_add(&offset, epoch);
|
||||
|
||||
case FILE_EPOCH_WAIT: /* read first value at now + first + epoch */
|
||||
offset = now;
|
||||
return time_add(&now, epoch);
|
||||
break;
|
||||
|
||||
case FILE_EPOCH_RELATIVE: /* read first value at first + epoch */
|
||||
return *epoch;
|
||||
break;
|
||||
|
||||
case FILE_EPOCH_ABSOLUTE: /* read first value at f->read_epoch */
|
||||
return time_diff(first, epoch);
|
||||
break;
|
||||
|
||||
default: { }
|
||||
default:
|
||||
return (struct timespec) { 0 };
|
||||
}
|
||||
|
||||
return offset;
|
||||
}
|
||||
|
||||
int file_parse(struct node *n, config_setting_t *cfg)
|
||||
|
|
|
@ -49,14 +49,17 @@ int signal_parse(struct node *n, config_setting_t *cfg)
|
|||
{
|
||||
struct signal *s = n->_vd;
|
||||
|
||||
int ret;
|
||||
const char *type;
|
||||
|
||||
if (!config_setting_lookup_string(cfg, "signal", &type))
|
||||
s->type = SIGNAL_TYPE_MIXED;
|
||||
else {
|
||||
s->type = signal_lookup_type(type);
|
||||
if (s->type == -1)
|
||||
ret = signal_lookup_type(type);
|
||||
if (ret == -1)
|
||||
cerror(cfg, "Unknown signal type '%s'", type);
|
||||
|
||||
s->type = ret;
|
||||
}
|
||||
|
||||
if (!config_setting_lookup_bool(cfg, "realtime", &s->rt))
|
||||
|
@ -85,6 +88,7 @@ int signal_parse(struct node *n, config_setting_t *cfg)
|
|||
|
||||
int signal_parse_cli(struct node *n, int argc, char *argv[])
|
||||
{
|
||||
int ret;
|
||||
char *type;
|
||||
|
||||
struct signal *s = n->_vd;
|
||||
|
@ -139,10 +143,12 @@ check: if (optarg == endptr)
|
|||
|
||||
type = argv[optind];
|
||||
|
||||
s->type = signal_lookup_type(type);
|
||||
if (s->type == -1)
|
||||
ret = signal_lookup_type(type);
|
||||
if (ret == -1)
|
||||
error("Invalid signal type: %s", type);
|
||||
|
||||
s->type = ret;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -375,7 +375,7 @@ int websocket_deinit()
|
|||
|
||||
/* Wait for all connections to be closed */
|
||||
while (list_length(&connections) > 0)
|
||||
sleep(0.2);
|
||||
usleep(0.2*1e6);
|
||||
|
||||
list_destroy(&connections, (dtor_cb_t) websocket_destination_destroy, true);
|
||||
|
||||
|
|
|
@ -188,7 +188,7 @@ int queue_pull_many(struct queue *q, void *ptr[], size_t cnt)
|
|||
|
||||
int queue_close(struct queue *q)
|
||||
{
|
||||
int expected = STATE_INITIALIZED;
|
||||
enum state expected = STATE_INITIALIZED;
|
||||
if (atomic_compare_exchange_weak_explicit(&q->state, &expected, STATE_STOPPED, memory_order_relaxed, memory_order_relaxed))
|
||||
return 0;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue