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
- Branch
- /ps/trunk
- Lint
Lint OK - Unit
No Unit Test Coverage - Build Status
Buildable 6232 Build 10352: Vulcan Build Jenkins Build 10351: arc lint + arc unit
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 | 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 | 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 | ||
---|---|---|
119–123 | 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 | private |