From 9c7cba6d6c77b433333542592e1219a1abab6f1e Mon Sep 17 00:00:00 2001 From: Alex Fabijanic Date: Fri, 22 Dec 2023 20:22:33 +0100 Subject: [PATCH] backport leftover 1.12 changes --- CppParser/testsuite/src/CppParserTest.cpp | 16 ++++++++++++++++ Data/src/SessionPool.cpp | 2 ++ Foundation/include/Poco/Logger.h | 10 ++++++++++ Foundation/src/Thread_POSIX.cpp | 4 ++-- Net/include/Poco/Net/SocketReactor.h | 2 +- Net/src/HTTPDigestCredentials.cpp | 8 ++++---- Net/testsuite/src/PollSetTest.cpp | 1 - 7 files changed, 35 insertions(+), 8 deletions(-) diff --git a/CppParser/testsuite/src/CppParserTest.cpp b/CppParser/testsuite/src/CppParserTest.cpp index 35ce2d5ec2..b200ca1454 100644 --- a/CppParser/testsuite/src/CppParserTest.cpp +++ b/CppParser/testsuite/src/CppParserTest.cpp @@ -94,6 +94,22 @@ void CppParserTest::testExtractName() name = Symbol::extractName(decl); assertTrue (name == "func"); + decl = "std::function func"; + name = Symbol::extractName(decl); + assertTrue (name == "func"); + + decl = "std::function func"; + name = Symbol::extractName(decl); + assertTrue (name == "func"); + + decl = "std::function(std::vector)> func"; + name = Symbol::extractName(decl); + assertTrue (name == "func"); + + decl = "std::function)> func"; + name = Symbol::extractName(decl); + assertTrue (name == "func"); + decl = "const std::vector* var"; name = Symbol::extractName(decl); assertTrue (name == "var"); diff --git a/Data/src/SessionPool.cpp b/Data/src/SessionPool.cpp index ff849a8cea..eb5e8db188 100644 --- a/Data/src/SessionPool.cpp +++ b/Data/src/SessionPool.cpp @@ -317,6 +317,8 @@ void SessionPool::shutdown() if (_shutdown.exchange(true)) return; _shutdown = true; _janitorTimer.stop(); + + Poco::Mutex::ScopedLock lock(_mutex); closeAll(_idleSessions); closeAll(_activeSessions); } diff --git a/Foundation/include/Poco/Logger.h b/Foundation/include/Poco/Logger.h index bfa2fec14f..84e3b985a5 100644 --- a/Foundation/include/Poco/Logger.h +++ b/Foundation/include/Poco/Logger.h @@ -462,6 +462,7 @@ class Foundation_API Logger: public Channel ~Logger(); void log(const std::string& text, Message::Priority prio); + void logNPC(const std::string& text, Message::Priority prio); void log(const std::string& text, Message::Priority prio, const char* file, int line); static std::string format(const std::string& fmt, int argc, std::string argv[]); @@ -789,6 +790,15 @@ inline void Logger::log(const std::string& text, Message::Priority prio) } +inline void Logger::logNPC(const std::string& text, Message::Priority prio) +{ + if (_pChannel) + { + _pChannel->log(Message(_name, text, prio)); + } +} + + inline void Logger::log(const std::string& text, Message::Priority prio, const char* file, int line) { if (_level >= prio && _pChannel) diff --git a/Foundation/src/Thread_POSIX.cpp b/Foundation/src/Thread_POSIX.cpp index ecbca60507..211404fc9c 100644 --- a/Foundation/src/Thread_POSIX.cpp +++ b/Foundation/src/Thread_POSIX.cpp @@ -262,12 +262,12 @@ void ThreadImpl::setSignalMaskImpl(uint32_t sigMask) sigset_t sset; sigemptyset(&sset); - for (int sig = 0; sig < sizeof(uint32_t) * 8; ++sig) + for (int sig = 0; sig < sizeof(uint32_t) * 8; ++sig) { if ((sigMask & (1 << sig)) != 0) sigaddset(&sset, sig); } - + pthread_sigmask(SIG_BLOCK, &sset, 0); } diff --git a/Net/include/Poco/Net/SocketReactor.h b/Net/include/Poco/Net/SocketReactor.h index aefc4dc939..653a59a4ec 100644 --- a/Net/include/Poco/Net/SocketReactor.h +++ b/Net/include/Poco/Net/SocketReactor.h @@ -104,7 +104,7 @@ class Net_API SocketReactor: public Poco::Runnable /// Finally, when the SocketReactor is about to shut down (as a result /// of stop() being called), it dispatches a ShutdownNotification /// to all event handlers. This is done in the onShutdown() method - /// which can be overridded by subclasses to perform custom + /// which can be overridden by subclasses to perform custom /// shutdown processing. /// /// The SocketReactor is implemented so that it can run in its own thread. diff --git a/Net/src/HTTPDigestCredentials.cpp b/Net/src/HTTPDigestCredentials.cpp index 068dbb9f5a..736538adee 100644 --- a/Net/src/HTTPDigestCredentials.cpp +++ b/Net/src/HTTPDigestCredentials.cpp @@ -334,8 +334,8 @@ void HTTPDigestCredentials::updateAuthParams(const HTTPRequest& request) ha1 = digest(engine, ha1, nonce, cnonce); } - const std::string ha2 = digest(engine, request.getMethod(), request.getURI()); - + const std::string ha2 = digest(engine, request.getMethod(), request.getURI()); + _requestAuthParams.set(NC_PARAM, nc); _requestAuthParams.set(CNONCE_PARAM, cnonce); _requestAuthParams.set(RESPONSE_PARAM, digest(engine, ha1, nonce, nc, cnonce, qop, ha2)); @@ -367,7 +367,7 @@ bool HTTPDigestCredentials::verifyAuthParams(const HTTPRequest& request, const H else if (icompare(qop, AUTH_PARAM) == 0) { const std::string& algorithm = params.get(ALGORITHM_PARAM, MD_5_ALGORITHM); - + if (!isAlgorithmSupported(algorithm)) { throw NotImplementedException("Unsupported digest algorithm", algorithm); } @@ -406,7 +406,7 @@ int HTTPDigestCredentials::updateNonceCounter(const std::string& nonce) bool HTTPDigestCredentials::isAlgorithmSupported(const std::string& algorithm) const { - bool isAlgorithmSupported = std::find_if(std::begin(SUPPORTED_ALGORITHMS), + bool isAlgorithmSupported = std::find_if(std::begin(SUPPORTED_ALGORITHMS), std::end(SUPPORTED_ALGORITHMS), [&algorithm](const std::string& supportedAlgorithm) { diff --git a/Net/testsuite/src/PollSetTest.cpp b/Net/testsuite/src/PollSetTest.cpp index dd8e0b2517..5897b80f80 100644 --- a/Net/testsuite/src/PollSetTest.cpp +++ b/Net/testsuite/src/PollSetTest.cpp @@ -361,7 +361,6 @@ void PollSetTest::testPollNoServer() catch (Poco::Exception&) {} assertEqual(2, ps.poll(Timespan(1000000)).size()); - }