Fix warnings

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2026-05-06 11:31:07 +02:00
parent 49564e2e5e
commit 1be7acaedd
11 changed files with 76 additions and 60 deletions

View File

@@ -345,7 +345,7 @@ void driver_exec_finished_cont_ccid(uint8_t itf, uint16_t size_next, uint16_t of
}
void ccid_task(void) {
for (int itf = 0; itf < ITF_SC_TOTAL; itf++) {
for (uint8_t itf = 0; itf < ITF_SC_TOTAL; itf++) {
int status = card_status(sc_itf_to_usb_itf(itf));
if (status == PICOKEYS_OK) {
driver_exec_finished_ccid(itf, finished_data_size);

View File

@@ -336,7 +336,7 @@ uint16_t emul_read(uint8_t itf) {
}
#endif
else {
emul_rx_size += valread;
emul_rx_size += (uint16_t)valread;
}
return (uint16_t)emul_rx_size;
}

View File

@@ -62,7 +62,7 @@ typedef int socket_t;
static struct tcp_pcb *listener_pcb = NULL;
#else
extern socket_t tls_listener_sock;
static socket_t listener_sock = -1;
static socket_t listener_sock = INVALID_SOCKET;
static pthread_t rest_thread;
#endif
static rest_conn_t conns[REST_MAX_CONNS];
@@ -162,7 +162,7 @@ static void send_json_error(rest_conn_t *conn, int status_code, const char *erro
rest_close_conn(conn);
return;
}
send_json(conn, status_code, rest_status_text_from_code(status_code), json);
send_json(conn, status_code, rest_status_text_from_code((uint16_t)status_code), json);
}
void rest_task(void) {
@@ -395,7 +395,7 @@ static void send_response(rest_conn_t *conn, int status_code, const char *status
}
#ifdef ENABLE_EMULATION
while (sent_total < (size_t)header_len) {
int n = send((socket_t)conn->sock, headers_buf + sent_total, (size_t)header_len - sent_total, 0);
int n = send((socket_t)conn->sock, headers_buf + sent_total, (int)((size_t)header_len - sent_total), 0);
if (n <= 0) {
rest_close_conn(conn);
return;
@@ -404,7 +404,7 @@ static void send_response(rest_conn_t *conn, int status_code, const char *status
}
sent_total = 0;
while (sent_total < body_len) {
int n = send((socket_t)conn->sock, body + sent_total, body_len - sent_total, 0);
int n = send((socket_t)conn->sock, body + sent_total, (int)(body_len - sent_total), 0);
if (n <= 0) {
rest_close_conn(conn);
return;
@@ -610,7 +610,7 @@ static int parse_request(rest_conn_t *conn, rest_request_t *request) {
}
headers_size = conn->request_headers_size;
content_length = conn->request_content_length;
content_length = (unsigned long)conn->request_content_length;
header_end = conn->request + headers_size - 4;
line_end = strstr(conn->request, "\r\n");

View File

@@ -163,6 +163,7 @@ typedef int socklen_t;
#else
#include <strings.h>
typedef int socket_t;
#define INVALID_SOCKET (-1)
#include <arpa/inet.h>
#include <errno.h>
#include <netinet/in.h>
@@ -171,7 +172,7 @@ typedef int socket_t;
#include <unistd.h>
#endif
socket_t tls_listener_sock = -1;
socket_t tls_listener_sock = INVALID_SOCKET;
int emulation_rest_tls_port(void) {
const char *port_env = getenv("PICO_REST_TLS_PORT");