1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

fix new cppcheck errors

This commit is contained in:
Steffen Vogel 2021-09-17 18:19:06 +02:00
parent be2402a181
commit 0dc8adcdd3
8 changed files with 12 additions and 16 deletions

View file

@ -180,7 +180,10 @@ protected:
std::string signalName;
public:
using Hook::Hook;
SingleSignalHook(struct vpath *p, struct vnode *n, int fl, int prio, bool en = true) :
Hook(p, n, fl, prio, en),
signalIndex(0)
{ }
virtual
void parse(json_t *json);

View file

@ -62,7 +62,6 @@ struct vnode_type {
villas::node::NodeList instances; /**< A list of all existing nodes of this type. */
size_t size; /**< Size of private data bock. @see node::_vd */
size_t pool_size;
struct {
/** Global initialization per node type.

View file

@ -105,6 +105,7 @@ protected:
/* Reconstruct the original signal */
for (int k = 0; k < fharmonics_len; k++) {
double freq = fharmonics[k];
// cppcheck-suppress objectIndex
std::complex<double> coeff = in[k];
std::complex<double> om = 2.0i * M_PI * freq * time;
@ -296,7 +297,7 @@ public:
virtual Hook::Reason process(sample *smp)
{
if (signal_index > smp->length)
if (signal_index >= smp->length)
return Hook::Reason::ERROR;
if (inverse) {

View file

@ -124,10 +124,10 @@ int influxdb_close(struct vnode *n)
int influxdb_write(struct vnode *n, struct sample * const smps[], unsigned cnt)
{
struct influxdb *i = (struct influxdb *) n->_vd;
char *buf = nullptr;
ssize_t sentlen, buflen;
auto *buf = strf("");
for (unsigned k = 0; k < cnt; k++) {
const struct sample *smp = smps[k];

View file

@ -126,8 +126,7 @@ void TEMPerDevice::read(struct sample *smp)
smp->flags = 0;
smp->length = i;
if (smp->length > 0)
smp->flags |= (int) SampleFlags::HAS_DATA;
smp->flags |= (int) SampleFlags::HAS_DATA;
}
/* Thanks to https://github.com/edorfaus/TEMPered */

View file

@ -237,7 +237,7 @@ static int path_prepare_poll(struct vpath *p)
int path_prepare(struct vpath *p, NodeList &nodes)
{
int ret;
unsigned pool_size;
unsigned pool_size = 0;
struct memory_type *pool_mt = memory_default;
@ -334,9 +334,6 @@ int path_prepare(struct vpath *p, NodeList &nodes)
for (size_t i = 0; i < vlist_length(&p->destinations); i++) {
auto *pd = (struct vpath_destination *) vlist_at(&p->destinations, i);
if (node_type(pd->node)->pool_size > pool_size)
pool_size = node_type(pd->node)->pool_size;
if (node_type(pd->node)->memory_type)
pool_mt = node_memory_type(pd->node);

View file

@ -54,9 +54,6 @@ int path_source_init_master(struct vpath_source *ps, struct vnode *n)
int pool_size = MAX(DEFAULT_QUEUE_LENGTH, 20 * ps->node->in.vectorize);
if (node_type(ps->node)->pool_size)
pool_size = node_type(ps->node)->pool_size;
ret = pool_init(&ps->pool, pool_size, SAMPLE_LENGTH(node_input_signals_max_cnt(ps->node)), node_memory_type(ps->node));
if (ret)

View file

@ -163,7 +163,7 @@ int queue_push_many(struct queue *q, void *ptr[], size_t cnt)
int ret;
size_t i;
for (i = 0; i < cnt; i++) {
for (ret = 0, i = 0; i < cnt; i++) {
ret = queue_push(q, ptr[i]);
if (ret <= 0)
break;
@ -180,7 +180,7 @@ int queue_pull_many(struct queue *q, void *ptr[], size_t cnt)
int ret;
size_t i;
for (i = 0; i < cnt; i++) {
for (ret = 0, i = 0; i < cnt; i++) {
ret = queue_pull(q, &ptr[i]);
if (ret <= 0)
break;