From ebfe4382ee1ddeda7c2e4ea17f4328c087372e1c Mon Sep 17 00:00:00 2001 From: Andri Yngvason Date: Sun, 19 Jan 2020 19:16:27 +0000 Subject: [PATCH] server: Use size_t for encoding indices --- src/server.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/server.c b/src/server.c index d412cce..2209590 100644 --- a/src/server.c +++ b/src/server.c @@ -309,14 +309,14 @@ static int on_client_set_encodings(struct nvnc_client* client) (struct rfb_client_set_encodings_msg*)(client->msg_buffer + client->buffer_index); - int n_encodings = MIN(MAX_ENCODINGS, ntohs(msg->n_encodings)); - int n = 0; + size_t n_encodings = MIN(MAX_ENCODINGS, ntohs(msg->n_encodings)); + size_t n = 0; if (client->buffer_len - client->buffer_index < sizeof(*msg) + n_encodings * 4) return 0; - for (int i = 0; i < n_encodings; ++i) { + for (size_t i = 0; i < n_encodings; ++i) { enum rfb_encodings encoding = htonl(msg->encodings[i]); switch (encoding) { @@ -666,7 +666,7 @@ static void on_write_frame_done(uv_write_t* req, int status) enum rfb_encodings choose_frame_encoding(struct nvnc_client* client) { - for (int i = 0; i < client->n_encodings; ++i) + for (size_t i = 0; i < client->n_encodings; ++i) switch (client->encodings[i]) { case RFB_ENCODING_RAW: #ifdef ENABLE_TIGHT