diff --git a/include/villas/hook.hpp b/include/villas/hook.hpp index 943f92983..27bd280c8 100644 --- a/include/villas/hook.hpp +++ b/include/villas/hook.hpp @@ -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); diff --git a/include/villas/node_type.h b/include/villas/node_type.h index 41bd45d7e..2d89da9f7 100644 --- a/include/villas/node_type.h +++ b/include/villas/node_type.h @@ -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. diff --git a/lib/hooks/dp.cpp b/lib/hooks/dp.cpp index 09a7bf7e3..60097c234 100644 --- a/lib/hooks/dp.cpp +++ b/lib/hooks/dp.cpp @@ -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 coeff = in[k]; std::complex 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) { diff --git a/lib/nodes/influxdb.cpp b/lib/nodes/influxdb.cpp index 8f6f4cfbc..8ffc7edb7 100644 --- a/lib/nodes/influxdb.cpp +++ b/lib/nodes/influxdb.cpp @@ -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]; diff --git a/lib/nodes/temper.cpp b/lib/nodes/temper.cpp index 88103fc70..374e49ea5 100644 --- a/lib/nodes/temper.cpp +++ b/lib/nodes/temper.cpp @@ -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 */ diff --git a/lib/path.cpp b/lib/path.cpp index 250ce6860..42e944454 100644 --- a/lib/path.cpp +++ b/lib/path.cpp @@ -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); diff --git a/lib/path_source.cpp b/lib/path_source.cpp index 7ac60f5f8..bed33d62c 100644 --- a/lib/path_source.cpp +++ b/lib/path_source.cpp @@ -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) diff --git a/lib/queue.cpp b/lib/queue.cpp index 52636afcc..777816af8 100644 --- a/lib/queue.cpp +++ b/lib/queue.cpp @@ -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;