Buildfix for some platforms

Buildfix for some platforms that do not have HAVE_TRANSLATE defined aswell as platforms that define sockaddr_storage as sockaddr/sockaddr_in.
This commit is contained in:
Cthulhu-throwaway 2021-12-20 10:19:42 -03:00 committed by m4xw
parent cae793e39f
commit 568a30380b
2 changed files with 14 additions and 7 deletions

View File

@ -264,10 +264,10 @@ OBJ += \
tasks/task_manual_content_scan.o \ tasks/task_manual_content_scan.o \
tasks/task_core_backup.o \ tasks/task_core_backup.o \
$(LIBRETRO_COMM_DIR)/encodings/encoding_utf.o \ $(LIBRETRO_COMM_DIR)/encodings/encoding_utf.o \
$(LIBRETRO_COMM_DIR)/encodings/encoding_crc32.o $(LIBRETRO_COMM_DIR)/encodings/encoding_crc32.o \
$(LIBRETRO_COMM_DIR)/encodings/encoding_base64.o
ifeq ($(HAVE_TRANSLATE), 1) ifeq ($(HAVE_TRANSLATE), 1)
OBJ += $(LIBRETRO_COMM_DIR)/encodings/encoding_base64.o
OBJ += tasks/task_translation.o OBJ += tasks/task_translation.o
endif endif

View File

@ -344,8 +344,11 @@ static bool netplay_lan_ad_client_response(void)
continue; continue;
/* And that we know how to handle it */ /* And that we know how to handle it */
#ifdef HAVE_INET6
if (their_addr.ss_family != AF_INET) if (their_addr.ss_family != AF_INET)
continue; continue;
#endif
if (!netplay_is_lan_address( if (!netplay_is_lan_address(
(struct sockaddr_in *) &their_addr)) (struct sockaddr_in *) &their_addr))
continue; continue;
@ -560,8 +563,11 @@ static bool netplay_lan_ad_server(netplay_t *netplay)
return true; return true;
} }
#ifdef HAVE_INET6
if (their_addr.ss_family != AF_INET) if (their_addr.ss_family != AF_INET)
return true; return true;
#endif
if (!netplay_is_lan_address( if (!netplay_is_lan_address(
(struct sockaddr_in *) &their_addr)) (struct sockaddr_in *) &their_addr))
return true; return true;
@ -4491,7 +4497,8 @@ static void announce_play_spectate(netplay_t *netplay,
if (ping >= 0) if (ping >= 0)
{ {
snprintf(ping_str, sizeof(ping_str), " (ping: %i ms)", ping); snprintf(ping_str, sizeof(ping_str), " (ping: %li ms)",
(long int)ping);
strlcat(msg, ping_str, sizeof(msg)); strlcat(msg, ping_str, sizeof(msg));
} }
@ -7405,7 +7412,6 @@ bool netplay_poll(
size_t i; size_t i;
int res; int res;
uint32_t client; uint32_t client;
settings_t *settings = (settings_t*)settings_data;
if (!get_self_input_state(block_libretro_input, netplay)) if (!get_self_input_state(block_libretro_input, netplay))
goto catastrophe; goto catastrophe;
@ -8514,12 +8520,13 @@ bool netplay_is_lan_address(struct sockaddr_in *addr)
static const uint32_t subnets[] = {0x0A000000, 0xAC100000, 0xC0A80000}; static const uint32_t subnets[] = {0x0A000000, 0xAC100000, 0xC0A80000};
static const uint32_t masks[] = {0xFF000000, 0xFFF00000, 0xFFFF0000}; static const uint32_t masks[] = {0xFF000000, 0xFFF00000, 0xFFFF0000};
size_t i; size_t i;
uint32_t uaddr;
memcpy(&uaddr, &addr->sin_addr, sizeof(uaddr));
for (i = 0; i < ARRAY_SIZE(subnets); i++) for (i = 0; i < ARRAY_SIZE(subnets); i++)
{ if ((uaddr & masks[i]) == subnets[i])
if ((*(uint32_t *)&addr->sin_addr & masks[i]) == subnets[i])
return true; return true;
}
return false; return false;
} }