Commit Diff


commit - a631de77b5c5dad4a23107a30e1aa5f49cd76d37
commit + 516a00f1223763e16b5d1397c25041fc40a166b1
blob - b8c555ceffae58e8e93eb6eecad45354d127f0c7
blob + 7d749cf682325a3081ebb20c29ae5300aae4e3cf
--- include/globals.h
+++ 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.
blob - 97c26f1ebd721ff802b643e96bfea1e6a7254433
blob + 4f323b3db15ebd2381b1f1f1a89d14ed1f23c590
--- src/packets.c
+++ 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 <player> <message> - Send a private message\n"
blob - a84ffd1d0d554d906f5000834af086c8bbeed8a5
blob + 92f39a89584fe04c2fc85bb104aa9f1ba425e9e2
--- src/tools.c
+++ 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;