diff --git a/include/globals.h b/include/globals.h index b8c555c..7d749cf 100644 --- a/include/globals.h +++ b/include/globals.h @@ -103,7 +103,7 @@ #define NETWORK_TIMEOUT_TIME 15000000 // Size of the receive buffer for incoming string data -#define MAX_RECV_BUF_LEN 256 +#define MAX_RECV_BUF_LEN 256 // If defined, sends the server brand to clients. Doesn't do much, but will // show up in the top-left of the F3/debug menu, in the Minecraft client. diff --git a/src/packets.c b/src/packets.c index 97c26f1..4f323b3 100644 --- a/src/packets.c +++ b/src/packets.c @@ -1145,7 +1145,7 @@ int cs_chat (int client_fd) { // Handle chat commands - if (!strncmp(recv_buffer, "!msg", 4)) { + if (!strncmp((char *)recv_buffer, "!msg", 4)) { int target_offset = 5; int target_end_offset = 0; @@ -1177,7 +1177,7 @@ int cs_chat (int client_fd) { int name_len = strlen(player->name); int text_len = message_len - text_offset; memmove(recv_buffer + name_len + 24, recv_buffer + text_offset, text_len); - snprintf(recv_buffer, sizeof(recv_buffer), "§7§o%s whispers to you:", player->name); + snprintf((char *)recv_buffer, sizeof(recv_buffer), "§7§o%s whispers to you:", player->name); recv_buffer[name_len + 23] = ' '; // Send message to target player sc_systemChat(target->client_fd, (char *)recv_buffer, (uint16_t)(name_len + 24 + text_len)); @@ -1185,7 +1185,7 @@ int cs_chat (int client_fd) { // Format output for sending player int target_len = target_end_offset - target_offset; memmove(recv_buffer + target_len + 23, recv_buffer + name_len + 24, text_len); - snprintf(recv_buffer, sizeof(recv_buffer), "§7§oYou whisper to %s:", target->name); + snprintf((char *)recv_buffer, sizeof(recv_buffer), "§7§oYou whisper to %s:", target->name); recv_buffer[target_len + 22] = ' '; // Report back to sending player sc_systemChat(client_fd, (char *)recv_buffer, (uint16_t)(target_len + 23 + text_len)); @@ -1193,7 +1193,7 @@ int cs_chat (int client_fd) { goto cleanup; } - if (!strncmp(recv_buffer, "!help", 5)) { + if (!strncmp((char *)recv_buffer, "!help", 5)) { // Send command guide const char help_msg[] = "§7Commands:\n" " !msg - Send a private message\n" diff --git a/src/tools.c b/src/tools.c index a84ffd1..92f39a8 100644 --- a/src/tools.c +++ b/src/tools.c @@ -221,7 +221,7 @@ double readDouble (int client_fd) { ssize_t readLengthPrefixedData (int client_fd) { uint32_t length = readVarInt(client_fd); if (length >= MAX_RECV_BUF_LEN) { - printf("ERROR: Received length (%u) exceeds maximum (%u)\n", length, MAX_RECV_BUF_LEN); + printf("ERROR: Received length (%lu) exceeds maximum (%u)\n", length, MAX_RECV_BUF_LEN); disconnectClient(&client_fd, -1); recv_count = 0; return 0;