]> git.meshlink.io Git - meshlink/blobdiff - test/blackbox/common/mesh_event_handler.c
Fix compiler warnings in the test suites.
[meshlink] / test / blackbox / common / mesh_event_handler.c
index bb5faf1c173c463698266cc7ba339dddd528a138..84ae63dd83436ec0cb42c780ef411ec1b36aa66a 100644 (file)
@@ -83,6 +83,7 @@ static bool wait_cond_flag(struct cond_flag *s, int seconds) {
 
 // event_receive_handler running in a separate thread queues all the events received from the UDP port
 static void *event_receive_handler(void *arg) {
+       (void)arg;
        size_t recv_ret;
        char udp_buff[UDP_BUFF_MAX];
        struct sockaddr client;
@@ -120,7 +121,7 @@ static void *event_handler(void *argv) {
        bool callback_return = false;
        void *data;
        mesh_event_payload_t mesh_event_rec_packet;
-       mesh_event_callback_t callback = (mesh_event_callback_t)argv;
+       mesh_event_callback_t callback = *(mesh_event_callback_t *)argv;
 
        while(event_handle_thread_running) {
 
@@ -173,7 +174,7 @@ char *mesh_event_sock_create(const char *if_name) {
        server.sin_port   = htons(atoi(SERVER_LISTEN_PORT));
        assert(bind(server_fd, (struct sockaddr *) &server, sizeof(struct sockaddr)) != -1);
 
-       assert(ip = malloc(30));
+       assert((ip = malloc(30)));
        strncpy(ip, inet_ntoa(resp_if_addr->sin_addr), 20);
        strcat(ip, ":");
        strcat(ip, SERVER_LISTEN_PORT);
@@ -255,7 +256,7 @@ bool wait_for_event(mesh_event_callback_t callback, int seconds) {
        }
 
        set_cond_flag(&sync_event, false);
-       assert(!pthread_create(&event_handle_thread, NULL, event_handler, (void *)callback));
+       assert(!pthread_create(&event_handle_thread, NULL, event_handler, (void *)&callback));
        bool wait_ret = wait_cond_flag(&sync_event, seconds);
        event_handle_thread_running = false;
        pthread_cancel(event_handle_thread);
@@ -279,4 +280,4 @@ void mesh_event_destroy(void) {
        mesh_events_flush();
        event_receive_thread_running = false;
        pthread_cancel(event_receive_thread);
-}
\ No newline at end of file
+}