Split this for good practice, making it a bit easier to read and maintain.
Details
- Reviewers
- None
- Commits
- rP22916: Split NetFileTransfer message parsing into one function per case, refs #5212.
- Trac Tickets
- #5212
Notice the code didn't change. Could use an FSM model eventually.
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
Successful build - Chance fights ever on the side of the prudent.
Link to build: https://jenkins.wildfiregames.com/job/differential/636/display/redirect
source/network/NetFileTransfer.cpp | ||
---|---|---|
29 ↗ | (On Diff #6738) | Sorry, didn't comprehend what you meant. Preferably it should become an FSM but here we can use the switch indeed |
source/network/NetFileTransfer.cpp | ||
---|---|---|
106 ↗ | (On Diff #6738) | I guess it's exactly 0.5 because that's 1/2 :p as in at most two LOG draws per second. |
Build failure - The Moirai have given mortals hearts that can endure.
Link to build: https://jenkins.wildfiregames.com/job/docker-differential/727/display/redirect
The sprintf casts can be removed by using %lu for the u32 arguments and %zu for size_t. The latter has a precedent in the VertexBufferManager.cpp:
size_t vertexSize, size_t numVertices
LOGERROR("Failed to create VBOs (%zu*%zu)", vertexSize, numVertices);
source/network/NetFileTransfer.cpp | ||
---|---|---|
123 ↗ | (On Diff #9815) | We can reuse the iterator below to avoid the duplicate lookup. Also the [] operator has the side effect of insertion when most of the time it would be an error to insert this way. |
source/network/NetFileTransfer.h | ||
91 ↗ | (On Diff #9815) | private |