diff options
| author | comex <comexk@gmail.com> | 2020-08-31 10:20:44 -0400 |
|---|---|---|
| committer | comex <comexk@gmail.com> | 2020-12-06 19:14:42 -0500 |
| commit | 0791082b435371837bbecd50575911ce0ba16dc9 (patch) | |
| tree | 363be86931fe14b0ddc33be3b4119ae21c9a1543 /src/core/hle/service/sockets/sockets_translate.h | |
| parent | 5933667cb83b690d029b9d5b646dc93f1ef4fda8 (diff) | |
network, sockets: Replace `POLL_IN`, `POLL_OUT`, etc. constants with an `enum class PollEvents`
Actually, two enum classes, since for some reason there are two separate
yet identical `PollFD` types used in the codebase. I get that one is
ABI-compatible with the Switch while the other is an abstract type used
for the host, but why not use `WSAPOLLFD` directly for the latter?
Anyway, why make this change? Because on Apple platforms, `POLL_IN`,
`POLL_OUT`, etc. (with an underscore) are defined as macros in
<sys/signal.h>. (This is inherited from FreeBSD.) So defining
a variable with the same name causes a compile error.
I could just rename the variables, but while I was at it I thought I
might as well switch to an enum for stronger typing.
Also, change the type used for values copied directly to/from the
`events` and `revents` fields of the host *native*
`pollfd`/`WSASPOLLFD`, from `u32` to `short`, as `short` is the correct
canonical type on both Unix and Windows.
Diffstat (limited to 'src/core/hle/service/sockets/sockets_translate.h')
| -rw-r--r-- | src/core/hle/service/sockets/sockets_translate.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/hle/service/sockets/sockets_translate.h b/src/core/hle/service/sockets/sockets_translate.h index e498913d4..057d1ff22 100644 --- a/src/core/hle/service/sockets/sockets_translate.h +++ b/src/core/hle/service/sockets/sockets_translate.h @@ -31,10 +31,10 @@ Network::Type Translate(Type type); Network::Protocol Translate(Type type, Protocol protocol); /// Translate abstract poll event flags to guest poll event flags -u16 TranslatePollEventsToHost(u32 flags); +Network::PollEvents TranslatePollEventsToHost(PollEvents flags); /// Translate guest poll event flags to abstract poll event flags -u16 TranslatePollEventsToGuest(u32 flags); +PollEvents TranslatePollEventsToGuest(Network::PollEvents flags); /// Translate guest socket address structure to abstract socket address structure Network::SockAddrIn Translate(SockAddrIn value); |
