1
0
mirror of https://github.com/p2r3/bareiron.git synced 2025-10-01 23:25:09 +02:00

fix various compilation issues when targeting esp-idf

This commit is contained in:
p2r3
2025-09-19 02:24:36 +03:00
parent a631de77b5
commit 516a00f122
3 changed files with 6 additions and 6 deletions

View File

@@ -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.

View File

@@ -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"

View File

@@ -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;