#3302: MSVC: Poco hides warnings (C4996) for the C++14 attribute [[deprecated]]

This commit is contained in:
Günter Obiltschnig 2021-06-17 18:20:29 +02:00
parent 2740068e59
commit 22eb76d3ae
21 changed files with 104 additions and 7 deletions

View File

@ -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;

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/NumberFormatter.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);
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
}

View File

@ -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

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/Version.h"
#include <cstdlib>

View File

@ -25,6 +25,11 @@
#include <iphlpapi.h>
#if defined(_MSC_VER)
#pragma warning(disable:4996) // deprecation warnings
#endif
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
#include "Poco/Platform.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/Timezone.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/MemoryStream.h"
#include <iomanip>
@ -31,6 +36,7 @@
#endif
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 <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 "CppUnit/TestCaller.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 "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;

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 "CppUnit/TestCaller.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/NetException.h"
#include "Poco/RefCountedObject.h"

View File

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

View File

@ -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;

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/Context.h"
#include "Poco/Net/Utility.h"
@ -26,6 +31,7 @@
#include "Poco/Util/OptionException.h"
namespace Poco {
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/Context.h"
#include "Poco/Net/Utility.h"

View File

@ -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<int>(len));
}
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/Environment.h"
#include "Poco/Path.h"

View File

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