fix: Resolve compiler warnings across multiple modules#5103
Merged
Conversation
ef9d209 to
7c374de
Compare
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.
Summary
This PR addresses compiler warnings reported in CI builds (GCC, Clang, MSVC) across multiple modules, improving code quality and C++ standards compliance.
80 files changed across Foundation, Net, Crypto, Data, JSON, MongoDB, Redis, XML, and Zip modules.
1. Stream Buffer Return Types
Changed
readFromDevice()andwriteToDevice()return types frominttostd::streamsizeto match the C++ standard library interface.Affected files:
Foundation/include/Poco/BufferedStreamBuf.h,BufferedBidirectionalStreamBuf.hFoundation/include/Poco/DeflatingStream.h,InflatingStream.h,DigestStream.h,FIFOBufferStream.h,FileStream_*.h,PipeStream.h,RandomStream.hFoundation/src/DeflatingStream.cpp,InflatingStream.cpp,DigestStream.cpp,FIFOBufferStream.cpp,FileStream_*.cpp,PipeStream.cpp,RandomStream.cpp,StreamConverter.cppNet/include/Poco/Net/HTTPChunkedStream.h,HTTPFixedLengthStream.h,HTTPHeaderStream.h,HTTPStream.h,MultipartReader.h,SocketStream.h,HTTPReactorServerSession.hNet/src/HTTPChunkedStream.cpp,HTTPFixedLengthStream.cpp,HTTPHeaderStream.cpp,HTTPStream.cpp,MultipartReader.cpp,SocketStream.cpp,HTTPReactorServerSession.cppCrypto/include/Poco/Crypto/CryptoStream.h,Crypto/src/CryptoStream.cppRedis/include/Poco/Redis/RedisStream.h,Redis/src/RedisStream.cppZip/include/Poco/Zip/AutoDetectStream.h,PartialStream.h,ZipStream.hZip/src/AutoDetectStream.cpp,PartialStream.cpp,ZipStream.cpp2. Signed/Unsigned Comparison Warnings (C4244, C4245)
Added explicit
static_cast<>to fix comparisons between signed and unsigned types.Foundation/src/DateTime.cppstatic_cast<short>()for int-to-short member initializationFoundation/src/Path.cppstatic_cast<std::size_t>()for int-to-size_t comparisonsFoundation/src/ThreadPool.cppstatic_cast<std::size_t>()for capacity comparisonsFoundation/src/Logger.cppint addrtostd::size_t addrCrypto/src/CipherImpl.cppstatic_cast<int>()andstatic_cast<std::streamsize>()Crypto/src/Envelope.cpp,EVPCipherImpl.cpp,RSACipherImpl.cppJSON/include/Poco/JSON/Object.h,Array.h,Stringifier.hunsigned int indent, fixed internal loop variables and arithmetic withstatic_cast<unsigned int>(step)JSON/src/Object.cpp,Array.cpp,Stringifier.cppZip/src/ZipUtil.cpp3. Constructor Member Initializer Order
Fixed member initializer list order to match declaration order (GCC
-Wreorder).Net/src/TCPReactorAcceptor.cppNet/src/TCPReactorServer.cpp4. Unused Result Warnings
Added
[[maybe_unused]]for system call return values.Net/src/PollSet.cpp:read()andwrite()on eventfd5. Unused Variable Warnings (C4189)
Added
[[maybe_unused]]attribute or(void)cast for intentionally unused variables.Net/src/WebSocketImpl.cppnin debug assertionMongoDB/src/TopologyDescription.cppunknownCountMongoDB/testsuite/src/MongoDBTestOpMsg.cpplastupdatedTimestampMongoDB/testsuite/src/ReplicaSetTest.cppfoundTaggedServerFoundation/src/Timezone_WIN32.cppdstFlagfromGetTimeZoneInformation()Zip/testsuite/src/ZipTest.cppPOCO_UNUSEDto[[maybe_unused]])6. Missing Field Initializers (C4351)
Changed
= {0}and= {nullptr}to= {}for proper aggregate initialization.Data/MySQL/src/Binder.cpp:MYSQL_TIMEandMYSQL_BINDstructsData/MySQL/src/Extractor.cpp:MYSQL_TIMEandMYSQL_BINDstructsData/PostgreSQL/src/StatementExecutor.cpp:RegularExpression::Matchstruct7. Parameter/Variable Shadowing (C4456, C4457, C4458)
Renamed variables to avoid shadowing.
Zip/include/Poco/Zip/PartialStream.hend→endPos(shadowsstd::ios::end)Zip/src/PartialStream.cppend→endPosNet/src/HTMLForm.cppistr→partStream(shadows function parameter)JSON/testsuite/src/JSONTest.cppparser1/2,result1/2,json1/2,ss1/28. Other Fixes
Data/ODBC/src/Binder.cppData/ODBC/src/Unicode_UNIXODBC.cppXML/src/ParserEngine.cppNet/src/HTTPClientSession.cppNet/testsuite/src/MailMessageTest.cpp#include <algorithm>, usestd::min()Foundation/src/UUID.cpp,Foundation/include/Poco/UUID.hCrypto/src/CipherKeyImpl.cpp,ECKeyImpl.cppTest plan