From d38946fcc720ff1cc5fcd8bf3ae3e3e2b9f40ab3 Mon Sep 17 00:00:00 2001 From: "Morgan 'ARR\\!' Allen" Date: Sat, 6 Jan 2024 13:05:24 -0800 Subject: [PATCH] use ssize_t in the now_receive callback flow --- include/ifnow_now.h | 2 +- src/main.c | 4 ++-- src/now.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/ifnow_now.h b/include/ifnow_now.h index 8972300..f71eef5 100644 --- a/include/ifnow_now.h +++ b/include/ifnow_now.h @@ -12,7 +12,7 @@ #define ERR_BIND_FAILED (-3) #define ERR_FILTER_FAILED (-4) -typedef int (*ifnow_now_receive_cb)(void *now_cfg, uint8_t *buf, uint32_t len); +typedef int (*ifnow_now_receive_cb)(void *now_cfg, uint8_t *buf, ssize_t len); typedef struct { int fd_if_socket; diff --git a/src/main.c b/src/main.c index 7760aee..dbd8cc6 100644 --- a/src/main.c +++ b/src/main.c @@ -1,5 +1,5 @@ #include -#include +#include #include #include "ifnow.h" @@ -33,7 +33,7 @@ char *color_chart[] = { }; uint8_t color_size = 15; -int ifnow_now_receive_callback(void *cfg, uint8_t *buf, uint32_t len) { +int ifnow_now_receive_callback(void *cfg, uint8_t *buf, ssize_t len) { ifnow_now_cfg_t *now_cfg = cfg; printf("NOW receive_count: %d\n", len); diff --git a/src/now.c b/src/now.c index b56d7d7..ecc5ce3 100644 --- a/src/now.c +++ b/src/now.c @@ -55,7 +55,7 @@ void *ifnow_thread_handle(void *arg) { receive_count = recv(now_cfg->fd_if_socket, receive_buffer, IFNOW_MAX_RECEIVE, MSG_TRUNC); if(receive_count > 0 && now_cfg->receive != NULL) { - now_cfg->receive(now_cfg, receive_buffer, receive_count); + now_cfg->receive(now_cfg, (uint8_t*)&receive_buffer, receive_count); } } }