Skip to content

Commit 82ccabb

Browse files
committed
Merge pull request #97098 from pafuent/picking_right_type_for_get_available_bytes
Add a macro on `NetSocketPosix` to pick the right type for `FIONREAD` `len` parameter
2 parents f3b2c48 + 84e2401 commit 82ccabb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/unix/net_socket_posix.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@
6767
#define SOCK_BUF(x) x
6868
#define SOCK_CBUF(x) x
6969
#define SOCK_IOCTL ioctl
70+
#define SOCK_FIONREAD_LEN_TYPE int
7071
#define SOCK_CLOSE ::close
7172
#define SOCK_CONNECT(p_sock, p_addr, p_addr_len) ::connect(p_sock, p_addr, p_addr_len)
7273

@@ -81,6 +82,7 @@
8182
#define SOCK_BUF(x) (char *)(x)
8283
#define SOCK_CBUF(x) (const char *)(x)
8384
#define SOCK_IOCTL ioctlsocket
85+
#define SOCK_FIONREAD_LEN_TYPE unsigned long
8486
#define SOCK_CLOSE closesocket
8587
// connect is broken on windows under certain conditions, reasons unknown:
8688
// See https://github.com/godotengine/webrtc-native/issues/6
@@ -742,7 +744,7 @@ bool NetSocketPosix::is_open() const {
742744
int NetSocketPosix::get_available_bytes() const {
743745
ERR_FAIL_COND_V(!is_open(), -1);
744746

745-
unsigned long len;
747+
SOCK_FIONREAD_LEN_TYPE len;
746748
int ret = SOCK_IOCTL(_sock, FIONREAD, &len);
747749
if (ret == -1) {
748750
_get_socket_error();

0 commit comments

Comments
 (0)