Merge branch 'poco-1.11.0' of github.com:pocoproject/poco into poco-1.11.0

This commit is contained in:
Günter Obiltschnig 2021-06-17 18:50:04 +02:00
commit 9dfda83305
22 changed files with 126 additions and 26 deletions

View File

@ -177,7 +177,15 @@ private:
EVP_PKEY* pKey = getFunc ? EVP_PKEY_new() : (EVP_PKEY*)*ppKey; EVP_PKEY* pKey = getFunc ? EVP_PKEY_new() : (EVP_PKEY*)*ppKey;
if (pKey) if (pKey)
{ {
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4996) // deprecation warnings
#endif
pFile = fopen(keyFile.c_str(), "r"); pFile = fopen(keyFile.c_str(), "r");
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
if (pFile) if (pFile)
{ {
pem_password_cb* pCB = pass.empty() ? (pem_password_cb*)0 : &passCB; pem_password_cb* pCB = pass.empty() ? (pem_password_cb*)0 : &passCB;

View File

@ -13,6 +13,11 @@
// //
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "Poco/Crypto/PKCS12Container.h" #include "Poco/Crypto/PKCS12Container.h"
#include "Poco/NumberFormatter.h" #include "Poco/NumberFormatter.h"
#include "Poco/StreamCopier.h" #include "Poco/StreamCopier.h"

View File

@ -47,7 +47,14 @@ inline void makeUTF8(Poco::Buffer<wchar_t>& buffer, SQLINTEGER length, SQLPOINTE
UnicodeConverter::toUTF8(buffer.begin(), length, result); UnicodeConverter::toUTF8(buffer.begin(), length, result);
std::memset(pTarget, 0, targetLength); std::memset(pTarget, 0, targetLength);
#if defined(_MSC_VER)
#pragma warning(push)
#pragma warning(disable:4996) // deprecation warnings
#endif
std::strncpy((char*) pTarget, result.c_str(), result.size() < targetLength ? result.size() : targetLength); std::strncpy((char*) pTarget, result.c_str(), result.size() < targetLength ? result.size() : targetLength);
#if defined(_MSC_VER)
#pragma warning(pop)
#endif
} }

View File

@ -22,10 +22,6 @@
#include "Poco/UnWindows.h" #include "Poco/UnWindows.h"
#if defined(_MSC_VER) && !defined(POCO_MSVC_SECURE_WARNINGS) && !defined(_CRT_SECURE_NO_DEPRECATE)
#define _CRT_SECURE_NO_DEPRECATE
#endif
// Verify that we're built with the multithreaded // Verify that we're built with the multithreaded
// versions of the runtime libraries // versions of the runtime libraries
@ -78,7 +74,6 @@
#pragma warning(disable:4351) // new behavior: elements of array '...' will be default initialized #pragma warning(disable:4351) // new behavior: elements of array '...' will be default initialized
#pragma warning(disable:4355) // 'this' : used in base member initializer list #pragma warning(disable:4355) // 'this' : used in base member initializer list
#pragma warning(disable:4675) // resolved overload was found by argument-dependent lookup #pragma warning(disable:4675) // resolved overload was found by argument-dependent lookup
#pragma warning(disable:4996) // VC++ 8.0 deprecation warnings
#endif #endif

View File

@ -12,6 +12,11 @@
// //
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "Poco/Environment.h" #include "Poco/Environment.h"
#include "Poco/Version.h" #include "Poco/Version.h"
#include <cstdlib> #include <cstdlib>

View File

@ -25,6 +25,11 @@
#include <iphlpapi.h> #include <iphlpapi.h>
#if defined(_MSC_VER)
#pragma warning(disable:4996) // deprecation warnings
#endif
namespace Poco { namespace Poco {

View File

@ -12,6 +12,11 @@
// //
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif
// pull in platform identification macros needed below // pull in platform identification macros needed below
#include "Poco/Platform.h" #include "Poco/Platform.h"
#include "Poco/FPEnvironment.h" #include "Poco/FPEnvironment.h"

View File

@ -12,6 +12,11 @@
// //
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "Poco/LocalDateTime.h" #include "Poco/LocalDateTime.h"
#include "Poco/Timezone.h" #include "Poco/Timezone.h"
#include "Poco/Timespan.h" #include "Poco/Timespan.h"

View File

@ -12,6 +12,11 @@
// //
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "Poco/NumberFormatter.h" #include "Poco/NumberFormatter.h"
#include "Poco/MemoryStream.h" #include "Poco/MemoryStream.h"
#include <iomanip> #include <iomanip>
@ -31,6 +36,7 @@
#endif #endif
namespace Poco { namespace Poco {

View File

@ -12,6 +12,11 @@
// //
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "Poco/Timezone.h" #include "Poco/Timezone.h"
#include <ctime> #include <ctime>

View File

@ -8,6 +8,11 @@
// //
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "DateTimeTest.h" #include "DateTimeTest.h"
#include "CppUnit/TestCaller.h" #include "CppUnit/TestCaller.h"
#include "CppUnit/TestSuite.h" #include "CppUnit/TestSuite.h"

View File

@ -8,6 +8,11 @@
// //
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "LocalDateTimeTest.h" #include "LocalDateTimeTest.h"
#include "CppUnit/TestCaller.h" #include "CppUnit/TestCaller.h"
#include "CppUnit/TestSuite.h" #include "CppUnit/TestSuite.h"
@ -24,6 +29,7 @@
#include "wce_time.h" #include "wce_time.h"
#endif #endif
using Poco::LocalDateTime; using Poco::LocalDateTime;
using Poco::DateTime; using Poco::DateTime;
using Poco::Timestamp; using Poco::Timestamp;

View File

@ -8,6 +8,11 @@
// //
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "StringTest.h" #include "StringTest.h"
#include "CppUnit/TestCaller.h" #include "CppUnit/TestCaller.h"
#include "CppUnit/TestSuite.h" #include "CppUnit/TestSuite.h"

View File

@ -12,6 +12,11 @@
// //
#if defined(_MSC_VER) && !defined(_WINSOCK_DEPRECATED_NO_WARNINGS)
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#endif
#include "Poco/Net/IPAddressImpl.h" #include "Poco/Net/IPAddressImpl.h"
#include "Poco/Net/NetException.h" #include "Poco/Net/NetException.h"
#include "Poco/RefCountedObject.h" #include "Poco/RefCountedObject.h"

View File

@ -38,6 +38,11 @@
#include <iomanip> #include <iomanip>
#if defined(_MSC_VER)
#pragma warning(disable:4996) // deprecation warnings
#endif
using Poco::NumberFormatter; using Poco::NumberFormatter;
using Poco::FastMutex; using Poco::FastMutex;
using Poco::format; using Poco::format;

View File

@ -51,6 +51,11 @@
#endif #endif
#if defined(_MSC_VER)
#pragma warning(disable:4996) // deprecation warnings
#endif
using Poco::IOException; using Poco::IOException;
using Poco::TimeoutException; using Poco::TimeoutException;
using Poco::InvalidArgumentException; using Poco::InvalidArgumentException;

View File

@ -324,6 +324,7 @@ namespace
_data.resize(1); _data.resize(1);
_reactor.addEventHandler(_socket, Observer<DataServiceHandler, ReadableNotification>(*this, &DataServiceHandler::onReadable)); _reactor.addEventHandler(_socket, Observer<DataServiceHandler, ReadableNotification>(*this, &DataServiceHandler::onReadable));
_reactor.addEventHandler(_socket, Observer<DataServiceHandler, ShutdownNotification>(*this, &DataServiceHandler::onShutdown)); _reactor.addEventHandler(_socket, Observer<DataServiceHandler, ShutdownNotification>(*this, &DataServiceHandler::onShutdown));
_socket.setBlocking(false);
} }
~DataServiceHandler() ~DataServiceHandler()
@ -336,28 +337,32 @@ namespace
{ {
pNf->release(); pNf->release();
char buffer[64]; char buffer[64];
int n = _socket.receiveBytes(&buffer[0], sizeof(buffer)); int n = 0;
if (n > 0) do
{ {
_data[_pos].append(buffer, n); n = _socket.receiveBytes(&buffer[0], sizeof(buffer));
std::size_t pos; if (n > 0)
pos = _data[_pos].find('\n');
if(pos != std::string::npos)
{ {
if (pos == _data[_pos].size() - 1) _data[_pos].append(buffer, n);
std::size_t pos;
pos = _data[_pos].find('\n');
if (pos != std::string::npos)
{ {
_data[_pos].erase(pos, 1); if (pos == _data[_pos].size() - 1)
_data.push_back(std::string()); {
_data[_pos].erase(pos, 1);
_data.push_back(std::string());
}
else
{
_data.push_back(_data[_pos].substr(pos + 1));
_data[_pos].erase(pos);
}
++_pos;
} }
else
{
_data.push_back(_data[_pos].substr(pos + 1));
_data[_pos].erase(pos);
}
++_pos;
} }
} else break;
else return; } while (true);
} }
void onShutdown(ShutdownNotification* pNf) void onShutdown(ShutdownNotification* pNf)
@ -500,7 +505,6 @@ void SocketReactorTest::testDataCollection()
" \"data\":123" " \"data\":123"
"}\n"); "}\n");
sock.sendBytes(data0.data(), static_cast<int>(data0.size())); sock.sendBytes(data0.data(), static_cast<int>(data0.size()));
std::string data1("{" std::string data1("{"
" \"src\":\"127.0.0.1\"," " \"src\":\"127.0.0.1\","
" \"id\":\"test1\"," " \"id\":\"test1\","
@ -517,7 +521,6 @@ void SocketReactorTest::testDataCollection()
" ]" " ]"
"}\n"); "}\n");
sock.sendBytes(data1.data(), static_cast<int>(data1.size())); sock.sendBytes(data1.data(), static_cast<int>(data1.size()));
std::string data2 = "{" std::string data2 = "{"
" \"src\":\"127.0.0.1\"," " \"src\":\"127.0.0.1\","
" \"id\":\"test2\"," " \"id\":\"test2\","

View File

@ -12,6 +12,11 @@
// //
#if defined(_MSC_VER)
#pragma warning(disable:4996) // deprecation warnings
#endif
#include "Poco/Net/SSLManager.h" #include "Poco/Net/SSLManager.h"
#include "Poco/Net/Context.h" #include "Poco/Net/Context.h"
#include "Poco/Net/Utility.h" #include "Poco/Net/Utility.h"
@ -26,6 +31,7 @@
#include "Poco/Util/OptionException.h" #include "Poco/Util/OptionException.h"
namespace Poco { namespace Poco {
namespace Net { namespace Net {

View File

@ -12,6 +12,11 @@
// //
#if defined(_MSC_VER)
#pragma warning(disable:4996) // deprecation warnings
#endif
#include "Poco/Net/SSLManager.h" #include "Poco/Net/SSLManager.h"
#include "Poco/Net/Context.h" #include "Poco/Net/Context.h"
#include "Poco/Net/Utility.h" #include "Poco/Net/Utility.h"

View File

@ -41,13 +41,13 @@ RedisStreamBuf::~RedisStreamBuf()
int RedisStreamBuf::readFromDevice(char* buffer, std::streamsize len) int RedisStreamBuf::readFromDevice(char* buffer, std::streamsize len)
{ {
return _redis.receiveBytes(buffer, len); return _redis.receiveBytes(buffer, static_cast<int>(len));
} }
int RedisStreamBuf::writeToDevice(const char* buffer, std::streamsize length) int RedisStreamBuf::writeToDevice(const char* buffer, std::streamsize length)
{ {
return _redis.sendBytes(buffer, length); return _redis.sendBytes(buffer, static_cast<int>(length));
} }

View File

@ -12,6 +12,11 @@
// //
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif
#include "Poco/Util/SystemConfiguration.h" #include "Poco/Util/SystemConfiguration.h"
#include "Poco/Environment.h" #include "Poco/Environment.h"
#include "Poco/Path.h" #include "Poco/Path.h"

View File

@ -65,6 +65,10 @@
# endif # endif
#endif #endif
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS)
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <stddef.h> #include <stddef.h>
#include <string.h> /* memset(), memcpy() */ #include <string.h> /* memset(), memcpy() */
#include <assert.h> #include <assert.h>