Clear the compiler warnings on Linux and Windows - #32
Merged
Conversation
gcc had two, MSVC fourteen, and none of them were noise: - The HTTP connection pool keys itself on "host:port" in a buffer as wide as the host field alone, so gcc warned that the port could be truncated away. Two hosts differing only past that point would then share one pool. The host width and the key width are now named and the key is the wider of the two. - CMUTIL_SocketConnectIPCInternal passed a struct sockaddr_in* where a CMUTIL_SocketAddr* was expected. Same address either way, so the code worked, but the declared types disagreed - it now passes the storage it meant to. - select() takes an int nfds, and a SOCKET is a 64 bit handle on Windows where that argument is ignored outright; connect() and bind() take a socklen_t, not a size_t; Socket::Write and ByteBuffer::AddBytes take a uint32_t, not a size_t. All now say so. - crypto_test declared an EVP_CIPHER it never used. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
CMUTIL_PrivateKeyCreateFromPEM takes a const uint8_t*, which clang on macOS flagged for the empty string literal handed to it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gcc reported two warnings, MSVC fourteen. None of them were noise.
Latent bug
The HTTP connection pool keys itself on
"host:port"in a buffer as wide as the host field alone, so gcc warned that the port could be truncated away — two hosts differing only past that point would then share one connection pool. The host width and the key width are now named constants, and the key is the wider of the two.Type mismatch
CMUTIL_SocketConnectIPCInternalpassed astruct sockaddr_in*where aCMUTIL_SocketAddr*(struct sockaddr_storage*) was expected. Both point at the same object so the code worked, but the declared types disagreed; it now passes the storage it meant to.Narrowing conversions
select()int nfdsSOCKET + 1— a 64-bit handle on Windows, where the argument is ignored outrightconnect(),bind()socklen_tsize_tCMUTIL_Socket::Writeuint32_tsize_t/strlen()CMUTIL_ByteBuffer::AddBytesuint32_tstrlen()Unused
crypto_testdeclared anEVP_CIPHERit never used.Verification
Linux clean rebuild is now warning-free; 15/15 ctest and 21/21 samples pass. The Windows half is what this PR's CI run is for — the MSVC warnings were read out of the previous master run's log.
🤖 Generated with Claude Code