From 2014b8b61ab6acff52b1b9e0eefa9fe09b63a15f Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 11 Sep 2020 16:17:38 +0200 Subject: [PATCH] final cppcheck fixes --- .gitlab-ci.yml | 1 + lib/formats/value.cpp | 1 + lib/nodes/websocket.cpp | 6 +++--- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f3ac79fce..3a1a34978 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -178,6 +178,7 @@ test:cppcheck: --inline-suppr --enable=warning,performance,portability,information,missingInclude --std=c++11 + --suppress=noValidConfiguration -I include -I common/include src/ diff --git a/lib/formats/value.cpp b/lib/formats/value.cpp index c6ed3b596..18f3da704 100644 --- a/lib/formats/value.cpp +++ b/lib/formats/value.cpp @@ -93,6 +93,7 @@ out: smp->flags = 0; } static struct plugin p; + __attribute__((constructor(110))) static void UNIQUE(__ctor)() { p.name = "value"; p.description = "A bare text value without any headers"; diff --git a/lib/nodes/websocket.cpp b/lib/nodes/websocket.cpp index 31efce258..6e3aad0b3 100644 --- a/lib/nodes/websocket.cpp +++ b/lib/nodes/websocket.cpp @@ -278,9 +278,9 @@ int websocket_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, voi pulled = queue_pull_many(&c->queue, (void **) smps, cnt); if (pulled > 0) { size_t wbytes; - io_sprint(&c->io, c->buffers.send->buf + LWS_PRE, c->buffers.send->size - LWS_PRE, &wbytes, smps, pulled); + io_sprint(&c->io, c->buffers.send->buf.data() + LWS_PRE, c->buffers.send->buf.size() - LWS_PRE, &wbytes, smps, pulled); - ret = lws_write(wsi, (unsigned char *) c->buffers.send->buf + LWS_PRE, wbytes, c->io.flags & (int) IOFlags::HAS_BINARY_PAYLOAD ? LWS_WRITE_BINARY : LWS_WRITE_TEXT); + ret = lws_write(wsi, (unsigned char *) c->buffers.send->buf.data() + LWS_PRE, wbytes, c->io.flags & (int) IOFlags::HAS_BINARY_PAYLOAD ? LWS_WRITE_BINARY : LWS_WRITE_TEXT); sample_decref_many(smps, pulled); @@ -328,7 +328,7 @@ int websocket_protocol_cb(struct lws *wsi, enum lws_callback_reasons reason, voi if (avail < cnt) warning("Pool underrun for connection: %s", websocket_connection_name(c)); - recvd = io_sscan(&c->io, c->buffers.recv->buf, c->buffers.recv->len, nullptr, smps, avail); + recvd = io_sscan(&c->io, c->buffers.recv->buf.data(), c->buffers.recv->buf.size(), nullptr, smps, avail); if (recvd < 0) { warning("Failed to parse sample data received on connection: %s", websocket_connection_name(c)); break;