Skip to content

Commit

Permalink
#3302: MSVC: Poco hides warnings (C4996) for the C++14 attribute [[de…
Browse files Browse the repository at this point in the history
…precated]]
  • Loading branch information
obiltschnig committed Jun 17, 2021
1 parent 2740068 commit 22eb76d
Show file tree
Hide file tree
Showing 21 changed files with 104 additions and 7 deletions.
8 changes: 8 additions & 0 deletions Crypto/include/Poco/Crypto/EVPPKey.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,15 @@ class Crypto_API EVPPKey
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;
Expand Down
5 changes: 5 additions & 0 deletions Crypto/src/PKCS12Container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions Data/ODBC/include/Poco/Data/ODBC/Unicode_WIN32.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
}


Expand Down
5 changes: 0 additions & 5 deletions Foundation/include/Poco/Platform_WIN32.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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


Expand Down
5 changes: 5 additions & 0 deletions Foundation/src/Environment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
5 changes: 5 additions & 0 deletions Foundation/src/Environment_WIN32U.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
#include <iphlpapi.h>


#if defined(_MSC_VER)
#pragma warning(disable:4996) // deprecation warnings
#endif


namespace Poco {


Expand Down
5 changes: 5 additions & 0 deletions Foundation/src/FPEnvironment.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions Foundation/src/LocalDateTime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions Foundation/src/NumberFormatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -31,6 +36,7 @@
#endif



namespace Poco {


Expand Down
5 changes: 5 additions & 0 deletions Foundation/src/Timezone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
5 changes: 5 additions & 0 deletions Foundation/testsuite/src/DateTimeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions Foundation/testsuite/src/LocalDateTimeTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -24,6 +29,7 @@
#include "wce_time.h"
#endif


using Poco::LocalDateTime;
using Poco::DateTime;
using Poco::Timestamp;
Expand Down
5 changes: 5 additions & 0 deletions Foundation/testsuite/src/StringTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions Net/src/IPAddressImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
5 changes: 5 additions & 0 deletions Net/src/NetworkInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions Net/src/SocketImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 6 additions & 0 deletions NetSSL_OpenSSL/src/SSLManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -26,6 +31,7 @@
#include "Poco/Util/OptionException.h"



namespace Poco {
namespace Net {

Expand Down
5 changes: 5 additions & 0 deletions NetSSL_Win/src/SSLManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions Redis/src/RedisStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}


Expand Down
5 changes: 5 additions & 0 deletions Util/src/SystemConfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 4 additions & 0 deletions XML/src/xmlparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 22eb76d

Please sign in to comment.