aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2021-08-03 10:08:21 +0300
committerGeorge Kiagiadakis <george.kiagiadakis@collabora.com>2021-08-03 10:35:11 +0300
commit6f93de72365499f3431e6de4e81755feb277a103 (patch)
treed91c8b764f21b506dc75ca244061a61dbadefc8f
parentf93f9cda5d8a380bc8846b5de3fc24613466adf3 (diff)
lib: fix some static analysis warnings
Signed-off-by: George Kiagiadakis <george.kiagiadakis@collabora.com>
-rw-r--r--lib/data.h4
-rw-r--r--lib/receiver.c1
-rw-r--r--lib/sender.c10
3 files changed, 7 insertions, 8 deletions
diff --git a/lib/data.h b/lib/data.h
index 7072ba9..ba6559c 100644
--- a/lib/data.h
+++ b/lib/data.h
@@ -26,8 +26,8 @@ struct icipc_data {
#define ICIPC_DATA_BODY_SIZE(d) (((const struct icipc_data*)(d))->size)
#define ICIPC_DATA_TYPE(d) (((const struct icipc_data*)(d))->type)
#define ICIPC_DATA_SIZE(d) (sizeof(struct icipc_data) + ICIPC_DATA_BODY_SIZE(d))
-#define ICIPC_DATA_BODY(d) ((void*)(((uint8_t *) d) + sizeof(struct icipc_data)))
-#define ICIPC_DATA_BODY_CONST(d) ((const void*)(((const uint8_t *) d) + sizeof(struct icipc_data)))
+#define ICIPC_DATA_BODY(d) ((void*)(((uint8_t *) (d)) + sizeof(struct icipc_data)))
+#define ICIPC_DATA_BODY_CONST(d) ((const void*)(((const uint8_t *) (d)) + sizeof(struct icipc_data)))
enum {
DATA_TYPE_NONE = 1, /* SPA_TYPE_None */
diff --git a/lib/receiver.c b/lib/receiver.c
index e039ced..993db32 100644
--- a/lib/receiver.c
+++ b/lib/receiver.c
@@ -158,7 +158,6 @@ struct icipc_receiver *icipc_receiver_new(
if (stat(self->addr.sun_path, &socket_stat) < 0) {
if (errno != ENOENT) {
- res = -errno;
icipc_log_error("receiver %p: stat %s failed "
"with error: %m",
self, self->addr.sun_path);
diff --git a/lib/sender.c b/lib/sender.c
index fa2882e..3617d9e 100644
--- a/lib/sender.c
+++ b/lib/sender.c
@@ -50,10 +50,10 @@ static int push_sync_task(
struct icipc_sender *self,
icipc_sender_reply_func_t func,
void *data) {
- size_t i;
+ int i;
for (i = MAX_ASYNC_TASKS; i > 1; i--) {
- SenderTask *curr = self->async_tasks + i - 1;
- SenderTask *next = self->async_tasks + i - 2;
+ SenderTask *curr = &self->async_tasks[i - 1];
+ SenderTask *next = &self->async_tasks[i - 2];
if (next->func != NULL && curr->func == NULL) {
curr->func = func;
curr->data = data;
@@ -74,9 +74,9 @@ static void pop_sync_task(
bool all,
const uint8_t * buffer,
size_t size) {
- size_t i;
+ int i;
for (i = 0; i < MAX_ASYNC_TASKS; i++) {
- SenderTask *task = self->async_tasks + i;
+ SenderTask *task = &self->async_tasks[i];
if (task->func != NULL) {
if (trigger)
task->func(self, buffer, size, task->data);