Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TraversalProto: Minor cleanup #9455

Merged
merged 7 commits into from Jan 27, 2021
Merged

Conversation

lioncash
Copy link
Member

Mainly consists of converting enums over to enum class to prevent implicit conversions and namespace pollution, along with converting typedefs into using aliases.

@lioncash lioncash force-pushed the traversal branch 2 times, most recently from 230f433 to 89a8a80 Compare January 19, 2021 19:43
Source/Core/Common/TraversalClient.h Outdated Show resolved Hide resolved
Source/Core/Common/TraversalProto.h Outdated Show resolved Hide resolved
printf("-> %d %llu %s\n", ((TraversalPacket*)buffer)->type,
(long long)((TraversalPacket*)buffer)->requestId, SenderName(addr));
const auto* packet = static_cast<const TraversalPacket*>(buffer);
printf("-> %d %llu %s\n", static_cast<int>(packet->type),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if "replace printf with a xxxx_LOG statement" falls under "minor cleanup" - but that certainly shouldn't block this or anything. Especially when the Log Statement could get rid of the #if DEBUG (unless it means something significant for performance)

Prevents implicit conversions and prevents identifiers from polluting
the class scope.
Makes for strong typing and prevents namespace pollution.
Same behavior, more straightforward reading.
…NetAddress

Previously, eaddr would only be partially initialized in the ipv6 case.
Even if there's no support for it, we may as well ensure that the
variable always has deterministic initialization.

While we're at it, we can make the parameter a const reference, given no
members are modified.
Same behavior, but allows the use of non-allocating string types with
the interface.
@leoetlino leoetlino merged commit 4ba9bb2 into dolphin-emu:master Jan 27, 2021
10 checks passed
@lioncash lioncash deleted the traversal branch January 27, 2021 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants