[Kernel] Rename sin_zero due to #define on Android

This commit is contained in:
Triang3l 2021-09-11 23:31:52 +03:00
parent 44847abb98
commit 9d992e3d06
3 changed files with 10 additions and 5 deletions

View File

@ -950,7 +950,7 @@ dword_result_t NetDll_recvfrom(dword_t caller, dword_t socket_handle,
from_ptr->sin_family = native_from.sin_family;
from_ptr->sin_port = native_from.sin_port;
from_ptr->sin_addr = native_from.sin_addr;
memset(from_ptr->sin_zero, 0, 8);
std::memset(from_ptr->x_sin_zero, 0, sizeof(from_ptr->x_sin_zero));
}
if (fromlen_ptr) {
*fromlen_ptr = native_fromlen;

View File

@ -9,6 +9,8 @@
#include "src/xenia/kernel/xsocket.h"
#include <cstring>
#include "xenia/base/platform.h"
#include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/xam/xam_module.h"
@ -200,7 +202,7 @@ int XSocket::RecvFrom(uint8_t* buf, uint32_t buf_len, uint32_t flags,
from->sin_family = nfrom.sin_family;
from->sin_addr = ntohl(nfrom.sin_addr.s_addr); // BE <- BE
from->sin_port = nfrom.sin_port;
memset(&from->sin_zero, 0, 8);
std::memset(from->x_sin_zero, 0, sizeof(from->x_sin_zero));
}
if (from_len) {

View File

@ -10,6 +10,7 @@
#ifndef XENIA_KERNEL_XSOCKET_H_
#define XENIA_KERNEL_XSOCKET_H_
#include <cstring>
#include <queue>
#include "xenia/base/byte_order.h"
@ -42,7 +43,8 @@ struct XSOCKADDR_IN {
// Always big-endian!
xe::be<uint16_t> sin_port;
xe::be<uint32_t> sin_addr;
char sin_zero[8];
// sin_zero is defined as __pad on Android, so prefixed here.
char x_sin_zero[8];
};
// Xenia native sockaddr_in
@ -53,7 +55,7 @@ struct N_XSOCKADDR_IN {
sin_family = other.sin_family;
sin_port = other.sin_port;
sin_addr = other.sin_addr;
std::memset(sin_zero, 0, 8);
std::memset(x_sin_zero, 0, sizeof(x_sin_zero));
return *this;
}
@ -61,7 +63,8 @@ struct N_XSOCKADDR_IN {
uint16_t sin_family;
xe::be<uint16_t> sin_port;
xe::be<uint32_t> sin_addr;
char sin_zero[8];
// sin_zero is defined as __pad on Android, so prefixed here.
char x_sin_zero[8];
};
class XSocket : public XObject {