mirror of
https://github.com/libssh2/libssh2.git
synced 2025-08-01 11:26:53 +03:00
build: MSVS warning suppression option tidy-up
- in `win32/libssh2_config.h` replace `_CRT_SECURE_NO_DEPRECATE` with `_CRT_SECURE_NO_WARNINGS`, to use the official macro for this, like in CMake. Also, it's now safe to move it back under `_MSC_VER`. Suppressing: `warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead.` `warning C4996: 'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead.` - move `_CRT_NONSTDC_NO_DEPRECATE` to `example` and `tests`. Not needed for `src`. Suppressing: `warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _strdup.` `warning C4996: 'write': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _write.` - move `_WINSOCK_DEPRECATED_NO_WARNINGS` from source files to CMake files, in `example` and `tests`. Also limit this to MSVC. Suppressing: `warning C4996: 'inet_addr': Use inet_pton() or InetPton() instead` TODO: try fixing these instead of suppressing. Closes #929
This commit is contained in:
@ -39,6 +39,11 @@ list(APPEND LIBRARIES ${SOCKET_LIBRARIES})
|
||||
|
||||
add_definitions(-DHAVE_CONFIG_H)
|
||||
|
||||
if(MSVC)
|
||||
add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE)
|
||||
add_definitions(-D_WINSOCK_DEPRECATED_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
set(EXAMPLES
|
||||
direct_tcpip
|
||||
scp
|
||||
|
@ -1,9 +1,3 @@
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
|
||||
|
@ -2,12 +2,6 @@
|
||||
* Sample showing how to do a simple SCP transfer.
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
|
||||
|
@ -7,12 +7,6 @@
|
||||
* "scp_nonblock 192.168.0.1 user password /tmp/secrets"
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
|
||||
|
@ -2,12 +2,6 @@
|
||||
* Sample showing how to do an SCP upload.
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
|
||||
|
@ -2,12 +2,6 @@
|
||||
* Sample showing how to do an SCP non-blocking upload transfer.
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
|
||||
|
@ -7,12 +7,6 @@
|
||||
* "sftp 192.168.0.1 user password /tmp/secrets -p|-i|-k"
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
#include <libssh2_sftp.h>
|
||||
|
@ -7,12 +7,6 @@
|
||||
* sftp_append 192.168.0.1 user password localfile /tmp/remotefile
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
#include <libssh2_sftp.h>
|
||||
|
@ -7,12 +7,6 @@
|
||||
* "sftp 192.168.0.1 user password /tmp/sftp_mkdir"
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
#include <libssh2_sftp.h>
|
||||
|
@ -7,12 +7,6 @@
|
||||
* "sftp 192.168.0.1 user password /tmp/sftp_write_nonblock.c"
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
#include <libssh2_sftp.h>
|
||||
|
@ -7,12 +7,6 @@
|
||||
* "sftp_nonblock 192.168.0.1 user password /tmp/secrets"
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
#include <libssh2_sftp.h>
|
||||
|
@ -7,12 +7,6 @@
|
||||
* "sftp 192.168.0.1 user password sftp_write.c /tmp/secrets"
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
#include <libssh2_sftp.h>
|
||||
|
@ -7,12 +7,6 @@
|
||||
* "sftp 192.168.0.1 user password thisfile /tmp/storehere"
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
#include <libssh2_sftp.h>
|
||||
|
@ -7,12 +7,6 @@
|
||||
* "sftp 192.168.0.1 user password file /tmp/storehere"
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
#include <libssh2_sftp.h>
|
||||
|
@ -7,12 +7,6 @@
|
||||
* "sftpdir 192.168.0.1 user password /tmp/secretdir"
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
#include <libssh2_sftp.h>
|
||||
|
@ -7,12 +7,6 @@
|
||||
* "sftpdir 192.168.0.1 user password /tmp/secretdir"
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
#include <libssh2_sftp.h>
|
||||
|
@ -11,12 +11,6 @@
|
||||
* command executes on the remote machine
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
#include <libssh2_sftp.h>
|
||||
|
@ -6,12 +6,6 @@
|
||||
* "ssh2_agent host user"
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
#include <libssh2_sftp.h>
|
||||
|
@ -13,12 +13,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
|
||||
|
@ -8,12 +8,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
|
||||
|
@ -10,12 +10,6 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
|
||||
|
@ -1,9 +1,3 @@
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
|
||||
|
@ -1,9 +1,3 @@
|
||||
#ifdef WIN32
|
||||
#ifndef _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#define _WINSOCK_DEPRECATED_NO_WARNINGS
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include "libssh2_config.h"
|
||||
#include <libssh2.h>
|
||||
|
||||
|
Reference in New Issue
Block a user