Used pragmas to disable the deprecated warnings under Visual Studio rather than _WINSOCK_DEPRECATED_NO_WARNINGS. Using _WINSOCK_DEPRECATED_NO_WARNINGS could cross-pollintae out of the library and into user code

This commit is contained in:
Jeffrey Walton 2015-07-27 19:05:53 -04:00
parent 383d9636a8
commit 185a2c8e83
3 changed files with 27 additions and 1 deletions

View File

@ -1,6 +1,7 @@
// socketft.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#define _WINSOCK_DEPRECATED_NO_WARNINGS
#include "socketft.h"
#include "trap.h"

View File

@ -10,17 +10,31 @@
#include "trap.h"
#ifdef USE_WINDOWS_STYLE_SOCKETS
# if defined(_WINSOCKAPI_) && !defined(_WINSOCK2API_)
# error Winsock 1 is not supported by this library. Please include this file or winsock2.h before windows.h.
# endif
#define _WINSOCK_DEPRECATED_NO_WARNINGS
// Using _WINSOCK_DEPRECATED_NO_WARNINGS disables warnings for application code, too
#if (_MSC_VER)
# pragma warning (push)
# pragma warning (disable: 4996)
#endif
#include <winsock2.h>
#include "winpipes.h"
#if (_MSC_VER)
# pragma warning (pop)
#endif
#else
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#endif
NAMESPACE_BEGIN(CryptoPP)

View File

@ -9,8 +9,19 @@
#include "queue.h"
#include "trap.h"
// Using _WINSOCK_DEPRECATED_NO_WARNINGS disables warnings for application code, too
#if (_MSC_VER)
# pragma warning (push)
# pragma warning (disable: 4996)
#endif
#include <winsock2.h>
// Using _WINSOCK_DEPRECATED_NO_WARNINGS disables warnings for application code, too
#if (_MSC_VER)
# pragma warning (pop)
#endif
NAMESPACE_BEGIN(CryptoPP)
//! Windows Handle