diff --git a/Crypto/include/Poco/Crypto/EVPPKey.h b/Crypto/include/Poco/Crypto/EVPPKey.h index 87ab962d4..7cf44d867 100644 --- a/Crypto/include/Poco/Crypto/EVPPKey.h +++ b/Crypto/include/Poco/Crypto/EVPPKey.h @@ -177,7 +177,15 @@ private: EVP_PKEY* pKey = getFunc ? EVP_PKEY_new() : (EVP_PKEY*)*ppKey; if (pKey) { +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4996) // deprecation warnings +#endif pFile = fopen(keyFile.c_str(), "r"); +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + if (pFile) { pem_password_cb* pCB = pass.empty() ? (pem_password_cb*)0 : &passCB; diff --git a/Crypto/src/PKCS12Container.cpp b/Crypto/src/PKCS12Container.cpp index 39dc3f09c..dfc411130 100644 --- a/Crypto/src/PKCS12Container.cpp +++ b/Crypto/src/PKCS12Container.cpp @@ -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/NumberFormatter.h" #include "Poco/StreamCopier.h" diff --git a/Data/ODBC/include/Poco/Data/ODBC/Unicode_WIN32.h b/Data/ODBC/include/Poco/Data/ODBC/Unicode_WIN32.h index fa1abe945..2cd237b94 100644 --- a/Data/ODBC/include/Poco/Data/ODBC/Unicode_WIN32.h +++ b/Data/ODBC/include/Poco/Data/ODBC/Unicode_WIN32.h @@ -47,7 +47,14 @@ inline void makeUTF8(Poco::Buffer& buffer, SQLINTEGER length, SQLPOINTE UnicodeConverter::toUTF8(buffer.begin(), length, result); 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); +#if defined(_MSC_VER) +#pragma warning(pop) +#endif } diff --git a/Foundation/include/Poco/Platform_WIN32.h b/Foundation/include/Poco/Platform_WIN32.h index 77e448fca..65cdf46f5 100644 --- a/Foundation/include/Poco/Platform_WIN32.h +++ b/Foundation/include/Poco/Platform_WIN32.h @@ -22,10 +22,6 @@ #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 // 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:4355) // 'this' : used in base member initializer list #pragma warning(disable:4675) // resolved overload was found by argument-dependent lookup - #pragma warning(disable:4996) // VC++ 8.0 deprecation warnings #endif diff --git a/Foundation/src/Environment.cpp b/Foundation/src/Environment.cpp index e81a8a7c1..58a8ef3d5 100644 --- a/Foundation/src/Environment.cpp +++ b/Foundation/src/Environment.cpp @@ -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/Version.h" #include diff --git a/Foundation/src/Environment_WIN32U.cpp b/Foundation/src/Environment_WIN32U.cpp index 624ff83c8..3ba854981 100644 --- a/Foundation/src/Environment_WIN32U.cpp +++ b/Foundation/src/Environment_WIN32U.cpp @@ -25,6 +25,11 @@ #include +#if defined(_MSC_VER) +#pragma warning(disable:4996) // deprecation warnings +#endif + + namespace Poco { diff --git a/Foundation/src/FPEnvironment.cpp b/Foundation/src/FPEnvironment.cpp index 4617b7841..3b853ddc6 100644 --- a/Foundation/src/FPEnvironment.cpp +++ b/Foundation/src/FPEnvironment.cpp @@ -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 #include "Poco/Platform.h" #include "Poco/FPEnvironment.h" diff --git a/Foundation/src/LocalDateTime.cpp b/Foundation/src/LocalDateTime.cpp index 6683f8012..bdd0ca0bf 100644 --- a/Foundation/src/LocalDateTime.cpp +++ b/Foundation/src/LocalDateTime.cpp @@ -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/Timezone.h" #include "Poco/Timespan.h" diff --git a/Foundation/src/NumberFormatter.cpp b/Foundation/src/NumberFormatter.cpp index 43178b1ae..663864215 100644 --- a/Foundation/src/NumberFormatter.cpp +++ b/Foundation/src/NumberFormatter.cpp @@ -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/MemoryStream.h" #include @@ -31,6 +36,7 @@ #endif + namespace Poco { diff --git a/Foundation/src/Timezone.cpp b/Foundation/src/Timezone.cpp index fa229cbb2..a70a0cfe8 100644 --- a/Foundation/src/Timezone.cpp +++ b/Foundation/src/Timezone.cpp @@ -12,6 +12,11 @@ // +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) +#define _CRT_SECURE_NO_WARNINGS +#endif + + #include "Poco/Timezone.h" #include diff --git a/Foundation/testsuite/src/DateTimeTest.cpp b/Foundation/testsuite/src/DateTimeTest.cpp index 4b946bdd6..1f8cccf9e 100644 --- a/Foundation/testsuite/src/DateTimeTest.cpp +++ b/Foundation/testsuite/src/DateTimeTest.cpp @@ -8,6 +8,11 @@ // +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) +#define _CRT_SECURE_NO_WARNINGS +#endif + + #include "DateTimeTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" diff --git a/Foundation/testsuite/src/LocalDateTimeTest.cpp b/Foundation/testsuite/src/LocalDateTimeTest.cpp index 5cf89c294..f0a5ad579 100644 --- a/Foundation/testsuite/src/LocalDateTimeTest.cpp +++ b/Foundation/testsuite/src/LocalDateTimeTest.cpp @@ -8,6 +8,11 @@ // +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) +#define _CRT_SECURE_NO_WARNINGS +#endif + + #include "LocalDateTimeTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" @@ -24,6 +29,7 @@ #include "wce_time.h" #endif + using Poco::LocalDateTime; using Poco::DateTime; using Poco::Timestamp; diff --git a/Foundation/testsuite/src/StringTest.cpp b/Foundation/testsuite/src/StringTest.cpp index 860445069..976ec484e 100644 --- a/Foundation/testsuite/src/StringTest.cpp +++ b/Foundation/testsuite/src/StringTest.cpp @@ -8,6 +8,11 @@ // +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) +#define _CRT_SECURE_NO_WARNINGS +#endif + + #include "StringTest.h" #include "CppUnit/TestCaller.h" #include "CppUnit/TestSuite.h" diff --git a/Net/src/IPAddressImpl.cpp b/Net/src/IPAddressImpl.cpp index dcc63e686..4b20b1dbb 100644 --- a/Net/src/IPAddressImpl.cpp +++ b/Net/src/IPAddressImpl.cpp @@ -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/NetException.h" #include "Poco/RefCountedObject.h" diff --git a/Net/src/NetworkInterface.cpp b/Net/src/NetworkInterface.cpp index b59e53032..6fcd0eb25 100644 --- a/Net/src/NetworkInterface.cpp +++ b/Net/src/NetworkInterface.cpp @@ -38,6 +38,11 @@ #include +#if defined(_MSC_VER) +#pragma warning(disable:4996) // deprecation warnings +#endif + + using Poco::NumberFormatter; using Poco::FastMutex; using Poco::format; diff --git a/Net/src/SocketImpl.cpp b/Net/src/SocketImpl.cpp index 4fc40f16a..000de2dd5 100644 --- a/Net/src/SocketImpl.cpp +++ b/Net/src/SocketImpl.cpp @@ -51,6 +51,11 @@ #endif +#if defined(_MSC_VER) +#pragma warning(disable:4996) // deprecation warnings +#endif + + using Poco::IOException; using Poco::TimeoutException; using Poco::InvalidArgumentException; diff --git a/Net/testsuite/src/SocketReactorTest.cpp b/Net/testsuite/src/SocketReactorTest.cpp index 75a31d350..b9e2efa61 100644 --- a/Net/testsuite/src/SocketReactorTest.cpp +++ b/Net/testsuite/src/SocketReactorTest.cpp @@ -324,6 +324,7 @@ namespace _data.resize(1); _reactor.addEventHandler(_socket, Observer(*this, &DataServiceHandler::onReadable)); _reactor.addEventHandler(_socket, Observer(*this, &DataServiceHandler::onShutdown)); + _socket.setBlocking(false); } ~DataServiceHandler() @@ -336,28 +337,32 @@ namespace { pNf->release(); char buffer[64]; - int n = _socket.receiveBytes(&buffer[0], sizeof(buffer)); - if (n > 0) + int n = 0; + do { - _data[_pos].append(buffer, n); - std::size_t pos; - pos = _data[_pos].find('\n'); - if(pos != std::string::npos) + n = _socket.receiveBytes(&buffer[0], sizeof(buffer)); + if (n > 0) { - 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); - _data.push_back(std::string()); + if (pos == _data[_pos].size() - 1) + { + _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 return; + else break; + } while (true); } void onShutdown(ShutdownNotification* pNf) @@ -500,7 +505,6 @@ void SocketReactorTest::testDataCollection() " \"data\":123" "}\n"); sock.sendBytes(data0.data(), static_cast(data0.size())); - std::string data1("{" " \"src\":\"127.0.0.1\"," " \"id\":\"test1\"," @@ -517,7 +521,6 @@ void SocketReactorTest::testDataCollection() " ]" "}\n"); sock.sendBytes(data1.data(), static_cast(data1.size())); - std::string data2 = "{" " \"src\":\"127.0.0.1\"," " \"id\":\"test2\"," diff --git a/NetSSL_OpenSSL/src/SSLManager.cpp b/NetSSL_OpenSSL/src/SSLManager.cpp index f469adb69..efceb4dc0 100644 --- a/NetSSL_OpenSSL/src/SSLManager.cpp +++ b/NetSSL_OpenSSL/src/SSLManager.cpp @@ -12,6 +12,11 @@ // +#if defined(_MSC_VER) +#pragma warning(disable:4996) // deprecation warnings +#endif + + #include "Poco/Net/SSLManager.h" #include "Poco/Net/Context.h" #include "Poco/Net/Utility.h" @@ -26,6 +31,7 @@ #include "Poco/Util/OptionException.h" + namespace Poco { namespace Net { diff --git a/NetSSL_Win/src/SSLManager.cpp b/NetSSL_Win/src/SSLManager.cpp index fbabfcb03..75827bac0 100644 --- a/NetSSL_Win/src/SSLManager.cpp +++ b/NetSSL_Win/src/SSLManager.cpp @@ -12,6 +12,11 @@ // +#if defined(_MSC_VER) +#pragma warning(disable:4996) // deprecation warnings +#endif + + #include "Poco/Net/SSLManager.h" #include "Poco/Net/Context.h" #include "Poco/Net/Utility.h" diff --git a/Redis/src/RedisStream.cpp b/Redis/src/RedisStream.cpp index a81eb2939..1a8a507f4 100644 --- a/Redis/src/RedisStream.cpp +++ b/Redis/src/RedisStream.cpp @@ -41,13 +41,13 @@ RedisStreamBuf::~RedisStreamBuf() int RedisStreamBuf::readFromDevice(char* buffer, std::streamsize len) { - return _redis.receiveBytes(buffer, len); + return _redis.receiveBytes(buffer, static_cast(len)); } int RedisStreamBuf::writeToDevice(const char* buffer, std::streamsize length) { - return _redis.sendBytes(buffer, length); + return _redis.sendBytes(buffer, static_cast(length)); } diff --git a/Util/src/SystemConfiguration.cpp b/Util/src/SystemConfiguration.cpp index 19332f14c..352eb5437 100644 --- a/Util/src/SystemConfiguration.cpp +++ b/Util/src/SystemConfiguration.cpp @@ -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/Environment.h" #include "Poco/Path.h" diff --git a/XML/src/xmlparse.cpp b/XML/src/xmlparse.cpp index 4d6afb5cd..e55e9b9e6 100644 --- a/XML/src/xmlparse.cpp +++ b/XML/src/xmlparse.cpp @@ -65,6 +65,10 @@ # endif #endif +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) +#define _CRT_SECURE_NO_WARNINGS +#endif + #include #include /* memset(), memcpy() */ #include